A component that acts as one of the vertical or horizontal bars you see being used to resize panels in a window. More...
Inherits Component.
Public Member Functions | |
| StretchableLayoutResizerBar (StretchableLayoutManager *layoutToUse, int itemIndexInLayout, bool isBarVertical) | |
| Creates a resizer bar for use on a specified layout. | |
| ~StretchableLayoutResizerBar () | |
| Destructor. | |
| virtual void | hasBeenMoved () |
| This is called when the bar is dragged. | |
| void | paint (Graphics &g) |
| Components can override this method to draw their content. | |
| void | mouseDown (const MouseEvent &e) |
| Called when a mouse button is pressed while it's over this component. | |
| void | mouseDrag (const MouseEvent &e) |
| Called when the mouse is moved while a button is held down. | |
A component that acts as one of the vertical or horizontal bars you see being used to resize panels in a window.
One of these acts with a StretchableLayoutManager to resize the other components.
| StretchableLayoutResizerBar::StretchableLayoutResizerBar | ( | StretchableLayoutManager * | layoutToUse, |
| int | itemIndexInLayout, | ||
| bool | isBarVertical | ||
| ) |
Creates a resizer bar for use on a specified layout.
| layoutToUse | the layout that will be affected when this bar is dragged |
| itemIndexInLayout | the item index in the layout that corresponds to this bar component. You'll need to set up the item properties in a suitable way for a divider bar, e.g. for an 8-pixel wide bar which, you could call myLayout->setItemLayout (barIndex, 8, 8, 8) |
| isBarVertical | true if it's an upright bar that you drag left and right; false for a horizontal one that you drag up and down |
| StretchableLayoutResizerBar::~StretchableLayoutResizerBar | ( | ) |
Destructor.
| virtual void StretchableLayoutResizerBar::hasBeenMoved | ( | ) | [virtual] |
This is called when the bar is dragged.
This method must update the positions of any components whose position is determined by the StretchableLayoutManager, because they might have just moved.
The default implementation calls the resized() method of this component's parent component, because that's often where you're likely to apply the layout, but it can be overridden for more specific needs.
| void StretchableLayoutResizerBar::paint | ( | Graphics & | g ) | [virtual] |
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.
| void StretchableLayoutResizerBar::mouseDown | ( | const MouseEvent & | e ) | [virtual] |
Called when a mouse button is pressed while it's over this 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.
Once a button is held down, the mouseDrag method will be called when the mouse moves, until the button is released.
| e | details about the position and status of the mouse event |
Reimplemented from Component.
| void StretchableLayoutResizerBar::mouseDrag | ( | const MouseEvent & | e ) | [virtual] |
Called when the mouse is moved while a button is held down.
When a mouse button is pressed inside a component, that component receives mouseDrag callbacks each time the mouse moves, even if the mouse strays outside the component's bounds.
If you want to be able to drag things off the edge of a component and have the component scroll when you get to the edges, the beginDragAutoRepeat() method might be useful.
| e | details about the position and status of the mouse event |
Reimplemented from Component.