A component that resizes its parent component when dragged. More...
Inherits Component.
Public Types | |
| enum | Edge { leftEdge, rightEdge, topEdge, bottomEdge } |
Public Member Functions | |
| ResizableEdgeComponent (Component *componentToResize, ComponentBoundsConstrainer *constrainer, Edge edgeToResize) | |
| Creates a resizer bar. | |
| ~ResizableEdgeComponent () | |
| Destructor. | |
| bool | isVertical () const noexcept |
Protected Member Functions | |
| void | paint (Graphics &g) |
| void | mouseDown (const MouseEvent &e) |
| void | mouseDrag (const MouseEvent &e) |
| void | mouseUp (const MouseEvent &e) |
A component that resizes its parent component when dragged.
This component forms a bar along one edge of a component, allowing it to be dragged by that edges to resize it.
To use it, just add it to your component, positioning it along the appropriate edge. Make sure you reposition the resizer component each time the parent's size changes, to keep it in the correct position.
| ResizableEdgeComponent::ResizableEdgeComponent | ( | Component * | componentToResize, |
| ComponentBoundsConstrainer * | constrainer, | ||
| Edge | edgeToResize | ||
| ) |
Creates a resizer bar.
Pass in the target component which you want to be resized when this one is dragged. The target component will usually be this component's parent, but this isn't mandatory.
Remember that when the target component is resized, it'll need to move and resize this component to keep it in place, as this won't happen automatically.
If the constrainer parameter is non-zero, then this object will be used to enforce limits on the size and position that the component can be stretched to. Make sure that the constrainer isn't deleted while still in use by this object.
Destructor.
| bool ResizableEdgeComponent::isVertical | ( | ) | const |
| void ResizableEdgeComponent::paint | ( | Graphics & | g | ) | [protected, virtual] |
Reimplemented from Component.
| void ResizableEdgeComponent::mouseDown | ( | const MouseEvent & | e | ) | [protected, virtual] |
Reimplemented from Component.
| void ResizableEdgeComponent::mouseDrag | ( | const MouseEvent & | e | ) | [protected, virtual] |
Reimplemented from Component.
| void ResizableEdgeComponent::mouseUp | ( | const MouseEvent & | e | ) | [protected, virtual] |
Reimplemented from Component.