44 isCurrentlyActive = detail::TopLevelWindowManager::getInstance()->addWindow (
this);
50 detail::TopLevelWindowManager::getInstance()->removeWindow (
this);
56 auto*
wm = detail::TopLevelWindowManager::getInstance();
61 wm->checkFocusAsync();
64void TopLevelWindow::setWindowActive (
const bool isNowActive)
96int TopLevelWindow::getDesktopWindowStyleFlags()
const
119 if (shadower ==
nullptr)
123 if (shadower !=
nullptr)
124 shadower->setOwner (
this);
140 recreateDesktopWindow();
145void TopLevelWindow::recreateDesktopWindow()
182 return std::make_unique<AccessibilityHandler> (*
this, AccessibilityRole::window);
219 return detail::TopLevelWindowManager::getInstance()->windows.size();
224 return detail::TopLevelWindowManager::getInstance()->windows [index];
236 if (
tlw->isActiveWindow())
240 for (
auto* c =
tlw->getParentComponent(); c !=
nullptr; c = c->getParentComponent())
@ windowIsTemporary
Indicates that the window is a temporary popup, like a menu, tooltip, etc.
@ windowIgnoresKeyPresses
Tells the window not to catch any keypresses.
@ windowHasDropShadow
Indicates that the window should have a drop-shadow (this may not be possible on all platforms).
@ windowAppearsOnTaskbar
Indicates that the window should have a corresponding entry on the taskbar (ignored on MacOSX)
@ windowIsSemiTransparent
Not intended for public use - makes a window transparent.
@ windowHasTitleBar
Indicates that the window should have a normal OS-specific title bar and frame.
The base class for all JUCE user-interface objects.
void setBroughtToFrontOnMouseClick(bool shouldBeBroughtToFront) noexcept
Indicates whether the component should be brought to the front when clicked.
Component * getParentComponent() const noexcept
Returns the component which this component is inside.
void setTitle(const String &newTitle)
Sets the title for this component.
bool isOpaque() const noexcept
Returns true if no parts of this component are transparent.
void toFront(bool shouldAlsoGainKeyboardFocus)
Brings the component to the front of its siblings.
bool isShowing() const
Tests whether this component and all its parents are visible.
void sendLookAndFeelChange()
Calls the methods repaint(), lookAndFeelChanged(), and colourChanged() in this component and all its ...
FocusChangeType
Enumeration used by the focusGained() and focusLost() methods.
bool hasKeyboardFocus(bool trueIfChildIsFocused) const
Returns true if this component currently has the keyboard focus.
void setOpaque(bool shouldBeOpaque)
Indicates whether any parts of the component might be transparent.
Rectangle< int > getBounds() const noexcept
Returns this component's bounding box.
bool isOnDesktop() const noexcept
Returns true if this component is currently showing on the desktop.
virtual void addToDesktop(int windowStyleFlags, void *nativeWindowToAttachTo=nullptr)
Makes this component appear as a window on the desktop.
void setBounds(int x, int y, int width, int height)
Changes the component's position and size.
void setWantsKeyboardFocus(bool wantsFocus) noexcept
Sets a flag to indicate whether this component wants keyboard focus or not.
Rectangle< int > getParentMonitorArea() const
Returns the screen coordinates of the monitor that contains this component.
Point< int > localPointToGlobal(Point< int > localPoint) const
Converts a point relative to this component's top-left into a screen coordinate.
ComponentPeer * getPeer() const
Returns the heavyweight window that contains this component.
LookAndFeel & getLookAndFeel() const noexcept
Finds the appropriate look-and-feel to use for this component.
Rectangle< int > getLocalBounds() const noexcept
Returns the component's bounds, relative to its own origin.
void centreWithSize(int width, int height)
Changes the component's size and centres it within its parent.
virtual float getDesktopScaleFactor() const
Returns the default scale factor to use for this component when it is placed on the desktop.
float getGlobalScaleFactor() const noexcept
Returns the current global scale factor, as set by setGlobalScaleFactor().
static Desktop &JUCE_CALLTYPE getInstance()
There's only one desktop object, and this method will return it.
virtual std::unique_ptr< DropShadower > createDropShadowerForComponent(Component &)=0
Creates a drop-shadower for a given component, if required.
Manages a rectangle and allows geometric operations to be performed on it.
Point< ValueType > getCentre() const noexcept
Returns the centre point of the rectangle.
Rectangle constrainedWithin(Rectangle areaToFitWithin) const noexcept
Tries to fit this rectangle within a target area, returning the result.
bool isEmpty() const noexcept
Returns true if the rectangle's width or height are zero or less.
A base class for top-level windows.
bool isDropShadowEnabled() const noexcept
True if drop-shadowing is enabled.
void centreAroundComponent(Component *componentToCentreAround, int width, int height)
This will set the bounds of the window so that it's centred in front of another window.
void visibilityChanged() override
Called when this component's visibility changes.
~TopLevelWindow() override
Destructor.
static int getNumTopLevelWindows() noexcept
Returns the number of TopLevelWindow objects currently in use.
void setDropShadowEnabled(bool useShadow)
Turns the drop-shadow on and off.
static TopLevelWindow * getTopLevelWindow(int index) noexcept
Returns one of the TopLevelWindow objects currently in use.
static TopLevelWindow * getActiveTopLevelWindow() noexcept
Returns the currently-active top level window.
std::unique_ptr< AccessibilityHandler > createAccessibilityHandler() override
Override this method to return a custom AccessibilityHandler for this component.
bool isUsingNativeTitleBar() const noexcept
Returns true if the window is currently using an OS-native title bar.
void parentHierarchyChanged() override
Called to indicate that the component's parents have changed.
TopLevelWindow(const String &name, bool addToDesktop)
Creates a TopLevelWindow.
virtual void activeWindowStatusChanged()
This callback happens when this window becomes active or inactive.
void focusOfChildComponentChanged(FocusChangeType) override
Called to indicate a change in whether or not this component is the parent of the currently-focused c...
void setUsingNativeTitleBar(bool useNativeTitleBar)
Sets whether an OS-native title bar will be used, or a JUCE one.
void addToDesktop()
Adds the window to the desktop using the default flags.
Type unalignedPointerCast(void *ptr) noexcept
Casts a pointer to another type via void*, which suppresses the cast-align warning which sometimes ar...