|
LMMS
|
#include <juce_ComponentPeer.h>
Classes | |
| class | OptionalBorderSize |
| struct | DragInfo |
| struct | ScaleFactorListener |
Public Types | |
| 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) , windowRequiresSynchronousCoreGraphicsRendering = (1 << 11) , windowIsSemiTransparent = (1 << 30) } |
| enum class | Style { automatic , light , dark } |
Static Public Member Functions | |
| static int | getNumPeers () noexcept |
| static ComponentPeer * | getPeer (int index) noexcept |
| static ComponentPeer * | getPeerFor (const Component *) noexcept |
| static bool | isValidPeer (const ComponentPeer *peer) noexcept |
| static ModifierKeys | getCurrentModifiersRealtime () noexcept |
Static Protected Member Functions | |
| static void | forceDisplayUpdate () |
Protected Attributes | |
| Component & | component |
| const int | styleFlags |
| Rectangle< int > | lastNonFullscreenBounds |
| ComponentBoundsConstrainer * | constrainer = nullptr |
| ListenerList< ScaleFactorListener > | scaleFactorListeners |
| Style | style = Style::automatic |
Static Protected Attributes | |
| static std::function< ModifierKeys()> | getNativeRealtimeModifiers = nullptr |
Private Member Functions | |
| virtual void | appStyleChanged () |
| virtual void | textInputRequired (Point< int >, TextInputTarget &)=0 |
| virtual void | dismissPendingTextInput () |
| void | globalFocusChanged (Component *) override |
| Component * | getTargetForKeyPress () |
| Private Member Functions inherited from juce::FocusChangeListener | |
| virtual | ~FocusChangeListener ()=default |
Private Attributes | |
| WeakReference< Component > | lastFocusedComponent |
| WeakReference< Component > | dragAndDropTargetComponent |
| Component * | lastDragAndDropCompUnderMouse = nullptr |
| TextInputTarget * | textInputTarget = nullptr |
| const uint32 | uniqueID |
| bool | isWindowMinimised = false |
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.
@tags{GUI}
|
strong |
| enum juce::ComponentPeer::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. |
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
|
override |
Destructor.
|
inline |
Adds a scale factor listener.
|
inlineprivatevirtual |
|
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.
Reimplemented in juce::HWNDComponentPeer.
|
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::HWNDComponentPeer, and juce::LinuxComponentPeer.
|
privatevirtual |
If there's some kind of OS input-method in progress, this should dismiss it.
Overrides of this function should call closeInputMethodContext().
This function should not be called directly by Components - use refreshTextInputTarget instead.
Reimplemented in juce::HWNDComponentPeer.
| TextInputTarget * juce::ComponentPeer::findCurrentTextInputTarget | ( | ) |
Returns the currently focused TextInputTarget, or null if none is found.
|
staticprotected |
|
inline |
Returns the style requested for this app.
Returns the area in peer coordinates that is covered by the given sub-comp (which may be at any depth)
|
pure virtual |
Implemented in juce::HWNDComponentPeer, and juce::LinuxComponentPeer.
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::HWNDComponentPeer, and juce::LinuxComponentPeer.
|
inlinenoexcept |
Returns the component being represented by this peer.
|
inlinenoexcept |
Returns the current constrainer, if one has been set.
|
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.
|
virtual |
Reimplemented in juce::HWNDComponentPeer.
|
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::HWNDComponentPeer, and juce::LinuxComponentPeer.
|
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::HWNDComponentPeer, and juce::LinuxComponentPeer.
|
noexcept |
|
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::HWNDComponentPeer, and juce::LinuxComponentPeer.
Returns the size to restore to if fullscreen mode is turned off.
|
staticnoexcept |
Returns the number of currently-active peers.
|
staticnoexcept |
Returns one of the currently-active peers.
|
staticnoexcept |
Returns the peer that's attached to the given component, or nullptr if there isn't one.
|
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.
Reimplemented in juce::HWNDComponentPeer, and juce::LinuxComponentPeer.
|
inlinenoexcept |
Returns the set of style flags that were set when the window was created.
|
private |
|
inlinenoexcept |
Returns a unique ID for this peer. Each peer that is created is given a different ID.
Callback to indicate that the currently focused component has changed.
Implements juce::FocusChangeListener.
Converts a screen area to a position relative to the top-left of this component.
|
virtual |
Converts a screen area to a position relative to the top-left of this component.
Reimplemented in juce::HWNDComponentPeer, and juce::LinuxComponentPeer.
|
pure virtual |
Converts a screen coordinate to a position relative to the top-left of this component.
Implemented in juce::HWNDComponentPeer, and juce::LinuxComponentPeer.
Converts a screen coordinate to a position relative to the top-left of this component.
|
pure virtual |
Tries to give the window keyboard focus.
Implemented in juce::HWNDComponentPeer, and juce::LinuxComponentPeer.
| void juce::ComponentPeer::handleBroughtToFront | ( | ) |
Called when the window is brought to the front, either by the OS or by a call to toFront().
| void juce::ComponentPeer::handleFocusGain | ( | ) |
Called when the window gains keyboard focus.
| void juce::ComponentPeer::handleFocusLoss | ( | ) |
Called when the window loses keyboard focus.
Called when a key is pressed. Returns true if the keystroke was used.
| 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.
| bool juce::ComponentPeer::handleKeyUpOrDown | ( | bool | isKeyDown | ) |
Called whenever a key is pressed or released. Returns true if the keystroke was used.
| void juce::ComponentPeer::handleMagnifyGesture | ( | MouseInputSource::InputSourceType | type, |
| Point< float > | positionWithinPeer, | ||
| int64 | time, | ||
| float | scaleFactor, | ||
| int | touchIndex = 0 ) |
| void juce::ComponentPeer::handleModifierKeysChange | ( | ) |
Called whenever a modifier key is pressed or released.
| void juce::ComponentPeer::handleMouseEvent | ( | MouseInputSource::InputSourceType | type, |
| Point< float > | positionWithinPeer, | ||
| ModifierKeys | newMods, | ||
| float | pressure, | ||
| float | orientation, | ||
| int64 | time, | ||
| PenDetails | pen = {}, | ||
| int | touchIndex = 0 ) |
| void juce::ComponentPeer::handleMouseWheel | ( | MouseInputSource::InputSourceType | type, |
| Point< float > | positionWithinPeer, | ||
| int64 | time, | ||
| const MouseWheelDetails & | wheel, | ||
| int | touchIndex = 0 ) |
| 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.
| 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.
|
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.
| void juce::ComponentPeer::handleUserClosingWindow | ( | ) |
|
pure virtual |
True if the window has the keyboard focus.
Implemented in juce::HWNDComponentPeer, and juce::LinuxComponentPeer.
|
pure virtual |
True if the window is currently full-screen.
Implemented in juce::HWNDComponentPeer, and juce::LinuxComponentPeer.
|
virtual |
True if the window is in kiosk-mode.
|
pure virtual |
True if the window is currently minimised.
Implemented in juce::HWNDComponentPeer, and juce::LinuxComponentPeer.
|
staticnoexcept |
Checks if this peer object is valid.
| Rectangle< float > juce::ComponentPeer::localToGlobal | ( | const Rectangle< float > & | relativePosition | ) |
Converts a rectangle relative to the top-left of this component to screen coordinates.
|
virtual |
Converts a rectangle relative to the top-left of this component to screen coordinates.
Reimplemented in juce::HWNDComponentPeer, and juce::LinuxComponentPeer.
|
pure virtual |
Converts a position relative to the top-left of this component to screen coordinates.
Implemented in juce::HWNDComponentPeer, and juce::LinuxComponentPeer.
Converts a position relative to the top-left of this component to screen coordinates.
|
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::HWNDComponentPeer, and juce::LinuxComponentPeer.
| 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.
|
inline |
Removes a scale factor listener.
Invalidates a region of the window to be repainted asynchronously.
Implemented in juce::HWNDComponentPeer, and juce::LinuxComponentPeer.
|
pure virtual |
Changes the window's transparency.
Implemented in juce::HWNDComponentPeer, and juce::LinuxComponentPeer.
|
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::HWNDComponentPeer, and juce::LinuxComponentPeer.
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!
|
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::HWNDComponentPeer, and juce::LinuxComponentPeer.
|
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.
Reimplemented in juce::HWNDComponentPeer.
|
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.
|
pure virtual |
Enable/disable fullscreen mode for the window.
Implemented in juce::HWNDComponentPeer, and juce::LinuxComponentPeer.
|
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.
Attempts to change the icon associated with this window.
Implemented in juce::HWNDComponentPeer, and juce::LinuxComponentPeer.
|
pure virtual |
Minimises the window.
Implemented in juce::HWNDComponentPeer, and juce::LinuxComponentPeer.
Sets the size to restore to if fullscreen mode is turned off.
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.
Changes the title of the window.
Implemented in juce::HWNDComponentPeer, and juce::LinuxComponentPeer.
|
pure virtual |
Shows or hides the window.
Implemented in juce::HWNDComponentPeer, and juce::LinuxComponentPeer.
|
privatepure 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.
This function should not be called directly by Components - use refreshTextInputTarget instead.
Implemented in juce::HWNDComponentPeer, and juce::LinuxComponentPeer.
|
pure virtual |
Moves the window to be just behind another one.
Implemented in juce::HWNDComponentPeer, and juce::LinuxComponentPeer.
|
pure virtual |
Brings the window to the top, optionally also giving it keyboard focus.
Implemented in juce::HWNDComponentPeer, and juce::LinuxComponentPeer.
| void juce::ComponentPeer::updateBounds | ( | ) |
Updates the peer's bounds to match its component.
|
protected |
|
protected |
|
private |
|
staticprotected |
|
private |
|
private |
|
protected |
|
protected |
|
private |