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
juce_MenuBarModel.h
Go to the documentation of this file.
1 /*
2 ==============================================================================
3
4 This file is part of the JUCE library.
5 Copyright (c) 2022 - Raw Material Software Limited
6
7 JUCE is an open source library subject to commercial or open-source
8 licensing.
9
10 By using JUCE, you agree to the terms of both the JUCE 7 End-User License
11 Agreement and JUCE Privacy Policy.
12
13 End User License Agreement: www.juce.com/juce-7-licence
14 Privacy Policy: www.juce.com/juce-privacy-policy
15
16 Or: You may also use this code under the terms of the GPL v3 (see
17 www.gnu.org/licenses).
18
19 JUCE IS PROVIDED "AS IS" WITHOUT ANY WARRANTY, AND ALL WARRANTIES, WHETHER
20 EXPRESSED OR IMPLIED, INCLUDING MERCHANTABILITY AND FITNESS FOR PURPOSE, ARE
21 DISCLAIMED.
22
23 ==============================================================================
24*/
25
26namespace juce
27{
28
29//==============================================================================
40class JUCE_API MenuBarModel : private AsyncUpdater,
42{
43public:
44 //==============================================================================
45 MenuBarModel() noexcept;
46
48 ~MenuBarModel() override;
49
50 //==============================================================================
63 void menuItemsChanged();
64
71 void setApplicationCommandManagerToWatch (ApplicationCommandManager* manager);
72
73 //==============================================================================
78 class JUCE_API Listener
79 {
80 public:
82 virtual ~Listener() = default;
83
84 //==============================================================================
86 virtual void menuBarItemsChanged (MenuBarModel* menuBarModel) = 0;
87
91 virtual void menuCommandInvoked (MenuBarModel* menuBarModel,
93
96 virtual void menuBarActivated (MenuBarModel* menuBarModel, bool isActive);
97 };
98
106 void addListener (Listener* listenerToAdd);
107
111 void removeListener (Listener* listenerToRemove);
112
113 //==============================================================================
116
122 virtual PopupMenu getMenuForIndex (int topLevelMenuIndex,
123 const String& menuName) = 0;
124
132 virtual void menuItemSelected (int menuItemID,
133 int topLevelMenuIndex) = 0;
134
139 virtual void menuBarActivated (bool isActive);
140
141 //==============================================================================
142 #if JUCE_MAC || DOXYGEN
160 static void setMacMainMenu (MenuBarModel* newMenuBarModel,
161 const PopupMenu* extraAppleMenuItems = nullptr,
162 const String& recentItemsMenuName = String());
163
168
173 #endif
174
175 //==============================================================================
177 void applicationCommandInvoked (const ApplicationCommandTarget::InvocationInfo&) override;
179 void applicationCommandListChanged() override;
181 void handleAsyncUpdate() override;
183 void handleMenuBarActivate (bool isActive);
184private:
186 ListenerList<Listener> listeners;
187
189};
190
191
192} // namespace juce
A listener that receives callbacks from an ApplicationCommandManager when commands are invoked or the...
One of these objects holds a list of all the commands your app can perform, and despatches these comm...
Has a callback method that is triggered asynchronously.
Holds a set of objects and can invoke a member function callback on each object in the set with a sin...
A class to receive callbacks when a MenuBarModel changes.
virtual ~Listener()=default
Destructor.
virtual void menuCommandInvoked(MenuBarModel *menuBarModel, const ApplicationCommandTarget::InvocationInfo &info)=0
This callback is made when an application command is invoked that is represented by one of the items ...
virtual void menuBarItemsChanged(MenuBarModel *menuBarModel)=0
This callback is made when items are changed in the menu bar model.
A class for controlling MenuBar components.
static const PopupMenu * getMacExtraAppleItemsMenu()
OSX ONLY - Returns the menu that was last passed as the extraAppleMenuItems argument to setMacMainMen...
virtual PopupMenu getMenuForIndex(int topLevelMenuIndex, const String &menuName)=0
This should return the popup menu to display for a given top-level menu.
static MenuBarModel * getMacMainMenu()
OSX ONLY - Returns the menu model that is currently being shown as the main menu bar.
virtual StringArray getMenuBarNames()=0
This method must return a list of the names of the menus.
static void setMacMainMenu(MenuBarModel *newMenuBarModel, const PopupMenu *extraAppleMenuItems=nullptr, const String &recentItemsMenuName=String())
OSX ONLY - Sets the model that is currently being shown as the main menu bar at the top of the screen...
virtual void menuItemSelected(int menuItemID, int topLevelMenuIndex)=0
This is called when a menu item has been clicked on.
Creates and displays a popup-menu.
A special array for holding a list of strings.
The JUCE String class!
Definition juce_String.h:53
#define JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(className)
This is a shorthand way of writing both a JUCE_DECLARE_NON_COPYABLE and JUCE_LEAK_DETECTOR macro for ...
JUCE Namespace.
Contains contextual details about the invocation of a command.