JUCE-7.0.12-0-g4f43011b96 JUCE-7.0.12-0-g4f43011b96
JUCE — C++ application framework with suport for VST, VST3, LV2 audio plug-ins

« « « Anklang Documentation
Loading...
Searching...
No Matches
Public Member Functions | Public Attributes | List of all members
juce::PopupMenu::Item Struct Reference

Describes a popup menu item. More...

#include "juce_PopupMenu.h"

Public Member Functions

 Item ()
 Creates a null item.
 
 Item (String text)
 Creates an item with the given text.
 
 Item (const Item &)
 
Itemoperator= (const Item &)
 
 Item (Item &&)
 
Itemoperator= (Item &&)
 
ItemsetTicked (bool shouldBeTicked=true) &noexcept
 Sets the isTicked flag (and returns a reference to this item to allow chaining).
 
ItemsetEnabled (bool shouldBeEnabled) &noexcept
 Sets the isEnabled flag (and returns a reference to this item to allow chaining).
 
ItemsetAction (std::function< void()> action) &noexcept
 Sets the action property (and returns a reference to this item to allow chaining).
 
ItemsetID (int newID) &noexcept
 Sets the itemID property (and returns a reference to this item to allow chaining).
 
ItemsetColour (Colour) &noexcept
 Sets the colour property (and returns a reference to this item to allow chaining).
 
ItemsetCustomComponent (ReferenceCountedObjectPtr< CustomComponent > customComponent) &noexcept
 Sets the customComponent property (and returns a reference to this item to allow chaining).
 
ItemsetImage (std::unique_ptr< Drawable >) &noexcept
 Sets the image property (and returns a reference to this item to allow chaining).
 
Item && setTicked (bool shouldBeTicked=true) &&noexcept
 Sets the isTicked flag (and returns a reference to this item to allow chaining).
 
Item && setEnabled (bool shouldBeEnabled) &&noexcept
 Sets the isEnabled flag (and returns a reference to this item to allow chaining).
 
Item && setAction (std::function< void()> action) &&noexcept
 Sets the action property (and returns a reference to this item to allow chaining).
 
Item && setID (int newID) &&noexcept
 Sets the itemID property (and returns a reference to this item to allow chaining).
 
Item && setColour (Colour) &&noexcept
 Sets the colour property (and returns a reference to this item to allow chaining).
 
Item && setCustomComponent (ReferenceCountedObjectPtr< CustomComponent > customComponent) &&noexcept
 Sets the customComponent property (and returns a reference to this item to allow chaining).
 
Item && setImage (std::unique_ptr< Drawable >) &&noexcept
 Sets the image property (and returns a reference to this item to allow chaining).
 

Public Attributes

String text
 The menu item's name.
 
int itemID
 The menu item's ID.
 
std::function< void()> action
 An optional function which should be invoked when this menu item is triggered.
 
std::unique_ptr< PopupMenusubMenu
 A sub-menu, or nullptr if there isn't one.
 
std::unique_ptr< Drawableimage
 A drawable to use as an icon, or nullptr if there isn't one.
 
ReferenceCountedObjectPtr< CustomComponentcustomComponent
 A custom component for the item to display, or nullptr if there isn't one.
 
ReferenceCountedObjectPtr< CustomCallbackcustomCallback
 A custom callback for the item to use, or nullptr if there isn't one.
 
ApplicationCommandManagercommandManager
 A command manager to use to automatically invoke the command, or nullptr if none is specified.
 
String shortcutKeyDescription
 An optional string describing the shortcut key for this item.
 
Colour colour
 A colour to use to draw the menu text.
 
bool isEnabled
 True if this menu item is enabled.
 
bool isTicked
 True if this menu item should have a tick mark next to it.
 
bool isSeparator
 True if this menu item is a separator line.
 
bool isSectionHeader
 True if this menu item is a section header.
 
bool shouldBreakAfter
 True if this is the final item in the current column.
 

Detailed Description

Describes a popup menu item.

Definition at line 110 of file juce_PopupMenu.h.

Constructor & Destructor Documentation

◆ Item() [1/3]

juce::PopupMenu::Item::Item ( )
default

Creates a null item.

You'll need to set some fields after creating an Item before you can add it to a PopupMenu

◆ Item() [2/3]

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.

Definition at line 1642 of file juce_PopupMenu.cpp.

◆ Item() [3/3]

juce::PopupMenu::Item::Item ( const Item other)

Definition at line 1647 of file juce_PopupMenu.cpp.

Member Function Documentation

◆ operator=()

PopupMenu::Item & juce::PopupMenu::Item::operator= ( const Item other)

Definition at line 1665 of file juce_PopupMenu.cpp.

◆ setAction() [1/2]

PopupMenu::Item && juce::PopupMenu::Item::setAction ( std::function< void()>  action) &&
noexcept

Sets the action property (and returns a reference to this item to allow chaining).

Definition at line 1739 of file juce_PopupMenu.cpp.

◆ setAction() [2/2]

PopupMenu::Item & juce::PopupMenu::Item::setAction ( std::function< void()>  action) &
noexcept

Sets the action property (and returns a reference to this item to allow chaining).

Definition at line 1697 of file juce_PopupMenu.cpp.

◆ setColour() [1/2]

PopupMenu::Item && juce::PopupMenu::Item::setColour ( Colour  newColour) &&
noexcept

Sets the colour property (and returns a reference to this item to allow chaining).

Definition at line 1751 of file juce_PopupMenu.cpp.

◆ setColour() [2/2]

PopupMenu::Item & juce::PopupMenu::Item::setColour ( Colour  newColour) &
noexcept

Sets the colour property (and returns a reference to this item to allow chaining).

Definition at line 1709 of file juce_PopupMenu.cpp.

◆ setCustomComponent() [1/2]

PopupMenu::Item && juce::PopupMenu::Item::setCustomComponent ( ReferenceCountedObjectPtr< CustomComponent customComponent) &&
noexcept

Sets the customComponent property (and returns a reference to this item to allow chaining).

Definition at line 1757 of file juce_PopupMenu.cpp.

◆ setCustomComponent() [2/2]

PopupMenu::Item & juce::PopupMenu::Item::setCustomComponent ( ReferenceCountedObjectPtr< CustomComponent customComponent) &
noexcept

Sets the customComponent property (and returns a reference to this item to allow chaining).

Definition at line 1715 of file juce_PopupMenu.cpp.

◆ setEnabled() [1/2]

PopupMenu::Item && juce::PopupMenu::Item::setEnabled ( bool  shouldBeEnabled) &&
noexcept

Sets the isEnabled flag (and returns a reference to this item to allow chaining).

Definition at line 1733 of file juce_PopupMenu.cpp.

◆ setEnabled() [2/2]

PopupMenu::Item & juce::PopupMenu::Item::setEnabled ( bool  shouldBeEnabled) &
noexcept

Sets the isEnabled flag (and returns a reference to this item to allow chaining).

Definition at line 1691 of file juce_PopupMenu.cpp.

◆ setID() [1/2]

PopupMenu::Item && juce::PopupMenu::Item::setID ( int  newID) &&
noexcept

Sets the itemID property (and returns a reference to this item to allow chaining).

Definition at line 1745 of file juce_PopupMenu.cpp.

◆ setID() [2/2]

PopupMenu::Item & juce::PopupMenu::Item::setID ( int  newID) &
noexcept

Sets the itemID property (and returns a reference to this item to allow chaining).

Definition at line 1703 of file juce_PopupMenu.cpp.

◆ setImage() [1/2]

PopupMenu::Item && juce::PopupMenu::Item::setImage ( std::unique_ptr< Drawable newImage) &&
noexcept

Sets the image property (and returns a reference to this item to allow chaining).

Definition at line 1763 of file juce_PopupMenu.cpp.

◆ setImage() [2/2]

PopupMenu::Item & juce::PopupMenu::Item::setImage ( std::unique_ptr< Drawable newImage) &
noexcept

Sets the image property (and returns a reference to this item to allow chaining).

Definition at line 1721 of file juce_PopupMenu.cpp.

◆ setTicked() [1/2]

PopupMenu::Item && juce::PopupMenu::Item::setTicked ( bool  shouldBeTicked = true) &&
noexcept

Sets the isTicked flag (and returns a reference to this item to allow chaining).

Definition at line 1727 of file juce_PopupMenu.cpp.

◆ setTicked() [2/2]

PopupMenu::Item & juce::PopupMenu::Item::setTicked ( bool  shouldBeTicked = true) &
noexcept

Sets the isTicked flag (and returns a reference to this item to allow chaining).

Definition at line 1685 of file juce_PopupMenu.cpp.

Member Data Documentation

◆ action

std::function<void()> juce::PopupMenu::Item::action

An optional function which should be invoked when this menu item is triggered.

Definition at line 140 of file juce_PopupMenu.h.

◆ colour

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.

Definition at line 168 of file juce_PopupMenu.h.

◆ commandManager

ApplicationCommandManager* juce::PopupMenu::Item::commandManager

A command manager to use to automatically invoke the command, or nullptr if none is specified.

Definition at line 155 of file juce_PopupMenu.h.

◆ customCallback

ReferenceCountedObjectPtr<CustomCallback> juce::PopupMenu::Item::customCallback

A custom callback for the item to use, or nullptr if there isn't one.

Definition at line 152 of file juce_PopupMenu.h.

◆ customComponent

ReferenceCountedObjectPtr<CustomComponent> juce::PopupMenu::Item::customComponent

A custom component for the item to display, or nullptr if there isn't one.

Definition at line 149 of file juce_PopupMenu.h.

◆ image

std::unique_ptr<Drawable> juce::PopupMenu::Item::image

A drawable to use as an icon, or nullptr if there isn't one.

Definition at line 146 of file juce_PopupMenu.h.

◆ isEnabled

bool juce::PopupMenu::Item::isEnabled

True if this menu item is enabled.

Definition at line 171 of file juce_PopupMenu.h.

◆ isSectionHeader

bool juce::PopupMenu::Item::isSectionHeader

True if this menu item is a section header.

Definition at line 180 of file juce_PopupMenu.h.

◆ isSeparator

bool juce::PopupMenu::Item::isSeparator

True if this menu item is a separator line.

Definition at line 177 of file juce_PopupMenu.h.

◆ isTicked

bool juce::PopupMenu::Item::isTicked

True if this menu item should have a tick mark next to it.

Definition at line 174 of file juce_PopupMenu.h.

◆ itemID

int juce::PopupMenu::Item::itemID

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.

Definition at line 137 of file juce_PopupMenu.h.

◆ shortcutKeyDescription

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.

Definition at line 163 of file juce_PopupMenu.h.

◆ shouldBreakAfter

bool juce::PopupMenu::Item::shouldBreakAfter

True if this is the final item in the current column.

Definition at line 183 of file juce_PopupMenu.h.

◆ subMenu

std::unique_ptr<PopupMenu> juce::PopupMenu::Item::subMenu

A sub-menu, or nullptr if there isn't one.

Definition at line 143 of file juce_PopupMenu.h.

◆ text

String juce::PopupMenu::Item::text

The menu item's name.

Definition at line 130 of file juce_PopupMenu.h.


The documentation for this struct was generated from the following files: