LMMS
Loading...
Searching...
No Matches
juce::ResizableWindow Class Reference

#include <juce_ResizableWindow.h>

Inheritance diagram for juce::ResizableWindow:
juce::TopLevelWindow juce::Component juce::MouseListener juce::DocumentWindow juce::FileChooserDialogBox juce::DialogWindow juce::MultiDocumentPanelWindow juce::DefaultDialogWindow juce::Toolbar::CustomisationDialog

Classes

struct  LookAndFeelMethods

Public Types

enum  ColourIds { backgroundColourId = 0x1005700 }
Public Types inherited from juce::Component
enum class  FocusContainerType { none , focusContainer , keyboardFocusContainer }
enum  FocusChangeType { focusChangedByMouseClick , focusChangedByTabKey , focusChangedDirectly }

Public Member Functions

 ResizableWindow (const String &name, bool addToDesktop)
 ResizableWindow (const String &name, Colour backgroundColour, bool addToDesktop)
 ~ResizableWindow () override
Colour getBackgroundColour () const noexcept
void setBackgroundColour (Colour newColour)
void setResizable (bool shouldBeResizable, bool useBottomRightCornerResizer)
bool isResizable () const noexcept
void setResizeLimits (int newMinimumWidth, int newMinimumHeight, int newMaximumWidth, int newMaximumHeight) noexcept
void setDraggable (bool shouldBeDraggable) noexcept
bool isDraggable () const noexcept
ComponentBoundsConstrainergetConstrainer () noexcept
void setConstrainer (ComponentBoundsConstrainer *newConstrainer)
void setBoundsConstrained (const Rectangle< int > &newBounds)
bool isFullScreen () const
void setFullScreen (bool shouldBeFullScreen)
bool isMinimised () const
void setMinimised (bool shouldMinimise)
bool isKioskMode () const
String getWindowStateAsString ()
bool restoreWindowStateFromString (const String &previousState)
ComponentgetContentComponent () const noexcept
void setContentOwned (Component *newContentComponent, bool resizeToFitWhenContentChangesSize)
void setContentNonOwned (Component *newContentComponent, bool resizeToFitWhenContentChangesSize)
void clearContentComponent ()
void setContentComponentSize (int width, int height)
virtual BorderSize< intgetBorderThickness ()
virtual BorderSize< intgetContentComponentBorder ()
void setContentComponent (Component *newContentComponent, bool deleteOldOne=true, bool resizeToFit=false)
void addToDesktop ()
void addToDesktop (int windowStyleFlags, void *nativeWindowToAttachTo=nullptr) override
Public Member Functions inherited from juce::TopLevelWindow
 TopLevelWindow (const String &name, bool addToDesktop)
 ~TopLevelWindow () override
bool isActiveWindow () const noexcept
void centreAroundComponent (Component *componentToCentreAround, int width, int height)
void setDropShadowEnabled (bool useShadow)
bool isDropShadowEnabled () const noexcept
void setUsingNativeTitleBar (bool useNativeTitleBar)
bool isUsingNativeTitleBar () const noexcept
void addToDesktop ()
void addToDesktop (int windowStyleFlags, void *nativeWindowToAttachTo=nullptr) override
Public Member Functions inherited from juce::Component
 Component () noexcept
 ~Component () override
 Component (const String &componentName) noexcept
String getName () const noexcept
virtual void setName (const String &newName)
String getComponentID () const noexcept
void setComponentID (const String &newID)
virtual void setVisible (bool shouldBeVisible)
bool isVisible () const noexcept
bool isShowing () const
void removeFromDesktop ()
bool isOnDesktop () const noexcept
ComponentPeergetPeer () const
virtual void userTriedToCloseWindow ()
virtual void minimisationStateChanged (bool isNowMinimised)
virtual float getDesktopScaleFactor () const
void toFront (bool shouldAlsoGainKeyboardFocus)
void toBack ()
void toBehind (Component *other)
void setAlwaysOnTop (bool shouldStayOnTop)
bool isAlwaysOnTop () const noexcept
int getX () const noexcept
int getY () const noexcept
int getWidth () const noexcept
int getHeight () const noexcept
int getRight () const noexcept
Point< intgetPosition () const noexcept
int getBottom () const noexcept
Rectangle< intgetBounds () const noexcept
Rectangle< intgetLocalBounds () const noexcept
Rectangle< intgetBoundsInParent () const noexcept
int getScreenX () const
int getScreenY () const
Point< intgetScreenPosition () const
Rectangle< intgetScreenBounds () const
Point< intgetLocalPoint (const Component *sourceComponent, Point< int > pointRelativeToSourceComponent) const
Point< float > getLocalPoint (const Component *sourceComponent, Point< float > pointRelativeToSourceComponent) const
Rectangle< intgetLocalArea (const Component *sourceComponent, Rectangle< int > areaRelativeToSourceComponent) const
Rectangle< float > getLocalArea (const Component *sourceComponent, Rectangle< float > areaRelativeToSourceComponent) const
Point< intlocalPointToGlobal (Point< int > localPoint) const
Point< float > localPointToGlobal (Point< float > localPoint) const
Rectangle< intlocalAreaToGlobal (Rectangle< int > localArea) const
Rectangle< float > localAreaToGlobal (Rectangle< float > localArea) const
void setTopLeftPosition (int x, int y)
void setTopLeftPosition (Point< int > newTopLeftPosition)
void setTopRightPosition (int x, int y)
void setSize (int newWidth, int newHeight)
void setBounds (int x, int y, int width, int height)
void setBounds (Rectangle< int > newBounds)
void setBoundsRelative (float proportionalX, float proportionalY, float proportionalWidth, float proportionalHeight)
void setBoundsRelative (Rectangle< float > proportionalArea)
void setBoundsInset (BorderSize< int > borders)
void setBoundsToFit (Rectangle< int > targetArea, Justification justification, bool onlyReduceInSize)
void setCentrePosition (int x, int y)
void setCentrePosition (Point< int > newCentrePosition)
void setCentreRelative (float x, float y)
void centreWithSize (int width, int height)
void setTransform (const AffineTransform &transform)
AffineTransform getTransform () const
bool isTransformed () const noexcept
int proportionOfWidth (float proportion) const noexcept
int proportionOfHeight (float proportion) const noexcept
int getParentWidth () const noexcept
int getParentHeight () const noexcept
Rectangle< intgetParentMonitorArea () const
int getNumChildComponents () const noexcept
ComponentgetChildComponent (int index) const noexcept
int getIndexOfChildComponent (const Component *child) const noexcept
const Array< Component * > & getChildren () const noexcept
ComponentfindChildWithID (StringRef componentID) const noexcept
void addChildComponent (Component *child, int zOrder=-1)
void addChildComponent (Component &child, int zOrder=-1)
void addAndMakeVisible (Component *child, int zOrder=-1)
void addAndMakeVisible (Component &child, int zOrder=-1)
void addChildAndSetID (Component *child, const String &componentID)
void removeChildComponent (Component *childToRemove)
ComponentremoveChildComponent (int childIndexToRemove)
void removeAllChildren ()
void deleteAllChildren ()
ComponentgetParentComponent () const noexcept
template<class TargetClass>
TargetClass * findParentComponentOfClass () const
ComponentgetTopLevelComponent () const noexcept
bool isParentOf (const Component *possibleChild) const noexcept
virtual void childrenChanged ()
virtual bool hitTest (int x, int y)
void setInterceptsMouseClicks (bool allowClicksOnThisComponent, bool allowClicksOnChildComponents) noexcept
void getInterceptsMouseClicks (bool &allowsClicksOnThisComponent, bool &allowsClicksOnChildComponents) const noexcept
bool contains (Point< int > localPoint)
bool contains (Point< float > localPoint)
bool reallyContains (Point< int > localPoint, bool returnTrueIfWithinAChild)
bool reallyContains (Point< float > localPoint, bool returnTrueIfWithinAChild)
ComponentgetComponentAt (int x, int y)
ComponentgetComponentAt (Point< int > position)
ComponentgetComponentAt (Point< float > position)
void repaint ()
void repaint (int x, int y, int width, int height)
void repaint (Rectangle< int > area)
void setBufferedToImage (bool shouldBeBuffered)
Image createComponentSnapshot (Rectangle< int > areaToGrab, bool clipImageToComponentBounds=true, float scaleFactor=1.0f)
void paintEntireComponent (Graphics &context, bool ignoreAlphaLevel)
void setPaintingIsUnclipped (bool shouldPaintWithoutClipping) noexcept
bool isPaintingUnclipped () const noexcept
void setComponentEffect (ImageEffectFilter *newEffect)
ImageEffectFiltergetComponentEffect () const noexcept
LookAndFeelgetLookAndFeel () const noexcept
void setLookAndFeel (LookAndFeel *newLookAndFeel)
void sendLookAndFeelChange ()
void setOpaque (bool shouldBeOpaque)
bool isOpaque () const noexcept
void setBroughtToFrontOnMouseClick (bool shouldBeBroughtToFront) noexcept
bool isBroughtToFrontOnMouseClick () const noexcept
void setExplicitFocusOrder (int newFocusOrderIndex)
int getExplicitFocusOrder () const
void setFocusContainerType (FocusContainerType containerType) noexcept
bool isFocusContainer () const noexcept
bool isKeyboardFocusContainer () const noexcept
ComponentfindFocusContainer () const
ComponentfindKeyboardFocusContainer () const
void setWantsKeyboardFocus (bool wantsFocus) noexcept
bool getWantsKeyboardFocus () const noexcept
void setMouseClickGrabsKeyboardFocus (bool shouldGrabFocus)
bool getMouseClickGrabsKeyboardFocus () const noexcept
void grabKeyboardFocus ()
void giveAwayKeyboardFocus ()
bool hasKeyboardFocus (bool trueIfChildIsFocused) const
void moveKeyboardFocusToSibling (bool moveToNext)
virtual std::unique_ptr< ComponentTraversercreateFocusTraverser ()
virtual std::unique_ptr< ComponentTraversercreateKeyboardFocusTraverser ()
void setHasFocusOutline (bool hasFocusOutline) noexcept
bool hasFocusOutline () const noexcept
bool isEnabled () const noexcept
void setEnabled (bool shouldBeEnabled)
virtual void enablementChanged ()
float getAlpha () const noexcept
void setAlpha (float newAlpha)
virtual void alphaChanged ()
void setMouseCursor (const MouseCursor &cursorType)
virtual MouseCursor getMouseCursor ()
void updateMouseCursor () const
virtual void paintOverChildren (Graphics &g)
void mouseMove (const MouseEvent &event) override
void mouseEnter (const MouseEvent &event) override
void mouseExit (const MouseEvent &event) override
void mouseDoubleClick (const MouseEvent &event) override
void mouseWheelMove (const MouseEvent &event, const MouseWheelDetails &wheel) override
void mouseMagnify (const MouseEvent &event, float scaleFactor) override
void setRepaintsOnMouseActivity (bool shouldRepaint) noexcept
void addMouseListener (MouseListener *newListener, bool wantsEventsForAllNestedChildComponents)
void removeMouseListener (MouseListener *listenerToRemove)
void addKeyListener (KeyListener *newListener)
void removeKeyListener (KeyListener *listenerToRemove)
virtual bool keyPressed (const KeyPress &key)
virtual bool keyStateChanged (bool isKeyDown)
virtual void modifierKeysChanged (const ModifierKeys &modifiers)
virtual void focusGained (FocusChangeType cause)
virtual void focusLost (FocusChangeType cause)
bool isMouseOver (bool includeChildren=false) const
bool isMouseButtonDown (bool includeChildren=false) const
bool isMouseOverOrDragging (bool includeChildren=false) const
Point< intgetMouseXYRelative () const
virtual void broughtToFront ()
void addComponentListener (ComponentListener *newListener)
void removeComponentListener (ComponentListener *listenerToRemove)
void postCommandMessage (int commandId)
virtual void handleCommandMessage (int commandId)
void enterModalState (bool takeKeyboardFocus=true, ModalComponentManager::Callback *callback=nullptr, bool deleteWhenDismissed=false)
void exitModalState (int returnValue)
bool isCurrentlyModal (bool onlyConsiderForemostModalComponent=true) const noexcept
bool isCurrentlyBlockedByAnotherModalComponent () const
virtual bool canModalEventBeSentToComponent (const Component *targetComponent)
virtual void inputAttemptWhenModal ()
NamedValueSetgetProperties () noexcept
const NamedValueSetgetProperties () const noexcept
Colour findColour (int colourID, bool inheritFromParent=false) const
void setColour (int colourID, Colour newColour)
void removeColour (int colourID)
bool isColourSpecified (int colourID) const
void copyAllExplicitColoursTo (Component &target) const
virtual void colourChanged ()
voidgetWindowHandle () const
PositionergetPositioner () const noexcept
void setPositioner (Positioner *newPositioner)
void setCachedComponentImage (CachedComponentImage *newCachedImage)
CachedComponentImagegetCachedComponentImage () const noexcept
void setViewportIgnoreDragFlag (bool ignoreDrag) noexcept
bool getViewportIgnoreDragFlag () const noexcept
String getTitle () const noexcept
void setTitle (const String &newTitle)
String getDescription () const noexcept
void setDescription (const String &newDescription)
String getHelpText () const noexcept
void setHelpText (const String &newHelpText)
void setAccessible (bool shouldBeAccessible)
bool isAccessible () const noexcept
AccessibilityHandlergetAccessibilityHandler ()
void invalidateAccessibilityHandler ()
void setFocusContainer (bool shouldBeFocusContainer) noexcept
void contains (int, int)=delete
Public Member Functions inherited from juce::MouseListener
virtual ~MouseListener ()=default

Protected Member Functions

void paint (Graphics &) override
void moved () override
void resized () override
void mouseDown (const MouseEvent &) override
void mouseDrag (const MouseEvent &) override
void mouseUp (const MouseEvent &) override
void lookAndFeelChanged () override
void childBoundsChanged (Component *) override
void parentSizeChanged () override
void visibilityChanged () override
void activeWindowStatusChanged () override
int getDesktopWindowStyleFlags () const override
void getBorderThickness (int &left, int &top, int &right, int &bottom)
void getContentComponentBorder (int &left, int &top, int &right, int &bottom)
Protected Member Functions inherited from juce::TopLevelWindow
void focusOfChildComponentChanged (FocusChangeType) override
void parentHierarchyChanged () override
void recreateDesktopWindow ()
void visibilityChanged () override
Protected Member Functions inherited from juce::Component
virtual ComponentPeercreateNewPeer (int styleFlags, void *nativeWindowToAttachTo)

Protected Attributes

std::unique_ptr< ResizableCornerComponentresizableCorner
std::unique_ptr< ResizableBorderComponentresizableBorder

Private Member Functions

void initialise (bool addToDesktop)
void updateLastPosIfNotFullScreen ()
void updateLastPosIfShowing ()
void setContent (Component *, bool takeOwnership, bool resizeToFit)
void updatePeerConstrainer ()

Private Attributes

Component::SafePointer< ComponentcontentComponent
bool ownsContentComponent = false
bool resizeToFitContent = false
bool fullscreen = false
bool canDrag = true
bool dragStarted = false
ComponentDragger dragger
Rectangle< intlastNonFullScreenPos
ComponentBoundsConstrainer defaultConstrainer
ComponentBoundsConstrainerconstrainer = nullptr

Additional Inherited Members

Static Public Member Functions inherited from juce::TopLevelWindow
static int getNumTopLevelWindows () noexcept
static TopLevelWindowgetTopLevelWindow (int index) noexcept
static TopLevelWindowgetActiveTopLevelWindow () noexcept
Static Public Member Functions inherited from juce::Component
static float JUCE_CALLTYPE getApproximateScaleFactorForComponent (const Component *targetComponent)
static Component *JUCE_CALLTYPE getCurrentlyFocusedComponent () noexcept
static void JUCE_CALLTYPE unfocusAllComponents ()
static void JUCE_CALLTYPE beginDragAutoRepeat (int millisecondsBetweenCallbacks)
static bool JUCE_CALLTYPE isMouseButtonDownAnywhere () noexcept
static int JUCE_CALLTYPE getNumCurrentlyModalComponents () noexcept
static Component *JUCE_CALLTYPE getCurrentlyModalComponent (int index=0) noexcept
Static Protected Member Functions inherited from juce::Component
static std::unique_ptr< AccessibilityHandlercreateIgnoredAccessibilityHandler (Component &)

Detailed Description

A base class for top-level windows that can be dragged around and resized.

To add content to the window, use its setContentOwned() or setContentNonOwned() methods to give it a component that will remain positioned inside it (leaving a gap around the edges for a border).

It's not advisable to add child components directly to a ResizableWindow: put them inside your content component instead. And overriding methods like resized(), moved(), etc is also not recommended - instead override these methods for your content component. (If for some obscure reason you do need to override these methods, always remember to call the super-class's resized() method too, otherwise it'll fail to lay out the window decorations correctly).

By default resizing isn't enabled - use the setResizable() method to enable it and to choose the style of resizing to use.

See also
TopLevelWindow

@tags{GUI}

Member Enumeration Documentation

◆ ColourIds

enum juce::ResizableWindow::ColourIds

A set of colour IDs to use to change the colour of various aspects of the window.

These constants can be used either via the Component::setColour(), or LookAndFeel::setColour() methods.

See also
Component::setColour, Component::findColour, LookAndFeel::setColour, LookAndFeel::findColour
Enumerator
backgroundColourId 

A colour to use to fill the window's background.

Constructor & Destructor Documentation

◆ ResizableWindow() [1/2]

juce::ResizableWindow::ResizableWindow ( const String & name,
bool addToDesktop )

Creates a ResizableWindow.

This constructor doesn't specify a background colour, so the LookAndFeel's default background colour will be used.

Parameters
namethe name to give the component
addToDesktopif true, the window will be automatically added to the desktop; if false, you can use it as a child component

◆ ResizableWindow() [2/2]

juce::ResizableWindow::ResizableWindow ( const String & name,
Colour backgroundColour,
bool addToDesktop )

Creates a ResizableWindow.

Parameters
namethe name to give the component
backgroundColourthe colour to use for filling the window's background.
addToDesktopif true, the window will be automatically added to the desktop; if false, you can use it as a child component

◆ ~ResizableWindow()

juce::ResizableWindow::~ResizableWindow ( )
override

Destructor. If a content component has been set with setContentOwned(), it will be deleted.

Member Function Documentation

◆ activeWindowStatusChanged()

void juce::ResizableWindow::activeWindowStatusChanged ( )
overrideprotectedvirtual

This callback happens when this window becomes active or inactive.

See also
isActiveWindow

Reimplemented from juce::TopLevelWindow.

◆ addToDesktop() [1/2]

void juce::TopLevelWindow::addToDesktop ( )

Adds the window to the desktop using the default flags.

◆ addToDesktop() [2/2]

void juce::TopLevelWindow::addToDesktop ( int windowStyleFlags,
void * nativeWindowToAttachTo = nullptr )
overridevirtual

Makes this component appear as a window on the desktop.

Note that before calling this, you should make sure that the component's opacity is set correctly using setOpaque(). If the component is non-opaque, the windowing system will try to create a special transparent window for it, which will generally take a lot more CPU to operate (and might not even be possible on some platforms).

If the component is inside a parent component at the time this method is called, it will first be removed from that parent. Likewise if a component is on the desktop and is subsequently added to another component, it'll be removed from the desktop.

Parameters
windowStyleFlagsa combination of the flags specified in the ComponentPeer::StyleFlags enum, which define the window's characteristics.
nativeWindowToAttachTothis allows an OS object to be passed-in as the window in which the juce component should place itself. On Windows, this would be a HWND, a HIViewRef on the Mac. Not necessarily supported on all platforms, and best left as 0 unless you know what you're doing.
See also
removeFromDesktop, isOnDesktop, userTriedToCloseWindow, getPeer, ComponentPeer::setMinimised, ComponentPeer::StyleFlags, ComponentPeer::getStyleFlags, ComponentPeer::setFullScreen

Reimplemented from juce::Component.

◆ childBoundsChanged()

void juce::ResizableWindow::childBoundsChanged ( Component * child)
overrideprotectedvirtual

Called when one of this component's children is moved or resized.

If the parent wants to know about changes to its immediate children (not to children of its children), this is the method to override.

See also
moved, resized, parentSizeChanged

Reimplemented from juce::Component.

◆ clearContentComponent()

void juce::ResizableWindow::clearContentComponent ( )

Removes the current content component. If the previous content component was added with setContentOwned(), it will also be deleted. If it was added with setContentNonOwned(), it will simply be removed from this component.

◆ getBackgroundColour()

Colour juce::ResizableWindow::getBackgroundColour ( ) const
noexcept

Returns the colour currently being used for the window's background.

As a convenience the window will fill itself with this colour, but you can override the paint() method if you need more customised behaviour.

This method is the same as retrieving the colour for ResizableWindow::backgroundColourId.

See also
setBackgroundColour

◆ getBorderThickness() [1/2]

BorderSize< int > juce::ResizableWindow::getBorderThickness ( )
virtual

Returns the width of the frame to use around the window.

See also
getContentComponentBorder

Reimplemented in juce::DocumentWindow.

◆ getBorderThickness() [2/2]

void juce::ResizableWindow::getBorderThickness ( int & left,
int & top,
int & right,
int & bottom )
protected

◆ getConstrainer()

ComponentBoundsConstrainer * juce::ResizableWindow::getConstrainer ( )
inlinenoexcept

Returns the bounds constrainer object that this window is using. You can access this to change its properties.

◆ getContentComponent()

Component * juce::ResizableWindow::getContentComponent ( ) const
inlinenoexcept

Returns the current content component.

This will be the component set by setContentOwned() or setContentNonOwned, or nullptr if none has yet been specified.

See also
setContentOwned, setContentNonOwned

◆ getContentComponentBorder() [1/2]

BorderSize< int > juce::ResizableWindow::getContentComponentBorder ( )
virtual

Returns the insets to use when positioning the content component.

See also
getBorderThickness

Reimplemented in juce::DocumentWindow.

◆ getContentComponentBorder() [2/2]

void juce::ResizableWindow::getContentComponentBorder ( int & left,
int & top,
int & right,
int & bottom )
protected

◆ getDesktopWindowStyleFlags()

int juce::ResizableWindow::getDesktopWindowStyleFlags ( ) const
overrideprotectedvirtual

Reimplemented from juce::TopLevelWindow.

◆ getWindowStateAsString()

String juce::ResizableWindow::getWindowStateAsString ( )

Returns a string which encodes the window's current size and position.

This string will encapsulate the window's size, position, and whether it's in full-screen mode. It's intended for letting your application save and restore a window's position.

Use the restoreWindowStateFromString() to restore from a saved state.

See also
restoreWindowStateFromString

◆ initialise()

void juce::ResizableWindow::initialise ( bool addToDesktop)
private

◆ isDraggable()

bool juce::ResizableWindow::isDraggable ( ) const
inlinenoexcept

Returns true if the window can be dragged around by the user.

◆ isFullScreen()

bool juce::ResizableWindow::isFullScreen ( ) const

Returns true if the window is currently in full-screen mode.

See also
setFullScreen

◆ isKioskMode()

bool juce::ResizableWindow::isKioskMode ( ) const

Returns true if the window has been placed in kiosk-mode.

See also
Desktop::setKioskComponent

◆ isMinimised()

bool juce::ResizableWindow::isMinimised ( ) const

Returns true if the window is currently minimised.

See also
setMinimised

◆ isResizable()

bool juce::ResizableWindow::isResizable ( ) const
noexcept

Returns true if resizing is enabled.

See also
setResizable

◆ lookAndFeelChanged()

void juce::ResizableWindow::lookAndFeelChanged ( )
overrideprotectedvirtual

Called to let the component react to a change in the look-and-feel setting.

When the look-and-feel is changed for a component, this will be called in all its child components, recursively.

It can also be triggered manually by the sendLookAndFeelChange() method, in case an application uses a LookAndFeel class that might have changed internally.

See also
sendLookAndFeelChange, getLookAndFeel

Reimplemented from juce::Component.

◆ mouseDown()

void juce::ResizableWindow::mouseDown ( const MouseEvent & event)
overrideprotectedvirtual

Called when a mouse button is pressed.

The MouseEvent object passed in contains lots of methods for finding out which button was pressed, as well as which modifier keys (e.g. shift, ctrl) were held down at the time.

Once a button is held down, the mouseDrag method will be called when the mouse moves, until the button is released.

Parameters
Eventdetails about the position and status of the mouse event, including the source component in which it occurred
See also
mouseUp, mouseDrag, mouseDoubleClick, contains

Reimplemented from juce::Component.

◆ mouseDrag()

void juce::ResizableWindow::mouseDrag ( const MouseEvent & event)
overrideprotectedvirtual

Called when the mouse is moved while a button is held down.

When a mouse button is pressed inside a component, that component receives mouseDrag callbacks each time the mouse moves, even if the mouse strays outside the component's bounds.

Parameters
Eventdetails about the position and status of the mouse event, including the source component in which it occurred
See also
mouseDown, mouseUp, mouseMove, contains, setDragRepeatInterval

Reimplemented from juce::Component.

◆ mouseUp()

void juce::ResizableWindow::mouseUp ( const MouseEvent & event)
overrideprotectedvirtual

Called when a mouse button is released.

A mouseUp callback is sent to the component in which a button was pressed even if the mouse is actually over a different component when the button is released.

The MouseEvent object passed in contains lots of methods for finding out which buttons were down just before they were released.

Parameters
Eventdetails about the position and status of the mouse event, including the source component in which it occurred
See also
mouseDown, mouseDrag, mouseDoubleClick, contains

Reimplemented from juce::Component.

◆ moved()

void juce::ResizableWindow::moved ( )
overrideprotectedvirtual

(if overriding this, make sure you call ResizableWindow::moved() in your subclass)

Reimplemented from juce::Component.

◆ paint()

void juce::ResizableWindow::paint ( Graphics & g)
overrideprotectedvirtual

Components can override this method to draw their content.

The paint() method gets called when a region of a component needs redrawing, either because the component's repaint() method has been called, or because something has happened on the screen that means a section of a window needs to be redrawn.

Any child components will draw themselves over whatever this method draws. If you need to paint over the top of your child components, you can also implement the paintOverChildren() method to do this.

If you want to cause a component to redraw itself, this is done asynchronously - calling the repaint() method marks a region of the component as "dirty", and the paint() method will automatically be called sometime later, by the message thread, to paint any bits that need refreshing. In JUCE (and almost all modern UI frameworks), you never redraw something synchronously.

You should never need to call this method directly - to take a snapshot of the component you could use createComponentSnapshot() or paintEntireComponent().

Parameters
gthe graphics context that must be used to do the drawing operations.
See also
repaint, paintOverChildren, Graphics

Reimplemented from juce::Component.

◆ parentSizeChanged()

void juce::ResizableWindow::parentSizeChanged ( )
overrideprotectedvirtual

Called when this component's immediate parent has been resized.

If the component is a top-level window, this indicates that the screen size has changed.

See also
childBoundsChanged, moved, resized

Reimplemented from juce::Component.

◆ resized()

void juce::ResizableWindow::resized ( )
overrideprotectedvirtual

(if overriding this, make sure you call ResizableWindow::resized() in your subclass)

Reimplemented from juce::Component.

◆ restoreWindowStateFromString()

bool juce::ResizableWindow::restoreWindowStateFromString ( const String & previousState)

Restores the window to a previously-saved size and position.

This restores the window's size, position and full-screen status from an string that was previously created with the getWindowStateAsString() method.

Returns
false if the string wasn't a valid window state
See also
getWindowStateAsString

◆ setBackgroundColour()

void juce::ResizableWindow::setBackgroundColour ( Colour newColour)

Changes the colour currently being used for the window's background.

As a convenience the window will fill itself with this colour, but you can override the paint() method if you need more customised behaviour.

Note that the opaque state of this window is altered by this call to reflect the opacity of the colour passed-in. On window systems which can't support semi-transparent windows this might cause problems, (though it's unlikely you'll be using this class as a base for a semi-transparent component anyway).

You can also use the ResizableWindow::backgroundColourId colour id to set this colour.

See also
getBackgroundColour

◆ setBoundsConstrained()

void juce::ResizableWindow::setBoundsConstrained ( const Rectangle< int > & newBounds)

Calls the window's setBounds method, after first checking these bounds with the current constrainer.

See also
setConstrainer

◆ setConstrainer()

void juce::ResizableWindow::setConstrainer ( ComponentBoundsConstrainer * newConstrainer)

Sets the bounds-constrainer object to use for resizing and dragging this window.

A pointer to the object you pass in will be kept, but it won't be deleted by this object, so it's the caller's responsibility to manage it.

If you pass a nullptr, then no constraints will be placed on the positioning of the window.

◆ setContent()

void juce::ResizableWindow::setContent ( Component * newContentComponent,
bool takeOwnership,
bool resizeToFit )
private

◆ setContentComponent()

void juce::ResizableWindow::setContentComponent ( Component * newContentComponent,
bool deleteOldOne = true,
bool resizeToFit = false )

◆ setContentComponentSize()

void juce::ResizableWindow::setContentComponentSize ( int width,
int height )

Changes the window so that the content component ends up with the specified size.

This is basically a setSize call on the window, but which adds on the borders, so you can specify the content component's target size.

◆ setContentNonOwned()

void juce::ResizableWindow::setContentNonOwned ( Component * newContentComponent,
bool resizeToFitWhenContentChangesSize )

Changes the current content component.

This sets a component that will be placed in the centre of the ResizableWindow, (leaving a space around the edge for the border).

You should never add components directly to a ResizableWindow (or any of its subclasses) with addChildComponent(). Instead, add them to the content component.

Parameters
newContentComponentthe new component to use - this component will NOT be deleted by this component, so it's the caller's responsibility to manage its lifetime (it's ok to delete it while this window is still using it). To set a content component that the window will delete, call setContentOwned() instead.
resizeToFitWhenContentChangesSizeif true, then the ResizableWindow will maintain its size such that it always fits around the size of the content component. If false, the new content will be resized to fit the current space available.

◆ setContentOwned()

void juce::ResizableWindow::setContentOwned ( Component * newContentComponent,
bool resizeToFitWhenContentChangesSize )

Changes the current content component.

This sets a component that will be placed in the centre of the ResizableWindow, (leaving a space around the edge for the border).

You should never add components directly to a ResizableWindow (or any of its subclasses) with addChildComponent(). Instead, add them to the content component.

Parameters
newContentComponentthe new component to use - this component will be deleted when it's no longer needed (i.e. when the window is deleted or a new content component is set for it). To set a component that this window will not delete, call setContentNonOwned() instead.
resizeToFitWhenContentChangesSizeif true, then the ResizableWindow will maintain its size such that it always fits around the size of the content component. If false, the new content will be resized to fit the current space available.

◆ setDraggable()

void juce::ResizableWindow::setDraggable ( bool shouldBeDraggable)
noexcept

Can be used to enable or disable user-dragging of the window.

◆ setFullScreen()

void juce::ResizableWindow::setFullScreen ( bool shouldBeFullScreen)

Puts the window into full-screen mode, or restores it to its normal size.

If true, the window will become full-screen; if false, it will return to the last size it was before being made full-screen.

See also
isFullScreen

◆ setMinimised()

void juce::ResizableWindow::setMinimised ( bool shouldMinimise)

Minimises the window, or restores it to its previous position and size.

When being un-minimised, it'll return to the last position and size it was in before being minimised.

See also
isMinimised

◆ setResizable()

void juce::ResizableWindow::setResizable ( bool shouldBeResizable,
bool useBottomRightCornerResizer )

Make the window resizable or fixed.

Parameters
shouldBeResizablewhether it's resizable at all
useBottomRightCornerResizerif true, it'll add a ResizableCornerComponent at the bottom-right; if false, it'll use a ResizableBorderComponent around the edge
See also
setResizeLimits, isResizable

◆ setResizeLimits()

void juce::ResizableWindow::setResizeLimits ( int newMinimumWidth,
int newMinimumHeight,
int newMaximumWidth,
int newMaximumHeight )
noexcept

This sets the maximum and minimum sizes for the window.

If the window's current size is outside these limits, it will be resized to make sure it's within them.

A direct call to setBounds() will bypass any constraint checks, but when the window is dragged by the user or resized by other indirect means, the constrainer will limit the numbers involved.

See also
setResizable, setFixedAspectRatio

◆ updateLastPosIfNotFullScreen()

void juce::ResizableWindow::updateLastPosIfNotFullScreen ( )
private

◆ updateLastPosIfShowing()

void juce::ResizableWindow::updateLastPosIfShowing ( )
private

◆ updatePeerConstrainer()

void juce::ResizableWindow::updatePeerConstrainer ( )
private

◆ visibilityChanged()

void juce::ResizableWindow::visibilityChanged ( )
overrideprotectedvirtual

Called when this component's visibility changes.

See also
setVisible, isVisible

Reimplemented from juce::Component.

Member Data Documentation

◆ canDrag

bool juce::ResizableWindow::canDrag = true
private

◆ constrainer

ComponentBoundsConstrainer* juce::ResizableWindow::constrainer = nullptr
private

◆ contentComponent

Component::SafePointer<Component> juce::ResizableWindow::contentComponent
private

◆ defaultConstrainer

ComponentBoundsConstrainer juce::ResizableWindow::defaultConstrainer
private

◆ dragger

ComponentDragger juce::ResizableWindow::dragger
private

◆ dragStarted

bool juce::ResizableWindow::dragStarted = false
private

◆ fullscreen

bool juce::ResizableWindow::fullscreen = false
private

◆ lastNonFullScreenPos

Rectangle<int> juce::ResizableWindow::lastNonFullScreenPos
private

◆ ownsContentComponent

bool juce::ResizableWindow::ownsContentComponent = false
private

◆ resizableBorder

std::unique_ptr<ResizableBorderComponent> juce::ResizableWindow::resizableBorder
protected

◆ resizableCorner

std::unique_ptr<ResizableCornerComponent> juce::ResizableWindow::resizableCorner
protected

◆ resizeToFitContent

bool juce::ResizableWindow::resizeToFitContent = false
private

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