A component that acts as a rectangular selection region, which you drag with the mouse to select groups of objects (in conjunction with a SelectedItemSet). More...
Inherits Component.
Public Types | |
| enum | ColourIds { lassoFillColourId = 0x1000440, lassoOutlineColourId = 0x1000441 } |
A set of colour IDs to use to change the colour of various aspects of the label. More... | |
Public Member Functions | |
| LassoComponent (const int outlineThickness_=1) | |
| Creates a Lasso component. | |
| ~LassoComponent () | |
| Destructor. | |
| void | beginLasso (const MouseEvent &e, LassoSource< SelectableItemType > *const lassoSource) |
| Call this in your mouseDown event, to initialise a drag. | |
| void | dragLasso (const MouseEvent &e) |
| Call this in your mouseDrag event, to update the lasso's position. | |
| void | endLasso () |
| Call this in your mouseUp event, after the lasso has been dragged. | |
| void | paint (Graphics &g) |
| bool | hitTest (int x, int y) |
A component that acts as a rectangular selection region, which you drag with the mouse to select groups of objects (in conjunction with a SelectedItemSet).
To use one of these:
The class takes into account the modifier keys that are being held down while the lasso is being dragged, so if shift is pressed, then any lassoed items will be added to the original selection; if ctrl or command is pressed, they will be xor'ed with any previously selected items.
| enum LassoComponent::ColourIds |
A set of colour IDs to use to change the colour of various aspects of the label.
These constants can be used either via the Component::setColour(), or LookAndFeel::setColour() methods.
Note that you can also use the constants from TextEditor::ColourIds to change the colour of the text editor that is opened when a label is editable.
| LassoComponent< SelectableItemType >::LassoComponent | ( | const int | outlineThickness_ = 1 |
) | [explicit] |
Creates a Lasso component.
The fill colour is used to fill the lasso'ed rectangle, and the outline colour is used to draw a line around its edge.
| LassoComponent< SelectableItemType >::~LassoComponent | ( | ) |
Destructor.
| void LassoComponent< SelectableItemType >::beginLasso | ( | const MouseEvent & | e, | |
| LassoSource< SelectableItemType > *const | lassoSource | |||
| ) |
Call this in your mouseDown event, to initialise a drag.
Pass in a suitable LassoSource object which the lasso will use to find the items and change the selection.
After using this method to initialise the lasso, repeatedly call dragLasso() in your component's mouseDrag callback.
References LassoSource< SelectableItemType >::getLassoSelection(), Component::getParentComponent(), jassert, and Component::setSize().
| void LassoComponent< SelectableItemType >::dragLasso | ( | const MouseEvent & | e | ) |
Call this in your mouseDrag event, to update the lasso's position.
This must be repeatedly calling when the mouse is dragged, after you've first initialised the lasso with beginLasso().
This method takes into account the modifier keys that are being held down, so if shift is pressed, then the lassoed items will be added to any that were previously selected; if ctrl or command is pressed, then they will be xor'ed with previously selected items.
References Array< ElementType, TypeOfCriticalSectionToUse >::addArray(), Component::getHeight(), MouseEvent::getMouseDownPosition(), MouseEvent::getPosition(), Component::getWidth(), Component::getX(), Component::getY(), ModifierKeys::isAltDown(), ModifierKeys::isCommandDown(), ModifierKeys::isShiftDown(), MouseEvent::mods, Array< ElementType, TypeOfCriticalSectionToUse >::removeValuesIn(), Component::setBounds(), and Component::setVisible().
| void LassoComponent< SelectableItemType >::endLasso | ( | ) |
Call this in your mouseUp event, after the lasso has been dragged.
References Array< ElementType, TypeOfCriticalSectionToUse >::clear(), and Component::setVisible().
| void LassoComponent< SelectableItemType >::paint | ( | Graphics & | g | ) | [virtual] |
For internal use only.
Reimplemented from Component.
References Graphics::drawRect(), Graphics::fillAll(), Component::findColour(), Component::getHeight(), Component::getWidth(), Component::isMouseButtonDownAnywhere(), jassert, LassoComponent< SelectableItemType >::lassoFillColourId, LassoComponent< SelectableItemType >::lassoOutlineColourId, and Graphics::setColour().
| bool LassoComponent< SelectableItemType >::hitTest | ( | int | x, | |
| int | y | |||
| ) | [virtual] |
For internal use only.
Reimplemented from Component.
1.6.3