44 splashScreen.deleteAndZero();
52 resizableCorner.reset();
53 resizableBorder.reset();
78 #if ! JucePlugin_Build_Standalone
86 lastNonFullScreenPos.
setBounds (50, 50, 256, 256);
92int ResizableWindow::getDesktopWindowStyleFlags()
const
94 int styleFlags = TopLevelWindow::getDesktopWindowStyleFlags();
105 if (ownsContentComponent)
107 contentComponent.deleteAndZero();
112 contentComponent =
nullptr;
155 contentComponent.deleteAndZero();
160 contentComponent =
nullptr;
169 jassert (width > 0 && height > 0);
173 setSize (width + border.getLeftAndRight(),
174 height + border.getTopAndBottom());
192 updateLastPosIfShowing();
198 updateLastPosIfShowing();
205 if (resizableBorder !=
nullptr)
210 resizableBorder->toBack();
213 if (resizableCorner !=
nullptr)
223 if (contentComponent !=
nullptr)
227 jassert (! contentComponent->isTransformed());
232 updateLastPosIfShowing();
241 if ((child == contentComponent) && (child !=
nullptr) && resizeToFitContent)
261 repaint (area.removeFromTop (border.getTop()));
262 repaint (area.removeFromLeft (border.getLeft()));
263 repaint (area.removeFromRight (border.getRight()));
264 repaint (area.removeFromBottom (border.getBottom()));
269 const bool useBottomRightCornerResizer)
273 if (useBottomRightCornerResizer)
275 resizableBorder.reset();
277 if (resizableCorner ==
nullptr)
281 resizableCorner->setAlwaysOnTop (
true);
286 resizableCorner.reset();
288 if (resizableBorder ==
nullptr)
297 resizableCorner.reset();
298 resizableBorder.reset();
302 recreateDesktopWindow();
310 return resizableCorner !=
nullptr
311 || resizableBorder !=
nullptr;
320 jassert (constrainer == &defaultConstrainer || constrainer ==
nullptr);
322 if (constrainer ==
nullptr)
323 setConstrainer (&defaultConstrainer);
328 setBoundsConstrained (getBounds());
342 bool useBottomRightCornerResizer = resizableCorner !=
nullptr;
343 bool shouldBeResizable = useBottomRightCornerResizer || resizableBorder !=
nullptr;
345 resizableCorner.reset();
346 resizableBorder.reset();
349 updatePeerConstrainer();
355 if (constrainer !=
nullptr)
396 updatePeerConstrainer();
410 backgroundColour =
newColour.withAlpha (1.0f);
423 return peer !=
nullptr && peer->isFullScreen();
433 updateLastPosIfShowing();
441 auto lastPos = lastNonFullScreenPos;
468 return peer->isMinimised();
479 updateLastPosIfShowing();
493 return peer->isKioskMode();
498void ResizableWindow::updateLastPosIfShowing()
502 updateLastPosIfNotFullScreen();
503 updatePeerConstrainer();
507void ResizableWindow::updateLastPosIfNotFullScreen()
513void ResizableWindow::updatePeerConstrainer()
517 peer->setConstrainer (constrainer);
529 updateLastPosIfShowing();
554 const bool fs = tokens[0].startsWithIgnoreCase (
"fs");
572 if (
const auto frameSize = peer->getFrameSizeIfPresent())
577 if (peer ==
nullptr || ! peer->getFrameSizeIfPresent())
616 if (
const auto frameSize = peer->getFrameSizeIfPresent())
619 peer->setNonFullScreenBounds (
newPos);
622 updateLastPosIfNotFullScreen();
Specifies a set of gaps to be left around the sides of a rectangle.
Represents a colour, also including a transparency value.
A class that imposes restrictions on a Component's size or position.
void setMinimumOnscreenAmounts(int minimumWhenOffTheTop, int minimumWhenOffTheLeft, int minimumWhenOffTheBottom, int minimumWhenOffTheRight) noexcept
Sets the amount by which the component is allowed to go off-screen.
void setBoundsForComponent(Component *component, Rectangle< int > bounds, bool isStretchingTop, bool isStretchingLeft, bool isStretchingBottom, bool isStretchingRight)
Checks the given bounds, and then sets the component to the corrected size.
void dragComponent(Component *componentToDrag, const MouseEvent &e, ComponentBoundsConstrainer *constrainer)
Call this from your mouseDrag() callback to move the component.
void startDraggingComponent(Component *componentToDrag, const MouseEvent &e)
Call this from your component's mouseDown() method, to prepare for dragging.
@ windowIsResizable
Indicates that the window should have a resizable border.
@ windowHasTitleBar
Indicates that the window should have a normal OS-specific title bar and frame.
The base class for all JUCE user-interface objects.
Component * getParentComponent() const noexcept
Returns the component which this component is inside.
int getNumChildComponents() const noexcept
Returns the number of child components that this component contains.
int getIndexOfChildComponent(const Component *child) const noexcept
Returns the index of this component in the list of child components.
int getHeight() const noexcept
Returns the component's height in pixels.
bool isShowing() const
Tests whether this component and all its parents are visible.
void addAndMakeVisible(Component *child, int zOrder=-1)
Adds a child component to this one, and also makes the child visible if it isn't already.
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.
void repaint()
Marks the whole component as needing to be redrawn.
bool isOnDesktop() const noexcept
Returns true if this component is currently showing on the desktop.
void removeChildComponent(Component *childToRemove)
Removes one of this component's child-components.
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 setSize(int newWidth, int newHeight)
Changes the size of the component.
void setColour(int colourID, Colour newColour)
Registers a colour to be used for a particular purpose.
Colour findColour(int colourID, bool inheritFromParent=false) const
Looks for a colour that has been registered with the given colour ID number.
int getWidth() const noexcept
Returns the component's width in pixels.
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.
int getParentWidth() const noexcept
Returns the width of the component's parent.
void addChildComponent(Component *child, int zOrder=-1)
Adds a child component to this one.
int getParentHeight() const noexcept
Returns the height of the component's parent.
Component * getKioskModeComponent() const noexcept
Returns the component that is currently being used in kiosk-mode.
static Desktop &JUCE_CALLTYPE getInstance()
There's only one desktop object, and this method will return it.
static bool canUseSemiTransparentWindows() noexcept
True if the OS supports semitransparent windows.
A graphics context, used for drawing a component or image.
The standard JUCE splash screen component.
Contains position and status information about a mouse event.
Manages a rectangle and allows geometric operations to be performed on it.
String toString() const
Creates a string describing this rectangle.
void setBounds(ValueType newX, ValueType newY, ValueType newWidth, ValueType newHeight) noexcept
Changes all the rectangle's coordinates.
A component that resizes its parent component when dragged.
A component that resizes a parent component when dragged.
void setResizable(bool shouldBeResizable, bool useBottomRightCornerResizer)
Make the window resizable or fixed.
void setBoundsConstrained(const Rectangle< int > &newBounds)
Calls the window's setBounds method, after first checking these bounds with the current constrainer.
void setFullScreen(bool shouldBeFullScreen)
Puts the window into full-screen mode, or restores it to its normal size.
void mouseDown(const MouseEvent &) override
Called when a mouse button is pressed.
String getWindowStateAsString()
Returns a string which encodes the window's current size and position.
void setDraggable(bool shouldBeDraggable) noexcept
Can be used to enable or disable user-dragging of the window.
void resized() override
(if overriding this, make sure you call ResizableWindow::resized() in your subclass)
bool isResizable() const noexcept
Returns true if resizing is enabled.
void mouseUp(const MouseEvent &) override
Called when a mouse button is released.
void setResizeLimits(int newMinimumWidth, int newMinimumHeight, int newMaximumWidth, int newMaximumHeight) noexcept
This sets the maximum and minimum sizes for the window.
bool isMinimised() const
Returns true if the window is currently minimised.
bool isKioskMode() const
Returns true if the window has been placed in kiosk-mode.
void setContentOwned(Component *newContentComponent, bool resizeToFitWhenContentChangesSize)
Changes the current content component.
void mouseDrag(const MouseEvent &) override
Called when the mouse is moved while a button is held down.
void clearContentComponent()
Removes the current content component.
void lookAndFeelChanged() override
Called to let the component react to a change in the look-and-feel setting.
@ backgroundColourId
A colour to use to fill the window's background.
void setBackgroundColour(Colour newColour)
Changes the colour currently being used for the window's background.
void visibilityChanged() override
Called when this component's visibility changes.
virtual BorderSize< int > getContentComponentBorder()
Returns the insets to use when positioning the content component.
void paint(Graphics &) override
Components can override this method to draw their content.
virtual BorderSize< int > getBorderThickness()
Returns the width of the frame to use around the window.
bool isFullScreen() const
Returns true if the window is currently in full-screen mode.
void activeWindowStatusChanged() override
This callback happens when this window becomes active or inactive.
void parentSizeChanged() override
Called when this component's immediate parent has been resized.
Colour getBackgroundColour() const noexcept
Returns the colour currently being used for the window's background.
void setConstrainer(ComponentBoundsConstrainer *newConstrainer)
Sets the bounds-constrainer object to use for resizing and dragging this window.
void moved() override
(if overriding this, make sure you call ResizableWindow::moved() in your subclass)
bool restoreWindowStateFromString(const String &previousState)
Restores the window to a previously-saved size and position.
void setContentNonOwned(Component *newContentComponent, bool resizeToFitWhenContentChangesSize)
Changes the current content component.
~ResizableWindow() override
Destructor.
void setContentComponentSize(int width, int height)
Changes the window so that the content component ends up with the specified size.
void childBoundsChanged(Component *) override
Called when one of this component's children is moved or resized.
void setMinimised(bool shouldMinimise)
Minimises the window, or restores it to its previous position and size.
void addToDesktop()
Adds the window to the desktop using the default flags.
A special array for holding a list of strings.
void removeEmptyStrings(bool removeWhitespaceStrings=true)
Removes empty strings from the array.
int size() const noexcept
Returns the number of strings in the array.
void trim()
Deletes any whitespace characters from the starts and ends of all the strings.
int addTokens(StringRef stringToTokenise, bool preserveQuotedStrings)
Breaks up a string into tokens and adds them to this array.
A base class for top-level windows.
void visibilityChanged() override
Called when this component's visibility changes.
bool isUsingNativeTitleBar() const noexcept
Returns true if the window is currently using an OS-native title bar.
constexpr Type jmin(Type a, Type b)
Returns the smaller of two values.
Type jlimit(Type lowerLimit, Type upperLimit, Type valueToConstrain) noexcept
Constrains a value to keep it within a given range.
Type unalignedPointerCast(void *ptr) noexcept
Casts a pointer to another type via void*, which suppresses the cast-align warning which sometimes ar...