JUCE
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Defines
Public Member Functions
PopupMenu::CustomComponent Class Reference

A user-defined copmonent that can be used as an item in a popup menu. More...

Inherits Component, and SingleThreadedReferenceCountedObject.

List of all members.

Public Member Functions

 CustomComponent (bool isTriggeredAutomatically=true)
 Creates a custom item.
 ~CustomComponent ()
 Destructor.
virtual void getIdealSize (int &idealWidth, int &idealHeight)=0
 Returns a rectangle with the size that this component would like to have.
void triggerMenuItem ()
 Dismisses the menu, indicating that this item has been chosen.
bool isItemHighlighted () const noexcept
 Returns true if this item should be highlighted because the mouse is over it.
bool isTriggeredAutomatically () const noexcept
void setHighlighted (bool shouldBeHighlighted)

Detailed Description

A user-defined copmonent that can be used as an item in a popup menu.

See also:
PopupMenu::addCustomItem

Constructor & Destructor Documentation

PopupMenu::CustomComponent::CustomComponent ( bool  isTriggeredAutomatically = true)

Creates a custom item.

If isTriggeredAutomatically is true, then the menu will automatically detect a mouse-click on this component and use that to invoke the menu item. If it's false, then it's up to your class to manually trigger the item when it wants to.

Destructor.


Member Function Documentation

virtual void PopupMenu::CustomComponent::getIdealSize ( int &  idealWidth,
int &  idealHeight 
) [pure virtual]

Returns a rectangle with the size that this component would like to have.

Note that the size which this method returns isn't necessarily the one that the menu will give it, as the items will be stretched to have a uniform width.

Dismisses the menu, indicating that this item has been chosen.

This will cause the menu to exit from its modal state, returning this item's id as the result.

Returns true if this item should be highlighted because the mouse is over it.

You can call this method in your paint() method to find out whether to draw a highlight.

void PopupMenu::CustomComponent::setHighlighted ( bool  shouldBeHighlighted)

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