JUCE  v6.1.6 (6.0.8-1114)
JUCE API
Looking for a senior C++ dev?
I'm looking for work. Hire me!
juce::Desktop Class Reference

Describes and controls aspects of the computer's desktop. More...

#include <juce_Desktop.h>

Inheritance diagram for juce::Desktop:
Collaboration diagram for juce::Desktop:

Public Types

enum  DisplayOrientation {
  upright = 1,
  upsideDown = 2,
  rotatedClockwise = 4,
  rotatedAntiClockwise = 8,
  allOrientations = 1 + 2 + 4 + 8
}
 In a tablet/mobile device which can be turned around, this is used to indicate the orientation. More...
 

Public Member Functions

void addDarkModeSettingListener (DarkModeSettingListener *listener)
 Registers a DarkModeSettingListener that will receive a callback when the operating system dark mode setting changes. More...
 
void addFocusChangeListener (FocusChangeListener *listener)
 Registers a FocusChangeListener that will receive a callback whenever the focused component changes. More...
 
void addGlobalMouseListener (MouseListener *listener)
 Registers a MouseListener that will receive all mouse events that occur on any component. More...
 
void beginDragAutoRepeat (int millisecondsBetweenCallbacks)
 Ensures that a non-stop stream of mouse-drag events will be sent during the current mouse-drag operation. More...
 
ComponentfindComponentAt (Point< int > screenPosition) const
 Finds the component at a given screen location. More...
 
ComponentAnimatorgetAnimator () noexcept
 The Desktop object has a ComponentAnimator instance which can be used for performing your animations. More...
 
ComponentgetComponent (int index) const noexcept
 Returns one of the top-level desktop window components. More...
 
DisplayOrientation getCurrentOrientation () const
 In a tablet device which can be turned around, this returns the current orientation. More...
 
LookAndFeelgetDefaultLookAndFeel () noexcept
 Returns the current default look-and-feel for components which don't have one explicitly set. More...
 
const DisplaysgetDisplays () const noexcept
 Returns the Displays object representing the connected displays. More...
 
MouseInputSourcegetDraggingMouseSource (int index) const noexcept
 Returns one of the mouse sources that's currently being dragged. More...
 
float getGlobalScaleFactor () const noexcept
 Returns the current global scale factor, as set by setGlobalScaleFactor(). More...
 
ComponentgetKioskModeComponent () const noexcept
 Returns the component that is currently being used in kiosk-mode. More...
 
MouseInputSource getMainMouseSource () const noexcept
 Returns the main mouse input device that the system is using. More...
 
int getMouseButtonClickCounter () const noexcept
 Returns the number of times the mouse button has been clicked since the app started. More...
 
MouseInputSourcegetMouseSource (int index) const noexcept
 Returns one of the system's MouseInputSource objects. More...
 
const Array< MouseInputSource > & getMouseSources () const noexcept
 Provides access to the array of mouse sources, for iteration. More...
 
int getMouseWheelMoveCounter () const noexcept
 Returns the number of times the mouse wheel has been moved since the app started. More...
 
int getNumComponents () const noexcept
 Returns the number of components that are currently active as top-level desktop windows. More...
 
int getNumDraggingMouseSources () const noexcept
 Returns the number of mouse-sources that are currently being dragged. More...
 
int getNumMouseSources () const noexcept
 Returns the number of MouseInputSource objects the system has at its disposal. More...
 
int getOrientationsEnabled () const noexcept
 Returns the set of orientations the display is allowed to rotate to. More...
 
bool isDarkModeActive () const
 True if the operating system "dark mode" is active. More...
 
bool isHeadless () const noexcept
 Returns true on a headless system where there are no connected displays. More...
 
bool isOrientationEnabled (DisplayOrientation orientation) const noexcept
 Returns whether the display is allowed to auto-rotate to the given orientation. More...
 
void removeDarkModeSettingListener (DarkModeSettingListener *listener)
 Unregisters a DarkModeSettingListener that was added with addDarkModeSettingListener(). More...
 
void removeFocusChangeListener (FocusChangeListener *listener)
 Unregisters a FocusChangeListener that was added with addFocusChangeListener(). More...
 
void removeGlobalMouseListener (MouseListener *listener)
 Unregisters a MouseListener that was added with addGlobalMouseListener(). More...
 
void setDefaultLookAndFeel (LookAndFeel *newDefaultLookAndFeel)
 Changes the default look-and-feel. More...
 
void setGlobalScaleFactor (float newScaleFactor) noexcept
 Sets a global scale factor to be used for all desktop windows. More...
 
void setKioskModeComponent (Component *componentToUse, bool allowMenusAndBars=true)
 Takes a component and makes it full-screen, removing the taskbar, dock, etc. More...
 
void setOrientationsEnabled (int allowedOrientations)
 Sets which orientations the display is allowed to auto-rotate to. More...
 

Static Public Member Functions

static bool canUseSemiTransparentWindows () noexcept
 True if the OS supports semitransparent windows. More...
 
static DesktopgetInstance ()
 There's only one desktop object, and this method will return it. More...
 
static Point< intgetLastMouseDownPosition ()
 Returns the last position at which a mouse button was pressed. More...
 
static Point< intgetMousePosition ()
 Returns the mouse position. More...
 
static bool isScreenSaverEnabled ()
 Returns true if the screensaver has not been turned off. More...
 
static void setMousePosition (Point< int > newPosition)
 Makes the mouse pointer jump to a given location. More...
 
static void setScreenSaverEnabled (bool isEnabled)
 This lets you prevent the screensaver from becoming active. More...
 

Private Member Functions

 Desktop ()
 
 ~Desktop () override
 
void addDesktopComponent (Component *)
 
void allowedOrientationsChanged ()
 
void cancelPendingUpdate () noexcept
 This will stop any pending updates from happening. More...
 
void componentBroughtToFront (Component *)
 
void darkModeChanged ()
 
ListenerList< MouseListener > & getMouseListeners ()
 
int getTimerInterval () const noexcept
 Returns the timer's interval. More...
 
void handleAsyncUpdate () override
 Called back to do whatever your class needs to do. More...
 
void handleUpdateNowIfNeeded ()
 If an update has been triggered and is pending, this will invoke it synchronously. More...
 
void incrementMouseClickCounter () noexcept
 
void incrementMouseWheelCounter () noexcept
 
bool isTimerRunning () const noexcept
 Returns true if the timer is currently running. More...
 
bool isUpdatePending () const noexcept
 Returns true if there's an update callback in the pipeline. More...
 
void removeDesktopComponent (Component *)
 
void resetTimer ()
 
void sendMouseMove ()
 
void setKioskComponent (Component *, bool shouldBeEnabled, bool allowMenusAndBars)
 
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...
 
void timerCallback () override
 The user-defined callback routine that actually gets called periodically. More...
 
void triggerAsyncUpdate ()
 Causes the callback to be triggered at a later time. More...
 
void triggerFocusCallback ()
 
void updateFocusOutline ()
 

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...
 
static std::unique_ptr< NativeDarkModeChangeDetectorImpl > createNativeDarkModeChangeDetectorImpl ()
 
static void deleteAll ()
 Deletes all extant objects. More...
 
static double getDefaultMasterScale ()
 
static Point< floatgetMousePositionFloat ()
 

Private Attributes

ReferenceCountedObjectPtr< AsyncUpdaterMessage > activeMessage
 
int allowedOrientations = allOrientations
 
ComponentAnimator animator
 
WeakReference< LookAndFeelcurrentLookAndFeel
 
ListenerList< DarkModeSettingListenerdarkModeSettingListeners
 
std::unique_ptr< LookAndFeeldefaultLookAndFeel
 
Array< Component * > desktopComponents
 
std::unique_ptr< Displaysdisplays
 
ListenerList< FocusChangeListenerfocusListeners
 
std::unique_ptr< FocusOutlinefocusOutline
 
Rectangle< intkioskComponentOriginalBounds
 
ComponentkioskModeComponent = nullptr
 
bool kioskModeReentrant = false
 
Point< floatlastFakeMouseMove
 
float masterScaleFactor
 
int mouseClickCounter = 0
 
ListenerList< MouseListenermouseListeners
 
std::unique_ptr< MouseInputSource::SourceList > mouseSources
 
int mouseWheelCounter = 0
 
std::unique_ptr< NativeDarkModeChangeDetectorImpl > nativeDarkModeChangeDetectorImpl
 
Array< ComponentPeer * > peers
 
size_t positionInQueue = (size_t) -1
 
int timerPeriodMs = 0
 

Static Private Attributes

static Desktopinstance
 

Friends

class Component
 
class ComponentPeer
 
class DeletedAtShutdown
 
class Displays
 
class MouseInputSourceInternal
 
class TopLevelWindowManager
 

Detailed Description

Describes and controls aspects of the computer's desktop.

@tags{GUI}

Member Enumeration Documentation

◆ DisplayOrientation

In a tablet/mobile device which can be turned around, this is used to indicate the orientation.

Enumerator
upright 

Indicates that the device is the normal way up.

upsideDown 

Indicates that the device is upside-down.

rotatedClockwise 

Indicates that the device is turned 90 degrees clockwise from its upright position.

rotatedAntiClockwise 

Indicates that the device is turned 90 degrees anti-clockwise from its upright position.

allOrientations 

A combination of all the orientation values.

Constructor & Destructor Documentation

◆ Desktop()

juce::Desktop::Desktop ( )
private

◆ ~Desktop()

juce::Desktop::~Desktop ( )
overrideprivate

Member Function Documentation

◆ addDarkModeSettingListener()

void juce::Desktop::addDarkModeSettingListener ( DarkModeSettingListener listener)

Registers a DarkModeSettingListener that will receive a callback when the operating system dark mode setting changes.

To query whether dark mode is on use the isDarkModeActive() method.

See also
isDarkModeActive, removeDarkModeSettingListener

◆ addDesktopComponent()

void juce::Desktop::addDesktopComponent ( Component )
private

◆ addFocusChangeListener()

void juce::Desktop::addFocusChangeListener ( FocusChangeListener listener)

Registers a FocusChangeListener that will receive a callback whenever the focused component changes.

See also
removeFocusChangeListener

◆ addGlobalMouseListener()

void juce::Desktop::addGlobalMouseListener ( MouseListener listener)

Registers a MouseListener that will receive all mouse events that occur on any component.

See also
removeGlobalMouseListener

◆ allowedOrientationsChanged()

void juce::Desktop::allowedOrientationsChanged ( )
private

◆ beginDragAutoRepeat()

void juce::Desktop::beginDragAutoRepeat ( int  millisecondsBetweenCallbacks)

Ensures that a non-stop stream of mouse-drag events will be sent during the current mouse-drag operation.

This allows you to make sure that mouseDrag() events are sent continuously, even when the mouse isn't moving. This can be useful for things like auto-scrolling components when the mouse is near an edge.

Call this method during a mouseDown() or mouseDrag() callback, specifying the minimum interval between consecutive mouse drag callbacks. The callbacks will continue until the mouse is released, and then the interval will be reset, so you need to make sure it's called every time you begin a drag event. Passing an interval of 0 or less will cancel the auto-repeat.

See also
mouseDrag

◆ callAfterDelay()

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

Invokes a lambda after a given number of milliseconds.

◆ callPendingTimersSynchronously()

static void juce::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!

◆ cancelPendingUpdate()

void juce::AsyncUpdater::cancelPendingUpdate ( )
noexceptinherited

This will stop any pending updates from happening.

If called after triggerAsyncUpdate() and before the handleAsyncUpdate() callback happens, this will cancel the handleAsyncUpdate() callback.

Note that this method simply cancels the next callback - if a callback is already in progress on a different thread, this won't block until the callback finishes, so there's no guarantee that the callback isn't still running when the method returns.

◆ canUseSemiTransparentWindows()

static bool juce::Desktop::canUseSemiTransparentWindows ( )
staticnoexcept

True if the OS supports semitransparent windows.

◆ componentBroughtToFront()

void juce::Desktop::componentBroughtToFront ( Component )
private

◆ createNativeDarkModeChangeDetectorImpl()

static std::unique_ptr<NativeDarkModeChangeDetectorImpl> juce::Desktop::createNativeDarkModeChangeDetectorImpl ( )
staticprivate

◆ darkModeChanged()

void juce::Desktop::darkModeChanged ( )
private

◆ deleteAll()

static void juce::DeletedAtShutdown::deleteAll ( )
staticinherited

Deletes all extant objects.

This shouldn't be used by applications, as it's called automatically in the shutdown code of the JUCEApplicationBase class.

◆ findComponentAt()

Component* juce::Desktop::findComponentAt ( Point< int screenPosition) const

Finds the component at a given screen location.

This will drill down into top-level windows to find the child component at the given position.

Returns nullptr if the coordinates are inside a non-JUCE window.

Referenced by juce::WindowsHooks::mouseWheelHookCallback().

◆ getAnimator()

ComponentAnimator& juce::Desktop::getAnimator ( )
inlinenoexcept

The Desktop object has a ComponentAnimator instance which can be used for performing your animations.

Having a single shared ComponentAnimator object makes it more efficient when multiple components are being moved around simultaneously. It's also more convenient than having to manage your own instance of one.

See also
ComponentAnimator

◆ getComponent()

Component* juce::Desktop::getComponent ( int  index) const
noexcept

Returns one of the top-level desktop window components.

The index is from 0 to getNumComponents() - 1. This could return 0 if the index is out-of-range.

See also
getNumComponents, Component::addToDesktop

◆ getCurrentOrientation()

DisplayOrientation juce::Desktop::getCurrentOrientation ( ) const

In a tablet device which can be turned around, this returns the current orientation.

◆ getDefaultLookAndFeel()

LookAndFeel& juce::Desktop::getDefaultLookAndFeel ( )
noexcept

Returns the current default look-and-feel for components which don't have one explicitly set.

See also
setDefaultLookAndFeel

◆ getDefaultMasterScale()

static double juce::Desktop::getDefaultMasterScale ( )
staticprivate

◆ getDisplays()

const Displays& juce::Desktop::getDisplays ( ) const
inlinenoexcept

◆ getDraggingMouseSource()

MouseInputSource* juce::Desktop::getDraggingMouseSource ( int  index) const
noexcept

Returns one of the mouse sources that's currently being dragged.

The index should be between 0 and getNumDraggingMouseSources() - 1. If the index is out of range, or if no mice or fingers are down, this will return a null pointer.

◆ getGlobalScaleFactor()

float juce::Desktop::getGlobalScaleFactor ( ) const
inlinenoexcept

Returns the current global scale factor, as set by setGlobalScaleFactor().

See also
setGlobalScaleFactor

Referenced by juce::DialogWindow::getDesktopScaleFactor(), and juce::AlertWindow::getDesktopScaleFactor().

◆ getInstance()

◆ getKioskModeComponent()

Component* juce::Desktop::getKioskModeComponent ( ) const
inlinenoexcept

Returns the component that is currently being used in kiosk-mode.

This is the component that was last set by setKioskModeComponent(). If none has been set, this returns nullptr.

◆ getLastMouseDownPosition()

static Point<int> juce::Desktop::getLastMouseDownPosition ( )
static

Returns the last position at which a mouse button was pressed.

Note that this is just a shortcut for calling getMainMouseSource().getLastMouseDownPosition(), and in a multi-touch environment, it doesn't make much sense. ALWAYS prefer to get this information via other means, such as MouseEvent::getMouseDownScreenPosition() if possible, and only ever call this as a last resort.

◆ getMainMouseSource()

MouseInputSource juce::Desktop::getMainMouseSource ( ) const
noexcept

Returns the main mouse input device that the system is using.

See also
getNumMouseSources()

◆ getMouseButtonClickCounter()

int juce::Desktop::getMouseButtonClickCounter ( ) const
noexcept

Returns the number of times the mouse button has been clicked since the app started.

Each mouse-down event increments this number by 1.

See also
getMouseWheelMoveCounter

◆ getMouseListeners()

ListenerList<MouseListener>& juce::Desktop::getMouseListeners ( )
private

◆ getMousePosition()

static Point<int> juce::Desktop::getMousePosition ( )
static

Returns the mouse position.

The coordinates are relative to the top-left of the main monitor.

Note that this is just a shortcut for calling getMainMouseSource().getScreenPosition(), and you should only resort to grabbing the global mouse position if there's really no way to get the coordinates via a mouse event callback instead.

◆ getMousePositionFloat()

static Point<float> juce::Desktop::getMousePositionFloat ( )
staticprivate

◆ getMouseSource()

MouseInputSource* juce::Desktop::getMouseSource ( int  index) const
noexcept

Returns one of the system's MouseInputSource objects.

The index should be from 0 to getNumMouseSources() - 1. Out-of-range indexes will return a null pointer. In a traditional single-mouse system, there might be only one object. On a multi-touch system, there could be one input source per potential finger.

◆ getMouseSources()

const Array<MouseInputSource>& juce::Desktop::getMouseSources ( ) const
noexcept

Provides access to the array of mouse sources, for iteration.

In a traditional single-mouse system, there might be only one MouseInputSource. On a multi-touch system, there could be one input source per potential finger. The number of mouse sources returned here may increase dynamically as the program runs. To find out how many mouse events are currently happening, use getNumDraggingMouseSources().

◆ getMouseWheelMoveCounter()

int juce::Desktop::getMouseWheelMoveCounter ( ) const
noexcept

Returns the number of times the mouse wheel has been moved since the app started.

Each mouse-wheel event increments this number by 1.

See also
getMouseButtonClickCounter

◆ getNumComponents()

int juce::Desktop::getNumComponents ( ) const
noexcept

Returns the number of components that are currently active as top-level desktop windows.

See also
getComponent, Component::addToDesktop

◆ getNumDraggingMouseSources()

int juce::Desktop::getNumDraggingMouseSources ( ) const
noexcept

Returns the number of mouse-sources that are currently being dragged.

In a traditional single-mouse system, this will be 0 or 1, depending on whether a JUCE component has the button down on it. In a multi-touch system, this could be any number from 0 to the number of simultaneous touches that can be detected.

◆ getNumMouseSources()

int juce::Desktop::getNumMouseSources ( ) const
noexcept

Returns the number of MouseInputSource objects the system has at its disposal.

In a traditional single-mouse system, there might be only one MouseInputSource. On a multi-touch system, there could be one input source per potential finger. The number of mouse sources returned here may increase dynamically as the program runs. To find out how many mouse events are currently happening, use getNumDraggingMouseSources().

See also
getMouseSource

◆ getOrientationsEnabled()

int juce::Desktop::getOrientationsEnabled ( ) const
noexcept

Returns the set of orientations the display is allowed to rotate to.

See also
setOrientationsEnabled

◆ getTimerInterval()

int juce::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.

Referenced by juce::CarbonViewWrapperComponent::setOurSizeToEmbeddedViewSize().

◆ handleAsyncUpdate()

void juce::Desktop::handleAsyncUpdate ( )
overrideprivatevirtual

Called back to do whatever your class needs to do.

This method is called by the message thread at the next convenient time after the triggerAsyncUpdate() method has been called.

Implements juce::AsyncUpdater.

◆ handleUpdateNowIfNeeded()

void juce::AsyncUpdater::handleUpdateNowIfNeeded ( )
inherited

If an update has been triggered and is pending, this will invoke it synchronously.

Use this as a kind of "flush" operation - if an update is pending, the handleAsyncUpdate() method will be called immediately; if no update is pending, then nothing will be done.

Because this may invoke the callback, this method must only be called on the main event thread.

◆ incrementMouseClickCounter()

void juce::Desktop::incrementMouseClickCounter ( )
privatenoexcept

◆ incrementMouseWheelCounter()

void juce::Desktop::incrementMouseWheelCounter ( )
privatenoexcept

◆ isDarkModeActive()

bool juce::Desktop::isDarkModeActive ( ) const

True if the operating system "dark mode" is active.

To receive a callback when this setting changes implement the DarkModeSettingListener interface and use the addDarkModeSettingListener() to register a listener.

See also
addDarkModeSettingListener, removeDarkModeSettingListener

◆ isHeadless()

bool juce::Desktop::isHeadless ( ) const
noexcept

Returns true on a headless system where there are no connected displays.

◆ isOrientationEnabled()

bool juce::Desktop::isOrientationEnabled ( DisplayOrientation  orientation) const
noexcept

Returns whether the display is allowed to auto-rotate to the given orientation.

Each orientation can be enabled using setOrientationEnabled(). By default, all orientations are allowed.

◆ isScreenSaverEnabled()

static bool juce::Desktop::isScreenSaverEnabled ( )
static

Returns true if the screensaver has not been turned off.

This will return the last value passed into setScreenSaverEnabled(). Note that it won't tell you whether the user is actually using a screen saver, just whether this app is deliberately preventing one from running.

See also
setScreenSaverEnabled

◆ isTimerRunning()

bool juce::Timer::isTimerRunning ( ) const
inlinenoexceptinherited

Returns true if the timer is currently running.

◆ isUpdatePending()

bool juce::AsyncUpdater::isUpdatePending ( ) const
noexceptinherited

Returns true if there's an update callback in the pipeline.

◆ removeDarkModeSettingListener()

void juce::Desktop::removeDarkModeSettingListener ( DarkModeSettingListener listener)

◆ removeDesktopComponent()

void juce::Desktop::removeDesktopComponent ( Component )
private

◆ removeFocusChangeListener()

void juce::Desktop::removeFocusChangeListener ( FocusChangeListener listener)

Unregisters a FocusChangeListener that was added with addFocusChangeListener().

See also
addFocusChangeListener

◆ removeGlobalMouseListener()

void juce::Desktop::removeGlobalMouseListener ( MouseListener listener)

Unregisters a MouseListener that was added with addGlobalMouseListener().

See also
addGlobalMouseListener

◆ resetTimer()

void juce::Desktop::resetTimer ( )
private

◆ sendMouseMove()

void juce::Desktop::sendMouseMove ( )
private

◆ setDefaultLookAndFeel()

void juce::Desktop::setDefaultLookAndFeel ( LookAndFeel newDefaultLookAndFeel)

Changes the default look-and-feel.

Parameters
newDefaultLookAndFeelthe new look-and-feel object to use - if this is set to nullptr, it will revert to using the system's default one. The object passed-in must be deleted by the caller when it's no longer needed.
See also
getDefaultLookAndFeel

◆ setGlobalScaleFactor()

void juce::Desktop::setGlobalScaleFactor ( float  newScaleFactor)
noexcept

Sets a global scale factor to be used for all desktop windows.

Setting this will also scale the monitor sizes that are returned by getDisplays().

◆ setKioskComponent()

void juce::Desktop::setKioskComponent ( Component ,
bool  shouldBeEnabled,
bool  allowMenusAndBars 
)
private

◆ setKioskModeComponent()

void juce::Desktop::setKioskModeComponent ( Component componentToUse,
bool  allowMenusAndBars = true 
)

Takes a component and makes it full-screen, removing the taskbar, dock, etc.

The component must already be on the desktop for this method to work. It will be resized to completely fill the screen and any extraneous taskbars, menu bars, etc will be hidden.

To exit kiosk mode, just call setKioskModeComponent (nullptr). When this is called, the component that's currently being used will be resized back to the size and position it was in before being put into this mode.

If allowMenusAndBars is true, things like the menu and dock (on mac) are still allowed to pop up when the mouse moves onto them. If this is false, it'll try to hide as much on-screen paraphernalia as possible.

◆ setMousePosition()

static void juce::Desktop::setMousePosition ( Point< int newPosition)
static

Makes the mouse pointer jump to a given location.

The coordinates are relative to the top-left of the main monitor. Note that this is a pretty old method, kept around mainly for backwards-compatibility, and you should use the MouseInputSource class directly in new code.

◆ setOrientationsEnabled()

void juce::Desktop::setOrientationsEnabled ( int  allowedOrientations)

Sets which orientations the display is allowed to auto-rotate to.

For devices that support rotating desktops, this lets you specify which of the orientations your app can use.

The parameter is a bitwise or-ed combination of the values in DisplayOrientation, and must contain at least one set bit.

◆ setScreenSaverEnabled()

static void juce::Desktop::setScreenSaverEnabled ( bool  isEnabled)
static

This lets you prevent the screensaver from becoming active.

Handy if you're running some sort of presentation app where having a screensaver appear would be annoying.

Pass false to disable the screensaver, and true to re-enable it. (Note that this won't enable a screensaver unless the user has actually set one up).

The disablement will only happen while the JUCE application is the foreground process - if another task is running in front of it, then the screensaver will be unaffected.

See also
isScreenSaverEnabled

◆ startTimer()

void juce::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 juce::StandalonePluginHolder::init(), juce::CarbonViewWrapperComponent::setOurSizeToEmbeddedViewSize(), and juce::DeviceChangeDetector::triggerAsyncDeviceChangeCallback().

◆ startTimerHz()

void juce::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 juce::AnimatedPosition< Behaviour >::endDrag(), juce::AnimatedPosition< Behaviour >::nudge(), and juce::AnimatedPosition< Behaviour >::timerCallback().

◆ stopTimer()

void juce::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 juce::AnimatedPosition< Behaviour >::beginDrag(), juce::CarbonViewWrapperComponent::setOurSizeToEmbeddedViewSize(), juce::AnimatedPosition< Behaviour >::setPosition(), juce::DeviceChangeDetector::timerCallback(), juce::AnimatedPosition< Behaviour >::timerCallback(), and juce::StandalonePluginHolder::~StandalonePluginHolder().

◆ timerCallback()

void juce::Desktop::timerCallback ( )
overrideprivatevirtual

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 juce::Timer.

◆ triggerAsyncUpdate()

void juce::AsyncUpdater::triggerAsyncUpdate ( )
inherited

Causes the callback to be triggered at a later time.

This method returns immediately, after which a callback to the handleAsyncUpdate() method will be made by the message thread as soon as possible.

If an update callback is already pending but hasn't happened yet, calling this method will have no effect.

It's thread-safe to call this method from any thread, BUT beware of calling it from a real-time (e.g. audio) thread, because it involves posting a message to the system queue, which means it may block (and in general will do on most OSes).

◆ triggerFocusCallback()

void juce::Desktop::triggerFocusCallback ( )
private

◆ updateFocusOutline()

void juce::Desktop::updateFocusOutline ( )
private

Friends And Related Function Documentation

◆ Component

friend class Component
friend

◆ ComponentPeer

friend class ComponentPeer
friend

◆ DeletedAtShutdown

friend class DeletedAtShutdown
friend

◆ Displays

friend class Displays
friend

◆ MouseInputSourceInternal

friend class MouseInputSourceInternal
friend

◆ TopLevelWindowManager

friend class TopLevelWindowManager
friend

Member Data Documentation

◆ activeMessage

ReferenceCountedObjectPtr<AsyncUpdaterMessage> juce::AsyncUpdater::activeMessage
privateinherited

◆ allowedOrientations

int juce::Desktop::allowedOrientations = allOrientations
private

◆ animator

ComponentAnimator juce::Desktop::animator
private

◆ currentLookAndFeel

WeakReference<LookAndFeel> juce::Desktop::currentLookAndFeel
private

◆ darkModeSettingListeners

ListenerList<DarkModeSettingListener> juce::Desktop::darkModeSettingListeners
private

◆ defaultLookAndFeel

std::unique_ptr<LookAndFeel> juce::Desktop::defaultLookAndFeel
private

◆ desktopComponents

Array<Component*> juce::Desktop::desktopComponents
private

◆ displays

std::unique_ptr<Displays> juce::Desktop::displays
private

◆ focusListeners

ListenerList<FocusChangeListener> juce::Desktop::focusListeners
private

◆ focusOutline

std::unique_ptr<FocusOutline> juce::Desktop::focusOutline
private

◆ instance

Desktop* juce::Desktop::instance
staticprivate

◆ kioskComponentOriginalBounds

Rectangle<int> juce::Desktop::kioskComponentOriginalBounds
private

◆ kioskModeComponent

Component* juce::Desktop::kioskModeComponent = nullptr
private

◆ kioskModeReentrant

bool juce::Desktop::kioskModeReentrant = false
private

◆ lastFakeMouseMove

Point<float> juce::Desktop::lastFakeMouseMove
private

◆ masterScaleFactor

float juce::Desktop::masterScaleFactor
private

◆ mouseClickCounter

int juce::Desktop::mouseClickCounter = 0
private

◆ mouseListeners

ListenerList<MouseListener> juce::Desktop::mouseListeners
private

◆ mouseSources

std::unique_ptr<MouseInputSource::SourceList> juce::Desktop::mouseSources
private

◆ mouseWheelCounter

int juce::Desktop::mouseWheelCounter = 0
private

◆ nativeDarkModeChangeDetectorImpl

std::unique_ptr<NativeDarkModeChangeDetectorImpl> juce::Desktop::nativeDarkModeChangeDetectorImpl
private

◆ peers

Array<ComponentPeer*> juce::Desktop::peers
private

◆ positionInQueue

size_t juce::Timer::positionInQueue = (size_t) -1
privateinherited

◆ timerPeriodMs

int juce::Timer::timerPeriodMs = 0
privateinherited

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