171 bool isEnabled =
true;
174 bool isTicked =
false;
177 bool isSeparator =
false;
180 bool isSectionHeader =
false;
183 bool shouldBreakAfter =
false;
186 Item& setTicked (
bool shouldBeTicked =
true) &
noexcept;
188 Item& setEnabled (
bool shouldBeEnabled) &
noexcept;
192 Item& setID (
int newID) &
noexcept;
201 Item&& setTicked (
bool shouldBeTicked =
true) &&
noexcept;
203 Item&& setEnabled (
bool shouldBeEnabled) &&
noexcept;
207 Item&& setID (
int newID) &&
noexcept;
220 void addItem (
Item newItem);
223 void addItem (
String itemText,
227 void addItem (
String itemText,
244 void addItem (
int itemResultID,
246 bool isEnabled =
true,
247 bool isTicked =
false);
262 void addItem (
int itemResultID,
266 const Image& iconToUse);
282 void addItem (
int itemResultID,
314 void addColouredItem (
int itemResultID,
317 bool isEnabled =
true,
318 bool isTicked =
false,
319 const Image& iconToUse = {});
327 void addColouredItem (
int itemResultID,
329 Colour itemTextColour,
345 void addCustomItem (
int itemResultID,
348 const String& itemTitle = {});
366 void addCustomItem (
int itemResultID,
367 Component& customComponent,
370 bool triggerMenuItemAutomaticallyWhenClicked,
372 const String& itemTitle = {});
380 void addSubMenu (String subMenuName,
382 bool isEnabled =
true);
390 void addSubMenu (String subMenuName,
393 const Image& iconToUse,
394 bool isTicked =
false,
395 int itemResultID = 0);
407 void addSubMenu (String subMenuName,
411 bool isTicked =
false,
412 int itemResultID = 0);
426 void addSectionHeader (String title);
435 void addColumnBreak();
440 int getNumItems() const noexcept;
443 bool containsCommandItem (
int commandID) const;
446 bool containsAnyActiveItems() const noexcept;
469 enum class PopupDirection
490 [[nodiscard]]
Options withTargetComponent (
Component* targetComponent)
const;
491 [[nodiscard]]
Options withTargetComponent (
Component& targetComponent)
const;
515 [[nodiscard]]
Options withMousePosition()
const;
524 [[nodiscard]]
Options withDeletionCheck (
Component& componentToWatchForDeletion)
const;
527 [[nodiscard]]
Options withMinimumWidth (
int minWidth)
const;
530 [[nodiscard]]
Options withMinimumNumColumns (
int minNumColumns)
const;
533 [[nodiscard]]
Options withMaximumNumColumns (
int maxNumColumns)
const;
536 [[nodiscard]]
Options withStandardItemHeight (
int standardHeight)
const;
543 [[nodiscard]]
Options withItemThatMustBeVisible (
int idOfItemToBeVisible)
const;
554 [[nodiscard]]
Options withParentComponent (
Component* parentComponent)
const;
557 [[nodiscard]]
Options withPreferredPopupDirection (PopupDirection direction)
const;
567 [[nodiscard]]
Options withInitiallySelectedItem (
int idOfItemToBeSelected)
const;
574 [[nodiscard]]
Options forSubmenu()
const;
655 int visibleItemID = 0, minWidth = 0, minColumns = 1, maxColumns = 0, standardHeight = 0, initiallySelectedItemId = 0;
656 bool isWatchingForDeletion =
false;
657 PopupDirection preferredPopupDirection = PopupDirection::downwards;
661 #if JUCE_MODAL_LOOPS_PERMITTED
695 int show (
int itemIDThatMustBeVisible = 0,
696 int minimumWidth = 0,
697 int maximumNumColumns = 0,
698 int standardItemHeight = 0,
716 int itemIDThatMustBeVisible = 0,
717 int minimumWidth = 0,
718 int maximumNumColumns = 0,
719 int standardItemHeight = 0,
728 int showAt (
Component* componentToAttachTo,
729 int itemIDThatMustBeVisible = 0,
730 int minimumWidth = 0,
731 int maximumNumColumns = 0,
732 int standardItemHeight = 0,
737 int showMenu (
const Options& options);
741 void showMenuAsync (
const Options& options);
744 void showMenuAsync (
const Options& options,
748 void showMenuAsync (
const Options& options,
779 backgroundColourId = 0x1000700,
780 textColourId = 0x1000600,
782 headerTextColourId = 0x1000601,
784 highlightedBackgroundColourId = 0x1000900,
786 highlightedTextColourId = 0x1000800,
828 Item& getItem()
const;
832 bool searchRecursively;
879 void triggerMenuItem();
895 bool isTriggeredAutomatically() const noexcept {
return triggeredAutomatically; }
897 void setHighlighted (
bool shouldBeHighlighted);
901 bool isHighlighted =
false, triggeredAutomatically;
938 virtual void drawPopupMenuBackground (
Graphics&,
int width,
int height);
948 bool isSeparator,
bool isActive,
bool isHighlighted,
949 bool isTicked,
bool hasSubMenu,
951 const String& shortcutKeyText,
953 const Colour* textColour);
965 const String& sectionName,
971 virtual void drawPopupMenuUpDownArrow (
Graphics&,
972 int width,
int height,
973 bool isScrollUpArrow);
975 virtual void drawPopupMenuUpDownArrowWithOptions (
Graphics&,
976 int width,
int height,
977 bool isScrollUpArrow,
981 virtual void getIdealPopupMenuItemSize (
const String& text,
983 int standardMenuItemHeight,
990 int standardMenuItemHeight,
995 virtual int getMenuWindowFlags() = 0;
997 virtual void drawMenuBarBackground (
Graphics&,
int width,
int height,
1001 virtual int getDefaultMenuBarHeight() = 0;
1007 virtual void drawMenuBarItem (
Graphics&,
int width,
int height,
1010 bool isMouseOverItem,
1012 bool isMouseOverBar,
1015 virtual Component* getParentComponentForMenuOptions (
const Options& options) = 0;
1017 virtual void preparePopupMenuWindow (
Component& newWindow) = 0;
1024 virtual int getPopupMenuBorderSize();
1026 virtual int getPopupMenuBorderSizeWithOptions (
const Options&) = 0;
1043 [[deprecated (
"Use the new method.")]]
1044 int drawPopupMenuItem (
Graphics&,
int,
int,
bool,
bool,
bool,
bool,
bool,
const String&,
const String&,
Image*,
const Colour*) {
return 0; }
1049 JUCE_PUBLIC_IN_DLL_BUILD (
struct HelperClasses)
1051 friend struct HelperClasses;
1060 static void setItem (CustomComponent&,
const Item*);
One of these objects holds a list of all the commands your app can perform, and despatches these comm...
Holds a resizable array of primitive or copy-by-value objects.
Represents a colour, also including a transparency value.
The base class for all JUCE user-interface objects.
The base class for objects which can draw themselves, e.g.
Represents a particular font, including its size, style, etc.
A graphics context, used for drawing a component or image.
Holds a fixed-size bitmap.
LookAndFeel objects define the appearance of all the JUCE widgets, and subclasses can be used to appl...
Receives callbacks when a modal component is dismissed.
Manages a rectangle and allows geometric operations to be performed on it.
A smart-pointer class which points to a reference-counted object.
Adds reference-counting to an object.
This class acts as a pointer which will automatically become null if the object to which it points is...
#define JUCE_LEAK_DETECTOR(OwnerClass)
This macro lets you embed a leak-detecting object inside a class.
@ showMenu
Represents the user showing a contextual menu for a UI element.
int CommandID
A type used to hold the unique ID for an application command.
This abstract base class is implemented by LookAndFeel classes to provide menu drawing functionality.
virtual int getPopupMenuColumnSeparatorWidthWithOptions(const Options &)=0
Return the amount of space that should be left between popup menu columns.
virtual void getIdealPopupMenuItemSizeWithOptions(const String &text, bool isSeparator, int standardMenuItemHeight, int &idealWidth, int &idealHeight, const Options &)=0
Finds the best size for an item in a popup menu.
virtual void drawPopupMenuItemWithOptions(Graphics &, const Rectangle< int > &area, bool isHighlighted, const Item &item, const Options &)=0
Draws one of the items in a popup menu.
virtual void drawPopupMenuBackgroundWithOptions(Graphics &, int width, int height, const Options &)=0
Fills the background of a popup menu component.
virtual void drawPopupMenuColumnSeparatorWithOptions(Graphics &g, const Rectangle< int > &bounds, const Options &)=0
Implement this to draw some custom decoration between the columns of the popup menu.
virtual bool shouldPopupMenuScaleWithTargetComponent(const Options &options)=0
Return true if you want your popup menus to scale with the target component's AffineTransform or scal...
virtual Font getPopupMenuFont()=0
Returns the size and style of font to use in popup menus.