A component that resizes its parent component when dragged. More...
Inherits Component.
Classes | |
| class | Zone |
| Represents the different sections of a resizable border, which allow it to resized in different ways. More... | |
Public Member Functions | |
| ResizableBorderComponent (Component *componentToResize, ComponentBoundsConstrainer *constrainer) | |
| Creates a resizer. | |
| ~ResizableBorderComponent () | |
| Destructor. | |
| void | setBorderThickness (const BorderSize< int > &newBorderSize) |
| Specifies how many pixels wide the draggable edges of this component are. | |
| BorderSize< int > | getBorderThickness () const |
| Returns the number of pixels wide that the draggable edges of this component are. | |
Protected Member Functions | |
| void | paint (Graphics &g) |
| void | mouseEnter (const MouseEvent &e) |
| void | mouseMove (const MouseEvent &e) |
| void | mouseDown (const MouseEvent &e) |
| void | mouseDrag (const MouseEvent &e) |
| void | mouseUp (const MouseEvent &e) |
| bool | hitTest (int x, int y) |
A component that resizes its parent component when dragged.
This component forms a frame around the edge of a component, allowing it to be dragged by the edges or corners to resize it - like the way windows are resized in MSWindows or Linux.
To use it, just add it to your component, making it fill the entire parent component (there's a mouse hit-test that only traps mouse-events which land around the edge of the component, so it's even ok to put it on top of any other components you're using). Make sure you rescale the resizer component to fill the parent each time the parent's size changes.
| ResizableBorderComponent::ResizableBorderComponent | ( | Component * | componentToResize, |
| ComponentBoundsConstrainer * | constrainer | ||
| ) |
Creates a resizer.
Pass in the target component which you want to be resized when this one is dragged.
The target component will usually be a parent of the resizer component, 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.
| void ResizableBorderComponent::setBorderThickness | ( | const BorderSize< int > & | newBorderSize | ) |
Specifies how many pixels wide the draggable edges of this component are.
| BorderSize<int> ResizableBorderComponent::getBorderThickness | ( | ) | const |
Returns the number of pixels wide that the draggable edges of this component are.
| void ResizableBorderComponent::paint | ( | Graphics & | g | ) | [protected, virtual] |
Reimplemented from Component.
| void ResizableBorderComponent::mouseEnter | ( | const MouseEvent & | e | ) | [protected, virtual] |
Reimplemented from Component.
| void ResizableBorderComponent::mouseMove | ( | const MouseEvent & | e | ) | [protected, virtual] |
Reimplemented from Component.
| void ResizableBorderComponent::mouseDown | ( | const MouseEvent & | e | ) | [protected, virtual] |
Reimplemented from Component.
| void ResizableBorderComponent::mouseDrag | ( | const MouseEvent & | e | ) | [protected, virtual] |
Reimplemented from Component.
| void ResizableBorderComponent::mouseUp | ( | const MouseEvent & | e | ) | [protected, virtual] |
Reimplemented from Component.
| bool ResizableBorderComponent::hitTest | ( | int | x, |
| int | y | ||
| ) | [protected, virtual] |
Reimplemented from Component.