JUCE  v5.1.1-3-g1a0b28c73
JUCE API
FakeMouseMoveGenerator Class Reference

#include <juce_FakeMouseMoveGenerator.h>

Inheritance diagram for FakeMouseMoveGenerator:
Collaboration diagram for FakeMouseMoveGenerator:

Public Member Functions

 FakeMouseMoveGenerator ()
 
void timerCallback () override
 The user-defined callback routine that actually gets called periodically. More...
 

Private Member Functions

int getTimerInterval () const noexcept
 Returns the timer's interval. More...
 
bool isTimerRunning () const noexcept
 Returns true if the timer is currently running. More...
 
void startTimer (int intervalInMilliseconds) noexcept
 Starts the timer and sets the length of interval required. More...
 
void startTimerHz (int timerFrequencyHz) noexcept
 Starts the timer with an interval specified in Hertz. More...
 
void stopTimer () noexcept
 Stops the timer. More...
 

Static Private Member Functions

static void callAfterDelay (int milliseconds, std::function< void()> functionToCall)
 Invokes a lambda after a given number of milliseconds. More...
 
static void callPendingTimersSynchronously ()
 For internal use only: invokes any timers that need callbacks. More...
 

Private Attributes

Point< float > lastScreenPos
 

Constructor & Destructor Documentation

◆ FakeMouseMoveGenerator()

FakeMouseMoveGenerator::FakeMouseMoveGenerator ( )
inline

References Timer::startTimer().

Member Function Documentation

◆ callAfterDelay()

static void Timer::callAfterDelay ( int  milliseconds,
std::function< void()>  functionToCall 
)
staticinherited

Invokes a lambda after a given number of milliseconds.

◆ callPendingTimersSynchronously()

static void Timer::callPendingTimersSynchronously ( )
staticinherited

For internal use only: invokes any timers that need callbacks.

Don't call this unless you really know what you're doing!

◆ getTimerInterval()

int Timer::getTimerInterval ( ) const
inlinenoexceptinherited

Returns the timer's interval.

Returns
the timer's interval in milliseconds if it's running, or 0 if it's not.

References JUCE_CALLTYPE.

Referenced by CarbonViewWrapperComponent::setOurSizeToEmbeddedViewSize().

◆ isTimerRunning()

bool Timer::isTimerRunning ( ) const
inlinenoexceptinherited

Returns true if the timer is currently running.

◆ startTimer()

void Timer::startTimer ( int  intervalInMilliseconds)
noexceptinherited

Starts the timer and sets the length of interval required.

If the timer is already started, this will reset it, so the time between calling this method and the next timer callback will not be less than the interval length passed in.

Parameters
intervalInMillisecondsthe interval to use (any value less than 1 will be rounded up to 1)

Referenced by FakeMouseMoveGenerator(), StandalonePluginHolder::init(), and CarbonViewWrapperComponent::setOurSizeToEmbeddedViewSize().

◆ startTimerHz()

void Timer::startTimerHz ( int  timerFrequencyHz)
noexceptinherited

Starts the timer with an interval specified in Hertz.

This is effectively the same as calling startTimer (1000 / timerFrequencyHz).

Referenced by AnimatedPosition< Behaviour >::endDrag(), AnimatedPosition< Behaviour >::nudge(), and AnimatedPosition< Behaviour >::timerCallback().

◆ stopTimer()

void Timer::stopTimer ( )
noexceptinherited

Stops the timer.

No more timer callbacks will be triggered after this method returns.

Note that if you call this from a background thread while the message-thread is already in the middle of your callback, then this method will cancel any future timer callbacks, but it will return without waiting for the current one to finish. The current callback will continue, possibly still running some of your timer code after this method has returned.

Referenced by AnimatedPosition< Behaviour >::beginDrag(), CarbonViewWrapperComponent::setOurSizeToEmbeddedViewSize(), AnimatedPosition< Behaviour >::setPosition(), AnimatedPosition< Behaviour >::timerCallback(), and StandalonePluginHolder::~StandalonePluginHolder().

◆ timerCallback()

void FakeMouseMoveGenerator::timerCallback ( )
inlineoverridevirtual

The user-defined callback routine that actually gets called periodically.

It's perfectly ok to call startTimer() or stopTimer() from within this callback to change the subsequent intervals.

Implements Timer.

References Time::currentTimeMillis(), Desktop::findComponentAt(), ModifierKeys::getCurrentModifiers(), Desktop::getInstance(), ComponentPeer::getPeer(), MouseInputSource::invalidOrientation, MouseInputSource::invalidPressure, ModifierKeys::isAnyMouseButtonDown(), lastScreenPos, and Point< ValueType >::roundToInt().

Member Data Documentation

◆ lastScreenPos

Point<float> FakeMouseMoveGenerator::lastScreenPos
private

Referenced by timerCallback().


The documentation for this class was generated from the following file: