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

#include <juce_Toolbar.h>

Inheritance diagram for juce::Toolbar:
juce::Component juce::DragAndDropContainer juce::DragAndDropTarget juce::MouseListener

Classes

struct  LookAndFeelMethods
class  Spacer
class  MissingItemsComponent
class  CustomisationDialog

Public Types

enum  ToolbarItemStyle { iconsOnly , iconsWithText , textOnly }
enum  CustomisationFlags {
  allowIconsOnlyChoice = 1 , allowIconsWithTextChoice = 2 , allowTextOnlyChoice = 4 , showResetToDefaultsButton = 8 ,
  allCustomisationOptionsEnabled = (allowIconsOnlyChoice | allowIconsWithTextChoice | allowTextOnlyChoice | showResetToDefaultsButton)
}
enum  ColourIds {
  backgroundColourId = 0x1003200 , separatorColourId = 0x1003210 , buttonMouseOverBackgroundColourId = 0x1003220 , buttonMouseDownBackgroundColourId = 0x1003230 ,
  labelTextColourId = 0x1003240 , editingModeOutlineColourId = 0x1003250
}
Public Types inherited from juce::Component
enum class  FocusContainerType { none , focusContainer , keyboardFocusContainer }
enum  FocusChangeType { focusChangedByMouseClick , focusChangedByTabKey , focusChangedDirectly }

Public Member Functions

 Toolbar ()
 ~Toolbar () override
void setVertical (bool shouldBeVertical)
bool isVertical () const noexcept
int getThickness () const noexcept
int getLength () const noexcept
void clear ()
void addItem (ToolbarItemFactory &factory, int itemId, int insertIndex=-1)
void removeToolbarItem (int itemIndex)
ToolbarItemComponentremoveAndReturnItem (int itemIndex)
int getNumItems () const noexcept
int getItemId (int itemIndex) const noexcept
ToolbarItemComponentgetItemComponent (int itemIndex) const noexcept
void addDefaultItems (ToolbarItemFactory &factoryToUse)
ToolbarItemStyle getStyle () const noexcept
void setStyle (const ToolbarItemStyle &newStyle)
void showCustomisationDialog (ToolbarItemFactory &factory, int optionFlags=allCustomisationOptionsEnabled)
void setEditingActive (bool editingEnabled)
String toString () const
bool restoreFromString (ToolbarItemFactory &factoryToUse, const String &savedVersion)
void paint (Graphics &) override
void resized () override
void mouseDown (const MouseEvent &) override
bool isInterestedInDragSource (const SourceDetails &) override
void itemDragMove (const SourceDetails &) override
void itemDragExit (const SourceDetails &) override
void itemDropped (const SourceDetails &) override
void lookAndFeelChanged () override
void updateAllItemPositions (bool animate)
Public Member Functions inherited from juce::Component
 Component () noexcept
 ~Component () override
 Component (const String &componentName) noexcept
String getName () const noexcept
virtual void setName (const String &newName)
String getComponentID () const noexcept
void setComponentID (const String &newID)
virtual void setVisible (bool shouldBeVisible)
bool isVisible () const noexcept
virtual void visibilityChanged ()
bool isShowing () const
virtual void addToDesktop (int windowStyleFlags, void *nativeWindowToAttachTo=nullptr)
void removeFromDesktop ()
bool isOnDesktop () const noexcept
ComponentPeergetPeer () const
virtual void userTriedToCloseWindow ()
virtual void minimisationStateChanged (bool isNowMinimised)
virtual float getDesktopScaleFactor () const
void toFront (bool shouldAlsoGainKeyboardFocus)
void toBack ()
void toBehind (Component *other)
void setAlwaysOnTop (bool shouldStayOnTop)
bool isAlwaysOnTop () const noexcept
int getX () const noexcept
int getY () const noexcept
int getWidth () const noexcept
int getHeight () const noexcept
int getRight () const noexcept
Point< intgetPosition () const noexcept
int getBottom () const noexcept
Rectangle< intgetBounds () const noexcept
Rectangle< intgetLocalBounds () const noexcept
Rectangle< intgetBoundsInParent () const noexcept
int getScreenX () const
int getScreenY () const
Point< intgetScreenPosition () const
Rectangle< intgetScreenBounds () const
Point< intgetLocalPoint (const Component *sourceComponent, Point< int > pointRelativeToSourceComponent) const
Point< float > getLocalPoint (const Component *sourceComponent, Point< float > pointRelativeToSourceComponent) const
Rectangle< intgetLocalArea (const Component *sourceComponent, Rectangle< int > areaRelativeToSourceComponent) const
Rectangle< float > getLocalArea (const Component *sourceComponent, Rectangle< float > areaRelativeToSourceComponent) const
Point< intlocalPointToGlobal (Point< int > localPoint) const
Point< float > localPointToGlobal (Point< float > localPoint) const
Rectangle< intlocalAreaToGlobal (Rectangle< int > localArea) const
Rectangle< float > localAreaToGlobal (Rectangle< float > localArea) const
void setTopLeftPosition (int x, int y)
void setTopLeftPosition (Point< int > newTopLeftPosition)
void setTopRightPosition (int x, int y)
void setSize (int newWidth, int newHeight)
void setBounds (int x, int y, int width, int height)
void setBounds (Rectangle< int > newBounds)
void setBoundsRelative (float proportionalX, float proportionalY, float proportionalWidth, float proportionalHeight)
void setBoundsRelative (Rectangle< float > proportionalArea)
void setBoundsInset (BorderSize< int > borders)
void setBoundsToFit (Rectangle< int > targetArea, Justification justification, bool onlyReduceInSize)
void setCentrePosition (int x, int y)
void setCentrePosition (Point< int > newCentrePosition)
void setCentreRelative (float x, float y)
void centreWithSize (int width, int height)
void setTransform (const AffineTransform &transform)
AffineTransform getTransform () const
bool isTransformed () const noexcept
int proportionOfWidth (float proportion) const noexcept
int proportionOfHeight (float proportion) const noexcept
int getParentWidth () const noexcept
int getParentHeight () const noexcept
Rectangle< intgetParentMonitorArea () const
int getNumChildComponents () const noexcept
ComponentgetChildComponent (int index) const noexcept
int getIndexOfChildComponent (const Component *child) const noexcept
const Array< Component * > & getChildren () const noexcept
ComponentfindChildWithID (StringRef componentID) const noexcept
void addChildComponent (Component *child, int zOrder=-1)
void addChildComponent (Component &child, int zOrder=-1)
void addAndMakeVisible (Component *child, int zOrder=-1)
void addAndMakeVisible (Component &child, int zOrder=-1)
void addChildAndSetID (Component *child, const String &componentID)
void removeChildComponent (Component *childToRemove)
ComponentremoveChildComponent (int childIndexToRemove)
void removeAllChildren ()
void deleteAllChildren ()
ComponentgetParentComponent () const noexcept
template<class TargetClass>
TargetClass * findParentComponentOfClass () const
ComponentgetTopLevelComponent () const noexcept
bool isParentOf (const Component *possibleChild) const noexcept
virtual void parentHierarchyChanged ()
virtual void childrenChanged ()
virtual bool hitTest (int x, int y)
void setInterceptsMouseClicks (bool allowClicksOnThisComponent, bool allowClicksOnChildComponents) noexcept
void getInterceptsMouseClicks (bool &allowsClicksOnThisComponent, bool &allowsClicksOnChildComponents) const noexcept
bool contains (Point< int > localPoint)
bool contains (Point< float > localPoint)
bool reallyContains (Point< int > localPoint, bool returnTrueIfWithinAChild)
bool reallyContains (Point< float > localPoint, bool returnTrueIfWithinAChild)
ComponentgetComponentAt (int x, int y)
ComponentgetComponentAt (Point< int > position)
ComponentgetComponentAt (Point< float > position)
void repaint ()
void repaint (int x, int y, int width, int height)
void repaint (Rectangle< int > area)
void setBufferedToImage (bool shouldBeBuffered)
Image createComponentSnapshot (Rectangle< int > areaToGrab, bool clipImageToComponentBounds=true, float scaleFactor=1.0f)
void paintEntireComponent (Graphics &context, bool ignoreAlphaLevel)
void setPaintingIsUnclipped (bool shouldPaintWithoutClipping) noexcept
bool isPaintingUnclipped () const noexcept
void setComponentEffect (ImageEffectFilter *newEffect)
ImageEffectFiltergetComponentEffect () const noexcept
LookAndFeelgetLookAndFeel () const noexcept
void setLookAndFeel (LookAndFeel *newLookAndFeel)
void sendLookAndFeelChange ()
void setOpaque (bool shouldBeOpaque)
bool isOpaque () const noexcept
void setBroughtToFrontOnMouseClick (bool shouldBeBroughtToFront) noexcept
bool isBroughtToFrontOnMouseClick () const noexcept
void setExplicitFocusOrder (int newFocusOrderIndex)
int getExplicitFocusOrder () const
void setFocusContainerType (FocusContainerType containerType) noexcept
bool isFocusContainer () const noexcept
bool isKeyboardFocusContainer () const noexcept
ComponentfindFocusContainer () const
ComponentfindKeyboardFocusContainer () const
void setWantsKeyboardFocus (bool wantsFocus) noexcept
bool getWantsKeyboardFocus () const noexcept
void setMouseClickGrabsKeyboardFocus (bool shouldGrabFocus)
bool getMouseClickGrabsKeyboardFocus () const noexcept
void grabKeyboardFocus ()
void giveAwayKeyboardFocus ()
bool hasKeyboardFocus (bool trueIfChildIsFocused) const
void moveKeyboardFocusToSibling (bool moveToNext)
virtual std::unique_ptr< ComponentTraversercreateFocusTraverser ()
virtual std::unique_ptr< ComponentTraversercreateKeyboardFocusTraverser ()
void setHasFocusOutline (bool hasFocusOutline) noexcept
bool hasFocusOutline () const noexcept
bool isEnabled () const noexcept
void setEnabled (bool shouldBeEnabled)
virtual void enablementChanged ()
float getAlpha () const noexcept
void setAlpha (float newAlpha)
virtual void alphaChanged ()
void setMouseCursor (const MouseCursor &cursorType)
virtual MouseCursor getMouseCursor ()
void updateMouseCursor () const
virtual void paintOverChildren (Graphics &g)
void mouseMove (const MouseEvent &event) override
void mouseEnter (const MouseEvent &event) override
void mouseExit (const MouseEvent &event) override
void mouseDrag (const MouseEvent &event) override
void mouseUp (const MouseEvent &event) override
void mouseDoubleClick (const MouseEvent &event) override
void mouseWheelMove (const MouseEvent &event, const MouseWheelDetails &wheel) override
void mouseMagnify (const MouseEvent &event, float scaleFactor) override
void setRepaintsOnMouseActivity (bool shouldRepaint) noexcept
void addMouseListener (MouseListener *newListener, bool wantsEventsForAllNestedChildComponents)
void removeMouseListener (MouseListener *listenerToRemove)
void addKeyListener (KeyListener *newListener)
void removeKeyListener (KeyListener *listenerToRemove)
virtual bool keyPressed (const KeyPress &key)
virtual bool keyStateChanged (bool isKeyDown)
virtual void modifierKeysChanged (const ModifierKeys &modifiers)
virtual void focusGained (FocusChangeType cause)
virtual void focusLost (FocusChangeType cause)
virtual void focusOfChildComponentChanged (FocusChangeType cause)
bool isMouseOver (bool includeChildren=false) const
bool isMouseButtonDown (bool includeChildren=false) const
bool isMouseOverOrDragging (bool includeChildren=false) const
Point< intgetMouseXYRelative () const
virtual void moved ()
virtual void childBoundsChanged (Component *child)
virtual void parentSizeChanged ()
virtual void broughtToFront ()
void addComponentListener (ComponentListener *newListener)
void removeComponentListener (ComponentListener *listenerToRemove)
void postCommandMessage (int commandId)
virtual void handleCommandMessage (int commandId)
void enterModalState (bool takeKeyboardFocus=true, ModalComponentManager::Callback *callback=nullptr, bool deleteWhenDismissed=false)
void exitModalState (int returnValue)
bool isCurrentlyModal (bool onlyConsiderForemostModalComponent=true) const noexcept
bool isCurrentlyBlockedByAnotherModalComponent () const
virtual bool canModalEventBeSentToComponent (const Component *targetComponent)
virtual void inputAttemptWhenModal ()
NamedValueSetgetProperties () noexcept
const NamedValueSetgetProperties () const noexcept
Colour findColour (int colourID, bool inheritFromParent=false) const
void setColour (int colourID, Colour newColour)
void removeColour (int colourID)
bool isColourSpecified (int colourID) const
void copyAllExplicitColoursTo (Component &target) const
virtual void colourChanged ()
voidgetWindowHandle () const
PositionergetPositioner () const noexcept
void setPositioner (Positioner *newPositioner)
void setCachedComponentImage (CachedComponentImage *newCachedImage)
CachedComponentImagegetCachedComponentImage () const noexcept
void setViewportIgnoreDragFlag (bool ignoreDrag) noexcept
bool getViewportIgnoreDragFlag () const noexcept
String getTitle () const noexcept
void setTitle (const String &newTitle)
String getDescription () const noexcept
void setDescription (const String &newDescription)
String getHelpText () const noexcept
void setHelpText (const String &newHelpText)
void setAccessible (bool shouldBeAccessible)
bool isAccessible () const noexcept
AccessibilityHandlergetAccessibilityHandler ()
void invalidateAccessibilityHandler ()
void setFocusContainer (bool shouldBeFocusContainer) noexcept
void contains (int, int)=delete
Public Member Functions inherited from juce::MouseListener
virtual ~MouseListener ()=default
Public Member Functions inherited from juce::DragAndDropContainer
 DragAndDropContainer ()
virtual ~DragAndDropContainer ()
void startDragging (const var &sourceDescription, Component *sourceComponent, const ScaledImage &dragImage=ScaledImage(), bool allowDraggingToOtherJuceWindows=false, const Point< int > *imageOffsetFromMouse=nullptr, const MouseInputSource *inputSourceCausingDrag=nullptr)
void startDragging (const var &sourceDescription, Component *sourceComponent, Image dragImage, bool allowDraggingToOtherJuceWindows=false, const Point< int > *imageOffsetFromMouse=nullptr, const MouseInputSource *inputSourceCausingDrag=nullptr)
bool isDragAndDropActive () const
int getNumCurrentDrags () const
var getCurrentDragDescription () const
var getDragDescriptionForIndex (int index) const
void setCurrentDragImage (const ScaledImage &newImage)
void setCurrentDragImage (const Image &newImage)
void setDragImageForIndex (int index, const ScaledImage &newImage)
void setDragImageForIndex (int index, const Image &newImage)
Public Member Functions inherited from juce::DragAndDropTarget
virtual ~DragAndDropTarget ()=default
virtual void itemDragEnter (const SourceDetails &dragSourceDetails)
virtual bool shouldDrawDragImageWhenOver ()

Static Public Member Functions

static ToolbarItemComponentcreateItem (ToolbarItemFactory &, int itemId)
Static Public Member Functions inherited from juce::Component
static float JUCE_CALLTYPE getApproximateScaleFactorForComponent (const Component *targetComponent)
static Component *JUCE_CALLTYPE getCurrentlyFocusedComponent () noexcept
static void JUCE_CALLTYPE unfocusAllComponents ()
static void JUCE_CALLTYPE beginDragAutoRepeat (int millisecondsBetweenCallbacks)
static bool JUCE_CALLTYPE isMouseButtonDownAnywhere () noexcept
static int JUCE_CALLTYPE getNumCurrentlyModalComponents () noexcept
static Component *JUCE_CALLTYPE getCurrentlyModalComponent (int index=0) noexcept
Static Public Member Functions inherited from juce::DragAndDropContainer
static DragAndDropContainerfindParentDragContainerFor (Component *childComponent)
static bool performExternalDragDropOfFiles (const StringArray &files, bool canMoveFiles, Component *sourceComponent=nullptr, std::function< void()> callback=nullptr)
static bool performExternalDragDropOfText (const String &text, Component *sourceComponent=nullptr, std::function< void()> callback=nullptr)

Static Public Attributes

static const char *const toolbarDragDescriptor = "_toolbarItem_"

Private Member Functions

std::unique_ptr< AccessibilityHandlercreateAccessibilityHandler () override
void initMissingItemButton ()
void showMissingItems ()
void addItemInternal (ToolbarItemFactory &factory, int itemId, int insertIndex)
ToolbarItemComponentgetNextActiveComponent (int index, int delta) const

Private Attributes

std::unique_ptr< ButtonmissingItemsButton
bool vertical = false
bool isEditingActive = false
ToolbarItemStyle toolbarStyle = iconsOnly
OwnedArray< ToolbarItemComponentitems

Friends

class MissingItemsComponent

Additional Inherited Members

Protected Member Functions inherited from juce::Component
virtual ComponentPeercreateNewPeer (int styleFlags, void *nativeWindowToAttachTo)
Protected Member Functions inherited from juce::DragAndDropContainer
virtual bool shouldDropFilesWhenDraggedExternally (const DragAndDropTarget::SourceDetails &sourceDetails, StringArray &files, bool &canMoveFiles)
virtual bool shouldDropTextWhenDraggedExternally (const DragAndDropTarget::SourceDetails &sourceDetails, String &text)
virtual void dragOperationStarted (const DragAndDropTarget::SourceDetails &)
virtual void dragOperationEnded (const DragAndDropTarget::SourceDetails &)
Static Protected Member Functions inherited from juce::Component
static std::unique_ptr< AccessibilityHandlercreateIgnoredAccessibilityHandler (Component &)

Detailed Description

A toolbar component.

A toolbar contains a horizontal or vertical strip of ToolbarItemComponents, and looks after their order and layout.

Items (icon buttons or other custom components) are added to a toolbar using a ToolbarItemFactory - each type of item is given a unique ID number, and a toolbar might contain more than one instance of a particular item type.

Toolbars can be interactively customised, allowing the user to drag the items around, and to drag items onto or off the toolbar, using the ToolbarItemPalette component as a source of new items.

See also
ToolbarItemFactory, ToolbarItemComponent, ToolbarItemPalette

@tags{GUI}

Member Enumeration Documentation

◆ ColourIds

enum juce::Toolbar::ColourIds

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

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

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

A colour to use to fill the toolbar's background. For more control over this, override LookAndFeel::paintToolbarBackground().

separatorColourId 

A colour to use to draw the separator lines.

buttonMouseOverBackgroundColourId 

A colour used to paint the background of buttons when the mouse is over them.

buttonMouseDownBackgroundColourId 

A colour used to paint the background of buttons when the mouse is held down on them.

labelTextColourId 

A colour to use for drawing the text under buttons when the style is set to iconsWithText or textOnly.

editingModeOutlineColourId 

A colour to use for an outline around buttons when the customisation dialog is active and the mouse moves over them.

◆ CustomisationFlags

enum juce::Toolbar::CustomisationFlags

Flags used by the showCustomisationDialog() method.

Enumerator
allowIconsOnlyChoice 

If this flag is specified, the customisation dialog can show the "icons only" option on its choice of toolbar styles.

allowIconsWithTextChoice 

If this flag is specified, the customisation dialog can show the "icons with text" option on its choice of toolbar styles.

allowTextOnlyChoice 

If this flag is specified, the customisation dialog can show the "text only" option on its choice of toolbar styles.

showResetToDefaultsButton 

If this flag is specified, the customisation dialog can show a button to reset the toolbar to its default set of items.

allCustomisationOptionsEnabled 

◆ ToolbarItemStyle

enum juce::Toolbar::ToolbarItemStyle

Options for the way items should be displayed.

See also
setStyle, getStyle
Enumerator
iconsOnly 

Means that the toolbar should just contain icons.

iconsWithText 

Means that the toolbar should have text labels under each icon.

textOnly 

Means that the toolbar only display text labels for each item.

Constructor & Destructor Documentation

◆ Toolbar()

juce::Toolbar::Toolbar ( )

Creates an empty toolbar component.

To add some icons or other components to your toolbar, you'll need to create a ToolbarItemFactory class that can create a suitable set of ToolbarItemComponents.

See also
ToolbarItemFactory, ToolbarItemComponents

◆ ~Toolbar()

juce::Toolbar::~Toolbar ( )
override

Destructor.

Any items on the bar will be deleted when the toolbar is deleted.

Member Function Documentation

◆ addDefaultItems()

void juce::Toolbar::addDefaultItems ( ToolbarItemFactory & factoryToUse)

Clears this toolbar and adds to it the default set of items that the specified factory creates.

See also
ToolbarItemFactory::getDefaultItemSet

◆ addItem()

void juce::Toolbar::addItem ( ToolbarItemFactory & factory,
int itemId,
int insertIndex = -1 )

Adds an item to the toolbar.

The factory's ToolbarItemFactory::createItem() will be called by this method to create the component that will actually be added to the bar.

The new item will be inserted at the specified index (if the index is -1, it will be added to the right-hand or bottom end of the bar).

Once added, the component will be automatically deleted by this object when it is no longer needed.

See also
ToolbarItemFactory

◆ addItemInternal()

void juce::Toolbar::addItemInternal ( ToolbarItemFactory & factory,
int itemId,
int insertIndex )
private

◆ clear()

void juce::Toolbar::clear ( )

Deletes all items from the bar.

◆ createAccessibilityHandler()

std::unique_ptr< AccessibilityHandler > juce::Toolbar::createAccessibilityHandler ( )
overrideprivatevirtual

Override this method to return a custom AccessibilityHandler for this component.

The default implementation creates and returns a AccessibilityHandler object with an unspecified role, meaning that it will be visible to accessibility clients but without a specific role, action callbacks or interfaces. To control how accessibility clients see and interact with your component subclass AccessibilityHandler, implement the desired behaviours, and return an instance of it from this method in your component subclass.

The accessibility handler you return here is guaranteed to be destroyed before its Component, so it's safe to store and use a reference back to the Component inside the AccessibilityHandler if necessary.

See also
getAccessibilityHandler

Reimplemented from juce::Component.

◆ createItem()

ToolbarItemComponent * juce::Toolbar::createItem ( ToolbarItemFactory & factory,
int itemId )
static

◆ getItemComponent()

ToolbarItemComponent * juce::Toolbar::getItemComponent ( int itemIndex) const
noexcept

Returns the component being used for the item with the given index.

If the index is less than zero or greater than the number of items, this will return nullptr.

See also
getNumItems

◆ getItemId()

int juce::Toolbar::getItemId ( int itemIndex) const
noexcept

Returns the ID of the item with the given index.

If the index is less than zero or greater than the number of items, this will return nullptr.

See also
getNumItems

◆ getLength()

int juce::Toolbar::getLength ( ) const
noexcept

Returns the length of the bar.

If the bar is horizontal, this will return its width; if it's vertical, it will return its height.

See also
getThickness

◆ getNextActiveComponent()

ToolbarItemComponent * juce::Toolbar::getNextActiveComponent ( int index,
int delta ) const
private

◆ getNumItems()

int juce::Toolbar::getNumItems ( ) const
noexcept

Returns the number of items currently on the toolbar.

See also
getItemId, getItemComponent

◆ getStyle()

ToolbarItemStyle juce::Toolbar::getStyle ( ) const
inlinenoexcept

Returns the toolbar's current style.

See also
ToolbarItemStyle, setStyle

◆ getThickness()

int juce::Toolbar::getThickness ( ) const
noexcept

Returns the depth of the bar.

If the bar is horizontal, this will return its height; if it's vertical, it will return its width.

See also
getLength

◆ initMissingItemButton()

void juce::Toolbar::initMissingItemButton ( )
private

◆ isInterestedInDragSource()

bool juce::Toolbar::isInterestedInDragSource ( const SourceDetails & dragSourceDetails)
overridevirtual

Callback to check whether this target is interested in the type of object being dragged.

Parameters
dragSourceDetailscontains information about the source of the drag operation.
Returns
true if this component wants to receive the other callbacks regarding this type of object; if it returns false, no other callbacks will be made.

Implements juce::DragAndDropTarget.

◆ isVertical()

bool juce::Toolbar::isVertical ( ) const
inlinenoexcept

Returns true if the bar is set to be vertical, or false if it's horizontal.

You can change the bar's orientation with setVertical().

◆ itemDragExit()

void juce::Toolbar::itemDragExit ( const SourceDetails & dragSourceDetails)
overridevirtual

Callback to indicate that something has been dragged off the edge of this component.

This gets called when the user moves the mouse out of this component while dragging something.

If you've used itemDragEnter() to repaint your component and give feedback, use this as a signal to repaint it in its normal state.

Parameters
dragSourceDetailscontains information about the source of the drag operation.
See also
itemDragEnter

Reimplemented from juce::DragAndDropTarget.

◆ itemDragMove()

void juce::Toolbar::itemDragMove ( const SourceDetails & dragSourceDetails)
overridevirtual

Callback to indicate that the user is dragging something over this component.

This gets called when the user moves the mouse over this component while dragging something. Normally overriding itemDragEnter() and itemDragExit() are enough, but this lets you know what happens in-between.

Parameters
dragSourceDetailscontains information about the source of the drag operation.

Reimplemented from juce::DragAndDropTarget.

◆ itemDropped()

void juce::Toolbar::itemDropped ( const SourceDetails & dragSourceDetails)
overridevirtual

Callback to indicate that the user has dropped something onto this component.

When the user drops an item this get called, and you can use the description to work out whether your object wants to deal with it or not.

Note that after this is called, the itemDragExit method may not be called, so you should clean up in here if there's anything you need to do when the drag finishes.

Parameters
dragSourceDetailscontains information about the source of the drag operation.

Implements juce::DragAndDropTarget.

◆ lookAndFeelChanged()

void juce::Toolbar::lookAndFeelChanged ( )
overridevirtual

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

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

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

See also
sendLookAndFeelChange, getLookAndFeel

Reimplemented from juce::Component.

◆ mouseDown()

void juce::Toolbar::mouseDown ( const MouseEvent & event)
overridevirtual

Called when a mouse button is pressed.

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

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

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

Reimplemented from juce::Component.

◆ paint()

void juce::Toolbar::paint ( Graphics & g)
overridevirtual

Components can override this method to draw their content.

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

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

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

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

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

Reimplemented from juce::Component.

◆ removeAndReturnItem()

ToolbarItemComponent * juce::Toolbar::removeAndReturnItem ( int itemIndex)

Removes an item from the bar and returns it.

◆ removeToolbarItem()

void juce::Toolbar::removeToolbarItem ( int itemIndex)

Deletes one of the items from the bar.

◆ resized()

void juce::Toolbar::resized ( )
overridevirtual

Called when this component's size has been changed.

A component can implement this method to do things such as laying out its child components when its width or height changes.

The method is called synchronously as a result of the setBounds or setSize methods, so repeatedly changing a components size will repeatedly call its resized method (unlike things like repainting, where multiple calls to repaint are coalesced together).

If the component is a top-level window on the desktop, its size could also be changed by operating-system factors beyond the application's control.

See also
moved, setSize

Reimplemented from juce::Component.

◆ restoreFromString()

bool juce::Toolbar::restoreFromString ( ToolbarItemFactory & factoryToUse,
const String & savedVersion )

Restores a set of items that was previously stored in a string by the toString() method.

The factory object is used to create any item components that are needed.

See also
toString

◆ setEditingActive()

void juce::Toolbar::setEditingActive ( bool editingEnabled)

Turns on or off the toolbar's editing mode, in which its items can be rearranged by the user.

(In most cases it's easier just to use showCustomisationDialog() instead of trying to enable editing directly).

See also
ToolbarItemPalette

◆ setStyle()

void juce::Toolbar::setStyle ( const ToolbarItemStyle & newStyle)

Changes the toolbar's current style.

See also
ToolbarItemStyle, getStyle, ToolbarItemComponent::setStyle

◆ setVertical()

void juce::Toolbar::setVertical ( bool shouldBeVertical)

Changes the bar's orientation.

See also
isVertical

◆ showCustomisationDialog()

void juce::Toolbar::showCustomisationDialog ( ToolbarItemFactory & factory,
int optionFlags = allCustomisationOptionsEnabled )

Pops up a modal dialog box that allows this toolbar to be customised by the user.

The dialog contains a ToolbarItemPalette and various controls for editing other aspects of the toolbar. The dialog box will be opened modally, but the method will return immediately.

The factory is used to determine the set of items that will be shown on the palette.

The optionFlags parameter is a bitwise-or of values from the CustomisationFlags enum.

See also
ToolbarItemPalette

◆ showMissingItems()

void juce::Toolbar::showMissingItems ( )
private

◆ toString()

String juce::Toolbar::toString ( ) const

Returns a string that represents the toolbar's current set of items.

This lets you later restore the same item layout using restoreFromString().

See also
restoreFromString

◆ updateAllItemPositions()

void juce::Toolbar::updateAllItemPositions ( bool animate)

◆ MissingItemsComponent

friend class MissingItemsComponent
friend

Member Data Documentation

◆ isEditingActive

bool juce::Toolbar::isEditingActive = false
private

◆ items

OwnedArray<ToolbarItemComponent> juce::Toolbar::items
private

◆ missingItemsButton

std::unique_ptr<Button> juce::Toolbar::missingItemsButton
private

◆ toolbarDragDescriptor

const char *const juce::Toolbar::toolbarDragDescriptor = "_toolbarItem_"
static

◆ toolbarStyle

ToolbarItemStyle juce::Toolbar::toolbarStyle = iconsOnly
private

◆ vertical

bool juce::Toolbar::vertical = false
private

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