Hi,
I have added a main menu ontop of my application UI.
Eg, the typical “File”, “Edit”, “View”, “About” menu.
I used a simple example:
juce::StringArray MainMenuBarComponent::getMenuBarNames()
{
return juce::StringArray(“File”,“Edit”, “View”, “About”);
}
juce::PopupMenu MainMenuBarComponent::getMenuForIndex(int n, const juce::String& menuName)
{
PopupMenu menu;
if (menuName == "File")
{
menu.addItem(1, "New...");
menu.addItem(2, "Open...");
menu.addItem(3, "Save");
menu.addItem(4, "Save as...");
menu.addItem(5, "Exit");
}
else if (menuName == "Edit")
{
menu.addItem(6, "Undo");
menu.addItem(7, "Redo");
menu.addItem(8, "Project Preferences...");
}
else if (menuName == "View")
{
menu.addItem(9, "Zoom In");
menu.addItem(10, "Zoom Out");
}
else if (menuName == "About")
{
menu.addItem(11, "About Hummingbird...");
}
return menu;
}
void MainMenuBarComponent::menuItemSelected(int menuItemID, int topLevelMenuIndex)
{
switch (menuItemID)
{
case 1: // New…
rootManager->NewProject(true);
break;
case 2: // Open…
rootManager->LoadProjectFromFile();
break;
case 3: // Save
rootManager->SaveProjectToFile();
break;
case 4: // Save as…
rootManager->SaveAsProjectToFile();
break;
case 5: // Exit
JUCEApplication::getInstance()->systemRequestedQuit();
break;
default:
break;
}
}
The problem is, while I can set fonts, font sizes and colours etc… for all my other components in my app, how do I do this for the menubar, with my code above ?
Also, I need to change the colours of the background, bounding box and font for the actual pulldown menus, such as the “New, Open, Save, Save as, Exit” when pulling down the File menu.
Currently the background of the main titlebar is black, but the background of the pulldown menus are darkblue/greenish, with white lines around them, which I’d like to change to lightgrey…
I’d love it if someone can clarify…
Thanks again!,
Terrence
