A user-defined copmonent that can be used as an item in a popup menu. More...
Inherits Component, and SingleThreadedReferenceCountedObject.
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) |
A user-defined copmonent that can be used as an item in a popup menu.
| 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.
| 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.
| bool PopupMenu::CustomComponent::isItemHighlighted | ( | ) | const |
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.
| bool PopupMenu::CustomComponent::isTriggeredAutomatically | ( | ) | const |
| void PopupMenu::CustomComponent::setHighlighted | ( | bool | shouldBeHighlighted | ) |