JUCE  v5.1.1-3-g1a0b28c73
JUCE API
DialogWindow Class Reference

A dialog-box style window. More...

#include <juce_DialogWindow.h>

Inheritance diagram for DialogWindow:
Collaboration diagram for DialogWindow:

Classes

struct  LaunchOptions
 This class defines a collection of settings to be used to open a DialogWindow. More...
 

Public Types

enum  ColourIds { textColourId = 0x1005701 }
 A set of colour IDs to use to change the colour of various aspects of the window. More...
 
enum  FocusChangeType {
  focusChangedByMouseClick,
  focusChangedByTabKey,
  focusChangedDirectly
}
 Enumeration used by the focusChanged() and focusLost() methods. More...
 
enum  TitleBarButtons {
  minimiseButton = 1,
  maximiseButton = 2,
  closeButton = 4,
  allButtons = 7
}
 The set of available button-types that can be put on the title bar. More...
 

Public Member Functions

 DialogWindow (const String &name, Colour backgroundColour, bool escapeKeyTriggersCloseButton, bool addToDesktop=true)
 Creates a DialogWindow. More...
 
 ~DialogWindow ()
 Destructor. More...
 
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. More...
 
void addChildAndSetID (Component *child, const String &componentID)
 Adds a child component to this one, makes it visible, and sets its component ID. More...
 
void addChildComponent (Component &child, int zOrder=-1)
 Adds a child component to this one. More...
 
void addComponentListener (ComponentListener *newListener)
 Adds a listener to be told about changes to the component hierarchy or position. More...
 
void addKeyListener (KeyListener *newListener)
 Adds a listener that wants to hear about keypresses that this component receives. More...
 
void addMouseListener (MouseListener *newListener, bool wantsEventsForAllNestedChildComponents)
 Registers a listener to be told when mouse events occur in this component. More...
 
void addToDesktop ()
 Adds the window to the desktop using the default flags. More...
 
void addToDesktop (int windowStyleFlags, void *nativeWindowToAttachTo=nullptr) override
 
virtual void alphaChanged ()
 Called when setAlpha() is used to change the alpha value of this component. More...
 
virtual void broughtToFront ()
 Called when this component has been moved to the front of its siblings. More...
 
virtual bool canModalEventBeSentToComponent (const Component *targetComponent)
 When a component is modal, this callback allows it to choose which other components can still receive events. More...
 
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. More...
 
void centreWithSize (int width, int height)
 Changes the component's size and centres it within its parent. More...
 
virtual void childrenChanged ()
 Subclasses can use this callback to be told when children are added or removed, or when their z-order changes. More...
 
void clearContentComponent ()
 Removes the current content component. More...
 
virtual void closeButtonPressed ()
 This method is called when the user tries to close the window. More...
 
virtual void colourChanged ()
 This method is called when a colour is changed by the setColour() method. More...
 
bool contains (Point< int > localPoint)
 Returns true if a given point lies within this component or one of its children. More...
 
void copyAllExplicitColoursTo (Component &target) const
 This looks for any colours that have been specified for this component, and copies them to the specified target component. More...
 
Image createComponentSnapshot (Rectangle< int > areaToGrab, bool clipImageToComponentBounds=true, float scaleFactor=1.0f)
 Generates a snapshot of part of this component. More...
 
virtual KeyboardFocusTraversercreateFocusTraverser ()
 Creates a KeyboardFocusTraverser object to use to determine the logic by which focus should be passed from this component. More...
 
void deleteAllChildren ()
 Removes and deletes all of this component's children. More...
 
virtual void enablementChanged ()
 Callback to indicate that this component has been enabled or disabled. More...
 
void enterModalState (bool takeKeyboardFocus=true, ModalComponentManager::Callback *callback=nullptr, bool deleteWhenDismissed=false)
 Puts the component into a modal state. More...
 
virtual bool escapeKeyPressed ()
 Called when the escape key is pressed. More...
 
void exitModalState (int returnValue)
 Ends a component's modal state. More...
 
ComponentfindChildWithID (StringRef componentID) const noexcept
 Looks for a child component with the specified ID. More...
 
Colour findColour (int colourId, bool inheritFromParent=false) const
 Looks for a colour that has been registered with the given colour ID number. More...
 
template<class TargetClass >
TargetClass * findParentComponentOfClass () const
 Searches the parent components for a component of a specified class. More...
 
virtual void focusGained (FocusChangeType cause)
 Called to indicate that this component has just acquired the keyboard focus. More...
 
virtual void focusLost (FocusChangeType cause)
 Called to indicate that this component has just lost the keyboard focus. More...
 
float getAlpha () const noexcept
 Returns the component's current transparancy level. More...
 
Colour getBackgroundColour () const noexcept
 Returns the colour currently being used for the window's background. More...
 
virtual BorderSize< intgetBorderThickness ()
 Returns the width of the frame to use around the window. More...
 
int getBottom () const noexcept
 Returns the y coordinate of the bottom edge of this component. More...
 
Rectangle< intgetBounds () const noexcept
 Returns this component's bounding box. More...
 
Rectangle< intgetBoundsInParent () const noexcept
 Returns the area of this component's parent which this component covers. More...
 
CachedComponentImagegetCachedComponentImage () const noexcept
 Returns the object that was set by setCachedComponentImage(). More...
 
ComponentgetChildComponent (int index) const noexcept
 Returns one of this component's child components, by it index. More...
 
const Array< Component * > & getChildren () const noexcept
 Provides access to the underlying array of child components. More...
 
ButtongetCloseButton () const noexcept
 Returns the close button, (or nullptr if there isn't one). More...
 
ComponentgetComponentAt (int x, int y)
 Returns the component at a certain point within this one. More...
 
ComponentgetComponentAt (Point< int > position)
 Returns the component at a certain point within this one. More...
 
ImageEffectFiltergetComponentEffect () const noexcept
 Returns the current component effect. More...
 
const StringgetComponentID () const noexcept
 Returns the ID string that was set by setComponentID(). More...
 
ComponentBoundsConstrainergetConstrainer () noexcept
 Returns the bounds constrainer object that this window is using. More...
 
ComponentgetContentComponent () const noexcept
 Returns the current content component. More...
 
virtual BorderSize< intgetContentComponentBorder ()
 Returns the insets to use when positioning the content component. More...
 
virtual float getDesktopScaleFactor () const
 Returns the default scale factor to use for this component when it is placed on the desktop. More...
 
int getExplicitFocusOrder () const
 Returns the focus order of this component, if one has been specified. More...
 
int getHeight () const noexcept
 Returns the component's height in pixels. More...
 
int getIndexOfChildComponent (const Component *child) const noexcept
 Returns the index of this component in the list of child components. More...
 
void getInterceptsMouseClicks (bool &allowsClicksOnThisComponent, bool &allowsClicksOnChildComponents) const noexcept
 Retrieves the current state of the mouse-click interception flags. More...
 
Rectangle< intgetLocalArea (const Component *sourceComponent, Rectangle< int > areaRelativeToSourceComponent) const
 Converts a rectangle to be relative to this component's coordinate space. More...
 
Rectangle< intgetLocalBounds () const noexcept
 Returns the component's bounds, relative to its own origin. More...
 
Point< intgetLocalPoint (const Component *sourceComponent, Point< int > pointRelativeToSourceComponent) const
 Converts a point to be relative to this component's coordinate space. More...
 
Point< float > getLocalPoint (const Component *sourceComponent, Point< float > pointRelativeToSourceComponent) const
 Converts a point to be relative to this component's coordinate space. More...
 
LookAndFeelgetLookAndFeel () const noexcept
 Finds the appropriate look-and-feel to use for this component. More...
 
virtual MarkerListgetMarkers (bool xAxis)
 Components can implement this method to provide a MarkerList. More...
 
ButtongetMaximiseButton () const noexcept
 Returns the maximise button, (or nullptr if there isn't one). More...
 
ComponentgetMenuBarComponent () const noexcept
 Returns the current menu bar component, or null if there isn't one. More...
 
ButtongetMinimiseButton () const noexcept
 Returns the minimise button, (or nullptr if there isn't one). More...
 
bool getMouseClickGrabsKeyboardFocus () const noexcept
 Returns the last value set with setMouseClickGrabsKeyboardFocus(). More...
 
virtual MouseCursor getMouseCursor ()
 Returns the mouse cursor shape to use when the mouse is over this component. More...
 
Point< intgetMouseXYRelative () const
 Returns the mouse's current position, relative to this component. More...
 
const StringgetName () const noexcept
 Returns the name of this component. More...
 
int getNumChildComponents () const noexcept
 Returns the number of child components that this component contains. More...
 
ComponentgetParentComponent () const noexcept
 Returns the component which this component is inside. More...
 
int getParentHeight () const noexcept
 Returns the height of the component's parent. More...
 
Rectangle< intgetParentMonitorArea () const
 Returns the screen coordinates of the monitor that contains this component. More...
 
int getParentWidth () const noexcept
 Returns the width of the component's parent. More...
 
ComponentPeergetPeer () const
 Returns the heavyweight window that contains this component. More...
 
Point< intgetPosition () const noexcept
 Returns the component's top-left position as a Point. More...
 
PositionergetPositioner () const noexcept
 Returns the Positioner object that has been set for this component. More...
 
NamedValueSetgetProperties () noexcept
 Returns the set of properties that belong to this component. More...
 
const NamedValueSetgetProperties () const noexcept
 Returns the set of properties that belong to this component. More...
 
int getRight () const noexcept
 Returns the x coordinate of the component's right-hand edge. More...
 
Rectangle< intgetScreenBounds () const
 Returns the bounds of this component, relative to the screen's top-left. More...
 
Point< intgetScreenPosition () const
 Returns the position of this component's top-left corner relative to the screen's top-left. More...
 
int getScreenX () const
 Returns this component's x coordinate relative the screen's top-left origin. More...
 
int getScreenY () const
 Returns this component's y coordinate relative the screen's top-left origin. More...
 
int getTitleBarHeight () const
 Returns the current title bar height. More...
 
ComponentgetTopLevelComponent () const noexcept
 Returns the highest-level component which contains this one or its parents. More...
 
AffineTransform getTransform () const
 Returns the transform that is currently being applied to this component. More...
 
bool getViewportIgnoreDragFlag () const noexcept
 Retrieves the current state of the Viewport drag-to-scroll functionality flag. More...
 
bool getWantsKeyboardFocus () const noexcept
 Returns true if the component is interested in getting keyboard focus. More...
 
int getWidth () const noexcept
 Returns the component's width in pixels. More...
 
void * getWindowHandle () const
 Returns the underlying native window handle for this component. More...
 
String getWindowStateAsString ()
 Returns a string which encodes the window's current size and position. More...
 
int getX () const noexcept
 Returns the x coordinate of the component's left edge. More...
 
int getY () const noexcept
 Returns the y coordinate of the top of this component. More...
 
Point< intglobalPositionToRelative (Point< int >) const
 deprecated More...
 
void grabKeyboardFocus ()
 Tries to give keyboard focus to this component. More...
 
virtual void handleCommandMessage (int commandId)
 Called to handle a command that was sent by postCommandMessage(). More...
 
bool hasKeyboardFocus (bool trueIfChildIsFocused) const
 Returns true if this component currently has the keyboard focus. More...
 
virtual bool hitTest (int x, int y)
 Tests whether a given point is inside the component. More...
 
virtual void inputAttemptWhenModal ()
 Called when the user tries to click on a component that is blocked by another modal component. More...
 
bool isActiveWindow () const noexcept
 True if this is currently the TopLevelWindow that is actively being used. More...
 
bool isAlwaysOnTop () const noexcept
 Returns true if this component is set to always stay in front of its siblings. More...
 
bool isBroughtToFrontOnMouseClick () const noexcept
 Indicates whether the component should be brought to the front when clicked-on. More...
 
bool isColourSpecified (int colourId) const
 Returns true if the specified colour ID has been explicitly set for this component using the setColour() method. More...
 
bool isCurrentlyBlockedByAnotherModalComponent () const
 Checks whether there's a modal component somewhere that's stopping this one from receiving messages. More...
 
bool isCurrentlyModal (bool onlyConsiderForemostModalComponent=true) const noexcept
 Returns true if this component is the modal one. More...
 
bool isDraggable () const noexcept
 Returns true if the window can be dragged around by the user. More...
 
bool isDropShadowEnabled () const noexcept
 True if drop-shadowing is enabled. More...
 
bool isEnabled () const noexcept
 Returns true if the component (and all its parents) are enabled. More...
 
bool isFocusContainer () const noexcept
 Returns true if this component has been marked as a focus container. More...
 
bool isFullScreen () const
 Returns true if the window is currently in full-screen mode. More...
 
bool isKioskMode () const
 Returns true if the window has been placed in kiosk-mode. More...
 
bool isMinimised () const
 Returns true if the window is currently minimised. More...
 
bool isMouseButtonDown () const
 Returns true if the mouse button is currently held down in this component. More...
 
bool isMouseOver (bool includeChildren=false) const
 Returns true if the mouse is currently over this component. More...
 
bool isMouseOverOrDragging (bool includeChildren=false) const
 True if the mouse is over this component, or if it's being dragged in this component. More...
 
bool isOnDesktop () const noexcept
 Returns true if this component is currently showing on the desktop. More...
 
bool isOpaque () const noexcept
 Returns true if no parts of this component are transparent. More...
 
bool isParentOf (const Component *possibleChild) const noexcept
 Checks whether a component is anywhere inside this component or its children. More...
 
bool isResizable () const noexcept
 Returns true if resizing is enabled. More...
 
bool isShowing () const
 Tests whether this component and all its parents are visible. More...
 
bool isTransformed () const noexcept
 Returns true if a non-identity transform is being applied to this component. More...
 
bool isUsingNativeTitleBar () const noexcept
 Returns true if the window is currently using an OS-native title bar. More...
 
bool isVisible () const noexcept
 Tests whether the component is visible or not. More...
 
virtual bool keyStateChanged (bool isKeyDown)
 Called when a key is pressed or released. More...
 
Rectangle< intlocalAreaToGlobal (Rectangle< int > localArea) const
 Converts a rectangle from this component's coordinate space to a screen coordinate. More...
 
Point< intlocalPointToGlobal (Point< int > localPoint) const
 Converts a point relative to this component's top-left into a screen coordinate. More...
 
Point< float > localPointToGlobal (Point< float > localPoint) const
 Converts a point relative to this component's top-left into a screen coordinate. More...
 
virtual void maximiseButtonPressed ()
 Callback that is triggered when the maximise button is pressed, or when the title-bar is double-clicked. More...
 
virtual void minimisationStateChanged (bool isNowMinimised)
 Called for a desktop component which has just been minimised or un-minimised. More...
 
virtual void minimiseButtonPressed ()
 Callback that is triggered when the minimise button is pressed. More...
 
virtual void modifierKeysChanged (const ModifierKeys &modifiers)
 Called when a modifier key is pressed or released. More...
 
virtual void mouseDoubleClick (const MouseEvent &event) override
 Called when a mouse button has been double-clicked on a component. More...
 
virtual void mouseEnter (const MouseEvent &event) override
 Called when the mouse first enters a component. More...
 
virtual void mouseExit (const MouseEvent &event) override
 Called when the mouse moves out of a component. More...
 
virtual void mouseMagnify (const MouseEvent &event, float scaleFactor)
 Called when a pinch-to-zoom mouse-gesture is used. More...
 
virtual void mouseMove (const MouseEvent &event) override
 Called when the mouse moves inside a component. More...
 
virtual void mouseWheelMove (const MouseEvent &event, const MouseWheelDetails &wheel) override
 Called when the mouse-wheel is moved. More...
 
void moveKeyboardFocusToSibling (bool moveToNext)
 Tries to move the keyboard focus to one of this component's siblings. More...
 
void paintEntireComponent (Graphics &context, bool ignoreAlphaLevel)
 Draws this component and all its subcomponents onto the specified graphics context. More...
 
virtual void paintOverChildren (Graphics &g)
 Components can override this method to draw over the top of their children. More...
 
void postCommandMessage (int commandId)
 Dispatches a numbered message to this component. More...
 
int proportionOfHeight (float proportion) const noexcept
 Returns a proportion of the component's height. More...
 
int proportionOfWidth (float proportion) const noexcept
 Returns a proportion of the component's width. More...
 
bool reallyContains (Point< int > localPoint, bool returnTrueIfWithinAChild)
 Returns true if a given point lies in this component, taking any overlapping siblings into account. More...
 
Point< intrelativePositionToGlobal (Point< int >) const
 deprecated More...
 
Point< intrelativePositionToOtherComponent (const Component *, Point< int >) const
 deprecated More...
 
void removeAllChildren ()
 Removes all this component's children. More...
 
void removeChildComponent (Component *childToRemove)
 Removes one of this component's child-components. More...
 
ComponentremoveChildComponent (int childIndexToRemove)
 Removes one of this component's child-components by index. More...
 
void removeColour (int colourId)
 If a colour has been set with setColour(), this will remove it. More...
 
void removeComponentListener (ComponentListener *listenerToRemove)
 Removes a component listener. More...
 
void removeFromDesktop ()
 If the component is currently showing on the desktop, this will hide it. More...
 
void removeKeyListener (KeyListener *listenerToRemove)
 Removes a previously-registered key listener. More...
 
void removeMouseListener (MouseListener *listenerToRemove)
 Deregisters a mouse listener. More...
 
void repaint ()
 Marks the whole component as needing to be redrawn. More...
 
void repaint (int x, int y, int width, int height)
 Marks a subsection of this component as needing to be redrawn. More...
 
void repaint (Rectangle< int > area)
 Marks a subsection of this component as needing to be redrawn. More...
 
bool restoreWindowStateFromString (const String &previousState)
 Restores the window to a previously-saved size and position. More...
 
int runModalLoop ()
 Runs a component modally, waiting until the loop terminates. More...
 
void sendLookAndFeelChange ()
 Calls the lookAndFeelChanged() method in this component and all its children. More...
 
void setAlpha (float newAlpha)
 Changes the transparency of this component. More...
 
void setAlwaysOnTop (bool shouldStayOnTop)
 Sets whether the component should always be kept at the front of its siblings. More...
 
void setBackgroundColour (Colour newColour)
 Changes the colour currently being used for the window's background. More...
 
void setBounds (int x, int y, int width, int height)
 Changes the component's position and size. More...
 
void setBounds (Rectangle< int > newBounds)
 Changes the component's position and size. More...
 
void setBounds (const RelativeRectangle &)
 deprecated More...
 
void setBounds (const String &)
 deprecated More...
 
void setBoundsConstrained (const Rectangle< int > &newBounds)
 Calls the window's setBounds method, after first checking these bounds with the current constrainer. More...
 
void setBoundsInset (BorderSize< int > borders)
 Changes the component's position and size based on the amount of space to leave around it. More...
 
void setBoundsRelative (float proportionalX, float proportionalY, float proportionalWidth, float proportionalHeight)
 Changes the component's position and size in terms of fractions of its parent's size. More...
 
void setBoundsToFit (int x, int y, int width, int height, Justification justification, bool onlyReduceInSize)
 Positions the component within a given rectangle, keeping its proportions unchanged. More...
 
void setBroughtToFrontOnMouseClick (bool shouldBeBroughtToFront) noexcept
 Indicates whether the component should be brought to the front when clicked. More...
 
void setBufferedToImage (bool shouldBeBuffered)
 Makes the component use an internal buffer to optimise its redrawing. More...
 
void setCachedComponentImage (CachedComponentImage *newCachedImage)
 Gives the component a CachedComponentImage that should be used to buffer its painting. More...
 
void setCentrePosition (int x, int y)
 Changes the position of the component's centre. More...
 
void setCentrePosition (Point< int > newCentrePosition)
 Changes the position of the component's centre. More...
 
void setCentreRelative (float x, float y)
 Changes the position of the component's centre. More...
 
void setColour (int colourId, Colour newColour)
 Registers a colour to be used for a particular purpose. More...
 
void setComponentEffect (ImageEffectFilter *newEffect)
 Adds an effect filter to alter the component's appearance. More...
 
void setComponentID (const String &newID)
 Sets the component's ID string. More...
 
void setConstrainer (ComponentBoundsConstrainer *newConstrainer)
 Sets the bounds-constrainer object to use for resizing and dragging this window. More...
 
void setContentComponent (Component *newContentComponent, bool deleteOldOne=true, bool resizeToFit=false)
 deprecated More...
 
void setContentComponentSize (int width, int height)
 Changes the window so that the content component ends up with the specified size. More...
 
void setContentNonOwned (Component *newContentComponent, bool resizeToFitWhenContentChangesSize)
 Changes the current content component. More...
 
void setContentOwned (Component *newContentComponent, bool resizeToFitWhenContentChangesSize)
 Changes the current content component. More...
 
void setDraggable (bool shouldBeDraggable) noexcept
 Can be used to enable or disable user-dragging of the window. More...
 
void setDropShadowEnabled (bool useShadow)
 Turns the drop-shadow on and off. More...
 
void setEnabled (bool shouldBeEnabled)
 Enables or disables this component. More...
 
void setExplicitFocusOrder (int newFocusOrderIndex)
 Sets the index used in determining the order in which focusable components should be traversed. More...
 
void setFocusContainer (bool shouldBeFocusContainer) noexcept
 Indicates whether this component is a parent for components that can have their focus traversed. More...
 
void setFullScreen (bool shouldBeFullScreen)
 Puts the window into full-screen mode, or restores it to its normal size. More...
 
void setIcon (const Image &imageToUse)
 Sets an icon to show in the title bar, next to the title. More...
 
void setInterceptsMouseClicks (bool allowClicksOnThisComponent, bool allowClicksOnChildComponents) noexcept
 Changes the default return value for the hitTest() method. More...
 
void setLookAndFeel (LookAndFeel *newLookAndFeel)
 Sets the look and feel to use for this component. More...
 
void setMenuBar (MenuBarModel *menuBarModel, int menuBarHeight=0)
 Creates a menu inside this window. More...
 
void setMenuBarComponent (Component *newMenuBarComponent)
 Replaces the current menu bar with a custom component. More...
 
void setMinimised (bool shouldMinimise)
 Minimises the window, or restores it to its previous position and size. More...
 
void setMouseClickGrabsKeyboardFocus (bool shouldGrabFocus)
 Chooses whether a click on this component automatically grabs the focus. More...
 
void setMouseCursor (const MouseCursor &cursorType)
 Changes the mouse cursor shape to use when the mouse is over this component. More...
 
void setName (const String &newName) override
 Changes the component's name. More...
 
void setOpaque (bool shouldBeOpaque)
 Indicates whether any parts of the component might be transparent. More...
 
void setPaintingIsUnclipped (bool shouldPaintWithoutClipping) noexcept
 This allows you to indicate that this component doesn't require its graphics context to be clipped when it is being painted. More...
 
void setPositioner (Positioner *newPositioner)
 Sets a new Positioner object for this component. More...
 
void setRepaintsOnMouseActivity (bool shouldRepaint) noexcept
 Causes automatic repaints when the mouse enters or exits this component. More...
 
void setResizable (bool shouldBeResizable, bool useBottomRightCornerResizer)
 Make the window resizable or fixed. More...
 
void setResizeLimits (int newMinimumWidth, int newMinimumHeight, int newMaximumWidth, int newMaximumHeight) noexcept
 This sets the maximum and minimum sizes for the window. More...
 
void setSize (int newWidth, int newHeight)
 Changes the size of the component. More...
 
void setTitleBarButtonsRequired (int requiredButtons, bool positionTitleBarButtonsOnLeft)
 Changes the set of title-bar buttons being shown. More...
 
void setTitleBarHeight (int newHeight)
 Changes the height of the title-bar. More...
 
void setTitleBarTextCentred (bool textShouldBeCentred)
 Sets whether the title should be centred within the window. More...
 
void setTopLeftPosition (int x, int y)
 Moves the component to a new position. More...
 
void setTopLeftPosition (Point< int > newTopLeftPosition)
 Moves the component to a new position. More...
 
void setTopRightPosition (int x, int y)
 Moves the component to a new position. More...
 
void setTransform (const AffineTransform &transform)
 Sets a transform matrix to be applied to this component. More...
 
void setUsingNativeTitleBar (bool useNativeTitleBar)
 Sets whether an OS-native title bar will be used, or a Juce one. More...
 
void setViewportIgnoreDragFlag (bool ignoreDrag) noexcept
 Sets a flag to indicate whether mouse drag events on this Component should be ignored when it is inside a Viewport with drag-to-scroll functionality enabled. More...
 
virtual void setVisible (bool shouldBeVisible)
 Makes the component visible or invisible. More...
 
void setWantsKeyboardFocus (bool wantsFocus) noexcept
 Sets a flag to indicate whether this component needs keyboard focus or not. More...
 
void toBack ()
 Changes this component's z-order to be at the back of all its siblings. More...
 
void toBehind (Component *other)
 Changes this component's z-order so that it's just behind another component. More...
 
void toFront (bool shouldAlsoGainFocus)
 Brings the component to the front of its siblings. More...
 
void updateMouseCursor () const
 Forces the current mouse cursor to be updated. More...
 
virtual void userTriedToCloseWindow ()
 For components on the desktop, this is called if the system wants to close the window. More...
 

Static Public Member Functions

static void beginDragAutoRepeat (int millisecondsBetweenCallbacks)
 Ensures that a non-stop stream of mouse-drag events will be sent during the current mouse-drag operation. More...
 
static TopLevelWindowgetActiveTopLevelWindow () noexcept
 Returns the currently-active top level window. More...
 
static ComponentgetCurrentlyFocusedComponent () noexcept
 Returns the component that currently has the keyboard focus. More...
 
static ComponentgetCurrentlyModalComponent (int index=0) noexcept
 Returns one of the components that are currently modal. More...
 
static int getNumCurrentlyModalComponents () noexcept
 Returns the number of components that are currently in a modal state. More...
 
static int getNumTopLevelWindows () noexcept
 Returns the number of TopLevelWindow objects currently in use. More...
 
static TopLevelWindowgetTopLevelWindow (int index) noexcept
 Returns one of the TopLevelWindow objects currently in use. More...
 
static bool isMouseButtonDownAnywhere () noexcept
 Returns true if a mouse button is currently down. More...
 
static void showDialog (const String &dialogTitle, Component *contentComponent, Component *componentToCentreAround, Colour backgroundColour, bool escapeKeyTriggersCloseButton, bool shouldBeResizable=false, bool useBottomRightCornerResizer=false)
 Easy way of quickly showing a dialog box containing a given component. More...
 
static int showModalDialog (const String &dialogTitle, Component *contentComponent, Component *componentToCentreAround, Colour backgroundColour, bool escapeKeyTriggersCloseButton, bool shouldBeResizable=false, bool useBottomRightCornerResizer=false)
 Easy way of quickly showing a dialog box containing a given component. More...
 
static void unfocusAllComponents ()
 If any component has keyboard focus, this will defocus it. More...
 

Protected Member Functions

void activeWindowStatusChanged () override
 
void addAndMakeVisible (Component *, int zOrder=-1)
 Overridden to warn people about adding components directly to this component instead of using setContentOwned(). More...
 
void addChildComponent (Component *, int zOrder=-1)
 Overridden to warn people about adding components directly to this component instead of using setContentOwned(). More...
 
void childBoundsChanged (Component *) override
 
void focusOfChildComponentChanged (FocusChangeType) override
 
int getDesktopWindowStyleFlags () const override
 
bool keyPressed (const KeyPress &) override
 
void lookAndFeelChanged () override
 
void mouseDown (const MouseEvent &) override
 
void mouseDrag (const MouseEvent &) override
 
void mouseUp (const MouseEvent &) override
 
void moved () override
 (if overriding this, make sure you call ResizableWindow::moved() in your subclass) More...
 
void paint (Graphics &) override
 
void parentHierarchyChanged () override
 
void parentSizeChanged () override
 
void recreateDesktopWindow ()
 
void resized () override
 
void visibilityChanged () override
 

Protected Attributes

ScopedPointer< ResizableBorderComponentresizableBorder
 
ScopedPointer< ResizableCornerComponentresizableCorner
 

Private Attributes

bool escapeKeyTriggersCloseButton
 

Detailed Description

A dialog-box style window.

This class is a convenient way of creating a DocumentWindow with a close button that can be triggered by pressing the escape key.

Any of the methods available to a DocumentWindow or ResizableWindow are also available to this, so it can be made resizable, have a menu bar, etc.

You can either override or use an instance of the DialogWindow class directly, or you can use a DialogWindow::LaunchOptions structure to quickly set up and launch a box containing a content component.

If you use the class directly, you'll need to override the DocumentWindow::closeButtonPressed() method to handle the user clicking the close button - for more info, see the DocumentWindow help.

See also
DocumentWindow, ResizableWindow

Member Enumeration Documentation

◆ ColourIds

enum DocumentWindow::ColourIds
inherited

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
textColourId 

The colour to draw any text with.

It's up to the look and feel class how this is used.

◆ FocusChangeType

Enumeration used by the focusChanged() and focusLost() methods.

Enumerator
focusChangedByMouseClick 

Means that the user clicked the mouse to change focus.

focusChangedByTabKey 

Means that the user pressed the tab key to move the focus.

focusChangedDirectly 

Means that the focus was changed by a call to grabKeyboardFocus().

◆ TitleBarButtons

The set of available button-types that can be put on the title bar.

See also
setTitleBarButtonsRequired
Enumerator
minimiseButton 
maximiseButton 
closeButton 
allButtons 

A combination of all the buttons above.

Constructor & Destructor Documentation

◆ DialogWindow()

DialogWindow::DialogWindow ( const String name,
Colour  backgroundColour,
bool  escapeKeyTriggersCloseButton,
bool  addToDesktop = true 
)

Creates a DialogWindow.

Parameters
namethe name to give the component - this is also the title shown at the top of the window. To change this later, use setName()
backgroundColourthe colour to use for filling the window's background.
escapeKeyTriggersCloseButtonif true, then pressing the escape key will cause the close button to be triggered
addToDesktopif true, the window will be automatically added to the desktop; if false, you can use it as a child component

◆ ~DialogWindow()

DialogWindow::~DialogWindow ( )

Destructor.

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

Member Function Documentation

◆ activeWindowStatusChanged()

void ResizableWindow::activeWindowStatusChanged ( )
overrideprotectedvirtualinherited

Reimplemented from TopLevelWindow.

◆ addAndMakeVisible() [1/2]

void ResizableWindow::addAndMakeVisible ( Component ,
int  zOrder = -1 
)
protectedinherited

Overridden to warn people about adding components directly to this component instead of using setContentOwned().

If you know what you're doing and are sure you really want to add a component, specify a base-class method call to Component::addAndMakeVisible(), to side-step this warning.

◆ addAndMakeVisible() [2/2]

void Component::addAndMakeVisible ( Component child,
int  zOrder = -1 
)
inherited

Adds a child component to this one, and also makes the child visible if it isn't already.

This is the same as calling setVisible (true) on the child and then addChildComponent(). See addChildComponent() for more details.

◆ addChildAndSetID()

void Component::addChildAndSetID ( Component child,
const String componentID 
)
inherited

Adds a child component to this one, makes it visible, and sets its component ID.

See also
addAndMakeVisible, addChildComponent

◆ addChildComponent() [1/2]

void ResizableWindow::addChildComponent ( Component ,
int  zOrder = -1 
)
protectedinherited

Overridden to warn people about adding components directly to this component instead of using setContentOwned().

If you know what you're doing and are sure you really want to add a component, specify a base-class method call to Component::addAndMakeVisible(), to side-step this warning.

◆ addChildComponent() [2/2]

void Component::addChildComponent ( Component child,
int  zOrder = -1 
)
inherited

Adds a child component to this one.

Adding a child component does not mean that the component will own or delete the child - it's your responsibility to delete the component. Note that it's safe to delete a component without first removing it from its parent - doing so will automatically remove it and send out the appropriate notifications before the deletion completes.

If the child is already a child of this component, then no action will be taken, and its z-order will be left unchanged.

Parameters
childthe new component to add. If the component passed-in is already the child of another component, it'll first be removed from it current parent.
zOrderThe index in the child-list at which this component should be inserted. A value of -1 will insert it in front of the others, 0 is the back.
See also
removeChildComponent, addAndMakeVisible, addChildAndSetID, getChild, ComponentListener::componentChildrenChanged

◆ addComponentListener()

void Component::addComponentListener ( ComponentListener newListener)
inherited

Adds a listener to be told about changes to the component hierarchy or position.

Component listeners get called when this component's size, position or children change - see the ComponentListener class for more details.

Parameters
newListenerthe listener to register - if this is already registered, it will be ignored.
See also
ComponentListener, removeComponentListener

◆ addKeyListener()

void Component::addKeyListener ( KeyListener newListener)
inherited

Adds a listener that wants to hear about keypresses that this component receives.

The listeners that are registered with a component are called by its keyPressed() or keyStateChanged() methods (assuming these haven't been overridden to do something else).

If you add an object as a key listener, be careful to remove it when the object is deleted, or the component will be left with a dangling pointer.

See also
keyPressed, keyStateChanged, removeKeyListener

◆ addMouseListener()

void Component::addMouseListener ( MouseListener newListener,
bool  wantsEventsForAllNestedChildComponents 
)
inherited

Registers a listener to be told when mouse events occur in this component.

If you need to get informed about mouse events in a component but can't or don't want to override its methods, you can attach any number of listeners to the component, and these will get told about the events in addition to the component's own callbacks being called.

Note that a MouseListener can also be attached to more than one component.

Parameters
newListenerthe listener to register
wantsEventsForAllNestedChildComponentsif true, the listener will receive callbacks for events that happen to any child component within this component, including deeply-nested child components. If false, it will only be told about events that this component handles.
See also
MouseListener, removeMouseListener

◆ addToDesktop() [1/2]

void TopLevelWindow::addToDesktop ( )
inherited

Adds the window to the desktop using the default flags.

◆ addToDesktop() [2/2]

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

Reimplemented from Component.

◆ alphaChanged()

virtual void Component::alphaChanged ( )
virtualinherited

Called when setAlpha() is used to change the alpha value of this component.

If you override this, you should also invoke the base class's implementation during your overridden function, as it performs some repainting behaviour.

Reimplemented in NSViewComponent.

◆ beginDragAutoRepeat()

static void Component::beginDragAutoRepeat ( int  millisecondsBetweenCallbacks)
staticinherited

Ensures that a non-stop stream of mouse-drag events will be sent during the current mouse-drag operation.

This allows you to make sure that mouseDrag() events are sent continuously, even when the mouse isn't moving. This can be useful for things like auto-scrolling components when the mouse is near an edge.

Call this method during a mouseDown() or mouseDrag() callback, specifying the minimum interval between consecutive mouse drag callbacks. The callbacks will continue until the mouse is released, and then the interval will be reset, so you need to make sure it's called every time you begin a drag event. Passing an interval of 0 or less will cancel the auto-repeat.

See also
mouseDrag, Desktop::beginDragAutoRepeat

◆ broughtToFront()

virtual void Component::broughtToFront ( )
virtualinherited

Called when this component has been moved to the front of its siblings.

The component may have been brought to the front by the toFront() method, or by the operating system if it's a top-level window.

See also
toFront

Reimplemented in XEmbedComponent, and MultiDocumentPanelWindow.

◆ canModalEventBeSentToComponent()

virtual bool Component::canModalEventBeSentToComponent ( const Component targetComponent)
virtualinherited

When a component is modal, this callback allows it to choose which other components can still receive events.

When a modal component is active and the user clicks on a non-modal component, this method is called on the modal component, and if it returns true, the event is allowed to reach its target. If it returns false, the event is blocked and the inputAttemptWhenModal() callback is made.

It called by the isCurrentlyBlockedByAnotherModalComponent() method. The default implementation just returns false in all cases.

◆ centreAroundComponent()

void TopLevelWindow::centreAroundComponent ( Component componentToCentreAround,
int  width,
int  height 
)
inherited

This will set the bounds of the window so that it's centred in front of another window.

If your app has a few windows open and want to pop up a dialog box for one of them, you can use this to show it in front of the relevant parent window, which is a bit neater than just having it appear in the middle of the screen.

If componentToCentreAround is nullptr, then the currently active TopLevelWindow will be used instead. If no window is focused, it'll just default to the middle of the screen.

◆ centreWithSize()

void Component::centreWithSize ( int  width,
int  height 
)
inherited

Changes the component's size and centres it within its parent.

After changing the size, the component will be moved so that it's centred within its parent. If the component is on the desktop (or has no parent component), then it'll be centred within the main monitor area.

◆ childBoundsChanged()

void ResizableWindow::childBoundsChanged ( Component )
overrideprotectedvirtualinherited

Reimplemented from Component.

◆ childrenChanged()

virtual void Component::childrenChanged ( )
virtualinherited

Subclasses can use this callback to be told when children are added or removed, or when their z-order changes.

See also
parentHierarchyChanged, ComponentListener::componentChildrenChanged

Reimplemented in DrawableComposite.

◆ clearContentComponent()

void ResizableWindow::clearContentComponent ( )
inherited

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.

◆ closeButtonPressed()

virtual void DocumentWindow::closeButtonPressed ( )
virtualinherited

This method is called when the user tries to close the window.

This is triggered by the user clicking the close button, or using some other OS-specific key shortcut or OS menu for getting rid of a window.

If the window is just a pop-up, you should override this closeButtonPressed() method and make it delete the window in whatever way is appropriate for your app. E.g. you might just want to call "delete this".

If your app is centred around this window such that the whole app should quit when the window is closed, then you will probably want to use this method as an opportunity to call JUCEApplicationBase::quit(), and leave the window to be deleted later by your JUCEApplicationBase::shutdown() method. (Doing it this way means that your window will still get cleaned-up if the app is quit by some other means (e.g. a cmd-Q on the mac or closing it via the taskbar icon on Windows).

(Note that the DocumentWindow class overrides Component::userTriedToCloseWindow() and redirects it to call this method, so any methods of closing the window that are caught by userTriedToCloseWindow() will also end up here).

Reimplemented in StandaloneFilterWindow, and MultiDocumentPanelWindow.

◆ colourChanged()

virtual void Component::colourChanged ( )
virtualinherited

◆ contains()

bool Component::contains ( Point< int localPoint)
inherited

Returns true if a given point lies within this component or one of its children.

Never override this method! Use hitTest to create custom hit regions.

Parameters
localPointthe coordinate to test, relative to this component's top-left.
Returns
true if the point is within the component's hit-test area, but only if that part of the component isn't clipped by its parent component. Note that this won't take into account any overlapping sibling components which might be in the way - for that, see reallyContains()
See also
hitTest, reallyContains, getComponentAt

◆ copyAllExplicitColoursTo()

void Component::copyAllExplicitColoursTo ( Component target) const
inherited

This looks for any colours that have been specified for this component, and copies them to the specified target component.

◆ createComponentSnapshot()

Image Component::createComponentSnapshot ( Rectangle< int areaToGrab,
bool  clipImageToComponentBounds = true,
float  scaleFactor = 1.0f 
)
inherited

Generates a snapshot of part of this component.

This will return a new Image, the size of the rectangle specified, containing a snapshot of the specified area of the component and all its children.

The image may or may not have an alpha-channel, depending on whether the image is opaque or not.

If the clipImageToComponentBounds parameter is true and the area is greater than the size of the component, it'll be clipped. If clipImageToComponentBounds is false then parts of the component beyond its bounds can be drawn.

See also
paintEntireComponent

◆ createFocusTraverser()

virtual KeyboardFocusTraverser* Component::createFocusTraverser ( )
virtualinherited

Creates a KeyboardFocusTraverser object to use to determine the logic by which focus should be passed from this component.

The default implementation of this method will return a default KeyboardFocusTraverser if this component is a focus container (as determined by the setFocusContainer() method). If the component isn't a focus container, then it will recursively ask its parents for a KeyboardFocusTraverser.

If you overrride this to return a custom KeyboardFocusTraverser, then this component and all its sub-components will use the new object to make their focusing decisions.

The method should return a new object, which the caller is required to delete when no longer needed.

Reimplemented in Label, and FilenameComponent.

◆ deleteAllChildren()

void Component::deleteAllChildren ( )
inherited

Removes and deletes all of this component's children.

My advice is to avoid this method! It's an old function that is only kept here for backwards-compatibility with legacy code, and should be viewed with extreme suspicion by anyone attempting to write modern C++. In almost all cases, it's much smarter to manage the lifetimes of your child components via modern RAII techniques such as simply making them member variables, or using ScopedPointer, OwnedArray, etc to manage their lifetimes appropriately.

See also
removeAllChildren

◆ enablementChanged()

virtual void Component::enablementChanged ( )
virtualinherited

Callback to indicate that this component has been enabled or disabled.

This can be triggered by one of the component's parent components being enabled or disabled, as well as changes to the component itself.

The default implementation of this method does nothing; your class may wish to repaint itself or something when this happens.

See also
setEnabled, isEnabled

Reimplemented in Slider, TreeView, TextEditor, Button, ComboBox, Label, DrawableButton, PropertyComponent, GroupComponent, and ToolbarButton.

Referenced by PropertyComponent::setPreferredHeight().

◆ enterModalState()

void Component::enterModalState ( bool  takeKeyboardFocus = true,
ModalComponentManager::Callback callback = nullptr,
bool  deleteWhenDismissed = false 
)
inherited

Puts the component into a modal state.

This makes the component modal, so that messages are blocked from reaching any components other than this one and its children, but unlike runModalLoop(), this method returns immediately.

If takeKeyboardFocus is true, the component will use grabKeyboardFocus() to get the focus, which is usually what you'll want it to do. If not, it will leave the focus unchanged.

The callback is an optional object which will receive a callback when the modal component loses its modal status, either by being hidden or when exitModalState() is called. If you pass an object in here, the system will take care of deleting it later, after making the callback

If deleteWhenDismissed is true, then when it is dismissed, the component will be deleted and then the callback will be called. (This will safely handle the situation where the component is deleted before its exitModalState() method is called).

See also
exitModalState, runModalLoop, ModalComponentManager::attachCallback

◆ escapeKeyPressed()

virtual bool DialogWindow::escapeKeyPressed ( )
virtual

Called when the escape key is pressed.

This can be overridden to do things other than the default behaviour, which is to hide the window. Return true if the key has been used, or false if it was ignored.

◆ exitModalState()

void Component::exitModalState ( int  returnValue)
inherited

Ends a component's modal state.

If this component is currently modal, this will turn off its modalness, and return a value to the runModalLoop() method that might have be running its modal loop.

See also
runModalLoop, enterModalState, isCurrentlyModal

◆ findChildWithID()

Component* Component::findChildWithID ( StringRef  componentID) const
noexceptinherited

Looks for a child component with the specified ID.

See also
setComponentID, getComponentID

◆ findColour()

Colour Component::findColour ( int  colourId,
bool  inheritFromParent = false 
) const
inherited

Looks for a colour that has been registered with the given colour ID number.

If a colour has been set for this ID number using setColour(), then it is returned. If none has been set, the method will try calling the component's LookAndFeel class's findColour() method. If none has been registered with the look-and-feel either, it will just return black.

The colour IDs for various purposes are stored as enums in the components that they are relevant to - for an example, see Slider::ColourIds, Label::ColourIds, TextEditor::ColourIds, TreeView::ColourIds, etc.

See also
setColour, isColourSpecified, colourChanged, LookAndFeel::findColour, LookAndFeel::setColour

◆ findParentComponentOfClass()

template<class TargetClass >
TargetClass* Component::findParentComponentOfClass ( ) const
inlineinherited

Searches the parent components for a component of a specified class.

For example findParentComponentOfClass <MyComp>() would return the first parent component that can be dynamically cast to a MyComp, or will return nullptr if none of the parents are suitable.

◆ focusGained()

virtual void Component::focusGained ( FocusChangeType  cause)
virtualinherited

Called to indicate that this component has just acquired the keyboard focus.

See also
focusLost, setWantsKeyboardFocus, getCurrentlyFocusedComponent, hasKeyboardFocus

Reimplemented in TextEditor, Button, ComboBox, CodeEditorComponent, Label, WebBrowserComponent, and XEmbedComponent.

◆ focusLost()

virtual void Component::focusLost ( FocusChangeType  cause)
virtualinherited

Called to indicate that this component has just lost the keyboard focus.

See also
focusGained, setWantsKeyboardFocus, getCurrentlyFocusedComponent, hasKeyboardFocus

Reimplemented in TextEditor, Button, ComboBox, CodeEditorComponent, MidiKeyboardComponent, and XEmbedComponent.

Referenced by MidiKeyboardComponent::getOctaveForMiddleC().

◆ focusOfChildComponentChanged()

void TopLevelWindow::focusOfChildComponentChanged ( FocusChangeType  )
overrideprotectedvirtualinherited

Reimplemented from Component.

◆ getActiveTopLevelWindow()

static TopLevelWindow* TopLevelWindow::getActiveTopLevelWindow ( )
staticnoexceptinherited

Returns the currently-active top level window.

There might not be one, of course, so this can return nullptr.

◆ getAlpha()

float Component::getAlpha ( ) const
noexceptinherited

Returns the component's current transparancy level.

See setAlpha() for more details.

◆ getBackgroundColour()

Colour ResizableWindow::getBackgroundColour ( ) const
noexceptinherited

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

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

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

See also
getContentComponentBorder

◆ getBottom()

int Component::getBottom ( ) const
inlinenoexceptinherited

Returns the y coordinate of the bottom edge of this component.

This is a distance in pixels from the top edge of the component's parent.

Note that if you've used setTransform() to apply a transform, then the component's bounds will no longer be a direct reflection of the position at which it appears within its parent, as the transform will be applied to its bounding box.

◆ getBounds()

Rectangle<int> Component::getBounds ( ) const
inlinenoexceptinherited

Returns this component's bounding box.

The rectangle returned is relative to the top-left of the component's parent.

Note that if you've used setTransform() to apply a transform, then the component's bounds will no longer be a direct reflection of the position at which it appears within its parent, as the transform will be applied to its bounding box.

◆ getBoundsInParent()

Rectangle<int> Component::getBoundsInParent ( ) const
noexceptinherited

Returns the area of this component's parent which this component covers.

The returned area is relative to the parent's coordinate space. If the component has an affine transform specified, then the resulting area will be the smallest rectangle that fully covers the component's transformed bounding box. If this component has no parent, the return value will simply be the same as getBounds().

◆ getCachedComponentImage()

CachedComponentImage* Component::getCachedComponentImage ( ) const
inlinenoexceptinherited

Returns the object that was set by setCachedComponentImage().

See also
setCachedComponentImage

◆ getChildComponent()

Component* Component::getChildComponent ( int  index) const
noexceptinherited

Returns one of this component's child components, by it index.

The component with index 0 is at the back of the z-order, the one at the front will have index (getNumChildComponents() - 1).

If the index is out-of-range, this will return a null pointer.

See also
getChildren, getNumChildComponents, getIndexOfChildComponent

◆ getChildren()

const Array<Component*>& Component::getChildren ( ) const
inlinenoexceptinherited

Provides access to the underlying array of child components.

The most likely reason you may want to use this is for iteration in a range-based for loop.

Referenced by componentPeerAboutToChange().

◆ getCloseButton()

Button* DocumentWindow::getCloseButton ( ) const
noexceptinherited

Returns the close button, (or nullptr if there isn't one).

◆ getComponentAt() [1/2]

Component* Component::getComponentAt ( int  x,
int  y 
)
inherited

Returns the component at a certain point within this one.

Parameters
xthe x coordinate to test, relative to this component's left edge.
ythe y coordinate to test, relative to this component's top edge.
Returns
the component that is at this position - which may be 0, this component, or one of its children. Note that overlapping siblings that might actually be in the way are not taken into account by this method - to account for these, instead call getComponentAt on the top-level parent of this component.
See also
hitTest, contains, reallyContains

◆ getComponentAt() [2/2]

Component* Component::getComponentAt ( Point< int position)
inherited

Returns the component at a certain point within this one.

Parameters
positionthe coordinate to test, relative to this component's top-left.
Returns
the component that is at this position - which may be 0, this component, or one of its children. Note that overlapping siblings that might actually be in the way are not taken into account by this method - to account for these, instead call getComponentAt on the top-level parent of this component.
See also
hitTest, contains, reallyContains

◆ getComponentEffect()

◆ getComponentID()

const String& Component::getComponentID ( ) const
inlinenoexceptinherited

Returns the ID string that was set by setComponentID().

See also
setComponentID, findChildWithID

◆ getConstrainer()

ComponentBoundsConstrainer* ResizableWindow::getConstrainer ( )
inlinenoexceptinherited

Returns the bounds constrainer object that this window is using.

You can access this to change its properties.

◆ getContentComponent()

Component* ResizableWindow::getContentComponent ( ) const
inlinenoexceptinherited

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

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

Returns the insets to use when positioning the content component.

See also
getBorderThickness

◆ getCurrentlyFocusedComponent()

static Component* Component::getCurrentlyFocusedComponent ( )
staticnoexceptinherited

Returns the component that currently has the keyboard focus.

Returns
the focused component, or null if nothing is focused.

◆ getCurrentlyModalComponent()

static Component* Component::getCurrentlyModalComponent ( int  index = 0)
staticnoexceptinherited

Returns one of the components that are currently modal.

The index specifies which of the possible modal components to return. The order of the components in this list is the reverse of the order in which they became modal - so the component at index 0 is always the active component, and the others are progressively earlier ones that are themselves now blocked by later ones.

Returns
the modal component, or null if no components are modal (or if the index is out of range)
See also
getNumCurrentlyModalComponents, runModalLoop, isCurrentlyModal

◆ getDesktopScaleFactor()

virtual float Component::getDesktopScaleFactor ( ) const
virtualinherited

Returns the default scale factor to use for this component when it is placed on the desktop.

The default implementation of this method just returns the value from Desktop::getGlobalScaleFactor(), but it can be overridden if a particular component has different requirements. The method only used if this component is added to the desktop - it has no effect for child components.

Referenced by JuceGLView::layerClass, OpenGLContext::NativeContext::NativeContext(), and CarbonViewWrapperComponent::setEmbeddedWindowToOurSize().

◆ getDesktopWindowStyleFlags()

int ResizableWindow::getDesktopWindowStyleFlags ( ) const
overrideprotectedvirtualinherited

Reimplemented from TopLevelWindow.

◆ getExplicitFocusOrder()

int Component::getExplicitFocusOrder ( ) const
inherited

Returns the focus order of this component, if one has been specified.

By default components don't have a focus order - in that case, this will return 0. Lower numbers indicate that the component will be earlier in the focus traversal order.

To change the order, call setExplicitFocusOrder().

The focus order may be used by the KeyboardFocusTraverser class as part of its algorithm for deciding the order in which components should be traversed. See the KeyboardFocusTraverser class for more details on this.

See also
moveKeyboardFocusToSibling, createFocusTraverser, KeyboardFocusTraverser

◆ getHeight()

◆ getIndexOfChildComponent()

int Component::getIndexOfChildComponent ( const Component child) const
noexceptinherited

Returns the index of this component in the list of child components.

A value of 0 means it is first in the list (i.e. behind all other components). Higher values are further towards the front.

Returns -1 if the component passed-in is not a child of this component.

See also
getChildren, getNumChildComponents, getChildComponent, addChildComponent, toFront, toBack, toBehind

◆ getInterceptsMouseClicks()

void Component::getInterceptsMouseClicks ( bool &  allowsClicksOnThisComponent,
bool &  allowsClicksOnChildComponents 
) const
noexceptinherited

Retrieves the current state of the mouse-click interception flags.

On return, the two parameters are set to the state used in the last call to setInterceptsMouseClicks().

See also
setInterceptsMouseClicks

◆ getLocalArea()

Rectangle<int> Component::getLocalArea ( const Component sourceComponent,
Rectangle< int areaRelativeToSourceComponent 
) const
inherited

Converts a rectangle to be relative to this component's coordinate space.

This takes a rectangle that is relative to a different component, and returns its position relative to this component. If the sourceComponent parameter is null, the source rectangle is assumed to be a screen coordinate.

If you've used setTransform() to apply one or more transforms to components, then the source rectangle may not actually be rectanglular when converted to the target space, so in that situation this will return the smallest rectangle that fully contains the transformed area.

Referenced by OpenGLContext::NativeContext::NativeContext().

◆ getLocalBounds()

Rectangle<int> Component::getLocalBounds ( ) const
noexceptinherited

Returns the component's bounds, relative to its own origin.

This is like getBounds(), but returns the rectangle in local coordinates, In practice, it'll return a rectangle with position (0, 0), and the same size as this component.

Referenced by OpenGLContext::NativeContext::NativeContext().

◆ getLocalPoint() [1/2]

Point<int> Component::getLocalPoint ( const Component sourceComponent,
Point< int pointRelativeToSourceComponent 
) const
inherited

Converts a point to be relative to this component's coordinate space.

This takes a point relative to a different component, and returns its position relative to this component. If the sourceComponent parameter is null, the source point is assumed to be a global screen coordinate.

◆ getLocalPoint() [2/2]

Point<float> Component::getLocalPoint ( const Component sourceComponent,
Point< float >  pointRelativeToSourceComponent 
) const
inherited

Converts a point to be relative to this component's coordinate space.

This takes a point relative to a different component, and returns its position relative to this component. If the sourceComponent parameter is null, the source point is assumed to be a global screen coordinate.

◆ getLookAndFeel()

LookAndFeel& Component::getLookAndFeel ( ) const
noexceptinherited

Finds the appropriate look-and-feel to use for this component.

If the component hasn't had a look-and-feel explicitly set, this will return the parent's look-and-feel, or just the default one if there's no parent.

See also
setLookAndFeel, lookAndFeelChanged

Referenced by StandalonePluginHolder::showAudioSettingsDialog().

◆ getMarkers()

virtual MarkerList* Component::getMarkers ( bool  xAxis)
virtualinherited

Components can implement this method to provide a MarkerList.

The default implementation of this method returns nullptr, but you can override it to return a pointer to the component's marker list. If xAxis is true, it should return the X marker list; if false, it should return the Y markers.

Reimplemented in DrawableComposite.

◆ getMaximiseButton()

Button* DocumentWindow::getMaximiseButton ( ) const
noexceptinherited

Returns the maximise button, (or nullptr if there isn't one).

◆ getMenuBarComponent()

Component* DocumentWindow::getMenuBarComponent ( ) const
noexceptinherited

Returns the current menu bar component, or null if there isn't one.

This is probably a MenuBarComponent, unless a custom one has been set using setMenuBarComponent().

◆ getMinimiseButton()

Button* DocumentWindow::getMinimiseButton ( ) const
noexceptinherited

Returns the minimise button, (or nullptr if there isn't one).

◆ getMouseClickGrabsKeyboardFocus()

bool Component::getMouseClickGrabsKeyboardFocus ( ) const
noexceptinherited

Returns the last value set with setMouseClickGrabsKeyboardFocus().

See setMouseClickGrabsKeyboardFocus() for more info.

◆ getMouseCursor()

virtual MouseCursor Component::getMouseCursor ( )
virtualinherited

Returns the mouse cursor shape to use when the mouse is over this component.

The default implementation will return the cursor that was set by setCursor() but can be overridden for more specialised purposes, e.g. returning different cursors depending on the mouse position.

See also
MouseCursor

Reimplemented in TableHeaderComponent.

◆ getMouseXYRelative()

Point<int> Component::getMouseXYRelative ( ) const
inherited

Returns the mouse's current position, relative to this component.

The return value is relative to the component's top-left corner.

◆ getName()

const String& Component::getName ( ) const
inlinenoexceptinherited

Returns the name of this component.

See also
setName

References setName.

◆ getNumChildComponents()

int Component::getNumChildComponents ( ) const
noexceptinherited

Returns the number of child components that this component contains.

See also
getChildren, getChildComponent, getIndexOfChildComponent

◆ getNumCurrentlyModalComponents()

static int Component::getNumCurrentlyModalComponents ( )
staticnoexceptinherited

Returns the number of components that are currently in a modal state.

See also
getCurrentlyModalComponent

◆ getNumTopLevelWindows()

static int TopLevelWindow::getNumTopLevelWindows ( )
staticnoexceptinherited

Returns the number of TopLevelWindow objects currently in use.

See also
getTopLevelWindow

◆ getParentComponent()

Component* Component::getParentComponent ( ) const
inlinenoexceptinherited

Returns the component which this component is inside.

If this is the highest-level component or hasn't yet been added to a parent, this will return null.

Referenced by CarbonViewWrapperComponent::setOurSizeToEmbeddedViewSize().

◆ getParentHeight()

int Component::getParentHeight ( ) const
noexceptinherited

Returns the height of the component's parent.

If the component has no parent (i.e. if it's on the desktop), this will return the height of the screen.

◆ getParentMonitorArea()

Rectangle<int> Component::getParentMonitorArea ( ) const
inherited

Returns the screen coordinates of the monitor that contains this component.

If there's only one monitor, this will return its size - if there are multiple monitors, it will return the area of the monitor that contains the component's centre.

◆ getParentWidth()

int Component::getParentWidth ( ) const
noexceptinherited

Returns the width of the component's parent.

If the component has no parent (i.e. if it's on the desktop), this will return the width of the screen.

◆ getPeer()

ComponentPeer* Component::getPeer ( ) const
inherited

Returns the heavyweight window that contains this component.

If this component is itself on the desktop, this will return the window object that it is using. Otherwise, it will return the window of its top-level parent component.

This may return nullptr if there isn't a desktop component.

See also
addToDesktop, isOnDesktop

Referenced by VideoComponent::Pimpl::DirectShowContext::createNativeWindow(), JuceGLView::layerClass, OpenGLContext::NativeContext::NativeContext(), OpenGLContext::NativeContext::updateWindowPosition(), and OpenGLContext::NativeContext::~NativeContext().

◆ getPosition()

Point<int> Component::getPosition ( ) const
inlinenoexceptinherited

Returns the component's top-left position as a Point.

◆ getPositioner()

Positioner* Component::getPositioner ( ) const
noexceptinherited

Returns the Positioner object that has been set for this component.

See also
setPositioner()

◆ getProperties() [1/2]

NamedValueSet& Component::getProperties ( )
inlinenoexceptinherited

Returns the set of properties that belong to this component.

Each component has a NamedValueSet object which you can use to attach arbitrary items of data to it.

◆ getProperties() [2/2]

const NamedValueSet& Component::getProperties ( ) const
inlinenoexceptinherited

Returns the set of properties that belong to this component.

Each component has a NamedValueSet object which you can use to attach arbitrary items of data to it.

◆ getRight()

int Component::getRight ( ) const
inlinenoexceptinherited

Returns the x coordinate of the component's right-hand edge.

This is a distance in pixels from the left edge of the component's parent.

Note that if you've used setTransform() to apply a transform, then the component's bounds will no longer be a direct reflection of the position at which it appears within its parent, as the transform will be applied to its bounding box.

◆ getScreenBounds()

Rectangle<int> Component::getScreenBounds ( ) const
inherited

Returns the bounds of this component, relative to the screen's top-left.

See also
getScreenPosition

Referenced by CarbonViewWrapperComponent::setEmbeddedWindowToOurSize().

◆ getScreenPosition()

Point<int> Component::getScreenPosition ( ) const
inherited

Returns the position of this component's top-left corner relative to the screen's top-left.

See also
getScreenBounds

◆ getScreenX()

int Component::getScreenX ( ) const
inherited

Returns this component's x coordinate relative the screen's top-left origin.

See also
getX, localPointToGlobal

Referenced by CarbonViewWrapperComponent::createWindow().

◆ getScreenY()

int Component::getScreenY ( ) const
inherited

Returns this component's y coordinate relative the screen's top-left origin.

See also
getY, localPointToGlobal

Referenced by CarbonViewWrapperComponent::createWindow().

◆ getTitleBarHeight()

int DocumentWindow::getTitleBarHeight ( ) const
inherited

Returns the current title bar height.

◆ getTopLevelComponent()

Component* Component::getTopLevelComponent ( ) const
noexceptinherited

Returns the highest-level component which contains this one or its parents.

This will search upwards in the parent-hierarchy from this component, until it finds the highest one that doesn't have a parent (i.e. is on the desktop or not yet added to a parent), and will return that.

Referenced by CarbonViewWrapperComponent::carbonEventHandler(), CarbonViewWrapperComponent::componentMovedOrResized(), OpenGLContext::NativeContext::createNativeWindow(), VideoComponent::Pimpl::DirectShowContext::createNativeWindow(), OpenGLContext::NativeContext::NativeContext(), and CarbonViewWrapperComponent::setEmbeddedWindowToOurSize().

◆ getTopLevelWindow()

static TopLevelWindow* TopLevelWindow::getTopLevelWindow ( int  index)
staticnoexceptinherited

Returns one of the TopLevelWindow objects currently in use.

The index is 0 to (getNumTopLevelWindows() - 1).

◆ getTransform()

AffineTransform Component::getTransform ( ) const
inherited

Returns the transform that is currently being applied to this component.

For more details about transforms, see setTransform().

See also
setTransform

◆ getViewportIgnoreDragFlag()

bool Component::getViewportIgnoreDragFlag ( ) const
inlinenoexceptinherited

Retrieves the current state of the Viewport drag-to-scroll functionality flag.

See also
setViewportIgnoreDragFlag

References JUCE_DEPRECATED.

◆ getWantsKeyboardFocus()

bool Component::getWantsKeyboardFocus ( ) const
noexceptinherited

Returns true if the component is interested in getting keyboard focus.

This returns the flag set by setWantsKeyboardFocus(). The default setting is false.

See also
setWantsKeyboardFocus

◆ getWidth()

◆ getWindowHandle()

void* Component::getWindowHandle ( ) const
inherited

Returns the underlying native window handle for this component.

This is platform-dependent and strictly for power-users only!

Referenced by CarbonViewWrapperComponent::getOwnerWindow().

◆ getWindowStateAsString()

String ResizableWindow::getWindowStateAsString ( )
inherited

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

◆ getX()

int Component::getX ( ) const
inlinenoexceptinherited

Returns the x coordinate of the component's left edge.

This is a distance in pixels from the left edge of the component's parent.

Note that if you've used setTransform() to apply a transform, then the component's bounds will no longer be a direct reflection of the position at which it appears within its parent, as the transform will be applied to its bounding box.

◆ getY()

int Component::getY ( ) const
inlinenoexceptinherited

Returns the y coordinate of the top of this component.

This is a distance in pixels from the top edge of the component's parent.

Note that if you've used setTransform() to apply a transform, then the component's bounds will no longer be a direct reflection of the position at which it appears within its parent, as the transform will be applied to its bounding box.

◆ globalPositionToRelative()

Point<int> Component::globalPositionToRelative ( Point< int ) const
inherited

deprecated

◆ grabKeyboardFocus()

void Component::grabKeyboardFocus ( )
inherited

Tries to give keyboard focus to this component.

When the user clicks on a component or its grabKeyboardFocus() method is called, the following procedure is used to work out which component should get it:

  • if the component that was clicked on actually wants focus (as indicated by calling getWantsKeyboardFocus), it gets it.
  • if the component itself doesn't want focus, it will try to pass it on to whichever of its children is the default component, as determined by KeyboardFocusTraverser::getDefaultComponent()
  • if none of its children want focus at all, it will pass it up to its parent instead, unless it's a top-level component without a parent, in which case it just takes the focus itself.

Important note! It's obviously not possible for a component to be focused unless it's actually visible, on-screen, and inside a window that is also visible. So there's no point trying to call this in the component's own constructor or before all of its parent hierarchy has been fully instantiated.

See also
setWantsKeyboardFocus, getWantsKeyboardFocus, hasKeyboardFocus, getCurrentlyFocusedComponent, focusGained, focusLost, keyPressed, keyStateChanged

◆ handleCommandMessage()

virtual void Component::handleCommandMessage ( int  commandId)
virtualinherited

Called to handle a command that was sent by postCommandMessage().

This is called by the message thread when a command message arrives, and the component can override this method to process it in any way it needs to.

See also
postCommandMessage

Reimplemented in TextEditor, Button, CallOutBox, OpenGLContext::NativeContext::DummyComponent, MenuBarComponent, and OpenGLContext::NativeContext::DummyComponent.

◆ hasKeyboardFocus()

bool Component::hasKeyboardFocus ( bool  trueIfChildIsFocused) const
inherited

Returns true if this component currently has the keyboard focus.

Parameters
trueIfChildIsFocusedif this is true, then the method returns true if either this component or any of its children (recursively) have the focus. If false, the method only returns true if this component has the focus.
See also
grabKeyboardFocus, setWantsKeyboardFocus, getCurrentlyFocusedComponent, focusGained, focusLost

◆ hitTest()

virtual bool Component::hitTest ( int  x,
int  y 
)
virtualinherited

Tests whether a given point is inside the component.

Overriding this method allows you to create components which only intercept mouse-clicks within a user-defined area.

This is called to find out whether a particular x, y coordinate is considered to be inside the component or not, and is used by methods such as contains() and getComponentAt() to work out which component the mouse is clicked on.

Components with custom shapes will probably want to override it to perform some more complex hit-testing.

The default implementation of this method returns either true or false, depending on the value that was set by calling setInterceptsMouseClicks() (true is the default return value).

Note that the hit-test region is not related to the opacity with which areas of a component are painted.

Applications should never call hitTest() directly - instead use the contains() method, because this will also test for occlusion by the component's parent.

Note that for components on the desktop, this method will be ignored, because it's not always possible to implement this behaviour on all platforms.

Parameters
xthe x coordinate to test, relative to the left hand edge of this component. This value is guaranteed to be greater than or equal to zero, and less than the component's width
ythe y coordinate to test, relative to the top edge of this component. This value is guaranteed to be greater than or equal to zero, and less than the component's height
Returns
true if the click is considered to be inside the component
See also
setInterceptsMouseClicks, contains

Reimplemented in LassoComponent< SelectableItemType >, ResizableBorderComponent, CallOutBox, DrawableShape, ImageButton, TabBarButton, DrawableImage, ResizableCornerComponent, and JUCESplashScreen.

Referenced by DrawableImage::getBoundingBox(), and TabBarButton::getExtraComponentPlacement().

◆ inputAttemptWhenModal()

virtual void Component::inputAttemptWhenModal ( )
virtualinherited

Called when the user tries to click on a component that is blocked by another modal component.

When a component is modal and the user clicks on one of the other components, the modal component will receive this callback.

The default implementation of this method will play a beep, and bring the currently modal component to the front, but it can be overridden to do other tasks.

See also
isCurrentlyBlockedByAnotherModalComponent, canModalEventBeSentToComponent

Reimplemented in Label, and CallOutBox.

◆ isActiveWindow()

bool TopLevelWindow::isActiveWindow ( ) const
inlinenoexceptinherited

True if this is currently the TopLevelWindow that is actively being used.

This isn't quite the same as having keyboard focus, because the focus may be on a child component or a temporary pop-up menu, etc, while this window is still considered to be active.

See also
activeWindowStatusChanged

◆ isAlwaysOnTop()

bool Component::isAlwaysOnTop ( ) const
noexceptinherited

Returns true if this component is set to always stay in front of its siblings.

See also
setAlwaysOnTop

◆ isBroughtToFrontOnMouseClick()

bool Component::isBroughtToFrontOnMouseClick ( ) const
noexceptinherited

Indicates whether the component should be brought to the front when clicked-on.

See also
setBroughtToFrontOnMouseClick

◆ isColourSpecified()

bool Component::isColourSpecified ( int  colourId) const
inherited

Returns true if the specified colour ID has been explicitly set for this component using the setColour() method.

◆ isCurrentlyBlockedByAnotherModalComponent()

bool Component::isCurrentlyBlockedByAnotherModalComponent ( ) const
inherited

Checks whether there's a modal component somewhere that's stopping this one from receiving messages.

If there is a modal component, its canModalEventBeSentToComponent() method will be called to see if it will still allow this component to receive events.

See also
runModalLoop, getCurrentlyModalComponent

◆ isCurrentlyModal()

bool Component::isCurrentlyModal ( bool  onlyConsiderForemostModalComponent = true) const
noexceptinherited

Returns true if this component is the modal one.

It's possible to have nested modal components, e.g. a pop-up dialog box that launches another pop-up. If onlyConsiderForemostModalComponent is true then isCurrentlyModal will only return true for the one at the top of the stack. If onlyConsiderForemostModalComponent is false then isCurrentlyModal will return true for any modal component in the stack.

See also
getCurrentlyModalComponent

◆ isDraggable()

bool ResizableWindow::isDraggable ( ) const
inlinenoexceptinherited

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

◆ isDropShadowEnabled()

bool TopLevelWindow::isDropShadowEnabled ( ) const
inlinenoexceptinherited

◆ isEnabled()

bool Component::isEnabled ( ) const
noexceptinherited

Returns true if the component (and all its parents) are enabled.

Components are enabled by default, and can be disabled with setEnabled(). Exactly what difference this makes to the component depends on the type. E.g. buttons and sliders will choose to draw themselves differently, etc.

Note that if one of this component's parents is disabled, this will always return false, even if this component itself is enabled.

See also
setEnabled, enablementChanged

◆ isFocusContainer()

bool Component::isFocusContainer ( ) const
noexceptinherited

Returns true if this component has been marked as a focus container.

See setFocusContainer() for more details.

See also
setFocusContainer, moveKeyboardFocusToSibling, createFocusTraverser

◆ isFullScreen()

bool ResizableWindow::isFullScreen ( ) const
inherited

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

See also
setFullScreen

◆ isKioskMode()

bool ResizableWindow::isKioskMode ( ) const
inherited

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

See also
Desktop::setKioskComponent

◆ isMinimised()

bool ResizableWindow::isMinimised ( ) const
inherited

Returns true if the window is currently minimised.

See also
setMinimised

◆ isMouseButtonDown()

bool Component::isMouseButtonDown ( ) const
inherited

Returns true if the mouse button is currently held down in this component.

Note that this is a test to see whether the mouse is being pressed in this component, so it'll return false if called on component A when the mouse is actually being dragged in component B.

See also
isMouseButtonDownAnywhere, isMouseOver, isMouseOverOrDragging

◆ isMouseButtonDownAnywhere()

static bool Component::isMouseButtonDownAnywhere ( )
staticnoexceptinherited

Returns true if a mouse button is currently down.

Unlike isMouseButtonDown, this will test the current state of the buttons without regard to which component (if any) it has been pressed in.

See also
isMouseButtonDown, ModifierKeys

◆ isMouseOver()

bool Component::isMouseOver ( bool  includeChildren = false) const
inherited

Returns true if the mouse is currently over this component.

If the mouse isn't over the component, this will return false, even if the mouse is currently being dragged - so you can use this in your mouseDrag method to find out whether it's really over the component or not.

Note that when the mouse button is being held down, then the only component for which this method will return true is the one that was originally clicked on.

If includeChildren is true, then this will also return true if the mouse is over any of the component's children (recursively) as well as the component itself.

See also
isMouseButtonDown. isMouseOverOrDragging, mouseDrag

◆ isMouseOverOrDragging()

bool Component::isMouseOverOrDragging ( bool  includeChildren = false) const
inherited

True if the mouse is over this component, or if it's being dragged in this component.

This is a handy equivalent to (isMouseOver() || isMouseButtonDown()).

See also
isMouseOver, isMouseButtonDown, isMouseButtonDownAnywhere

◆ isOnDesktop()

bool Component::isOnDesktop ( ) const
noexceptinherited

Returns true if this component is currently showing on the desktop.

See also
addToDesktop, removeFromDesktop

◆ isOpaque()

bool Component::isOpaque ( ) const
noexceptinherited

Returns true if no parts of this component are transparent.

Returns
the value that was set by setOpaque, (the default being false)
See also
setOpaque

◆ isParentOf()

bool Component::isParentOf ( const Component possibleChild) const
noexceptinherited

Checks whether a component is anywhere inside this component or its children.

This will recursively check through this component's children to see if the given component is anywhere inside.

◆ isResizable()

bool ResizableWindow::isResizable ( ) const
noexceptinherited

Returns true if resizing is enabled.

See also
setResizable

◆ isShowing()

bool Component::isShowing ( ) const
inherited

Tests whether this component and all its parents are visible.

Returns
true only if this component and all its parents are visible.
See also
isVisible

Referenced by CarbonViewWrapperComponent::componentVisibilityChanged(), and CarbonViewWrapperComponent::timerCallback().

◆ isTransformed()

bool Component::isTransformed ( ) const
noexceptinherited

Returns true if a non-identity transform is being applied to this component.

For more details about transforms, see setTransform().

See also
setTransform

◆ isUsingNativeTitleBar()

bool TopLevelWindow::isUsingNativeTitleBar ( ) const
noexceptinherited

Returns true if the window is currently using an OS-native title bar.

See also
setUsingNativeTitleBar

◆ isVisible()

bool Component::isVisible ( ) const
inlinenoexceptinherited

Tests whether the component is visible or not.

this doesn't necessarily tell you whether this comp is actually on the screen because this depends on whether all the parent components are also visible - use isShowing() to find this out.

See also
isShowing, setVisible

◆ keyPressed()

bool DialogWindow::keyPressed ( const KeyPress )
overrideprotectedvirtual

Reimplemented from Component.

◆ keyStateChanged()

virtual bool Component::keyStateChanged ( bool  isKeyDown)
virtualinherited

Called when a key is pressed or released.

Whenever a key on the keyboard is pressed or released (including modifier keys like shift and ctrl), this method will be called on the component that currently has the keyboard focus. Remember that a component will only be given the focus if its setWantsKeyboardFocus() method has been used to enable this.

If your implementation returns true, the event will be consumed and not passed on to any other listeners. If it returns false, then any KeyListeners that have been registered with this component will have their keyStateChanged methods called. As soon as one of these returns true, the process will stop, but if they all return false, the event will be passed upwards to this component's parent, and so on.

The default implementation of this method does nothing and returns false.

To find out which keys are up or down at any time, see the KeyPress::isKeyCurrentlyDown() method.

Parameters
isKeyDowntrue if a key has been pressed; false if it has been released
See also
keyPressed, KeyPress, getCurrentlyFocusedComponent, addKeyListener

Reimplemented in TextEditor, ListBox, ComboBox, and MidiKeyboardComponent.

Referenced by ListBox::getHeaderComponent(), MidiKeyboardComponent::getOctaveForMiddleC(), and Button::LookAndFeelMethods::~LookAndFeelMethods().

◆ localAreaToGlobal()

Rectangle<int> Component::localAreaToGlobal ( Rectangle< int localArea) const
inherited

Converts a rectangle from this component's coordinate space to a screen coordinate.

If you've used setTransform() to apply one or more transforms to components, then the source rectangle may not actually be rectanglular when converted to the target space, so in that situation this will return the smallest rectangle that fully contains the transformed area.

See also
getLocalPoint, localPointToGlobal

◆ localPointToGlobal() [1/2]

Point<int> Component::localPointToGlobal ( Point< int localPoint) const
inherited

Converts a point relative to this component's top-left into a screen coordinate.

See also
getLocalPoint, localAreaToGlobal

◆ localPointToGlobal() [2/2]

Point<float> Component::localPointToGlobal ( Point< float >  localPoint) const
inherited

Converts a point relative to this component's top-left into a screen coordinate.

See also
getLocalPoint, localAreaToGlobal

◆ lookAndFeelChanged()

void ResizableWindow::lookAndFeelChanged ( )
overrideprotectedvirtualinherited

Reimplemented from Component.

◆ maximiseButtonPressed()

virtual void DocumentWindow::maximiseButtonPressed ( )
virtualinherited

Callback that is triggered when the maximise button is pressed, or when the title-bar is double-clicked.

The default implementation of this calls ResizableWindow::setFullScreen(), but you can override it to do more customised behaviour.

Reimplemented in MultiDocumentPanelWindow.

◆ minimisationStateChanged()

virtual void Component::minimisationStateChanged ( bool  isNowMinimised)
virtualinherited

Called for a desktop component which has just been minimised or un-minimised.

This will only be called for components on the desktop.

See also
getPeer, ComponentPeer::setMinimised, ComponentPeer::isMinimised

◆ minimiseButtonPressed()

virtual void DocumentWindow::minimiseButtonPressed ( )
virtualinherited

Callback that is triggered when the minimise button is pressed.

The default implementation of this calls ResizableWindow::setMinimised(), but you can override it to do more customised behaviour.

◆ modifierKeysChanged()

virtual void Component::modifierKeysChanged ( const ModifierKeys modifiers)
virtualinherited

Called when a modifier key is pressed or released.

Whenever the shift, control, alt or command keys are pressed or released, this method will be called on the component that currently has the keyboard focus. Remember that a component will only be given the focus if its setWantsKeyboardFocus() method has been used to enable this.

The default implementation of this method actually calls its parent's modifierKeysChanged method, so that focused components which aren't interested in this will give their parents a chance to act on the event instead.

See also
keyStateChanged, ModifierKeys

Reimplemented in Slider.

◆ mouseDoubleClick()

virtual void Component::mouseDoubleClick ( const MouseEvent event)
overridevirtualinherited

Called when a mouse button has been double-clicked on a component.

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.

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

Reimplemented from MouseListener.

Reimplemented in Slider, TextEditor, CodeEditorComponent, and Label.

◆ mouseDown()

void ResizableWindow::mouseDown ( const MouseEvent )
overrideprotectedvirtualinherited

Reimplemented from Component.

◆ mouseDrag()

void ResizableWindow::mouseDrag ( const MouseEvent )
overrideprotectedvirtualinherited

Reimplemented from Component.

◆ mouseEnter()

virtual void Component::mouseEnter ( const MouseEvent event)
overridevirtualinherited

Called when the mouse first enters a component.

If the mouse button isn't pressed and the mouse moves into a component, this will be called to let the component react to this.

When the mouse button is pressed and held down while being moved in or out of a component, no mouseEnter or mouseExit callbacks are made - only mouseDrag messages are sent to the component that the mouse was originally clicked on, 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
mouseExit, mouseDrag, mouseMove, contains

Reimplemented from MouseListener.

Reimplemented in Button, TableHeaderComponent, MidiKeyboardComponent, ResizableBorderComponent, TooltipWindow, and MenuBarComponent.

Referenced by MidiKeyboardComponent::getOctaveForMiddleC().

◆ mouseExit()

virtual void Component::mouseExit ( const MouseEvent event)
overridevirtualinherited

Called when the mouse moves out of a component.

This will be called when the mouse moves off the edge of this component.

If the mouse button was pressed, and it was then dragged off the edge of the component and released, then this callback will happen when the button is released, after the mouseUp callback.

Parameters
eventdetails about the position and status of the mouse event, including the source component in which it occurred
See also
mouseEnter, mouseDrag, mouseMove, contains

Reimplemented from MouseListener.

Reimplemented in Button, TableHeaderComponent, MidiKeyboardComponent, and MenuBarComponent.

Referenced by MidiKeyboardComponent::getOctaveForMiddleC().

◆ mouseMagnify()

virtual void Component::mouseMagnify ( const MouseEvent event,
float  scaleFactor 
)
virtualinherited

Called when a pinch-to-zoom mouse-gesture is used.

If not overridden, a component will forward this message to its parent, so that parent components can collect gesture messages that are unused by child components.

Parameters
eventdetails about the mouse event
scaleFactora multiplier to indicate by how much the size of the target should be changed. A value of 1.0 would indicate no change, values greater than 1.0 mean it should be enlarged.

◆ mouseMove()

virtual void Component::mouseMove ( const MouseEvent event)
overridevirtualinherited

Called when the mouse moves inside a component.

If the mouse button isn't pressed and the mouse moves over a component, this will be called to let the component react to this.

A component will always get a mouseEnter callback before a mouseMove.

Parameters
eventdetails about the position and status of the mouse event, including the source component in which it occurred
See also
mouseEnter, mouseExit, mouseDrag, contains

Reimplemented from MouseListener.

Reimplemented in TableHeaderComponent, MidiKeyboardComponent, ResizableBorderComponent, and MenuBarComponent.

Referenced by MidiKeyboardComponent::getOctaveForMiddleC().

◆ mouseUp()

void ResizableWindow::mouseUp ( const MouseEvent )
overrideprotectedvirtualinherited

Reimplemented from Component.

◆ mouseWheelMove()

virtual void Component::mouseWheelMove ( const MouseEvent event,
const MouseWheelDetails wheel 
)
overridevirtualinherited

Called when the mouse-wheel is moved.

This callback is sent to the component that the mouse is over when the wheel is moved.

If not overridden, a component will forward this message to its parent, so that parent components can collect mouse-wheel messages that happen to child components which aren't interested in them. (Bear in mind that if you attach a component as a mouse-listener to other components, then those wheel moves will also end up calling this method and being passed up to the parents, which may not be what you intended to happen).

Parameters
eventdetails about the mouse event
wheeldetails about the mouse wheel movement

Reimplemented from MouseListener.

Reimplemented in Slider, TextEditor, ListBox, ComboBox, ScrollBar, CodeEditorComponent, MidiKeyboardComponent, and Viewport.

Referenced by ListBox::getHeaderComponent(), Viewport::getHorizontalScrollBar(), and MidiKeyboardComponent::getOctaveForMiddleC().

◆ moved()

void ResizableWindow::moved ( )
overrideprotectedvirtualinherited

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

Reimplemented from Component.

◆ moveKeyboardFocusToSibling()

void Component::moveKeyboardFocusToSibling ( bool  moveToNext)
inherited

Tries to move the keyboard focus to one of this component's siblings.

This will try to move focus to either the next or previous component. (This is the method that is used when shifting focus by pressing the tab key).

Components for which getWantsKeyboardFocus() returns false are not looked at.

Parameters
moveToNextif true, the focus will move forwards; if false, it will move backwards
See also
grabKeyboardFocus, setFocusContainer, setWantsKeyboardFocus

◆ paint()

void ResizableWindow::paint ( Graphics )
overrideprotectedvirtualinherited

Reimplemented from Component.

◆ paintEntireComponent()

void Component::paintEntireComponent ( Graphics context,
bool  ignoreAlphaLevel 
)
inherited

Draws this component and all its subcomponents onto the specified graphics context.

You should very rarely have to use this method, it's simply there in case you need to draw a component with a custom graphics context for some reason, e.g. for creating a snapshot of the component.

It calls paint(), paintOverChildren() and recursively calls paintEntireComponent() on its children in order to render the entire tree.

The graphics context may be left in an undefined state after this method returns, so you may need to reset it if you're going to use it again.

If ignoreAlphaLevel is false, then the component will be drawn with the opacity level specified by getAlpha(); if ignoreAlphaLevel is true, then this will be ignored and an alpha of 1.0 will be used.

◆ paintOverChildren()

virtual void Component::paintOverChildren ( Graphics g)
virtualinherited

Components can override this method to draw over the top of their children.

For most drawing operations, it's better to use the normal paint() method, but if you need to overlay something on top of the children, this can be used.

See also
paint, Graphics

Reimplemented in TextEditor, ListBox, and FilenameComponent.

Referenced by ListBox::getHeaderComponent().

◆ parentHierarchyChanged()

void TopLevelWindow::parentHierarchyChanged ( )
overrideprotectedvirtualinherited

Reimplemented from Component.

◆ parentSizeChanged()

void ResizableWindow::parentSizeChanged ( )
overrideprotectedvirtualinherited

Reimplemented from Component.

◆ postCommandMessage()

void Component::postCommandMessage ( int  commandId)
inherited

Dispatches a numbered message to this component.

This is a quick and cheap way of allowing simple asynchronous messages to be sent to components. It's also safe, because if the component that you send the message to is a null or dangling pointer, this won't cause an error.

The command ID is later delivered to the component's handleCommandMessage() method by the application's message queue.

See also
handleCommandMessage

◆ proportionOfHeight()

int Component::proportionOfHeight ( float  proportion) const
noexceptinherited

Returns a proportion of the component's height.

This is a handy equivalent of (getHeight() * proportion).

◆ proportionOfWidth()

int Component::proportionOfWidth ( float  proportion) const
noexceptinherited

Returns a proportion of the component's width.

This is a handy equivalent of (getWidth() * proportion).

◆ reallyContains()

bool Component::reallyContains ( Point< int localPoint,
bool  returnTrueIfWithinAChild 
)
inherited

Returns true if a given point lies in this component, taking any overlapping siblings into account.

Parameters
localPointthe coordinate to test, relative to this component's top-left.
returnTrueIfWithinAChildif the point actually lies within a child of this component, this determines whether that is counted as a hit.
See also
contains, getComponentAt

◆ recreateDesktopWindow()

void TopLevelWindow::recreateDesktopWindow ( )
protectedinherited

◆ relativePositionToGlobal()

Point<int> Component::relativePositionToGlobal ( Point< int ) const
inherited

deprecated

◆ relativePositionToOtherComponent()

Point<int> Component::relativePositionToOtherComponent ( const Component ,
Point< int  
) const
inherited

deprecated

◆ removeAllChildren()

void Component::removeAllChildren ( )
inherited

Removes all this component's children.

Note that this won't delete them! To do that, use deleteAllChildren() instead.

◆ removeChildComponent() [1/2]

void Component::removeChildComponent ( Component childToRemove)
inherited

Removes one of this component's child-components.

If the child passed-in isn't actually a child of this component (either because it's invalid or is the child of a different parent), then no action is taken.

Note that removing a child will not delete it! But it's ok to delete a component without first removing it - doing so will automatically remove it and send out the appropriate notifications before the deletion completes.

See also
addChildComponent, ComponentListener::componentChildrenChanged

◆ removeChildComponent() [2/2]

Component* Component::removeChildComponent ( int  childIndexToRemove)
inherited

Removes one of this component's child-components by index.

This will return a pointer to the component that was removed, or null if the index was out-of-range.

Note that removing a child will not delete it! But it's ok to delete a component without first removing it - doing so will automatically remove it and send out the appropriate notifications before the deletion completes.

See also
addChildComponent, ComponentListener::componentChildrenChanged

◆ removeColour()

void Component::removeColour ( int  colourId)
inherited

If a colour has been set with setColour(), this will remove it.

This allows you to make a colour revert to its default state.

◆ removeComponentListener()

void Component::removeComponentListener ( ComponentListener listenerToRemove)
inherited

Removes a component listener.

See also
addComponentListener

◆ removeFromDesktop()

void Component::removeFromDesktop ( )
inherited

If the component is currently showing on the desktop, this will hide it.

You can also use setVisible() to hide a desktop window temporarily, but removeFromDesktop() will free any system resources that are being used up.

See also
addToDesktop, isOnDesktop

◆ removeKeyListener()

void Component::removeKeyListener ( KeyListener listenerToRemove)
inherited

Removes a previously-registered key listener.

See also
addKeyListener

◆ removeMouseListener()

void Component::removeMouseListener ( MouseListener listenerToRemove)
inherited

Deregisters a mouse listener.

See also
addMouseListener, MouseListener

◆ repaint() [1/3]

void Component::repaint ( )
inherited

Marks the whole component as needing to be redrawn.

Calling this will not do any repainting immediately, but will mark the component as 'dirty'. At some point in the near future the operating system will send a paint message, which will redraw all the dirty regions of all components. There's no guarantee about how soon after calling repaint() the redraw will actually happen, and other queued events may be delivered before a redraw is done.

If the setBufferedToImage() method has been used to cause this component to use a buffer, the repaint() call will invalidate the cached buffer. If setCachedComponentImage() has been used to provide a custom image cache, that cache will be invalidated appropriately.

To redraw just a subsection of the component rather than the whole thing, use the repaint (int, int, int, int) method.

See also
paint

Referenced by OpenGLContext::NativeContext::NativeContext().

◆ repaint() [2/3]

void Component::repaint ( int  x,
int  y,
int  width,
int  height 
)
inherited

Marks a subsection of this component as needing to be redrawn.

Calling this will not do any repainting immediately, but will mark the given region of the component as 'dirty'. At some point in the near future the operating system will send a paint message, which will redraw all the dirty regions of all components. There's no guarantee about how soon after calling repaint() the redraw will actually happen, and other queued events may be delivered before a redraw is done.

The region that is passed in will be clipped to keep it within the bounds of this component.

See also
repaint()

◆ repaint() [3/3]

void Component::repaint ( Rectangle< int area)
inherited

Marks a subsection of this component as needing to be redrawn.

Calling this will not do any repainting immediately, but will mark the given region of the component as 'dirty'. At some point in the near future the operating system will send a paint message, which will redraw all the dirty regions of all components. There's no guarantee about how soon after calling repaint() the redraw will actually happen, and other queued events may be delivered before a redraw is done.

The region that is passed in will be clipped to keep it within the bounds of this component.

See also
repaint()

◆ resized()

void DialogWindow::resized ( )
overrideprotectedvirtual

Reimplemented from Component.

◆ restoreWindowStateFromString()

bool ResizableWindow::restoreWindowStateFromString ( const String previousState)
inherited

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

◆ runModalLoop()

int Component::runModalLoop ( )
inherited

Runs a component modally, waiting until the loop terminates.

This method first makes the component visible, brings it to the front and gives it the keyboard focus.

It then runs a loop, dispatching messages from the system message queue, but blocking all mouse or keyboard messages from reaching any components other than this one and its children.

This loop continues until the component's exitModalState() method is called (or the component is deleted), and then this method returns, returning the value passed into exitModalState().

Note that you SHOULD NEVER USE THIS METHOD! Modal loops are a dangerous construct because things that happen during the events that they dispatch could affect the state of objects which are currently in use somewhere on the stack, so when the loop finishes and the stack unwinds, horrible problems can occur. This is especially bad in plugins, where the host may choose to delete the plugin during runModalLoop(), so that when it returns, the entire DLL could have been unloaded from memory! Also, some OSes deliberately make it impossible to run modal loops (e.g. Android), so this method won't even exist on some platforms.

See also
enterModalState, exitModalState, isCurrentlyModal, getCurrentlyModalComponent, isCurrentlyBlockedByAnotherModalComponent, ModalComponentManager

◆ sendLookAndFeelChange()

void Component::sendLookAndFeelChange ( )
inherited

Calls the lookAndFeelChanged() method in this component and all its children.

This will recurse through the children and their children, calling lookAndFeelChanged() on them all.

See also
lookAndFeelChanged

◆ setAlpha()

void Component::setAlpha ( float  newAlpha)
inherited

Changes the transparency of this component.

When painted, the entire component and all its children will be rendered with this as the overall opacity level, where 0 is completely invisible, and 1.0 is fully opaque (i.e. normal).

See also
getAlpha, alphaChanged

◆ setAlwaysOnTop()

void Component::setAlwaysOnTop ( bool  shouldStayOnTop)
inherited

Sets whether the component should always be kept at the front of its siblings.

See also
isAlwaysOnTop

◆ setBackgroundColour()

void ResizableWindow::setBackgroundColour ( Colour  newColour)
inherited

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

◆ setBounds() [1/4]

void Component::setBounds ( int  x,
int  y,
int  width,
int  height 
)
inherited

Changes the component's position and size.

The coordinates are relative to the top-left of the component's parent, or relative to the origin of the screen if the component is on the desktop.

If this method changes the component's top-left position, it will make a synchronous call to moved(). If it changes the size, it will also make a call to resized().

Note that if you've used setTransform() to apply a transform, then the component's bounds will no longer be a direct reflection of the position at which it appears within its parent, as the transform will be applied to whatever bounds you set for it.

See also
setTopLeftPosition, setSize, ComponentListener::componentMovedOrResized

◆ setBounds() [2/4]

void Component::setBounds ( Rectangle< int newBounds)
inherited

Changes the component's position and size.

The coordinates are relative to the top-left of the component's parent, or relative to the origin of the screen if the component is on the desktop.

If this method changes the component's top-left position, it will make a synchronous call to moved(). If it changes the size, it will also make a call to resized().

Note that if you've used setTransform() to apply a transform, then the component's bounds will no longer be a direct reflection of the position at which it appears within its parent, as the transform will be applied to whatever bounds you set for it.

See also
setBounds

◆ setBounds() [3/4]

void Component::setBounds ( const RelativeRectangle )
inherited

deprecated

◆ setBounds() [4/4]

void Component::setBounds ( const String )
inherited

deprecated

◆ setBoundsConstrained()

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

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

See also
setConstrainer

◆ setBoundsInset()

void Component::setBoundsInset ( BorderSize< int borders)
inherited

Changes the component's position and size based on the amount of space to leave around it.

This will position the component within its parent, leaving the specified number of pixels around each edge.

See also
setBounds

◆ setBoundsRelative()

void Component::setBoundsRelative ( float  proportionalX,
float  proportionalY,
float  proportionalWidth,
float  proportionalHeight 
)
inherited

Changes the component's position and size in terms of fractions of its parent's size.

The values are factors of the parent's size, so for example setBoundsRelative (0.2f, 0.2f, 0.5f, 0.5f) would give it half the width and height of the parent, with its top-left position 20% of the way across and down the parent.

See also
setBounds

◆ setBoundsToFit()

void Component::setBoundsToFit ( int  x,
int  y,
int  width,
int  height,
Justification  justification,
bool  onlyReduceInSize 
)
inherited

Positions the component within a given rectangle, keeping its proportions unchanged.

If onlyReduceInSize is false, the component will be resized to fill as much of the rectangle as possible without changing its aspect ratio (the component's current size is used to determine its aspect ratio, so a zero-size component won't work here). If onlyReduceInSize is true, it will only be resized if it's too big to fit inside the rectangle.

It will then be positioned within the rectangle according to the justification flags specified.

See also
setBounds

◆ setBroughtToFrontOnMouseClick()

void Component::setBroughtToFrontOnMouseClick ( bool  shouldBeBroughtToFront)
noexceptinherited

Indicates whether the component should be brought to the front when clicked.

Setting this flag to true will cause the component to be brought to the front when the mouse is clicked somewhere inside it or its child components.

Note that a top-level desktop window might still be brought to the front by the operating system when it's clicked, depending on how the OS works.

By default this is set to false.

See also
setMouseClickGrabsKeyboardFocus

◆ setBufferedToImage()

void Component::setBufferedToImage ( bool  shouldBeBuffered)
inherited

Makes the component use an internal buffer to optimise its redrawing.

Setting this flag to true will cause the component to allocate an internal buffer into which it paints itself and all its child components, so that when asked to redraw itself, it can use this buffer rather than actually calling the paint() method.

Parts of the buffer are invalidated when repaint() is called on this component or its children. The buffer is then repainted at the next paint() callback.

See also
repaint, paint, createComponentSnapshot

◆ setCachedComponentImage()

void Component::setCachedComponentImage ( CachedComponentImage newCachedImage)
inherited

Gives the component a CachedComponentImage that should be used to buffer its painting.

The object that is passed-in will be owned by this component, and will be deleted automatically later on.

See also
setBufferedToImage

◆ setCentrePosition() [1/2]

void Component::setCentrePosition ( int  x,
int  y 
)
inherited

Changes the position of the component's centre.

Leaves the component's size unchanged, but sets the position of its centre relative to its parent's top-left.

See also
setBounds

◆ setCentrePosition() [2/2]

void Component::setCentrePosition ( Point< int newCentrePosition)
inherited

Changes the position of the component's centre.

Leaves the component's size unchanged, but sets the position of its centre relative to its parent's top-left.

See also
setBounds

◆ setCentreRelative()

void Component::setCentreRelative ( float  x,
float  y 
)
inherited

Changes the position of the component's centre.

Leaves the size unchanged, but positions its centre relative to its parent's size. E.g. setCentreRelative (0.5f, 0.5f) would place it centrally in its parent.

◆ setColour()

void Component::setColour ( int  colourId,
Colour  newColour 
)
inherited

Registers a colour to be used for a particular purpose.

Changing a colour will cause a synchronous callback to the colourChanged() method, which your component can override if it needs to do something when colours are altered.

For more details about colour IDs, see the comments for findColour().

See also
findColour, isColourSpecified, colourChanged, LookAndFeel::findColour, LookAndFeel::setColour

Referenced by DrawableText::getText().

◆ setComponentEffect()

void Component::setComponentEffect ( ImageEffectFilter newEffect)
inherited

Adds an effect filter to alter the component's appearance.

When a component has an effect filter set, then this is applied to the results of its paint() method. There are a few preset effects, such as a drop-shadow or glow, but they can be user-defined as well.

The effect that is passed in will not be deleted by the component - the caller must take care of deleting it.

To remove an effect from a component, pass a null pointer in as the parameter.

See also
ImageEffectFilter, DropShadowEffect, GlowEffect

◆ setComponentID()

void Component::setComponentID ( const String newID)
inherited

Sets the component's ID string.

You can retrieve the ID using getComponentID().

See also
getComponentID, findChildWithID

◆ setConstrainer()

void ResizableWindow::setConstrainer ( ComponentBoundsConstrainer newConstrainer)
inherited

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 contraints will be placed on the positioning of the window.

◆ setContentComponent()

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

deprecated

◆ setContentComponentSize()

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

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 ResizableWindow::setContentNonOwned ( Component newContentComponent,
bool  resizeToFitWhenContentChangesSize 
)
inherited

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 ResizableWindow::setContentOwned ( Component newContentComponent,
bool  resizeToFitWhenContentChangesSize 
)
inherited

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 ResizableWindow::setDraggable ( bool  shouldBeDraggable)
noexceptinherited

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

◆ setDropShadowEnabled()

void TopLevelWindow::setDropShadowEnabled ( bool  useShadow)
inherited

Turns the drop-shadow on and off.

◆ setEnabled()

void Component::setEnabled ( bool  shouldBeEnabled)
inherited

Enables or disables this component.

Disabling a component will also cause all of its child components to become disabled.

Similarly, enabling a component which is inside a disabled parent component won't make any difference until the parent is re-enabled.

See also
isEnabled, enablementChanged

◆ setExplicitFocusOrder()

void Component::setExplicitFocusOrder ( int  newFocusOrderIndex)
inherited

Sets the index used in determining the order in which focusable components should be traversed.

A value of 0 or less is taken to mean that no explicit order is wanted, and that traversal should use other factors, like the component's position.

See also
getExplicitFocusOrder, moveKeyboardFocusToSibling

◆ setFocusContainer()

void Component::setFocusContainer ( bool  shouldBeFocusContainer)
noexceptinherited

Indicates whether this component is a parent for components that can have their focus traversed.

This flag is used by the default implementation of the createFocusTraverser() method, which uses the flag to find the first parent component (of the currently focused one) which wants to be a focus container.

So using this method to set the flag to 'true' causes this component to act as the top level within which focus is passed around.

See also
isFocusContainer, createFocusTraverser, moveKeyboardFocusToSibling

◆ setFullScreen()

void ResizableWindow::setFullScreen ( bool  shouldBeFullScreen)
inherited

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

◆ setIcon()

void DocumentWindow::setIcon ( const Image imageToUse)
inherited

Sets an icon to show in the title bar, next to the title.

A copy is made internally of the image, so the caller can delete the image after calling this. If 0 is passed-in, any existing icon will be removed.

◆ setInterceptsMouseClicks()

void Component::setInterceptsMouseClicks ( bool  allowClicksOnThisComponent,
bool  allowClicksOnChildComponents 
)
noexceptinherited

Changes the default return value for the hitTest() method.

Setting this to false is an easy way to make a component pass its mouse-clicks through to the components behind it.

When a component is created, the default setting for this is true.

Parameters
allowClicksOnThisComponentif true, hitTest() will always return true; if false, it will return false (or true for child components if allowClicksOnChildComponents is true)
allowClicksOnChildComponentsif this is true and allowClicksOnThisComponent is false, then child components can be clicked on as normal but clicks on this component pass straight through; if this is false and allowClicksOnThisComponent is false, then neither this component nor any child components can be clicked on
See also
hitTest, getInterceptsMouseClicks

◆ setLookAndFeel()

void Component::setLookAndFeel ( LookAndFeel newLookAndFeel)
inherited

Sets the look and feel to use for this component.

This will also change the look and feel for any child components that haven't had their look set explicitly.

The object passed in will not be deleted by the component, so it's the caller's responsibility to manage it. It may be used at any time until this component has been deleted.

Calling this method will also invoke the sendLookAndFeelChange() method.

See also
getLookAndFeel, lookAndFeelChanged

◆ setMenuBar()

void DocumentWindow::setMenuBar ( MenuBarModel menuBarModel,
int  menuBarHeight = 0 
)
inherited

Creates a menu inside this window.

Parameters
menuBarModelthis specifies a MenuBarModel that should be used to generate the contents of a menu bar that will be placed just below the title bar, and just above any content component. If this value is a nullptr, any existing menu bar will be removed from the component; if it is not a nullptr, one will be added if it's required.
menuBarHeightthe height of the menu bar component, if one is needed. Pass a value of zero or less to use the look-and-feel's default size.

◆ setMenuBarComponent()

void DocumentWindow::setMenuBarComponent ( Component newMenuBarComponent)
inherited

Replaces the current menu bar with a custom component.

The component will be owned and deleted by the document window.

◆ setMinimised()

void ResizableWindow::setMinimised ( bool  shouldMinimise)
inherited

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

◆ setMouseClickGrabsKeyboardFocus()

void Component::setMouseClickGrabsKeyboardFocus ( bool  shouldGrabFocus)
inherited

Chooses whether a click on this component automatically grabs the focus.

By default this is set to true, but you might want a component which can be focused, but where you don't want the user to be able to affect it directly by clicking.

◆ setMouseCursor()

void Component::setMouseCursor ( const MouseCursor cursorType)
inherited

Changes the mouse cursor shape to use when the mouse is over this component.

Note that the cursor set by this method can be overridden by the getMouseCursor method.

See also
MouseCursor

◆ setName()

void DocumentWindow::setName ( const String newName)
overridevirtualinherited

Changes the component's name.

(This is overridden from Component::setName() to cause a repaint, as the name is what gets drawn across the window's title bar).

Reimplemented from Component.

◆ setOpaque()

void Component::setOpaque ( bool  shouldBeOpaque)
inherited

Indicates whether any parts of the component might be transparent.

Components that always paint all of their contents with solid colour and thus completely cover any components behind them should use this method to tell the repaint system that they are opaque.

This information is used to optimise drawing, because it means that objects underneath opaque windows don't need to be painted.

By default, components are considered transparent, unless this is used to make it otherwise.

See also
isOpaque

◆ setPaintingIsUnclipped()

void Component::setPaintingIsUnclipped ( bool  shouldPaintWithoutClipping)
noexceptinherited

This allows you to indicate that this component doesn't require its graphics context to be clipped when it is being painted.

Most people will never need to use this setting, but in situations where you have a very large number of simple components being rendered, and where they are guaranteed never to do any drawing beyond their own boundaries, setting this to true will reduce the overhead involved in clipping the graphics context that gets passed to the component's paint() callback. If you enable this mode, you'll need to make sure your paint method doesn't call anything like Graphics::fillAll(), and doesn't draw beyond the component's bounds, because that'll produce artifacts. Your component also can't have any child components that may be placed beyond its bounds.

◆ setPositioner()

void Component::setPositioner ( Positioner newPositioner)
inherited

Sets a new Positioner object for this component.

If there's currently another positioner set, it will be deleted. The object that is passed in will be deleted automatically by this component when it's no longer required. Pass a null pointer to clear the current positioner.

See also
getPositioner()

◆ setRepaintsOnMouseActivity()

void Component::setRepaintsOnMouseActivity ( bool  shouldRepaint)
noexceptinherited

Causes automatic repaints when the mouse enters or exits this component.

If turned on, then when the mouse enters/exits, or when the button is pressed/released on the component, it will trigger a repaint.

This is handy for things like buttons that need to draw themselves differently when the mouse moves over them, and it avoids having to override all the different mouse callbacks and call repaint().

See also
mouseEnter, mouseExit, mouseDown, mouseUp

◆ setResizable()

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

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 ResizableWindow::setResizeLimits ( int  newMinimumWidth,
int  newMinimumHeight,
int  newMaximumWidth,
int  newMaximumHeight 
)
noexceptinherited

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

◆ setSize()

void Component::setSize ( int  newWidth,
int  newHeight 
)
inherited

Changes the size of the component.

A synchronous call to resized() will occur if the size actually changes.

Note that if you've used setTransform() to apply a transform, then the component's bounds will no longer be a direct reflection of the position at which it appears within its parent, as the transform will be applied to whatever bounds you set for it.

Referenced by CarbonViewWrapperComponent::setOurSizeToEmbeddedViewSize(), and StandalonePluginHolder::showAudioSettingsDialog().

◆ setTitleBarButtonsRequired()

void DocumentWindow::setTitleBarButtonsRequired ( int  requiredButtons,
bool  positionTitleBarButtonsOnLeft 
)
inherited

Changes the set of title-bar buttons being shown.

Parameters
requiredButtonsspecifies which of the buttons (close, minimise, maximise) should be shown on the title bar. This value is a bitwise combination of values from the TitleBarButtons enum. Note that it can be "allButtons" to get them all.
positionTitleBarButtonsOnLeftif true, the buttons should go at the left side of the bar; if false, they'll be placed at the right

◆ setTitleBarHeight()

void DocumentWindow::setTitleBarHeight ( int  newHeight)
inherited

Changes the height of the title-bar.

◆ setTitleBarTextCentred()

void DocumentWindow::setTitleBarTextCentred ( bool  textShouldBeCentred)
inherited

Sets whether the title should be centred within the window.

If true, the title text is shown in the middle of the title-bar; if false, it'll be shown at the left of the bar.

◆ setTopLeftPosition() [1/2]

void Component::setTopLeftPosition ( int  x,
int  y 
)
inherited

Moves the component to a new position.

Changes the component's top-left position (without changing its size). The position is relative to the top-left of the component's parent.

If the component actually moves, this method will make a synchronous call to moved().

Note that if you've used setTransform() to apply a transform, then the component's bounds will no longer be a direct reflection of the position at which it appears within its parent, as the transform will be applied to whatever bounds you set for it.

See also
setBounds, ComponentListener::componentMovedOrResized

◆ setTopLeftPosition() [2/2]

void Component::setTopLeftPosition ( Point< int newTopLeftPosition)
inherited

Moves the component to a new position.

Changes the component's top-left position (without changing its size). The position is relative to the top-left of the component's parent.

If the component actually moves, this method will make a synchronous call to moved().

Note that if you've used setTransform() to apply a transform, then the component's bounds will no longer be a direct reflection of the position at which it appears within its parent, as the transform will be applied to whatever bounds you set for it.

See also
setBounds, ComponentListener::componentMovedOrResized

◆ setTopRightPosition()

void Component::setTopRightPosition ( int  x,
int  y 
)
inherited

Moves the component to a new position.

Changes the position of the component's top-right corner (keeping it the same size). The position is relative to the top-left of the component's parent.

If the component actually moves, this method will make a synchronous call to moved().

Note that if you've used setTransform() to apply a transform, then the component's bounds will no longer be a direct reflection of the position at which it appears within its parent, as the transform will be applied to whatever bounds you set for it.

◆ setTransform()

void Component::setTransform ( const AffineTransform transform)
inherited

Sets a transform matrix to be applied to this component.

If you set a transform for a component, the component's position will be warped by it, relative to the component's parent's top-left origin. This means that the values you pass into setBounds() will no longer reflect the actual area within the parent that the component covers, as the bounds will be transformed and the component will probably end up actually appearing somewhere else within its parent.

When using transforms you need to be extremely careful when converting coordinates between the coordinate spaces of different components or the screen - you should always use getLocalPoint(), getLocalArea(), etc to do this, and never just manually add a component's position to a point in order to convert it between different components (but I'm sure you would never have done that anyway...).

Currently, transforms are not supported for desktop windows, so the transform will be ignored if you put a component on the desktop.

To remove a component's transform, simply pass AffineTransform() as the parameter to this method.

◆ setUsingNativeTitleBar()

void TopLevelWindow::setUsingNativeTitleBar ( bool  useNativeTitleBar)
inherited

Sets whether an OS-native title bar will be used, or a Juce one.

See also
isUsingNativeTitleBar

◆ setViewportIgnoreDragFlag()

void Component::setViewportIgnoreDragFlag ( bool  ignoreDrag)
inlinenoexceptinherited

Sets a flag to indicate whether mouse drag events on this Component should be ignored when it is inside a Viewport with drag-to-scroll functionality enabled.

This is useful for Components such as sliders that should not move their parent Viewport when dragged.

◆ setVisible()

virtual void Component::setVisible ( bool  shouldBeVisible)
virtualinherited

Makes the component visible or invisible.

This method will show or hide the component. Note that components default to being non-visible when first created. Also note that visible components won't be seen unless all their parent components are also visible.

This method will call visibilityChanged() and also componentVisibilityChanged() for any component listeners that are interested in this component.

Parameters
shouldBeVisiblewhether to show or hide the component
See also
isVisible, isShowing, visibilityChanged, ComponentListener::componentVisibilityChanged

Referenced by VideoComponent::Pimpl::Pimpl().

◆ setWantsKeyboardFocus()

void Component::setWantsKeyboardFocus ( bool  wantsFocus)
noexceptinherited

Sets a flag to indicate whether this component needs keyboard focus or not.

By default components aren't actually interested in gaining the focus, but this method can be used to turn this on.

See the grabKeyboardFocus() method for details about the way a component is chosen to receive the focus.

See also
grabKeyboardFocus, getWantsKeyboardFocus

◆ showDialog()

static void DialogWindow::showDialog ( const String dialogTitle,
Component contentComponent,
Component componentToCentreAround,
Colour  backgroundColour,
bool  escapeKeyTriggersCloseButton,
bool  shouldBeResizable = false,
bool  useBottomRightCornerResizer = false 
)
static

Easy way of quickly showing a dialog box containing a given component.

Note: this method has been superceded by the DialogWindow::LaunchOptions structure, which does the same job with some extra flexibility. The showDialog method is here for backwards compatibility, but please use DialogWindow::LaunchOptions in new code.

This will open and display a DialogWindow containing a given component, making it modal, but returning immediately to allow the dialog to finish in its own time. If you want to block and run a modal loop until the dialog is dismissed, use showModalDialog() instead.

To close the dialog programmatically, you should call exitModalState (returnValue) on the DialogWindow that is created. To find a pointer to this window from your contentComponent, you can do something like this:

dw->exitModalState (1234);
Parameters
dialogTitlethe dialog box's title
contentComponentthe content component for the dialog box. Make sure that this has been set to the size you want it to be before calling this method. The component won't be deleted by this call, so you can re-use it or delete it afterwards
componentToCentreAroundif this is not a nullptr, it indicates a component that you'd like to show this dialog box in front of. See the DocumentWindow::centreAroundComponent() method for more info on this parameter
backgroundColoura colour to use for the dialog box's background colour
escapeKeyTriggersCloseButtonif true, then pressing the escape key will cause the close button to be triggered
shouldBeResizableif true, the dialog window has either a resizable border, or a corner resizer
useBottomRightCornerResizerif shouldBeResizable is true, this indicates whether to use a border or corner resizer component. See ResizableWindow::setResizable()

◆ showModalDialog()

static int DialogWindow::showModalDialog ( const String dialogTitle,
Component contentComponent,
Component componentToCentreAround,
Colour  backgroundColour,
bool  escapeKeyTriggersCloseButton,
bool  shouldBeResizable = false,
bool  useBottomRightCornerResizer = false 
)
static

Easy way of quickly showing a dialog box containing a given component.

Note: this method has been superceded by the DialogWindow::LaunchOptions structure, which does the same job with some extra flexibility. The showDialog method is here for backwards compatibility, but please use DialogWindow::LaunchOptions in new code.

This will open and display a DialogWindow containing a given component, returning when the user clicks its close button.

It returns the value that was returned by the dialog box's runModalLoop() call.

To close the dialog programmatically, you should call exitModalState (returnValue) on the DialogWindow that is created. To find a pointer to this window from your contentComponent, you can do something like this:

dw->exitModalState (1234);
Parameters
dialogTitlethe dialog box's title
contentComponentthe content component for the dialog box. Make sure that this has been set to the size you want it to be before calling this method. The component won't be deleted by this call, so you can re-use it or delete it afterwards
componentToCentreAroundif this is not a nullptr, it indicates a component that you'd like to show this dialog box in front of. See the DocumentWindow::centreAroundComponent() method for more info on this parameter
backgroundColoura colour to use for the dialog box's background colour
escapeKeyTriggersCloseButtonif true, then pressing the escape key will cause the close button to be triggered
shouldBeResizableif true, the dialog window has either a resizable border, or a corner resizer
useBottomRightCornerResizerif shouldBeResizable is true, this indicates whether to use a border or corner resizer component. See ResizableWindow::setResizable()

◆ toBack()

void Component::toBack ( )
inherited

Changes this component's z-order to be at the back of all its siblings.

If the component is set to be 'always-on-top', it will only be moved to the back of the other other 'always-on-top' components.

See also
toFront, toBehind, setAlwaysOnTop

◆ toBehind()

void Component::toBehind ( Component other)
inherited

Changes this component's z-order so that it's just behind another component.

See also
toFront, toBack

◆ toFront()

void Component::toFront ( bool  shouldAlsoGainFocus)
inherited

Brings the component to the front of its siblings.

If some of the component's siblings have had their 'always-on-top' flag set, then they will still be kept in front of this one (unless of course this one is also 'always-on-top').

Parameters
shouldAlsoGainFocusif true, this will also try to assign keyboard focus to the component (see grabKeyboardFocus() for more details)
See also
toBack, toBehind, setAlwaysOnTop

Referenced by CarbonViewWrapperComponent::carbonEventHandler().

◆ unfocusAllComponents()

static void Component::unfocusAllComponents ( )
staticinherited

If any component has keyboard focus, this will defocus it.

◆ updateMouseCursor()

void Component::updateMouseCursor ( ) const
inherited

Forces the current mouse cursor to be updated.

If you're overriding the getMouseCursor() method to control which cursor is displayed, then this will only be checked each time the user moves the mouse. So if you want to force the system to check that the cursor being displayed is up-to-date (even if the mouse is just sitting there), call this method.

(If you're changing the cursor using setMouseCursor(), you don't need to bother calling this).

◆ userTriedToCloseWindow()

virtual void Component::userTriedToCloseWindow ( )
virtualinherited

For components on the desktop, this is called if the system wants to close the window.

This is a signal that either the user or the system wants the window to close. The default implementation of this method will trigger an assertion to warn you that your component should do something about it, but you can override this to ignore the event if you want.

Reimplemented in AlertWindow.

◆ visibilityChanged()

void ResizableWindow::visibilityChanged ( )
overrideprotectedvirtualinherited

Reimplemented from Component.

Member Data Documentation

◆ escapeKeyTriggersCloseButton

bool DialogWindow::escapeKeyTriggersCloseButton
private

◆ resizableBorder

ScopedPointer<ResizableBorderComponent> ResizableWindow::resizableBorder
protectedinherited

◆ resizableCorner

ScopedPointer<ResizableCornerComponent> ResizableWindow::resizableCorner
protectedinherited

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