openshot-audio
0.1.2
|
#include <juce_Toolbar.h>
Classes | |
class | CustomisationDialog |
struct | LookAndFeelMethods |
class | MissingItemsComponent |
class | Spacer |
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 } |
![]() | |
enum | FocusChangeType { focusChangedByMouseClick, focusChangedByTabKey, focusChangedDirectly } |
Static Public Member Functions | |
static ToolbarItemComponent * | createItem (ToolbarItemFactory &, int itemId) |
![]() | |
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 DragAndDropContainer * | findParentDragContainerFor (Component *childComponent) |
static bool | performExternalDragDropOfFiles (const StringArray &files, bool canMoveFiles) |
static bool | performExternalDragDropOfText (const String &text) |
Static Public Attributes | |
static const char *const | toolbarDragDescriptor = "_toolbarItem_" |
Friends | |
class | MissingItemsComponent |
Additional Inherited Members | |
![]() | |
virtual ComponentPeer * | createNewPeer (int styleFlags, void *nativeWindowToAttachTo) |
![]() | |
virtual bool | shouldDropFilesWhenDraggedExternally (const DragAndDropTarget::SourceDetails &sourceDetails, StringArray &files, bool &canMoveFiles) |
virtual void | dragOperationStarted () |
virtual void | dragOperationEnded () |
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.
enum 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.
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. |
Flags used by the showCustomisationDialog() method.
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.
Toolbar::~Toolbar | ( | ) |
Destructor.
Any items on the bar will be deleted when the toolbar is deleted.
void Toolbar::addDefaultItems | ( | ToolbarItemFactory & | factoryToUse | ) |
Clears this toolbar and adds to it the default set of items that the specified factory creates.
void 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.
void Toolbar::clear | ( | ) |
Deletes all items from the bar.
|
static |
|
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.
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.
|
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.
|
noexcept |
Returns the number of items currently on the toolbar.
|
inlinenoexcept |
Returns the toolbar's current style.
|
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.
|
overridevirtual |
Callback to check whether this target is interested in the type of object being dragged.
dragSourceDetails | contains information about the source of the drag operation. |
Implements DragAndDropTarget.
|
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().
|
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.
dragSourceDetails | contains information about the source of the drag operation. |
Reimplemented from DragAndDropTarget.
|
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.
dragSourceDetails | contains information about the source of the drag operation. |
Reimplemented from DragAndDropTarget.
|
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.
dragSourceDetails | contains information about the source of the drag operation. |
Implements DragAndDropTarget.
|
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.
event | details about the position and status of the mouse event, including the source component in which it occurred |
Reimplemented from Component.
|
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().
g | the graphics context that must be used to do the drawing operations. |
Reimplemented from Component.
ToolbarItemComponent * Toolbar::removeAndReturnItem | ( | int | itemIndex | ) |
Removes an item from the bar and returns it.
void Toolbar::removeToolbarItem | ( | int | itemIndex | ) |
Deletes one of the items from the bar.
|
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.
Reimplemented from Component.
bool 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.
void 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).
void Toolbar::setStyle | ( | const ToolbarItemStyle & | newStyle | ) |
Changes the toolbar's current style.
void Toolbar::setVertical | ( | bool | shouldBeVertical | ) |
Changes the bar's orientation.
void 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.
String 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().
void Toolbar::updateAllItemPositions | ( | bool | animate | ) |
|
friend |