You need to subclass MenuBarModel and override its pure virtual methods to set up your menu. Take a look at the MenusDemo class in the WidgetsDemo.cpp file of the JUCE Demo to see an example of how to do this.
I have the same question as in the beginning of the topic. How can I make a menu?
How do you do that? I didn’t found anything like “addItem” or something in MenuBarModel class :((
There’s no such class in WidgetsDemo.cpp (JUCE 7.0.3). There is, however, a class in a file ‘MenusDemo.h’ though I guess it requires building all Demos to see how it’s all connected and how to use it. Also the file is kinda… big and funky. Essentialy I need a simple menu with like two items (e.g. “Close”, “Format C:”).
The MenuBarModel class discussed in this thread is, iirc, for the application’s minimize/maximize/close buttons. Do you want to add the option to format your C drive to that list? What are the requirements, here?
The MenuBarModel relates to the whole issue of putting up a menubar in Mac or Windows, with drop down menus, submenus and commands, for which you use the ApplicationCommandManager, ApplicationCommandTarget, etc.
See the MenusDemo:
class MenusDemo : public Component,
/** A list of the commands that this demo responds to. */
menuPositionInsideWindow = 1,
EDIT: I found it quite complicated to get a fully-featured menubar up and running. There are a lot of interconnected pieces and classes.
It’s also highly recommended to examine the source code for The Projucer, which utilizes just about every menubar feature in a fully-fledged app.