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

The Component class uses a ComponentPeer internally to create and manage a real operating-system window. More...

#include <juce_ComponentPeer.h>

Collaboration diagram for juce::ComponentPeer:

Classes

struct  DragInfo
 Structure to describe drag and drop information. More...
 
class  OptionalBorderSize
 Represents the window borders around a window component. More...
 
struct  ScaleFactorListener
 Used to receive callbacks when the OS scale factor of this ComponentPeer changes. More...
 

Public Types

enum  Style {
  Style::automatic,
  Style::light,
  Style::dark
}
 
enum  StyleFlags {
  windowAppearsOnTaskbar = (1 << 0),
  windowIsTemporary = (1 << 1),
  windowIgnoresMouseClicks = (1 << 2),
  windowHasTitleBar = (1 << 3),
  windowIsResizable = (1 << 4),
  windowHasMinimiseButton = (1 << 5),
  windowHasMaximiseButton = (1 << 6),
  windowHasCloseButton = (1 << 7),
  windowHasDropShadow = (1 << 8),
  windowRepaintedExplictly = (1 << 9),
  windowIgnoresKeyPresses = (1 << 10),
  windowIsSemiTransparent = (1 << 30)
}
 A combination of these flags is passed to the ComponentPeer constructor. More...
 

Public Member Functions

 ComponentPeer (Component &component, int styleFlags)
 Creates a peer. More...
 
virtual ~ComponentPeer ()
 Destructor. More...
 
void addScaleFactorListener (ScaleFactorListener *listenerToAdd)
 Adds a scale factor listener. More...
 
virtual bool contains (Point< int > localPos, bool trueIfInAChildWindow) const =0
 Checks if a point is in the window. More...
 
virtual void dismissPendingTextInput ()
 If there's some kind of OS input-method in progress, this should dismiss it. More...
 
TextInputTargetfindCurrentTextInputTarget ()
 Returns the currently focused TextInputTarget, or null if none is found. More...
 
Style getAppStyle () const
 Returns the style requested for this app. More...
 
Rectangle< intgetAreaCoveredBy (const Component &subComponent) const
 Returns the area in peer coordinates that is covered by the given sub-comp (which may be at any depth) More...
 
virtual StringArray getAvailableRenderingEngines ()=0
 
virtual Rectangle< intgetBounds () const =0
 Returns the current position and size of the window. More...
 
ComponentgetComponent () noexcept
 Returns the component being represented by this peer. More...
 
ComponentBoundsConstrainergetConstrainer () const noexcept
 Returns the current constrainer, if one has been set. More...
 
virtual int getCurrentRenderingEngine () const
 
virtual BorderSize< intgetFrameSize () const =0
 Returns the size of the window frame that's around this window. More...
 
virtual OptionalBorderSize getFrameSizeIfPresent () const =0
 Returns the size of the window frame that's around this window. More...
 
ComponentgetLastFocusedSubcomponent () const noexcept
 
virtual void * getNativeHandle () const =0
 Returns the raw handle to whatever kind of window is being used. More...
 
const Rectangle< int > & getNonFullScreenBounds () const noexcept
 Returns the size to restore to if fullscreen mode is turned off. More...
 
virtual double getPlatformScaleFactor () const noexcept
 On Windows and Linux this will return the OS scaling factor currently being applied to the native window. More...
 
int getStyleFlags () const noexcept
 Returns the set of style flags that were set when the window was created. More...
 
uint32 getUniqueID () const noexcept
 Returns a unique ID for this peer. More...
 
Rectangle< floatglobalToLocal (const Rectangle< float > &screenPosition)
 Converts a screen area to a position relative to the top-left of this component. More...
 
virtual Rectangle< intglobalToLocal (const Rectangle< int > &screenPosition)
 Converts a screen area to a position relative to the top-left of this component. More...
 
virtual Point< floatglobalToLocal (Point< float > screenPosition)=0
 Converts a screen coordinate to a position relative to the top-left of this component. More...
 
Point< intglobalToLocal (Point< int > screenPosition)
 Converts a screen coordinate to a position relative to the top-left of this component. More...
 
virtual void grabFocus ()=0
 Tries to give the window keyboard focus. More...
 
void handleBroughtToFront ()
 Called when the window is brought to the front, either by the OS or by a call to toFront(). More...
 
bool handleDragDrop (const DragInfo &)
 
bool handleDragExit (const DragInfo &)
 
bool handleDragMove (const DragInfo &)
 
void handleFocusGain ()
 Called when the window gains keyboard focus. More...
 
void handleFocusLoss ()
 Called when the window loses keyboard focus. More...
 
bool handleKeyPress (const KeyPress &key)
 Called when a key is pressed. More...
 
bool handleKeyPress (int keyCode, juce_wchar textCharacter)
 Called when a key is pressed. More...
 
bool handleKeyUpOrDown (bool isKeyDown)
 Called whenever a key is pressed or released. More...
 
void handleMagnifyGesture (MouseInputSource::InputSourceType type, Point< float > positionWithinPeer, int64 time, float scaleFactor, int touchIndex=0)
 
void handleModifierKeysChange ()
 Called whenever a modifier key is pressed or released. More...
 
void handleMouseEvent (MouseInputSource::InputSourceType type, Point< float > positionWithinPeer, ModifierKeys newMods, float pressure, float orientation, int64 time, PenDetails pen={}, int touchIndex=0)
 
void handleMouseWheel (MouseInputSource::InputSourceType type, Point< float > positionWithinPeer, int64 time, const MouseWheelDetails &, int touchIndex=0)
 
void handleMovedOrResized ()
 This is called when the window's bounds change. More...
 
void handlePaint (LowLevelGraphicsContext &contextToPaintTo)
 This is called to repaint the component into the given context. More...
 
virtual void handleScreenSizeChange ()
 This is called if the screen resolution changes. More...
 
void handleUserClosingWindow ()
 
virtual bool isFocused () const =0
 True if the window has the keyboard focus. More...
 
virtual bool isFullScreen () const =0
 True if the window is currently full-screen. More...
 
virtual bool isKioskMode () const
 True if the window is in kiosk-mode. More...
 
virtual bool isMinimised () const =0
 True if the window is currently minimised. More...
 
Rectangle< floatlocalToGlobal (const Rectangle< float > &relativePosition)
 Converts a rectangle relative to the top-left of this component to screen coordinates. More...
 
virtual Rectangle< intlocalToGlobal (const Rectangle< int > &relativePosition)
 Converts a rectangle relative to the top-left of this component to screen coordinates. More...
 
virtual Point< floatlocalToGlobal (Point< float > relativePosition)=0
 Converts a position relative to the top-left of this component to screen coordinates. More...
 
Point< intlocalToGlobal (Point< int > relativePosition)
 Converts a position relative to the top-left of this component to screen coordinates. More...
 
virtual void performAnyPendingRepaintsNow ()=0
 This can be called (from the message thread) to cause the immediate redrawing of any areas of this window that need repainting. More...
 
void removeScaleFactorListener (ScaleFactorListener *listenerToRemove)
 Removes a scale factor listener. More...
 
virtual void repaint (const Rectangle< int > &area)=0
 Invalidates a region of the window to be repainted asynchronously. More...
 
virtual void setAlpha (float newAlpha)=0
 Changes the window's transparency. More...
 
virtual bool setAlwaysOnTop (bool alwaysOnTop)=0
 Sets this window to either be always-on-top or normal. More...
 
void setAppStyle (Style s)
 On operating systems that support it, this will update the style of this peer as requested. More...
 
virtual void setBounds (const Rectangle< int > &newBounds, bool isNowFullScreen)=0
 Moves and resizes the window. More...
 
void setConstrainer (ComponentBoundsConstrainer *newConstrainer) noexcept
 Sets a constrainer to use if the peer can resize itself. More...
 
virtual void setCurrentRenderingEngine (int index)
 
virtual bool setDocumentEditedStatus (bool edited)
 If this type of window is capable of indicating that the document in it has been edited, then this changes its status. More...
 
virtual void setFullScreen (bool shouldBeFullScreen)=0
 Enable/disable fullscreen mode for the window. More...
 
virtual void setHasChangedSinceSaved (bool)
 On platforms that support it, this will update the window's titlebar in some way to indicate that the window's document needs saving. More...
 
virtual void setIcon (const Image &newIcon)=0
 Attempts to change the icon associated with this window. More...
 
virtual void setMinimised (bool shouldBeMinimised)=0
 Minimises the window. More...
 
void setNonFullScreenBounds (const Rectangle< int > &newBounds) noexcept
 Sets the size to restore to if fullscreen mode is turned off. More...
 
virtual void setRepresentedFile (const File &)
 If this type of window is capable of indicating that it represents a file, then this lets you set the file. More...
 
virtual void setTitle (const String &title)=0
 Changes the title of the window. More...
 
virtual void setVisible (bool shouldBeVisible)=0
 Shows or hides the window. More...
 
virtual void textInputRequired (Point< int > position, TextInputTarget &)=0
 Tells the window that text input may be required at the given position. More...
 
virtual void toBehind (ComponentPeer *other)=0
 Moves the window to be just behind another one. More...
 
virtual void toFront (bool takeKeyboardFocus)=0
 Brings the window to the top, optionally also giving it keyboard focus. More...
 
void updateBounds ()
 Updates the peer's bounds to match its component. More...
 

Static Public Member Functions

static ModifierKeys getCurrentModifiersRealtime () noexcept
 On desktop platforms this method will check all the mouse and key states and return a ModifierKeys object representing them. More...
 
static int getNumPeers () noexcept
 Returns the number of currently-active peers. More...
 
static ComponentPeergetPeer (int index) noexcept
 Returns one of the currently-active peers. More...
 
static ComponentPeergetPeerFor (const Component *) noexcept
 Returns the peer that's attached to the given component, or nullptr if there isn't one. More...
 
static bool isValidPeer (const ComponentPeer *peer) noexcept
 Checks if this peer object is valid. More...
 

Static Protected Member Functions

static void forceDisplayUpdate ()
 

Protected Attributes

Componentcomponent
 
ComponentBoundsConstrainerconstrainer = nullptr
 
Rectangle< intlastNonFullscreenBounds
 
ListenerList< ScaleFactorListenerscaleFactorListeners
 
Style style = Style::automatic
 
const int styleFlags
 

Static Protected Attributes

static std::function< ModifierKeys()> getNativeRealtimeModifiers
 

Private Member Functions

virtual void appStyleChanged ()
 
ComponentgetTargetForKeyPress ()
 

Private Attributes

WeakReference< ComponentdragAndDropTargetComponent
 
bool isWindowMinimised = false
 
ComponentlastDragAndDropCompUnderMouse = nullptr
 
WeakReference< ComponentlastFocusedComponent
 
const uint32 uniqueID
 

Detailed Description

The Component class uses a ComponentPeer internally to create and manage a real operating-system window.

This is an abstract base class - the platform specific code contains implementations of it for the various platforms.

User-code should very rarely need to have any involvement with this class.

See also
Component::createNewPeer

@tags{GUI}

Member Enumeration Documentation

◆ Style

Enumerator
automatic 

A style that matches the system-wide style.

light 

A light style, which will probably use dark text on a light background.

dark 

A dark style, which will probably use light text on a dark background.

◆ StyleFlags

A combination of these flags is passed to the ComponentPeer constructor.

Enumerator
windowAppearsOnTaskbar 

Indicates that the window should have a corresponding entry on the taskbar (ignored on MacOSX)

windowIsTemporary 

Indicates that the window is a temporary popup, like a menu, tooltip, etc.

windowIgnoresMouseClicks 

Indicates that the window should let mouse clicks pass through it (may not be possible on some platforms).

windowHasTitleBar 

Indicates that the window should have a normal OS-specific title bar and frame.

if not specified, the window will be borderless.

windowIsResizable 

Indicates that the window should have a resizable border.

windowHasMinimiseButton 

Indicates that if the window has a title bar, it should have a minimise button on it.

windowHasMaximiseButton 

Indicates that if the window has a title bar, it should have a maximise button on it.

windowHasCloseButton 

Indicates that if the window has a title bar, it should have a close button on it.

windowHasDropShadow 

Indicates that the window should have a drop-shadow (this may not be possible on all platforms).

windowRepaintedExplictly 

Not intended for public use - this tells a window not to do its own repainting, but only to repaint when the performAnyPendingRepaintsNow() method is called.

windowIgnoresKeyPresses 

Tells the window not to catch any keypresses.

This can be used for things like plugin windows, to stop them interfering with the host's shortcut keys.

windowIsSemiTransparent 

Not intended for public use - makes a window transparent.

Constructor & Destructor Documentation

◆ ComponentPeer()

juce::ComponentPeer::ComponentPeer ( Component component,
int  styleFlags 
)

Creates a peer.

The component is the one that we intend to represent, and the style flags are a combination of the values in the StyleFlags enum

◆ ~ComponentPeer()

virtual juce::ComponentPeer::~ComponentPeer ( )
virtual

Destructor.

Member Function Documentation

◆ addScaleFactorListener()

void juce::ComponentPeer::addScaleFactorListener ( ScaleFactorListener listenerToAdd)
inline

Adds a scale factor listener.

◆ appStyleChanged()

virtual void juce::ComponentPeer::appStyleChanged ( )
inlineprivatevirtual

◆ contains()

virtual bool juce::ComponentPeer::contains ( Point< int localPos,
bool  trueIfInAChildWindow 
) const
pure virtual

Checks if a point is in the window.

The position is relative to the top-left of this window, in unscaled peer coordinates. If trueIfInAChildWindow is false, then this returns false if the point is actually inside a child of this window.

◆ dismissPendingTextInput()

virtual void juce::ComponentPeer::dismissPendingTextInput ( )
virtual

If there's some kind of OS input-method in progress, this should dismiss it.

◆ findCurrentTextInputTarget()

TextInputTarget* juce::ComponentPeer::findCurrentTextInputTarget ( )

Returns the currently focused TextInputTarget, or null if none is found.

◆ forceDisplayUpdate()

static void juce::ComponentPeer::forceDisplayUpdate ( )
staticprotected

◆ getAppStyle()

Style juce::ComponentPeer::getAppStyle ( ) const
inline

Returns the style requested for this app.

◆ getAreaCoveredBy()

Rectangle<int> juce::ComponentPeer::getAreaCoveredBy ( const Component subComponent) const

Returns the area in peer coordinates that is covered by the given sub-comp (which may be at any depth)

◆ getAvailableRenderingEngines()

virtual StringArray juce::ComponentPeer::getAvailableRenderingEngines ( )
pure virtual

◆ getBounds()

virtual Rectangle<int> juce::ComponentPeer::getBounds ( ) const
pure virtual

Returns the current position and size of the window.

If the native window is contained in another window, then the coordinates are relative to the parent window's origin, not the screen origin.

◆ getComponent()

Component& juce::ComponentPeer::getComponent ( )
inlinenoexcept

Returns the component being represented by this peer.

◆ getConstrainer()

ComponentBoundsConstrainer* juce::ComponentPeer::getConstrainer ( ) const
inlinenoexcept

Returns the current constrainer, if one has been set.

◆ getCurrentModifiersRealtime()

static ModifierKeys juce::ComponentPeer::getCurrentModifiersRealtime ( )
staticnoexcept

On desktop platforms this method will check all the mouse and key states and return a ModifierKeys object representing them.

This isn't recommended and is only needed in special circumstances for up-to-date modifier information at times when the app's event loop isn't running normally.

Another reason to avoid this method is that it's not stateless and calling it may update the ModifierKeys::currentModifiers object, which could cause subtle changes in the behaviour of some components.

◆ getCurrentRenderingEngine()

virtual int juce::ComponentPeer::getCurrentRenderingEngine ( ) const
virtual

◆ getFrameSize()

virtual BorderSize<int> juce::ComponentPeer::getFrameSize ( ) const
pure virtual

Returns the size of the window frame that's around this window.

Whether or not the window has a normal window frame depends on the flags that were set when the window was created by Component::addToDesktop()

◆ getFrameSizeIfPresent()

virtual OptionalBorderSize juce::ComponentPeer::getFrameSizeIfPresent ( ) const
pure virtual

Returns the size of the window frame that's around this window.

Depending on the platform the border size may be invalid for a short transient after creating a new window. Hence the returned value must be checked using operator bool() and the contained value can be accessed using operator*() only if it is present.

Whether or not the window has a normal window frame depends on the flags that were set when the window was created by Component::addToDesktop()

◆ getLastFocusedSubcomponent()

Component* juce::ComponentPeer::getLastFocusedSubcomponent ( ) const
noexcept

◆ getNativeHandle()

virtual void* juce::ComponentPeer::getNativeHandle ( ) const
pure virtual

Returns the raw handle to whatever kind of window is being used.

On windows, this is probably a HWND, on the mac, it's likely to be a WindowRef, but remember there's no guarantees what you'll get back.

Referenced by juce::OpenGLContext::NativeContext::NativeContext().

◆ getNonFullScreenBounds()

const Rectangle<int>& juce::ComponentPeer::getNonFullScreenBounds ( ) const
noexcept

Returns the size to restore to if fullscreen mode is turned off.

◆ getNumPeers()

static int juce::ComponentPeer::getNumPeers ( )
staticnoexcept

Returns the number of currently-active peers.

See also
getPeer

◆ getPeer()

static ComponentPeer* juce::ComponentPeer::getPeer ( int  index)
staticnoexcept

Returns one of the currently-active peers.

See also
getNumPeers

◆ getPeerFor()

static ComponentPeer* juce::ComponentPeer::getPeerFor ( const Component )
staticnoexcept

Returns the peer that's attached to the given component, or nullptr if there isn't one.

◆ getPlatformScaleFactor()

virtual double juce::ComponentPeer::getPlatformScaleFactor ( ) const
inlinevirtualnoexcept

On Windows and Linux this will return the OS scaling factor currently being applied to the native window.

This is used to convert between physical and logical pixels at the OS API level and you shouldn't need to use it in your own code unless you are dealing directly with the native window.

◆ getStyleFlags()

int juce::ComponentPeer::getStyleFlags ( ) const
inlinenoexcept

Returns the set of style flags that were set when the window was created.

See also
Component::addToDesktop

◆ getTargetForKeyPress()

Component* juce::ComponentPeer::getTargetForKeyPress ( )
private

◆ getUniqueID()

uint32 juce::ComponentPeer::getUniqueID ( ) const
inlinenoexcept

Returns a unique ID for this peer.

Each peer that is created is given a different ID.

◆ globalToLocal() [1/4]

Rectangle<float> juce::ComponentPeer::globalToLocal ( const Rectangle< float > &  screenPosition)

Converts a screen area to a position relative to the top-left of this component.

◆ globalToLocal() [2/4]

virtual Rectangle<int> juce::ComponentPeer::globalToLocal ( const Rectangle< int > &  screenPosition)
virtual

Converts a screen area to a position relative to the top-left of this component.

◆ globalToLocal() [3/4]

virtual Point<float> juce::ComponentPeer::globalToLocal ( Point< float screenPosition)
pure virtual

Converts a screen coordinate to a position relative to the top-left of this component.

◆ globalToLocal() [4/4]

Point<int> juce::ComponentPeer::globalToLocal ( Point< int screenPosition)

Converts a screen coordinate to a position relative to the top-left of this component.

◆ grabFocus()

virtual void juce::ComponentPeer::grabFocus ( )
pure virtual

Tries to give the window keyboard focus.

◆ handleBroughtToFront()

void juce::ComponentPeer::handleBroughtToFront ( )

Called when the window is brought to the front, either by the OS or by a call to toFront().

◆ handleDragDrop()

bool juce::ComponentPeer::handleDragDrop ( const DragInfo )

◆ handleDragExit()

bool juce::ComponentPeer::handleDragExit ( const DragInfo )

◆ handleDragMove()

bool juce::ComponentPeer::handleDragMove ( const DragInfo )

◆ handleFocusGain()

void juce::ComponentPeer::handleFocusGain ( )

Called when the window gains keyboard focus.

◆ handleFocusLoss()

void juce::ComponentPeer::handleFocusLoss ( )

Called when the window loses keyboard focus.

◆ handleKeyPress() [1/2]

bool juce::ComponentPeer::handleKeyPress ( const KeyPress key)

Called when a key is pressed.

Returns true if the keystroke was used.

◆ handleKeyPress() [2/2]

bool juce::ComponentPeer::handleKeyPress ( int  keyCode,
juce_wchar  textCharacter 
)

Called when a key is pressed.

For keycode info, see the KeyPress class. Returns true if the keystroke was used.

◆ handleKeyUpOrDown()

bool juce::ComponentPeer::handleKeyUpOrDown ( bool  isKeyDown)

Called whenever a key is pressed or released.

Returns true if the keystroke was used.

◆ handleMagnifyGesture()

void juce::ComponentPeer::handleMagnifyGesture ( MouseInputSource::InputSourceType  type,
Point< float positionWithinPeer,
int64  time,
float  scaleFactor,
int  touchIndex = 0 
)

◆ handleModifierKeysChange()

void juce::ComponentPeer::handleModifierKeysChange ( )

Called whenever a modifier key is pressed or released.

◆ handleMouseEvent()

void juce::ComponentPeer::handleMouseEvent ( MouseInputSource::InputSourceType  type,
Point< float positionWithinPeer,
ModifierKeys  newMods,
float  pressure,
float  orientation,
int64  time,
PenDetails  pen = {},
int  touchIndex = 0 
)

◆ handleMouseWheel()

void juce::ComponentPeer::handleMouseWheel ( MouseInputSource::InputSourceType  type,
Point< float positionWithinPeer,
int64  time,
const MouseWheelDetails ,
int  touchIndex = 0 
)

◆ handleMovedOrResized()

void juce::ComponentPeer::handleMovedOrResized ( )

This is called when the window's bounds change.

A peer implementation must call this when the window is moved and resized, so that this method can pass the message on to the component.

◆ handlePaint()

void juce::ComponentPeer::handlePaint ( LowLevelGraphicsContext contextToPaintTo)

This is called to repaint the component into the given context.

◆ handleScreenSizeChange()

virtual void juce::ComponentPeer::handleScreenSizeChange ( )
virtual

This is called if the screen resolution changes.

A peer implementation must call this if the monitor arrangement changes or the available screen size changes.

◆ handleUserClosingWindow()

void juce::ComponentPeer::handleUserClosingWindow ( )

◆ isFocused()

virtual bool juce::ComponentPeer::isFocused ( ) const
pure virtual

True if the window has the keyboard focus.

◆ isFullScreen()

virtual bool juce::ComponentPeer::isFullScreen ( ) const
pure virtual

True if the window is currently full-screen.

◆ isKioskMode()

virtual bool juce::ComponentPeer::isKioskMode ( ) const
virtual

True if the window is in kiosk-mode.

◆ isMinimised()

virtual bool juce::ComponentPeer::isMinimised ( ) const
pure virtual

True if the window is currently minimised.

◆ isValidPeer()

static bool juce::ComponentPeer::isValidPeer ( const ComponentPeer peer)
staticnoexcept

Checks if this peer object is valid.

See also
getNumPeers

◆ localToGlobal() [1/4]

Rectangle<float> juce::ComponentPeer::localToGlobal ( const Rectangle< float > &  relativePosition)

Converts a rectangle relative to the top-left of this component to screen coordinates.

◆ localToGlobal() [2/4]

virtual Rectangle<int> juce::ComponentPeer::localToGlobal ( const Rectangle< int > &  relativePosition)
virtual

Converts a rectangle relative to the top-left of this component to screen coordinates.

◆ localToGlobal() [3/4]

virtual Point<float> juce::ComponentPeer::localToGlobal ( Point< float relativePosition)
pure virtual

Converts a position relative to the top-left of this component to screen coordinates.

◆ localToGlobal() [4/4]

Point<int> juce::ComponentPeer::localToGlobal ( Point< int relativePosition)

Converts a position relative to the top-left of this component to screen coordinates.

◆ performAnyPendingRepaintsNow()

virtual void juce::ComponentPeer::performAnyPendingRepaintsNow ( )
pure virtual

This can be called (from the message thread) to cause the immediate redrawing of any areas of this window that need repainting.

You shouldn't ever really need to use this, it's mainly for special purposes like supporting audio plugins where the host's event loop is out of our control.

◆ removeScaleFactorListener()

void juce::ComponentPeer::removeScaleFactorListener ( ScaleFactorListener listenerToRemove)
inline

Removes a scale factor listener.

◆ repaint()

virtual void juce::ComponentPeer::repaint ( const Rectangle< int > &  area)
pure virtual

Invalidates a region of the window to be repainted asynchronously.

◆ setAlpha()

virtual void juce::ComponentPeer::setAlpha ( float  newAlpha)
pure virtual

Changes the window's transparency.

◆ setAlwaysOnTop()

virtual bool juce::ComponentPeer::setAlwaysOnTop ( bool  alwaysOnTop)
pure virtual

Sets this window to either be always-on-top or normal.

Some kinds of window might not be able to do this, so should return false.

◆ setAppStyle()

void juce::ComponentPeer::setAppStyle ( Style  s)
inline

On operating systems that support it, this will update the style of this peer as requested.

Note that this will not update the theme system-wide. This will only update UI elements so that they display appropriately for this peer!

References juce::gl::s.

◆ setBounds()

virtual void juce::ComponentPeer::setBounds ( const Rectangle< int > &  newBounds,
bool  isNowFullScreen 
)
pure virtual

Moves and resizes the window.

If the native window is contained in another window, then the coordinates are relative to the parent window's origin, not the screen origin.

This should result in a callback to handleMovedOrResized().

◆ setConstrainer()

void juce::ComponentPeer::setConstrainer ( ComponentBoundsConstrainer newConstrainer)
noexcept

Sets a constrainer to use if the peer can resize itself.

The constrainer won't be deleted by this object, so the caller must manage its lifetime.

◆ setCurrentRenderingEngine()

virtual void juce::ComponentPeer::setCurrentRenderingEngine ( int  index)
virtual

◆ setDocumentEditedStatus()

virtual bool juce::ComponentPeer::setDocumentEditedStatus ( bool  edited)
virtual

If this type of window is capable of indicating that the document in it has been edited, then this changes its status.

For example in OSX, this changes the appearance of the close button.

Returns
true if the window has a mechanism for showing this, or false if not.

◆ setFullScreen()

virtual void juce::ComponentPeer::setFullScreen ( bool  shouldBeFullScreen)
pure virtual

Enable/disable fullscreen mode for the window.

◆ setHasChangedSinceSaved()

virtual void juce::ComponentPeer::setHasChangedSinceSaved ( bool  )
inlinevirtual

On platforms that support it, this will update the window's titlebar in some way to indicate that the window's document needs saving.

◆ setIcon()

virtual void juce::ComponentPeer::setIcon ( const Image newIcon)
pure virtual

Attempts to change the icon associated with this window.

◆ setMinimised()

virtual void juce::ComponentPeer::setMinimised ( bool  shouldBeMinimised)
pure virtual

Minimises the window.

◆ setNonFullScreenBounds()

void juce::ComponentPeer::setNonFullScreenBounds ( const Rectangle< int > &  newBounds)
noexcept

Sets the size to restore to if fullscreen mode is turned off.

◆ setRepresentedFile()

virtual void juce::ComponentPeer::setRepresentedFile ( const File )
virtual

If this type of window is capable of indicating that it represents a file, then this lets you set the file.

E.g. in OSX it'll show an icon for the file in the title bar.

◆ setTitle()

virtual void juce::ComponentPeer::setTitle ( const String title)
pure virtual

Changes the title of the window.

◆ setVisible()

virtual void juce::ComponentPeer::setVisible ( bool  shouldBeVisible)
pure virtual

Shows or hides the window.

◆ textInputRequired()

virtual void juce::ComponentPeer::textInputRequired ( Point< int position,
TextInputTarget  
)
pure virtual

Tells the window that text input may be required at the given position.

This may cause things like a virtual on-screen keyboard to appear, depending on the OS.

◆ toBehind()

virtual void juce::ComponentPeer::toBehind ( ComponentPeer other)
pure virtual

Moves the window to be just behind another one.

◆ toFront()

virtual void juce::ComponentPeer::toFront ( bool  takeKeyboardFocus)
pure virtual

Brings the window to the top, optionally also giving it keyboard focus.

◆ updateBounds()

void juce::ComponentPeer::updateBounds ( )

Updates the peer's bounds to match its component.

Member Data Documentation

◆ component

Component& juce::ComponentPeer::component
protected

◆ constrainer

ComponentBoundsConstrainer* juce::ComponentPeer::constrainer = nullptr
protected

◆ dragAndDropTargetComponent

WeakReference<Component> juce::ComponentPeer::dragAndDropTargetComponent
private

◆ getNativeRealtimeModifiers

std::function<ModifierKeys()> juce::ComponentPeer::getNativeRealtimeModifiers
staticprotected

◆ isWindowMinimised

bool juce::ComponentPeer::isWindowMinimised = false
private

◆ lastDragAndDropCompUnderMouse

Component* juce::ComponentPeer::lastDragAndDropCompUnderMouse = nullptr
private

◆ lastFocusedComponent

WeakReference<Component> juce::ComponentPeer::lastFocusedComponent
private

◆ lastNonFullscreenBounds

Rectangle<int> juce::ComponentPeer::lastNonFullscreenBounds
protected

◆ scaleFactorListeners

ListenerList<ScaleFactorListener> juce::ComponentPeer::scaleFactorListeners
protected

◆ style

Style juce::ComponentPeer::style = Style::automatic
protected

◆ styleFlags

const int juce::ComponentPeer::styleFlags
protected

◆ uniqueID

const uint32 juce::ComponentPeer::uniqueID
private

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