Describes a popup menu item. More...
#include <juce_PopupMenu.h>
Public Member Functions | |
Item () | |
Creates a null item. More... | |
Item (const Item &) | |
Item (Item &&) | |
Item (String text) | |
Creates an item with the given text. More... | |
Item & | operator= (const Item &) |
Item & | operator= (Item &&) |
Item && | setAction (std::function< void()> action) &&noexcept |
Sets the action property (and returns a reference to this item to allow chaining). More... | |
Item & | setAction (std::function< void()> action) &noexcept |
Sets the action property (and returns a reference to this item to allow chaining). More... | |
Item && | setColour (Colour) &&noexcept |
Sets the colour property (and returns a reference to this item to allow chaining). More... | |
Item & | setColour (Colour) &noexcept |
Sets the colour property (and returns a reference to this item to allow chaining). More... | |
Item && | setCustomComponent (ReferenceCountedObjectPtr< CustomComponent > customComponent) &&noexcept |
Sets the customComponent property (and returns a reference to this item to allow chaining). More... | |
Item & | setCustomComponent (ReferenceCountedObjectPtr< CustomComponent > customComponent) &noexcept |
Sets the customComponent property (and returns a reference to this item to allow chaining). More... | |
Item && | setEnabled (bool shouldBeEnabled) &&noexcept |
Sets the isEnabled flag (and returns a reference to this item to allow chaining). More... | |
Item & | setEnabled (bool shouldBeEnabled) &noexcept |
Sets the isEnabled flag (and returns a reference to this item to allow chaining). More... | |
Item && | setID (int newID) &&noexcept |
Sets the itemID property (and returns a reference to this item to allow chaining). More... | |
Item & | setID (int newID) &noexcept |
Sets the itemID property (and returns a reference to this item to allow chaining). More... | |
Item && | setImage (std::unique_ptr< Drawable >) &&noexcept |
Sets the image property (and returns a reference to this item to allow chaining). More... | |
Item & | setImage (std::unique_ptr< Drawable >) &noexcept |
Sets the image property (and returns a reference to this item to allow chaining). More... | |
Item && | setTicked (bool shouldBeTicked=true) &&noexcept |
Sets the isTicked flag (and returns a reference to this item to allow chaining). More... | |
Item & | setTicked (bool shouldBeTicked=true) &noexcept |
Sets the isTicked flag (and returns a reference to this item to allow chaining). More... | |
Public Attributes | |
std::function< void()> | action |
An optional function which should be invoked when this menu item is triggered. More... | |
Colour | colour |
A colour to use to draw the menu text. More... | |
ApplicationCommandManager * | commandManager = nullptr |
A command manager to use to automatically invoke the command, or nullptr if none is specified. More... | |
ReferenceCountedObjectPtr< CustomCallback > | customCallback |
A custom callback for the item to use, or nullptr if there isn't one. More... | |
ReferenceCountedObjectPtr< CustomComponent > | customComponent |
A custom component for the item to display, or nullptr if there isn't one. More... | |
std::unique_ptr< Drawable > | image |
A drawable to use as an icon, or nullptr if there isn't one. More... | |
bool | isEnabled = true |
True if this menu item is enabled. More... | |
bool | isSectionHeader = false |
True if this menu item is a section header. More... | |
bool | isSeparator = false |
True if this menu item is a separator line. More... | |
bool | isTicked = false |
True if this menu item should have a tick mark next to it. More... | |
int | itemID = 0 |
The menu item's ID. More... | |
String | shortcutKeyDescription |
An optional string describing the shortcut key for this item. More... | |
bool | shouldBreakAfter = false |
True if this is the final item in the current column. More... | |
std::unique_ptr< PopupMenu > | subMenu |
A sub-menu, or nullptr if there isn't one. More... | |
String | text |
The menu item's name. More... | |
Describes a popup menu item.
juce::PopupMenu::Item::Item | ( | ) |
juce::PopupMenu::Item::Item | ( | String | text | ) |
Creates an item with the given text.
This constructor also initialises the itemID to -1, which makes it suitable for creating lambda-based item actions.
juce::PopupMenu::Item::Item | ( | const Item & | ) |
juce::PopupMenu::Item::Item | ( | Item && | ) |
|
noexcept |
Sets the action property (and returns a reference to this item to allow chaining).
|
noexcept |
Sets the action property (and returns a reference to this item to allow chaining).
Sets the colour property (and returns a reference to this item to allow chaining).
Sets the colour property (and returns a reference to this item to allow chaining).
|
noexcept |
Sets the customComponent property (and returns a reference to this item to allow chaining).
|
noexcept |
Sets the customComponent property (and returns a reference to this item to allow chaining).
Sets the isEnabled flag (and returns a reference to this item to allow chaining).
Sets the isEnabled flag (and returns a reference to this item to allow chaining).
Sets the itemID property (and returns a reference to this item to allow chaining).
Sets the itemID property (and returns a reference to this item to allow chaining).
Sets the image property (and returns a reference to this item to allow chaining).
Sets the image property (and returns a reference to this item to allow chaining).
Sets the isTicked flag (and returns a reference to this item to allow chaining).
Sets the isTicked flag (and returns a reference to this item to allow chaining).
std::function<void()> juce::PopupMenu::Item::action |
An optional function which should be invoked when this menu item is triggered.
Colour juce::PopupMenu::Item::colour |
A colour to use to draw the menu text.
By default this is transparent black, which means that the LookAndFeel should choose the colour.
ApplicationCommandManager* juce::PopupMenu::Item::commandManager = nullptr |
A command manager to use to automatically invoke the command, or nullptr if none is specified.
ReferenceCountedObjectPtr<CustomCallback> juce::PopupMenu::Item::customCallback |
A custom callback for the item to use, or nullptr if there isn't one.
ReferenceCountedObjectPtr<CustomComponent> juce::PopupMenu::Item::customComponent |
A custom component for the item to display, or nullptr if there isn't one.
std::unique_ptr<Drawable> juce::PopupMenu::Item::image |
A drawable to use as an icon, or nullptr if there isn't one.
bool juce::PopupMenu::Item::isEnabled = true |
True if this menu item is enabled.
bool juce::PopupMenu::Item::isSectionHeader = false |
True if this menu item is a section header.
bool juce::PopupMenu::Item::isSeparator = false |
True if this menu item is a separator line.
bool juce::PopupMenu::Item::isTicked = false |
True if this menu item should have a tick mark next to it.
int juce::PopupMenu::Item::itemID = 0 |
The menu item's ID.
This must not be 0 if you want the item to be triggerable, but if you're attaching an action callback to the item, you can set the itemID to -1 to indicate that it isn't actively needed.
String juce::PopupMenu::Item::shortcutKeyDescription |
An optional string describing the shortcut key for this item.
This is only used for displaying at the right-hand edge of a menu item - the menu won't attempt to actually catch or process the key. If you supply a commandManager parameter then the menu will attempt to fill-in this field automatically.
bool juce::PopupMenu::Item::shouldBreakAfter = false |
True if this is the final item in the current column.
std::unique_ptr<PopupMenu> juce::PopupMenu::Item::subMenu |
A sub-menu, or nullptr if there isn't one.
String juce::PopupMenu::Item::text |
The menu item's name.