A box with a small arrow that can be used as a temporary pop-up window to show extra controls when a button or other component is clicked. More...
Inherits Component.
Public Member Functions | |
| CallOutBox (Component &contentComponent, Component &componentToPointTo, Component *parentComponent) | |
| Creates a CallOutBox. | |
| ~CallOutBox () | |
| Destructor. | |
| void | setArrowSize (float newSize) |
| Changes the length of the arrow. | |
| void | updatePosition (const Rectangle< int > &newAreaToPointTo, const Rectangle< int > &newAreaToFitIn) |
| Updates the position and size of the box. | |
| void | paint (Graphics &g) |
| void | resized () |
| void | moved () |
| void | childBoundsChanged (Component *) |
| bool | hitTest (int x, int y) |
| void | inputAttemptWhenModal () |
| bool | keyPressed (const KeyPress &key) |
| void | handleCommandMessage (int commandId) |
A box with a small arrow that can be used as a temporary pop-up window to show extra controls when a button or other component is clicked.
Using one of these is similar to having a popup menu attached to a button or other component - but it looks fancier, and has an arrow that can indicate the object that it applies to.
Normally, you'd create one of these on the stack and run it modally, e.g.
void mouseUp (const MouseEvent& e) { MyContentComponent content; content.setSize (300, 300); CallOutBox callOut (content, *this, nullptr); callOut.runModalLoop(); }
The call-out will resize and position itself when the content changes size.
| CallOutBox::CallOutBox | ( | Component & | contentComponent, |
| Component & | componentToPointTo, | ||
| Component * | parentComponent | ||
| ) |
Creates a CallOutBox.
| contentComponent | the component to display inside the call-out. This should already have a size set (although the call-out will also update itself when the component's size is changed later). Obviously this component must not be deleted until the call-out box has been deleted. |
| componentToPointTo | the component that the call-out's arrow should point towards |
| parentComponent | if non-zero, this is the component to add the call-out to. If this is zero, the call-out will be added to the desktop. |
Destructor.
| void CallOutBox::setArrowSize | ( | float | newSize | ) |
Changes the length of the arrow.
| void CallOutBox::updatePosition | ( | const Rectangle< int > & | newAreaToPointTo, |
| const Rectangle< int > & | newAreaToFitIn | ||
| ) |
Updates the position and size of the box.
You shouldn't normally need to call this, unless you need more precise control over the layout.
| newAreaToPointTo | the rectangle to make the box's arrow point to |
| newAreaToFitIn | the area within which the box's position should be constrained |
| void CallOutBox::paint | ( | Graphics & | g | ) | [virtual] |
Reimplemented from Component.
| void CallOutBox::resized | ( | ) | [virtual] |
Reimplemented from Component.
| void CallOutBox::moved | ( | ) | [virtual] |
Reimplemented from Component.
| void CallOutBox::childBoundsChanged | ( | Component * | ) | [virtual] |
Reimplemented from Component.
| bool CallOutBox::hitTest | ( | int | x, |
| int | y | ||
| ) | [virtual] |
Reimplemented from Component.
| void CallOutBox::inputAttemptWhenModal | ( | ) | [virtual] |
Reimplemented from Component.
| bool CallOutBox::keyPressed | ( | const KeyPress & | key | ) | [virtual] |
Reimplemented from Component.
| void CallOutBox::handleCommandMessage | ( | int | commandId | ) | [virtual] |
Reimplemented from Component.