JUCE
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Defines
Public Member Functions
CallOutBox Class Reference

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.

List of all members.

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)

Detailed Description

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.


Constructor & Destructor Documentation

CallOutBox::CallOutBox ( Component contentComponent,
Component componentToPointTo,
Component parentComponent 
)

Creates a CallOutBox.

Parameters:
contentComponentthe 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.
componentToPointTothe component that the call-out's arrow should point towards
parentComponentif 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.


Member Function Documentation

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.

Parameters:
newAreaToPointTothe rectangle to make the box's arrow point to
newAreaToFitInthe 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.

Reimplemented from Component.

bool CallOutBox::keyPressed ( const KeyPress key) [virtual]

Reimplemented from Component.

void CallOutBox::handleCommandMessage ( int  commandId) [virtual]

Reimplemented from Component.


The documentation for this class was generated from the following file: