openshot-audio
0.1.5
|
#include <juce_SelectedItemSet.h>
Public Types | |
typedef SelectableItemType | ItemType |
typedef Array< SelectableItemType > | ItemArray |
Public Member Functions | |
typedef | PARAMETER_TYPE (SelectableItemType) ParameterType |
SelectedItemSet () | |
SelectedItemSet (const ItemArray &items) | |
SelectedItemSet (const SelectedItemSet &other) | |
SelectedItemSet & | operator= (const SelectedItemSet &other) |
void | selectOnly (ParameterType item) |
void | addToSelection (ParameterType item) |
void | addToSelectionBasedOnModifiers (ParameterType item, ModifierKeys modifiers) |
bool | addToSelectionOnMouseDown (ParameterType item, ModifierKeys modifiers) |
void | addToSelectionOnMouseUp (ParameterType item, ModifierKeys modifiers, const bool wasItemDragged, const bool resultOfMouseDownSelectMethod) |
void | deselect (ParameterType item) |
void | deselectAll () |
int | getNumSelected () const noexcept |
SelectableItemType | getSelectedItem (const int index) const |
bool | isSelected (ParameterType item) const noexcept |
const ItemArray & | getItemArray () const noexcept |
SelectableItemType * | begin () const noexcept |
SelectableItemType * | end () const noexcept |
virtual void | itemSelected (SelectableItemType) |
virtual void | itemDeselected (SelectableItemType) |
void | changed () |
void | changed (const bool synchronous) |
![]() | |
ChangeBroadcaster () noexcept | |
virtual | ~ChangeBroadcaster () |
void | addChangeListener (ChangeListener *listener) |
void | removeChangeListener (ChangeListener *listener) |
void | removeAllChangeListeners () |
void | sendChangeMessage () |
void | sendSynchronousChangeMessage () |
void | dispatchPendingMessages () |
Manages a list of selectable items.
Use one of these to keep a track of things that the user has highlighted, like icons or things in a list.
The class is templated so that you can use it to hold either a set of pointers to objects, or a set of ID numbers or handles, for cases where each item may not always have a corresponding object.
To be informed when items are selected/deselected, register a ChangeListener with this object.
typedef Array<SelectableItemType> SelectedItemSet< SelectableItemType >::ItemArray |
typedef SelectableItemType SelectedItemSet< SelectableItemType >::ItemType |
|
inline |
Creates an empty set.
|
inlineexplicit |
Creates a set based on an array of items.
|
inline |
Creates a copy of another set.
|
inline |
Selects an item. If the item is already selected, no change notification will be sent out.
|
inline |
Selects or deselects an item.
This will use the modifier keys to decide whether to deselect other items first.
So if the shift key is held down, the item will be added without deselecting anything (same as calling addToSelection() )
If no modifiers are down, the current selection will be cleared first (same as calling selectOnly() )
If the ctrl (or command on the Mac) key is held down, the item will be toggled - so it'll be added to the set unless it's already there, in which case it'll be deselected.
If the items that you're selecting can also be dragged, you may need to use the addToSelectionOnMouseDown() and addToSelectionOnMouseUp() calls to handle the subtleties of this kind of usage.
|
inline |
Selects or deselects items that can also be dragged, based on a mouse-down event.
If you call addToSelectionOnMouseDown() at the start of your mouseDown event, and then call addToSelectionOnMouseUp() at the end of your mouseUp event, this makes it easy to handle multiple-selection of sets of objects that can also be dragged.
For example, if you have several items already selected, and you click on one of them (without dragging), then you'd expect this to deselect the other, and just select the item you clicked on. But if you had clicked on this item and dragged it, you'd have expected them all to stay selected.
When you call this method, you'll need to store the boolean result, because the addToSelectionOnMouseUp() method will need to be know this value.
|
inline |
Selects or deselects items that can also be dragged, based on a mouse-up event.
Call this during a mouseUp callback, when you have previously called the addToSelectionOnMouseDown() method during your mouseDown event.
See addToSelectionOnMouseDown() for more info
item | the item to select (or deselect) |
modifiers | the modifiers from the mouse-up event |
wasItemDragged | true if your item was dragged during the mouse click |
resultOfMouseDownSelectMethod | this is the boolean return value that came back from the addToSelectionOnMouseDown() call that you should have made during the matching mouseDown event |
|
inlinenoexcept |
Provides iterator access to the array of items.
|
inline |
Used internally, but can be called to force a change message to be sent to the ChangeListeners.
|
inline |
Used internally, but can be called to force a change message to be sent to the ChangeListeners.
|
inline |
Deselects an item.
|
inline |
Deselects all items.
|
inlinenoexcept |
Provides iterator access to the array of items.
|
inlinenoexcept |
Provides access to the array of items.
|
inlinenoexcept |
Returns the number of currently selected items.
|
inline |
Returns one of the currently selected items. If the index is out-of-range, this returns a default-constructed SelectableItemType.
|
inlinenoexcept |
True if this item is currently selected.
|
inlinevirtual |
Can be overridden to do special handling when an item is deselected.
For example, if the item is an object, you might want to call it and tell it that it's being deselected.
|
inlinevirtual |
Can be overridden to do special handling when an item is selected.
For example, if the item is an object, you might want to call it and tell it that it's being selected.
|
inline |
Creates a copy of another set.
typedef SelectedItemSet< SelectableItemType >::PARAMETER_TYPE | ( | SelectableItemType | ) |
|
inline |
Clears any other currently selected items, and selects this item.
If this item is already the only thing selected, no change notification will be sent out.