A component that lets the user choose from a drop-down list of choices. More...
#include <juce_ComboBox.h>
Classes | |
class | Listener |
A class for receiving events from a ComboBox. More... | |
struct | LookAndFeelMethods |
This abstract base class is implemented by LookAndFeel classes to provide ComboBox functionality. More... | |
Public Types | |
enum | ColourIds { backgroundColourId = 0x1000b00, textColourId = 0x1000a00, outlineColourId = 0x1000c00, buttonColourId = 0x1000d00, arrowColourId = 0x1000e00, focusedOutlineColourId = 0x1000f00 } |
A set of colour IDs to use to change the colour of various aspects of the combo box. More... | |
enum | FocusChangeType { focusChangedByMouseClick, focusChangedByTabKey, focusChangedDirectly } |
Enumeration used by the focusChanged() and focusLost() methods. More... | |
Public Member Functions | |
ComboBox (const String &componentName={}) | |
Creates a combo-box. More... | |
~ComboBox () override | |
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 | 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 | 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 | addItem (const String &newItemText, int newItemId) |
Adds an item to be shown in the drop-down list. More... | |
void | addItemList (const StringArray &items, int firstItemIdOffset) |
Adds an array of items to the drop-down list. More... | |
void | addKeyListener (KeyListener *newListener) |
Adds a listener that wants to hear about keypresses that this component receives. More... | |
void | addListener (Listener *listener) |
Registers a listener that will be called when the box's content changes. More... | |
void | addMouseListener (MouseListener *newListener, bool wantsEventsForAllNestedChildComponents) |
Registers a listener to be told when mouse events occur in this component. More... | |
void | addSectionHeading (const String &headingName) |
Adds a heading to the drop-down list, so that you can group the items into different sections. More... | |
void | addSeparator () |
Adds a separator line to the drop-down list. More... | |
virtual void | addToDesktop (int windowStyleFlags, void *nativeWindowToAttachTo=nullptr) |
Makes this component appear as a window on the desktop. More... | |
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 | centreWithSize (int width, int height) |
Changes the component's size and centres it within its parent. More... | |
void | changeItemText (int itemId, const String &newText) |
Changes the text for an existing item. More... | |
virtual void | childBoundsChanged (Component *child) |
Called when one of this component's children is moved or resized. 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 | clear (NotificationType notification=sendNotificationAsync) |
Removes all the items from the drop-down list. More... | |
void | clear (bool) |
deprecated More... | |
void | colourChanged () override |
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 KeyboardFocusTraverser * | createFocusTraverser () |
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... | |
void | enablementChanged () override |
void | enterModalState (bool takeKeyboardFocus=true, ModalComponentManager::Callback *callback=nullptr, bool deleteWhenDismissed=false) |
Puts the component into a modal state. More... | |
void | exitModalState (int returnValue) |
Ends a component's modal state. More... | |
Component * | findChildWithID (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... | |
void | focusGained (Component::FocusChangeType) override |
void | focusLost (Component::FocusChangeType) override |
virtual void | focusOfChildComponentChanged (FocusChangeType cause) |
Called to indicate a change in whether or not this component is the parent of the currently-focused component. More... | |
float | getAlpha () const noexcept |
Returns the component's current transparancy level. More... | |
int | getBottom () const noexcept |
Returns the y coordinate of the bottom edge of this component. More... | |
Rectangle< int > | getBounds () const noexcept |
Returns this component's bounding box. More... | |
Rectangle< int > | getBoundsInParent () const noexcept |
Returns the area of this component's parent which this component covers. More... | |
CachedComponentImage * | getCachedComponentImage () const noexcept |
Returns the object that was set by setCachedComponentImage(). More... | |
Component * | getChildComponent (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... | |
Component * | getComponentAt (int x, int y) |
Returns the component at a certain point within this one. More... | |
Component * | getComponentAt (Point< int > position) |
Returns the component at a certain point within this one. More... | |
ImageEffectFilter * | getComponentEffect () const noexcept |
Returns the current component effect. More... | |
const String & | getComponentID () const noexcept |
Returns the ID string that was set by setComponentID(). 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... | |
int | getItemId (int index) const noexcept |
Returns the ID for one of the items in the list. More... | |
String | getItemText (int index) const |
Returns the text for one of the items in the list. More... | |
Justification | getJustificationType () const noexcept |
Returns the current justification for the text box. More... | |
Rectangle< int > | getLocalArea (const Component *sourceComponent, Rectangle< int > areaRelativeToSourceComponent) const |
Converts a rectangle to be relative to this component's coordinate space. More... | |
Rectangle< int > | getLocalBounds () const noexcept |
Returns the component's bounds, relative to its own origin. More... | |
Point< int > | getLocalPoint (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... | |
LookAndFeel & | getLookAndFeel () const noexcept |
Finds the appropriate look-and-feel to use for this component. 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< int > | getMouseXYRelative () const |
Returns the mouse's current position, relative to this component. More... | |
const String & | getName () const noexcept |
Returns the name of this component. More... | |
int | getNumChildComponents () const noexcept |
Returns the number of child components that this component contains. More... | |
int | getNumItems () const noexcept |
Returns the number of items that have been added to the list. More... | |
Component * | getParentComponent () 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< int > | getParentMonitorArea () 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... | |
ComponentPeer * | getPeer () const |
Returns the heavyweight window that contains this component. More... | |
Point< int > | getPosition () const noexcept |
Returns the component's top-left position as a Point. More... | |
Positioner * | getPositioner () const noexcept |
Returns the Positioner object that has been set for this component. More... | |
NamedValueSet & | getProperties () noexcept |
Returns the set of properties that belong to this component. More... | |
const NamedValueSet & | getProperties () 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... | |
PopupMenu * | getRootMenu () |
Returns the PopupMenu object associated with the ComboBox. More... | |
Rectangle< int > | getScreenBounds () const |
Returns the bounds of this component, relative to the screen's top-left. More... | |
Point< int > | getScreenPosition () 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 | getSelectedId () const noexcept |
Returns the ID of the item that's currently shown in the box. More... | |
Value & | getSelectedIdAsValue () |
Returns a Value object that can be used to get or set the selected item's ID. More... | |
int | getSelectedItemIndex () const |
Returns the index of the item that's currently shown in the box. More... | |
String | getText () const |
Returns the text that is currently shown in the combo-box's text field. More... | |
String | getTextWhenNoChoicesAvailable () const |
Returns the text shown when no items have been added to the list. More... | |
String | getTextWhenNothingSelected () const |
Returns the text that is shown when no item is selected. More... | |
String | getTooltip () override |
Component * | getTopLevelComponent () 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... | |
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... | |
void | grabKeyboardFocus () |
Tries to give keyboard focus to this component. More... | |
void | handleAsyncUpdate () override |
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... | |
void | hidePopup () |
Hides the combo box's popup list, if it's currently visible. More... | |
virtual bool | hitTest (int x, int y) |
Tests whether a given point is inside the component. More... | |
int | indexOfItemId (int itemId) const noexcept |
Returns the index in the list of a particular item ID. More... | |
virtual void | inputAttemptWhenModal () |
Called when the user tries to click on a component that is blocked by another modal component. 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 | 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 | isItemEnabled (int itemId) const noexcept |
Returns true if the given item is enabled. More... | |
bool | isMouseButtonDown (bool includeChildren=false) 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 | isPaintingUnclipped () const noexcept |
Returns true if this component doesn't require its graphics context to be clipped when it is being painted. More... | |
bool | isParentOf (const Component *possibleChild) const noexcept |
Checks whether a component is anywhere inside this component or its children. More... | |
bool | isPopupActive () const noexcept |
Returns true if the popup menu is currently being shown. More... | |
bool | isShowing () const |
Tests whether this component and all its parents are visible. More... | |
bool | isTextEditable () const noexcept |
Returns true if the text is directly editable. More... | |
bool | isTransformed () const noexcept |
Returns true if a non-identity transform is being applied to this component. More... | |
bool | isVisible () const noexcept |
Tests whether the component is visible or not. More... | |
bool | keyPressed (const KeyPress &) override |
bool | keyStateChanged (bool) override |
Rectangle< int > | localAreaToGlobal (Rectangle< int > localArea) const |
Converts a rectangle from this component's coordinate space to a screen coordinate. More... | |
Point< int > | localPointToGlobal (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... | |
void | lookAndFeelChanged () override |
virtual void | minimisationStateChanged (bool isNowMinimised) |
Called for a desktop component which has just been minimised or un-minimised. More... | |
virtual void | modifierKeysChanged (const ModifierKeys &modifiers) |
Called when a modifier key is pressed or released. More... | |
void | mouseDoubleClick (const MouseEvent &event) override |
Called when a mouse button has been double-clicked on a component. More... | |
void | mouseDown (const MouseEvent &) override |
void | mouseDrag (const MouseEvent &) override |
void | mouseEnter (const MouseEvent &event) override |
Called when the mouse first enters a component. More... | |
void | mouseExit (const MouseEvent &event) override |
Called when the mouse moves out of a component. More... | |
void | mouseMagnify (const MouseEvent &event, float scaleFactor) override |
Called when a pinch-to-zoom mouse-gesture is used. More... | |
void | mouseMove (const MouseEvent &event) override |
Called when the mouse moves inside a component. More... | |
void | mouseUp (const MouseEvent &) override |
void | mouseWheelMove (const MouseEvent &, const MouseWheelDetails &) override |
virtual void | moved () |
Called when this component's position has been changed. More... | |
void | moveKeyboardFocusToSibling (bool moveToNext) |
Tries to move the keyboard focus to one of this component's siblings. More... | |
void | paint (Graphics &) override |
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 | parentHierarchyChanged () override |
virtual void | parentSizeChanged () |
Called when this component's immediate parent has been resized. 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... | |
void | removeAllChildren () |
Removes all this component's children. More... | |
void | removeChildComponent (Component *childToRemove) |
Removes one of this component's child-components. More... | |
Component * | removeChildComponent (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 | removeListener (Listener *listener) |
Deregisters a previously-registered 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... | |
void | resized () override |
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 | 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 | 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 | setBoundsRelative (Rectangle< float > proportionalArea) |
Changes the component's position and size in terms of fractions of its parent's size. More... | |
void | setBoundsToFit (Rectangle< int > targetArea, 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 | setEditableText (bool isEditable) |
Sets whether the text in the combo-box is editable. 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 | setInterceptsMouseClicks (bool allowClicksOnThisComponent, bool allowClicksOnChildComponents) noexcept |
Changes the default return value for the hitTest() method. More... | |
void | setItemEnabled (int itemId, bool shouldBeEnabled) |
This allows items in the drop-down list to be selectively disabled. More... | |
void | setJustificationType (Justification justification) |
Sets the style of justification to be used for positioning the text. More... | |
void | setLookAndFeel (LookAndFeel *newLookAndFeel) |
Sets the look and feel to use for this component. 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... | |
virtual void | setName (const String &newName) |
Sets the name of this component. 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 | setScrollWheelEnabled (bool enabled) noexcept |
This can be used to allow the scroll-wheel to nudge the chosen item. More... | |
void | setSelectedId (int newItemId, NotificationType notification=sendNotificationAsync) |
Sets one of the items to be the current selection. More... | |
void | setSelectedId (int, bool) |
deprecated More... | |
void | setSelectedItemIndex (int newItemIndex, NotificationType notification=sendNotificationAsync) |
Sets one of the items to be the current selection. More... | |
void | setSelectedItemIndex (int, bool) |
deprecated More... | |
void | setSize (int newWidth, int newHeight) |
Changes the size of the component. More... | |
void | setText (const String &newText, NotificationType notification=sendNotificationAsync) |
Sets the contents of the combo-box's text field. More... | |
void | setText (const String &, bool) |
deprecated More... | |
void | setTextWhenNoChoicesAvailable (const String &newMessage) |
Sets the message to show when there are no items in the list, and the user clicks on the drop-down box. More... | |
void | setTextWhenNothingSelected (const String &newMessage) |
Sets a message to display when there is no item currently selected. More... | |
void | setTooltip (const String &newTooltip) override |
Gives the ComboBox a tooltip. 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 | 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 | showEditor () |
Programmatically opens the text editor to allow the user to edit the current item. More... | |
virtual void | showPopup () |
Pops up the combo box's list. 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... | |
void | valueChanged (Value &) override |
virtual void | visibilityChanged () |
Called when this component's visibility changes. 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 Component * | getCurrentlyFocusedComponent () noexcept |
Returns the component that currently has the keyboard focus. More... | |
static Component * | getCurrentlyModalComponent (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 bool | isMouseButtonDownAnywhere () noexcept |
Returns true if a mouse button is currently down. More... | |
static void | unfocusAllComponents () |
If any component has keyboard focus, this will defocus it. More... | |
Public Attributes | |
std::function< void()> | onChange |
You can assign a lambda to this callback object to have it called when the selected ID is changed. More... | |
Private Types | |
enum | EditableState { editableUnknown, labelIsNotEditable, labelIsEditable } |
Private Member Functions | |
void | cancelPendingUpdate () noexcept |
This will stop any pending updates from happening. More... | |
PopupMenu::Item * | getItemForId (int) const noexcept |
PopupMenu::Item * | getItemForIndex (int) const noexcept |
void | handleUpdateNowIfNeeded () |
If an update has been triggered and is pending, this will invoke it synchronously. More... | |
bool | isUpdatePending () const noexcept |
Returns true if there's an update callback in the pipeline. More... | |
bool | nudgeSelectedItem (int delta) |
bool | selectIfEnabled (int index) |
void | sendChange (NotificationType) |
void | showPopupIfNotActive () |
void | triggerAsyncUpdate () |
Causes the callback to be triggered at a later time. More... | |
Private Attributes | |
Value | currentId |
PopupMenu | currentMenu |
bool | isButtonDown = false |
std::unique_ptr< Label > | label |
EditableState | labelEditableState = editableUnknown |
int | lastCurrentId = 0 |
ListenerList< Listener > | listeners |
bool | menuActive = false |
float | mouseWheelAccumulator = 0 |
String | noChoicesMessage |
bool | scrollWheelEnabled = false |
String | textWhenNothingSelected |
A component that lets the user choose from a drop-down list of choices.
The combo-box has a list of text strings, each with an associated id number, that will be shown in the drop-down list when the user clicks on the component.
The currently selected choice is displayed in the combo-box, and this can either be read-only text, or editable.
To find out when the user selects a different item or edits the text, you can assign a lambda to the onChange member, or register a ComboBox::Listener to receive callbacks.
{GUI}
A set of colour IDs to use to change the colour of various aspects of the combo box.
These constants can be used either via the Component::setColour(), or LookAndFeel::setColour() methods.
To change the colours of the menu that pops up, you can set the colour IDs in PopupMenu::ColourIDs.
Enumerator | |
---|---|
backgroundColourId | The background colour to fill the box with. |
textColourId | The colour for the text in the box. |
outlineColourId | The colour for an outline around the box. |
buttonColourId | The base colour for the button (a LookAndFeel class will probably use variations on this). |
arrowColourId | The colour for the arrow shape that pops up the menu. |
focusedOutlineColourId | The colour that will be used to draw a box around the edge of the component when it has focus. |
|
private |
|
inherited |
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(). |
|
explicit |
Creates a combo-box.
On construction, the text field will be empty, so you should call the setSelectedId() or setText() method to choose the initial value before displaying it.
componentName | the name to set for the component (see Component::setName()) |
|
override |
Destructor.
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.
child | the 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. |
zOrder | The 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. |
Referenced by juce::StandaloneFilterWindow::StandaloneFilterWindow().
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.
child | the 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. |
zOrder | The 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. |
Adds a child component to this one, makes it visible, and sets its component ID.
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.
child | the 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. |
zOrder | The 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. |
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.
child | the 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. |
zOrder | The 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. |
|
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.
newListener | the listener to register - if this is already registered, it will be ignored. |
Adds an item to be shown in the drop-down list.
newItemText | the text of the item to show in the list |
newItemId | an associated ID number that can be set or retrieved - see getSelectedId() and setSelectedId(). Note that this value can not be 0! |
void juce::ComboBox::addItemList | ( | const StringArray & | items, |
int | firstItemIdOffset | ||
) |
Adds an array of items to the drop-down list.
The item ID of each item will be its index in the StringArray + firstItemIdOffset.
|
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.
void juce::ComboBox::addListener | ( | Listener * | listener | ) |
Registers a listener that will be called when the box's content changes.
|
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.
newListener | the listener to register |
wantsEventsForAllNestedChildComponents | if 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. |
void juce::ComboBox::addSectionHeading | ( | const String & | headingName | ) |
Adds a heading to the drop-down list, so that you can group the items into different sections.
The headings are indented slightly differently to set them apart from the items on the list, and obviously can't be selected. You might want to add separators between your sections too.
void juce::ComboBox::addSeparator | ( | ) |
Adds a separator line to the drop-down list.
This is like adding a separator to a popup menu. See PopupMenu::addSeparator().
|
virtualinherited |
Makes this component appear as a window on the desktop.
Note that before calling this, you should make sure that the component's opacity is set correctly using setOpaque(). If the component is non-opaque, the windowing system will try to create a special transparent window for it, which will generally take a lot more CPU to operate (and might not even be possible on some platforms).
If the component is inside a parent component at the time this method is called, it will first be removed from that parent. Likewise if a component is on the desktop and is subsequently added to another component, it'll be removed from the desktop.
windowStyleFlags | a combination of the flags specified in the ComponentPeer::StyleFlags enum, which define the window's characteristics. |
nativeWindowToAttachTo | this allows an OS object to be passed-in as the window in which the juce component should place itself. On Windows, this would be a HWND, a HIViewRef on the Mac. Not necessarily supported on all platforms, and best left as 0 unless you know what you're doing. |
Reimplemented in juce::TopLevelWindow.
|
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 juce::NSViewComponent.
|
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.
|
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.
Reimplemented in juce::XEmbedComponent, and juce::MultiDocumentPanelWindow.
|
noexceptinherited |
This will stop any pending updates from happening.
If called after triggerAsyncUpdate() and before the handleAsyncUpdate() callback happens, this will cancel the handleAsyncUpdate() callback.
Note that this method simply cancels the next callback - if a callback is already in progress on a different thread, this won't block until the callback finishes, so there's no guarantee that the callback isn't still running when the method returns.
|
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.
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.
Changes the text for an existing item.
|
virtualinherited |
Called when one of this component's children is moved or resized.
If the parent wants to know about changes to its immediate children (not to children of its children), this is the method to override.
Reimplemented in juce::ResizableWindow, juce::CallOutBox, juce::TabBarButton, and juce::DrawableComposite.
|
virtualinherited |
Subclasses can use this callback to be told when children are added or removed, or when their z-order changes.
Reimplemented in juce::DrawableComposite.
void juce::ComboBox::clear | ( | NotificationType | notification = sendNotificationAsync | ) |
Removes all the items from the drop-down list.
If this call causes the content to be cleared, and a change-message will be broadcast according to the notification parameter.
void juce::ComboBox::clear | ( | bool | ) |
deprecated
|
overridevirtual |
Reimplemented from juce::Component.
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.
localPoint | the coordinate to test, relative to this component's top-left. |
|
inherited |
This looks for any colours that have been specified for this component, and copies them to the specified target component.
|
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.
|
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 override 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 juce::Label, and juce::FilenameComponent.
|
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 std::unique_ptr, OwnedArray, etc to manage their lifetimes appropriately.
|
overridevirtual |
Reimplemented from juce::Component.
|
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).
|
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.
Looks for a child component with the specified ID.
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.
|
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.
|
overridevirtual |
Reimplemented from juce::Component.
|
overridevirtual |
Reimplemented from juce::Component.
|
virtualinherited |
Called to indicate a change in whether or not this component is the parent of the currently-focused component.
Essentially this is called when the return value of a call to hasKeyboardFocus (true) has changed. It happens when focus moves from one of this component's children (at any depth) to a component that isn't contained in this one, (or vice-versa). Note that this method does NOT get called to when focus simply moves from one of its child components to another.
Reimplemented in juce::Slider, and juce::TopLevelWindow.
|
noexceptinherited |
Returns the component's current transparancy level.
See setAlpha() for more details.
|
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.
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.
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().
|
inlinenoexceptinherited |
Returns the object that was set by setCachedComponentImage().
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.
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.
Returns the component at a certain point within this one.
x | the x coordinate to test, relative to this component's left edge. |
y | the y coordinate to test, relative to this component's top edge. |
Returns the component at a certain point within this one.
position | the coordinate to test, relative to this component's top-left. |
|
inlinenoexceptinherited |
|
inlinenoexceptinherited |
Returns the ID string that was set by setComponentID().
|
staticnoexceptinherited |
Returns the component that currently has the keyboard focus.
|
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.
|
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 juce::CarbonViewWrapperComponent::setEmbeddedWindowToOurSize().
|
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.
|
inlinenoexceptinherited |
Returns the component's height in pixels.
Referenced by juce::CarbonViewWrapperComponent::createWindow(), juce::CarbonViewWrapperComponent::setEmbeddedWindowToOurSize(), and juce::CarbonViewWrapperComponent::setOurSizeToEmbeddedViewSize().
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.
|
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().
|
privatenoexcept |
|
privatenoexcept |
Returns the ID for one of the items in the list.
Note that this doesn't include headers or separators.
index | the item's index from 0 to (getNumItems() - 1) |
Returns the text for one of the items in the list.
Note that this doesn't include headers or separators.
index | the item's index from 0 to (getNumItems() - 1) |
|
noexcept |
Returns the current justification for the text box.
|
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 juce::OpenGLContext::NativeContext::NativeContext().
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 juce::OpenGLContext::NativeContext::NativeContext().
|
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.
|
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.
|
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.
|
noexceptinherited |
Returns the last value set with setMouseClickGrabsKeyboardFocus().
See setMouseClickGrabsKeyboardFocus() for more info.
|
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.
Reimplemented in juce::TableHeaderComponent.
Returns the mouse's current position, relative to this component.
The return value is relative to the component's top-left corner.
|
inlinenoexceptinherited |
|
noexceptinherited |
Returns the number of child components that this component contains.
|
staticnoexceptinherited |
Returns the number of components that are currently in a modal state.
|
noexcept |
Returns the number of items that have been added to the list.
Note that this doesn't include headers or separators.
|
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 juce::CarbonViewWrapperComponent::setOurSizeToEmbeddedViewSize().
|
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.
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.
|
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.
|
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.
Referenced by juce::OpenGLContext::NativeContext::NativeContext(), juce::OpenGLContext::NativeContext::updateWindowPosition(), and juce::OpenGLContext::NativeContext::~NativeContext().
Returns the component's top-left position as a Point.
|
noexceptinherited |
Returns the Positioner object that has been set for this component.
|
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.
|
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.
|
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.
|
inline |
Returns the bounds of this component, relative to the screen's top-left.
Referenced by juce::CarbonViewWrapperComponent::setEmbeddedWindowToOurSize().
Returns the position of this component's top-left corner relative to the screen's top-left.
|
inherited |
Returns this component's x coordinate relative the screen's top-left origin.
Referenced by juce::CarbonViewWrapperComponent::createWindow().
|
inherited |
Returns this component's y coordinate relative the screen's top-left origin.
Referenced by juce::CarbonViewWrapperComponent::createWindow().
|
noexcept |
Returns the ID of the item that's currently shown in the box.
If no item is selected, or if the text is editable and the user has entered something which isn't one of the items in the list, then this will return 0.
|
inline |
Returns a Value object that can be used to get or set the selected item's ID.
You can call Value::referTo() on this object to make the combo box control another Value object.
References juce::sendNotificationAsync.
int juce::ComboBox::getSelectedItemIndex | ( | ) | const |
Returns the index of the item that's currently shown in the box.
If no item is selected, or if the text is editable and the user has entered something which isn't one of the items in the list, then this will return -1.
String juce::ComboBox::getText | ( | ) | const |
Returns the text that is currently shown in the combo-box's text field.
If the ComboBox has editable text, then this text may have been edited by the user; otherwise it will be one of the items from the list, or possibly an empty string if nothing was selected.
String juce::ComboBox::getTextWhenNoChoicesAvailable | ( | ) | const |
Returns the text shown when no items have been added to the list.
String juce::ComboBox::getTextWhenNothingSelected | ( | ) | const |
Returns the text that is shown when no item is selected.
|
inlineoverridevirtual |
Reimplemented from juce::SettableTooltipClient.
References JUCE_DEPRECATED.
|
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 juce::CarbonViewWrapperComponent::carbonEventHandler(), juce::CarbonViewWrapperComponent::componentMovedOrResized(), juce::OpenGLContext::NativeContext::createNativeWindow(), juce::OpenGLContext::NativeContext::NativeContext(), and juce::CarbonViewWrapperComponent::setEmbeddedWindowToOurSize().
|
inherited |
Returns the transform that is currently being applied to this component.
For more details about transforms, see setTransform().
|
inlinenoexceptinherited |
Retrieves the current state of the Viewport drag-to-scroll functionality flag.
|
noexceptinherited |
Returns true if the component is interested in getting keyboard focus.
This returns the flag set by setWantsKeyboardFocus(). The default setting is false.
|
inlinenoexceptinherited |
Returns the component's width in pixels.
Referenced by juce::CarbonViewWrapperComponent::createWindow(), juce::CarbonViewWrapperComponent::setEmbeddedWindowToOurSize(), and juce::CarbonViewWrapperComponent::setOurSizeToEmbeddedViewSize().
|
inherited |
Returns the underlying native window handle for this component.
This is platform-dependent and strictly for power-users only!
Referenced by juce::CarbonViewWrapperComponent::getOwnerWindow().
|
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.
|
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.
|
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:
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.
|
overridevirtual |
Implements juce::AsyncUpdater.
|
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.
Reimplemented in juce::TextEditor, juce::Button, juce::CallOutBox, juce::OpenGLContext::NativeContext::DummyComponent, juce::BurgerMenuComponent, juce::MenuBarComponent, and juce::OpenGLContext::NativeContext::DummyComponent.
|
inherited |
If an update has been triggered and is pending, this will invoke it synchronously.
Use this as a kind of "flush" operation - if an update is pending, the handleAsyncUpdate() method will be called immediately; if no update is pending, then nothing will be done.
Because this may invoke the callback, this method must only be called on the main event thread.
Returns true if this component currently has the keyboard focus.
trueIfChildIsFocused | if 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. |
void juce::ComboBox::hidePopup | ( | ) |
Hides the combo box's popup list, if it's currently visible.
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.
x | the 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 |
y | the 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 |
Reimplemented in juce::LassoComponent< SelectableItemType >, juce::ResizableBorderComponent, juce::CallOutBox, juce::ImageButton, juce::TabBarButton, juce::DrawableShape, juce::DrawableImage, juce::ResizableCornerComponent, and juce::JUCESplashScreen.
Returns the index in the list of a particular item ID.
If no such ID is found, this will return -1.
|
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.
Reimplemented in juce::Label, and juce::CallOutBox.
|
noexceptinherited |
Returns true if this component is set to always stay in front of its siblings.
|
noexceptinherited |
Indicates whether the component should be brought to the front when clicked-on.
Returns true if the specified colour ID has been explicitly set for this component using the setColour() method.
|
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.
|
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.
|
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.
|
noexceptinherited |
Returns true if this component has been marked as a focus container.
See setFocusContainer() for more details.
Returns true if the given item is enabled.
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.
|
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.
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.
Also note that on a touch-screen device, this will only return true when a finger is actually down - as soon as all touch is released, isMouseOver will always return false.
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.
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()).
|
noexceptinherited |
Returns true if this component is currently showing on the desktop.
|
noexceptinherited |
Returns true if no parts of this component are transparent.
|
noexceptinherited |
Returns true if this component doesn't require its graphics context to be clipped when it is being painted.
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.
|
inlinenoexcept |
Returns true if the popup menu is currently being shown.
|
inherited |
Tests whether this component and all its parents are visible.
Referenced by juce::CarbonViewWrapperComponent::componentVisibilityChanged(), juce::SidePanel::isPanelShowing(), and juce::CarbonViewWrapperComponent::timerCallback().
|
noexcept |
Returns true if the text is directly editable.
|
noexceptinherited |
Returns true if a non-identity transform is being applied to this component.
For more details about transforms, see setTransform().
|
noexceptinherited |
Returns true if there's an update callback in the pipeline.
|
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.
Reimplemented from juce::Component.
Reimplemented from juce::Component.
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.
Converts a point relative to this component's top-left into a screen coordinate.
Converts a point relative to this component's top-left into a screen coordinate.
|
overridevirtual |
Reimplemented from juce::Component.
|
virtualinherited |
Called for a desktop component which has just been minimised or un-minimised.
This will only be called for components on the desktop.
|
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.
Reimplemented in juce::Slider.
|
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.
event | details about the position and status of the mouse event, including the source component in which it occurred |
Reimplemented from juce::MouseListener.
Reimplemented in juce::Slider, juce::TextEditor, juce::CodeEditorComponent, and juce::Label.
|
overridevirtual |
Reimplemented from juce::Component.
|
overridevirtual |
Reimplemented from juce::Component.
|
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.
event | details about the position and status of the mouse event, including the source component in which it occurred |
Reimplemented from juce::MouseListener.
Reimplemented in juce::Slider, juce::TableHeaderComponent, juce::ResizableBorderComponent, juce::TooltipWindow, and juce::MenuBarComponent.
|
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.
event | details about the position and status of the mouse event, including the source component in which it occurred |
Reimplemented from juce::MouseListener.
Reimplemented in juce::Slider, juce::TableHeaderComponent, and juce::MenuBarComponent.
|
overridevirtualinherited |
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.
event | details about the mouse event |
scaleFactor | a 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. |
Reimplemented from juce::MouseListener.
|
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.
event | details about the position and status of the mouse event, including the source component in which it occurred |
Reimplemented from juce::MouseListener.
Reimplemented in juce::Slider, juce::TableHeaderComponent, juce::ResizableBorderComponent, and juce::MenuBarComponent.
|
overridevirtual |
Reimplemented from juce::Component.
|
overridevirtual |
Reimplemented from juce::Component.
|
virtualinherited |
Called when this component's position has been changed.
This is called when the position relative to its parent changes, not when its absolute position on the screen changes (so it won't be called for all child components when a parent component is moved).
The method is called synchronously as a result of the setBounds, setTopLeftPosition or any of the other repositioning methods, and like resized(), it will be called each time those methods are called.
If the component is a top-level window on the desktop, its position could also be changed by operating-system factors beyond the application's control.
Reimplemented in juce::ResizableWindow, juce::CallOutBox, and juce::SidePanel.
|
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.
moveToNext | if true, the focus will move forwards; if false, it will move backwards |
|
overridevirtual |
Reimplemented from juce::Component.
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.
|
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.
Reimplemented in juce::TextEditor, juce::ListBox, and juce::FilenameComponent.
|
overridevirtual |
Reimplemented from juce::Component.
|
virtualinherited |
Called when this component's immediate parent has been resized.
If the component is a top-level window, this indicates that the screen size has changed.
Reimplemented in juce::ResizableWindow, and juce::JUCESplashScreen.
|
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.
Returns a proportion of the component's height.
This is a handy equivalent of (getHeight() * proportion).
Returns a proportion of the component's width.
This is a handy equivalent of (getWidth() * proportion).
|
inherited |
Returns true if a given point lies in this component, taking any overlapping siblings into account.
localPoint | the coordinate to test, relative to this component's top-left. |
returnTrueIfWithinAChild | if the point actually lies within a child of this component, this determines whether that is counted as a hit. |
|
inherited |
Removes all this component's children.
Note that this won't delete them! To do that, use deleteAllChildren() instead.
|
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.
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.
|
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.
|
inherited |
Removes a component listener.
|
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.
|
inherited |
Removes a previously-registered key listener.
void juce::ComboBox::removeListener | ( | Listener * | listener | ) |
Deregisters a previously-registered listener.
|
inherited |
Deregisters a mouse listener.
|
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.
Referenced by juce::OpenGLContext::NativeContext::NativeContext().
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.
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.
|
overridevirtual |
Reimplemented from juce::Component.
|
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.
|
private |
|
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.
|
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).
|
inherited |
Sets whether the component should always be kept at the front of its siblings.
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.
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.
|
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.
|
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.
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.
|
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.
|
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.
|
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.
|
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.
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.
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.
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.
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().
|
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.
|
inherited |
Sets the component's ID string.
You can retrieve the ID using getComponentID().
void juce::ComboBox::setEditableText | ( | bool | isEditable | ) |
Sets whether the text in the combo-box is editable.
The default state for a new ComboBox is non-editable, and can only be changed by choosing from the drop-down list.
|
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.
|
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.
|
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.
|
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.
allowClicksOnThisComponent | if true, hitTest() will always return true; if false, it will return false (or true for child components if allowClicksOnChildComponents is true) |
allowClicksOnChildComponents | if 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 |
This allows items in the drop-down list to be selectively disabled.
When you add an item, it's enabled by default, but you can call this method to change its status.
If you disable an item which is already selected, this won't change the current selection - it just stops the user choosing that item from the list.
void juce::ComboBox::setJustificationType | ( | Justification | justification | ) |
Sets the style of justification to be used for positioning the text.
The default is Justification::centredLeft. The text is displayed using a Label component inside the ComboBox.
|
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.
|
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.
|
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.
|
virtualinherited |
Sets the name of this component.
When the name changes, all registered ComponentListeners will receive a ComponentListener::componentNameChanged() callback.
Reimplemented in juce::DocumentWindow.
|
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.
|
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.
|
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.
|
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().
|
noexcept |
This can be used to allow the scroll-wheel to nudge the chosen item.
By default it's disabled, and I'd recommend leaving it disabled if there's any chance that the control might be inside a scrollable list or viewport.
void juce::ComboBox::setSelectedId | ( | int | newItemId, |
NotificationType | notification = sendNotificationAsync |
||
) |
Sets one of the items to be the current selection.
This will set the ComboBox's text to that of the item that matches this ID.
newItemId | the new item to select |
notification | determines the type of change notification that will be sent to listeners if the value changes |
void juce::ComboBox::setSelectedItemIndex | ( | int | newItemIndex, |
NotificationType | notification = sendNotificationAsync |
||
) |
Sets one of the items to be the current selection.
This will set the ComboBox's text to that of the item at the given index in the list.
newItemIndex | the new item to select |
notification | determines the type of change notification that will be sent to listeners if the value changes |
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 juce::CarbonViewWrapperComponent::setOurSizeToEmbeddedViewSize().
void juce::ComboBox::setText | ( | const String & | newText, |
NotificationType | notification = sendNotificationAsync |
||
) |
Sets the contents of the combo-box's text field.
The text passed-in will be set as the current text regardless of whether it is one of the items in the list. If the current text isn't one of the items, then getSelectedId() will return 0, otherwise it wil return the approriate ID.
newText | the text to select |
notification | determines the type of change notification that will be sent to listeners if the text changes |
void juce::ComboBox::setTextWhenNoChoicesAvailable | ( | const String & | newMessage | ) |
Sets the message to show when there are no items in the list, and the user clicks on the drop-down box.
By default it just says "no choices", but this lets you change it to something more meaningful.
void juce::ComboBox::setTextWhenNothingSelected | ( | const String & | newMessage | ) |
Sets a message to display when there is no item currently selected.
|
overridevirtual |
Gives the ComboBox a tooltip.
Reimplemented from juce::SettableTooltipClient.
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.
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.
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.
|
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.
|
inlinenoexceptinherited |
|
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.
shouldBeVisible | whether to show or hide the component |
Reimplemented in juce::ScrollBar.
|
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.
void juce::ComboBox::showEditor | ( | ) |
Programmatically opens the text editor to allow the user to edit the current item.
This is the same effect as when the box is clicked-on.
|
virtual |
Pops up the combo box's list.
This is virtual so that you can override it with your own custom popup mechanism if you need some really unusual behaviour.
|
private |
|
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.
|
inherited |
|
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').
shouldAlsoGainFocus | if true, this will also try to assign keyboard focus to the component (see grabKeyboardFocus() for more details) |
Referenced by juce::CarbonViewWrapperComponent::carbonEventHandler().
|
inherited |
Causes the callback to be triggered at a later time.
This method returns immediately, after which a callback to the handleAsyncUpdate() method will be made by the message thread as soon as possible.
If an update callback is already pending but hasn't happened yet, calling this method will have no effect.
It's thread-safe to call this method from any thread, BUT beware of calling it from a real-time (e.g. audio) thread, because it involves posting a message to the system queue, which means it may block (and in general will do on most OSes).
|
staticinherited |
If any component has keyboard focus, this will defocus it.
|
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).
|
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 juce::AlertWindow.
|
overridevirtual |
Implements juce::Value::Listener.
|
virtualinherited |
Called when this component's visibility changes.
Reimplemented in juce::ListBox, juce::Button, juce::ResizableWindow, juce::TopLevelWindow, juce::WebBrowserComponent, and juce::ProgressBar.
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
std::function<void()> juce::ComboBox::onChange |
You can assign a lambda to this callback object to have it called when the selected ID is changed.
|
private |
|
private |