JUCE-7.0.12-0-g4f43011b96 JUCE-7.0.12-0-g4f43011b96
JUCE — C++ application framework with suport for VST, VST3, LV2 audio plug-ins

« « « Anklang Documentation
Loading...
Searching...
No Matches
Classes | Public Types | Public Member Functions | Static Public Member Functions | Static Protected Member Functions | Protected Attributes | Static Protected Attributes | List of all members
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"

Inheritance diagram for juce::ComponentPeer:
juce::FocusChangeListener juce::LinuxComponentPeer

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...
 
struct  VBlankListener
 Used to receive callbacks on every vertical blank event of the display that the peer currently belongs to. More...
 

Public Types

enum  StyleFlags {
  windowAppearsOnTaskbar , windowIsTemporary , windowIgnoresMouseClicks , windowHasTitleBar ,
  windowIsResizable , windowHasMinimiseButton , windowHasMaximiseButton , windowHasCloseButton ,
  windowHasDropShadow , windowRepaintedExplictly , windowIgnoresKeyPresses , windowRequiresSynchronousCoreGraphicsRendering ,
  windowIsSemiTransparent
}
 A combination of these flags is passed to the ComponentPeer constructor. More...
 
enum class  Style { automatic , light , dark }
 

Public Member Functions

 ComponentPeer (Component &component, int styleFlags)
 Creates a peer.
 
 ~ComponentPeer () override
 Destructor.
 
ComponentgetComponent () noexcept
 Returns the component being represented by this peer.
 
int getStyleFlags () const noexcept
 Returns the set of style flags that were set when the window was created.
 
uint32 getUniqueID () const noexcept
 Returns a unique ID for this peer.
 
virtual voidgetNativeHandle () const =0
 Returns the raw handle to whatever kind of window is being used.
 
virtual void setVisible (bool shouldBeVisible)=0
 Shows or hides the window.
 
virtual void setTitle (const String &title)=0
 Changes the title of the window.
 
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.
 
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.
 
virtual void setBounds (const Rectangle< int > &newBounds, bool isNowFullScreen)=0
 Moves and resizes the window.
 
void updateBounds ()
 Updates the peer's bounds to match its component.
 
virtual Rectangle< intgetBounds () const =0
 Returns the current position and size of the window.
 
virtual Point< floatlocalToGlobal (Point< float > relativePosition)=0
 Converts a position relative to the top-left of this component to screen coordinates.
 
virtual Point< floatglobalToLocal (Point< float > screenPosition)=0
 Converts a screen coordinate to a position relative to the top-left of this component.
 
Point< intlocalToGlobal (Point< int > relativePosition)
 Converts a position relative to the top-left of this component to screen coordinates.
 
Point< intglobalToLocal (Point< int > screenPosition)
 Converts a screen coordinate to a position relative to the top-left of this component.
 
virtual Rectangle< intlocalToGlobal (const Rectangle< int > &relativePosition)
 Converts a rectangle relative to the top-left of this component to screen coordinates.
 
virtual Rectangle< intglobalToLocal (const Rectangle< int > &screenPosition)
 Converts a screen area to a position relative to the top-left of this component.
 
Rectangle< floatlocalToGlobal (const Rectangle< float > &relativePosition)
 Converts a rectangle relative to the top-left of this component to screen coordinates.
 
Rectangle< floatglobalToLocal (const Rectangle< float > &screenPosition)
 Converts a screen area to a position relative to the top-left of this component.
 
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)
 
virtual void setMinimised (bool shouldBeMinimised)=0
 Minimises the window.
 
virtual bool isMinimised () const =0
 True if the window is currently minimised.
 
virtual void setFullScreen (bool shouldBeFullScreen)=0
 Enable/disable fullscreen mode for the window.
 
virtual bool isFullScreen () const =0
 True if the window is currently full-screen.
 
virtual bool isKioskMode () const
 True if the window is in kiosk-mode.
 
void setNonFullScreenBounds (const Rectangle< int > &newBounds) noexcept
 Sets the size to restore to if fullscreen mode is turned off.
 
const Rectangle< int > & getNonFullScreenBounds () const noexcept
 Returns the size to restore to if fullscreen mode is turned off.
 
virtual void setIcon (const Image &newIcon)=0
 Attempts to change the icon associated with this window.
 
void setConstrainer (ComponentBoundsConstrainer *newConstrainer) noexcept
 Sets a constrainer to use if the peer can resize itself.
 
virtual void startHostManagedResize (Point< int > mouseDownPosition, ResizableBorderComponent::Zone zone)
 Asks the window-manager to begin resizing this window, on platforms where this is useful (currently just Linux/X11).
 
ComponentBoundsConstrainergetConstrainer () const noexcept
 Returns the current constrainer, if one has been set.
 
virtual bool contains (Point< int > localPos, bool trueIfInAChildWindow) const =0
 Checks if a point is in the window.
 
virtual OptionalBorderSize getFrameSizeIfPresent () const =0
 Returns the size of the window frame that's around this window.
 
virtual BorderSize< intgetFrameSize () const =0
 Returns the size of the window frame that's around this window.
 
void handleMovedOrResized ()
 This is called when the window's bounds change.
 
virtual void handleScreenSizeChange ()
 This is called if the screen resolution changes.
 
void handlePaint (LowLevelGraphicsContext &contextToPaintTo)
 This is called to repaint the component into the given context.
 
virtual bool setAlwaysOnTop (bool alwaysOnTop)=0
 Sets this window to either be always-on-top or normal.
 
virtual void toFront (bool takeKeyboardFocus)=0
 Brings the window to the top, optionally also giving it keyboard focus.
 
virtual void toBehind (ComponentPeer *other)=0
 Moves the window to be just behind another one.
 
void handleBroughtToFront ()
 Called when the window is brought to the front, either by the OS or by a call to toFront().
 
virtual bool isFocused () const =0
 True if the window has the keyboard focus.
 
virtual void grabFocus ()=0
 Tries to give the window keyboard focus.
 
void handleFocusGain ()
 Called when the window gains keyboard focus.
 
void handleFocusLoss ()
 Called when the window loses keyboard focus.
 
ComponentgetLastFocusedSubcomponent () const noexcept
 
bool handleKeyPress (int keyCode, juce_wchar textCharacter)
 Called when a key is pressed.
 
bool handleKeyPress (const KeyPress &key)
 Called when a key is pressed.
 
bool handleKeyUpOrDown (bool isKeyDown)
 Called whenever a key is pressed or released.
 
void handleModifierKeysChange ()
 Called whenever a modifier key is pressed or released.
 
virtual void closeInputMethodContext ()
 If there's a currently active input-method context - i.e.
 
void refreshTextInputTarget ()
 Alerts the peer that the current text input target has changed somehow.
 
TextInputTargetfindCurrentTextInputTarget ()
 Returns the currently focused TextInputTarget, or null if none is found.
 
virtual void repaint (const Rectangle< int > &area)=0
 Invalidates a region of the window to be repainted asynchronously.
 
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.
 
virtual void setAlpha (float newAlpha)=0
 Changes the window's transparency.
 
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 handleMagnifyGesture (MouseInputSource::InputSourceType type, Point< float > positionWithinPeer, int64 time, float scaleFactor, int touchIndex=0)
 
void handleUserClosingWindow ()
 
bool handleDragMove (const DragInfo &)
 
bool handleDragExit (const DragInfo &)
 
bool handleDragDrop (const DragInfo &)
 
virtual StringArray getAvailableRenderingEngines ()=0
 
virtual int getCurrentRenderingEngine () const
 
virtual void setCurrentRenderingEngine (int index)
 
void addScaleFactorListener (ScaleFactorListener *listenerToAdd)
 Adds a scale factor listener.
 
void removeScaleFactorListener (ScaleFactorListener *listenerToRemove)
 Removes a scale factor listener.
 
void addVBlankListener (VBlankListener *listenerToAdd)
 Adds a VBlankListener.
 
void removeVBlankListener (VBlankListener *listenerToRemove)
 Removes a VBlankListener.
 
virtual double getPlatformScaleFactor () const noexcept
 On Windows and Linux this will return the OS scaling factor currently being applied to the native window.
 
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.
 
void setAppStyle (Style s)
 On operating systems that support it, this will update the style of this peer as requested.
 
Style getAppStyle () const
 Returns the style requested for this app.
 

Static Public Member Functions

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

Static Protected Member Functions

static void forceDisplayUpdate ()
 

Protected Attributes

Componentcomponent
 
const int styleFlags
 
Rectangle< intlastNonFullscreenBounds
 
ComponentBoundsConstrainerconstrainer
 
ListenerList< ScaleFactorListenerscaleFactorListeners
 
ListenerList< VBlankListenervBlankListeners
 
Style style
 

Static Protected Attributes

static std::function< ModifierKeys()> getNativeRealtimeModifiers
 

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}

Definition at line 43 of file juce_ComponentPeer.h.

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.

Definition at line 528 of file juce_ComponentPeer.h.

◆ 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.

windowRequiresSynchronousCoreGraphicsRendering 

Indicates that the window should not be rendered with asynchronous Core Graphics drawing operations.

Use this if there are issues with regions not being redrawn at the expected time (macOS and iOS only).

windowIsSemiTransparent 

Not intended for public use - makes a window transparent.

Definition at line 48 of file juce_ComponentPeer.h.

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

Definition at line 32 of file juce_ComponentPeer.cpp.

◆ ~ComponentPeer()

juce::ComponentPeer::~ComponentPeer ( )
override

Destructor.

Definition at line 42 of file juce_ComponentPeer.cpp.

Member Function Documentation

◆ addScaleFactorListener()

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

Adds a scale factor listener.

Definition at line 481 of file juce_ComponentPeer.h.

◆ addVBlankListener()

void juce::ComponentPeer::addVBlankListener ( VBlankListener listenerToAdd)

Adds a VBlankListener.

Definition at line 509 of file juce_ComponentPeer.h.

◆ closeInputMethodContext()

void juce::ComponentPeer::closeInputMethodContext ( )
virtual

If there's a currently active input-method context - i.e.

characters are being composed using multiple keystrokes - this should commit the current state of the context to the text and clear the context. This should not hide the virtual keyboard.

Definition at line 292 of file juce_ComponentPeer.cpp.

◆ 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.

Implemented in juce::LinuxComponentPeer.

◆ findCurrentTextInputTarget()

TextInputTarget * juce::ComponentPeer::findCurrentTextInputTarget ( )

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

Definition at line 280 of file juce_ComponentPeer.cpp.

◆ forceDisplayUpdate()

void juce::ComponentPeer::forceDisplayUpdate ( )
staticprotected

Definition at line 604 of file juce_ComponentPeer.cpp.

◆ getAppStyle()

Style juce::ComponentPeer::getAppStyle ( ) const

Returns the style requested for this app.

Definition at line 553 of file juce_ComponentPeer.h.

◆ 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)

Definition at line 431 of file juce_ComponentPeer.cpp.

◆ 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.

Implemented in juce::LinuxComponentPeer.

◆ getComponent()

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

Returns the component being represented by this peer.

Definition at line 142 of file juce_ComponentPeer.h.

◆ getConstrainer()

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

Returns the current constrainer, if one has been set.

Definition at line 272 of file juce_ComponentPeer.h.

◆ getCurrentModifiersRealtime()

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.

Definition at line 595 of file juce_ComponentPeer.cpp.

◆ getCurrentRenderingEngine()

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

Definition at line 589 of file juce_ComponentPeer.cpp.

◆ 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()

Implemented in juce::LinuxComponentPeer.

◆ 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()

Implemented in juce::LinuxComponentPeer.

◆ getLastFocusedSubcomponent()

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

Definition at line 385 of file juce_ComponentPeer.cpp.

◆ 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.

Implemented in juce::LinuxComponentPeer.

◆ getNonFullScreenBounds()

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

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

Definition at line 403 of file juce_ComponentPeer.cpp.

◆ getNumPeers()

int juce::ComponentPeer::getNumPeers ( )
staticnoexcept

Returns the number of currently-active peers.

See also
getPeer

Definition at line 51 of file juce_ComponentPeer.cpp.

◆ getPeer()

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

Returns one of the currently-active peers.

See also
getNumPeers

Definition at line 56 of file juce_ComponentPeer.cpp.

◆ getPeerFor()

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

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

Definition at line 61 of file juce_ComponentPeer.cpp.

◆ getPlatformScaleFactor()

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

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.

Reimplemented in juce::LinuxComponentPeer.

Definition at line 520 of file juce_ComponentPeer.h.

◆ getStyleFlags()

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

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

See also
Component::addToDesktop

Definition at line 147 of file juce_ComponentPeer.h.

◆ getUniqueID()

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

Returns a unique ID for this peer.

Each peer that is created is given a different ID.

Definition at line 152 of file juce_ComponentPeer.h.

◆ 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.

Definition at line 426 of file juce_ComponentPeer.cpp.

◆ globalToLocal() [2/4]

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.

Reimplemented in juce::LinuxComponentPeer.

Definition at line 416 of file juce_ComponentPeer.cpp.

◆ 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.

Implemented in juce::LinuxComponentPeer, and juce::LinuxComponentPeer.

◆ 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.

Definition at line 409 of file juce_ComponentPeer.cpp.

◆ grabFocus()

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

Tries to give the window keyboard focus.

Implemented in juce::LinuxComponentPeer.

◆ handleBroughtToFront()

void juce::ComponentPeer::handleBroughtToFront ( )

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

Definition at line 300 of file juce_ComponentPeer.cpp.

◆ handleDragDrop()

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

Definition at line 531 of file juce_ComponentPeer.cpp.

◆ handleDragExit()

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

Definition at line 520 of file juce_ComponentPeer.cpp.

◆ handleDragMove()

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

Definition at line 467 of file juce_ComponentPeer.cpp.

◆ handleFocusGain()

void juce::ComponentPeer::handleFocusGain ( )

Called when the window gains keyboard focus.

Definition at line 351 of file juce_ComponentPeer.cpp.

◆ handleFocusLoss()

void juce::ComponentPeer::handleFocusLoss ( )

Called when the window loses keyboard focus.

Definition at line 370 of file juce_ComponentPeer.cpp.

◆ handleKeyPress() [1/2]

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

Called when a key is pressed.

Returns true if the keystroke was used.

Definition at line 185 of file juce_ComponentPeer.cpp.

◆ 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.

Definition at line 178 of file juce_ComponentPeer.cpp.

◆ handleKeyUpOrDown()

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

Called whenever a key is pressed or released.

Returns true if the keystroke was used.

Definition at line 224 of file juce_ComponentPeer.cpp.

◆ handleMagnifyGesture()

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

Definition at line 99 of file juce_ComponentPeer.cpp.

◆ handleModifierKeysChange()

void juce::ComponentPeer::handleModifierKeysChange ( )

Called whenever a modifier key is pressed or released.

Definition at line 254 of file juce_ComponentPeer.cpp.

◆ handleMouseEvent()

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

Definition at line 86 of file juce_ComponentPeer.cpp.

◆ handleMouseWheel()

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

Definition at line 93 of file juce_ComponentPeer.cpp.

◆ 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.

Definition at line 310 of file juce_ComponentPeer.cpp.

◆ handlePaint()

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

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

If this fails, it's probably be because your CPU floating-point precision mode has been set to low.. This setting is sometimes changed by things like Direct3D, and can mess up a lot of the calculations that the library needs to do.

Definition at line 106 of file juce_ComponentPeer.cpp.

◆ handleScreenSizeChange()

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.

Definition at line 392 of file juce_ComponentPeer.cpp.

◆ handleUserClosingWindow()

void juce::ComponentPeer::handleUserClosingWindow ( )

Definition at line 574 of file juce_ComponentPeer.cpp.

◆ isFocused()

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

True if the window has the keyboard focus.

Implemented in juce::LinuxComponentPeer.

◆ isFullScreen()

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

True if the window is currently full-screen.

Implemented in juce::LinuxComponentPeer.

◆ isKioskMode()

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

True if the window is in kiosk-mode.

Definition at line 80 of file juce_ComponentPeer.cpp.

◆ isMinimised()

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

True if the window is currently minimised.

Implemented in juce::LinuxComponentPeer.

◆ isValidPeer()

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

Checks if this peer object is valid.

See also
getNumPeers

Definition at line 70 of file juce_ComponentPeer.cpp.

◆ 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.

Definition at line 421 of file juce_ComponentPeer.cpp.

◆ localToGlobal() [2/4]

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

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

Reimplemented in juce::LinuxComponentPeer.

Definition at line 411 of file juce_ComponentPeer.cpp.

◆ 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.

Implemented in juce::LinuxComponentPeer, and juce::LinuxComponentPeer.

◆ 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.

Definition at line 408 of file juce_ComponentPeer.cpp.

◆ 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.

Implemented in juce::LinuxComponentPeer.

◆ refreshTextInputTarget()

void juce::ComponentPeer::refreshTextInputTarget ( )

Alerts the peer that the current text input target has changed somehow.

The peer may hide or show the virtual keyboard as a result of this call.

Definition at line 267 of file juce_ComponentPeer.cpp.

◆ removeScaleFactorListener()

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

Removes a scale factor listener.

Definition at line 484 of file juce_ComponentPeer.h.

◆ removeVBlankListener()

void juce::ComponentPeer::removeVBlankListener ( VBlankListener listenerToRemove)

Removes a VBlankListener.

Definition at line 512 of file juce_ComponentPeer.h.

◆ repaint()

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

Invalidates a region of the window to be repainted asynchronously.

Implemented in juce::LinuxComponentPeer.

◆ setAlpha()

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

Changes the window's transparency.

Implemented in juce::LinuxComponentPeer.

◆ 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.

Implemented in juce::LinuxComponentPeer.

◆ setAppStyle()

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

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!

Definition at line 546 of file juce_ComponentPeer.h.

◆ 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().

Implemented in juce::LinuxComponentPeer.

◆ 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.

Definition at line 305 of file juce_ComponentPeer.cpp.

◆ setCurrentRenderingEngine()

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

Definition at line 590 of file juce_ComponentPeer.cpp.

◆ setDocumentEditedStatus()

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.

Definition at line 579 of file juce_ComponentPeer.cpp.

◆ setFullScreen()

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

Enable/disable fullscreen mode for the window.

Implemented in juce::LinuxComponentPeer.

◆ setHasChangedSinceSaved()

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

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

Definition at line 525 of file juce_ComponentPeer.h.

◆ setIcon()

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

Attempts to change the icon associated with this window.

Implemented in juce::LinuxComponentPeer.

◆ setMinimised()

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

Minimises the window.

Implemented in juce::LinuxComponentPeer.

◆ setNonFullScreenBounds()

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

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

Definition at line 398 of file juce_ComponentPeer.cpp.

◆ setRepresentedFile()

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.

Definition at line 584 of file juce_ComponentPeer.cpp.

◆ setTitle()

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

Changes the title of the window.

Implemented in juce::LinuxComponentPeer.

◆ setVisible()

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

Shows or hides the window.

Implemented in juce::LinuxComponentPeer.

◆ startHostManagedResize()

virtual void juce::ComponentPeer::startHostManagedResize ( Point< int mouseDownPosition,
ResizableBorderComponent::Zone  zone 
)
virtual

Asks the window-manager to begin resizing this window, on platforms where this is useful (currently just Linux/X11).

Parameters
mouseDownPositionThe position of the mouse event that started the resize in unscaled peer coordinates
zoneThe edges of the window that may be moved during the resize

Reimplemented in juce::LinuxComponentPeer.

Definition at line 268 of file juce_ComponentPeer.h.

◆ toBehind()

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

Moves the window to be just behind another one.

Implemented in juce::LinuxComponentPeer.

◆ toFront()

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

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

Implemented in juce::LinuxComponentPeer.

◆ updateBounds()

void juce::ComponentPeer::updateBounds ( )

Updates the peer's bounds to match its component.

Definition at line 75 of file juce_ComponentPeer.cpp.

Member Data Documentation

◆ component

Component& juce::ComponentPeer::component
protected

Definition at line 559 of file juce_ComponentPeer.h.

◆ constrainer

ComponentBoundsConstrainer* juce::ComponentPeer::constrainer
protected

Definition at line 562 of file juce_ComponentPeer.h.

◆ getNativeRealtimeModifiers

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

Definition at line 563 of file juce_ComponentPeer.h.

◆ lastNonFullscreenBounds

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

Definition at line 561 of file juce_ComponentPeer.h.

◆ scaleFactorListeners

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

Definition at line 564 of file juce_ComponentPeer.h.

◆ style

Style juce::ComponentPeer::style
protected

Definition at line 566 of file juce_ComponentPeer.h.

◆ styleFlags

const int juce::ComponentPeer::styleFlags
protected

Definition at line 560 of file juce_ComponentPeer.h.

◆ vBlankListeners

ListenerList<VBlankListener> juce::ComponentPeer::vBlankListeners
protected

Definition at line 565 of file juce_ComponentPeer.h.


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