MCPcopy Create free account
hub / github.com/DISTRHO/Cardinal / ShowExampleAppMainMenuBar

Function ShowExampleAppMainMenuBar

plugins/Cardinal/src/DearImGui/imgui_demo.cpp:6281–6302  ·  view source on GitHub ↗

Demonstrate creating a "main" fullscreen menu bar and populating it. Note the difference between BeginMainMenuBar() and BeginMenuBar(): - BeginMenuBar() = menu-bar inside current window (which needs the ImGuiWindowFlags_MenuBar flag!) - BeginMainMenuBar() = helper to create menu-bar-sized window at the top of the main viewport + call BeginMenuBar() into it.

Source from the content-addressed store, hash-verified

6279// - BeginMenuBar() = menu-bar inside current window (which needs the ImGuiWindowFlags_MenuBar flag!)
6280// - BeginMainMenuBar() = helper to create menu-bar-sized window at the top of the main viewport + call BeginMenuBar() into it.
6281static void ShowExampleAppMainMenuBar()
6282{
6283 if (ImGui::BeginMainMenuBar())
6284 {
6285 if (ImGui::BeginMenu("File"))
6286 {
6287 ShowExampleMenuFile();
6288 ImGui::EndMenu();
6289 }
6290 if (ImGui::BeginMenu("Edit"))
6291 {
6292 if (ImGui::MenuItem("Undo", "CTRL+Z")) {}
6293 if (ImGui::MenuItem("Redo", "CTRL+Y", false, false)) {} // Disabled item
6294 ImGui::Separator();
6295 if (ImGui::MenuItem("Cut", "CTRL+X")) {}
6296 if (ImGui::MenuItem("Copy", "CTRL+C")) {}
6297 if (ImGui::MenuItem("Paste", "CTRL+V")) {}
6298 ImGui::EndMenu();
6299 }
6300 ImGui::EndMainMenuBar();
6301 }
6302}
6303
6304// Note that shortcuts are currently provided for display only
6305// (future version will add explicit flags to BeginMenu() to request processing shortcuts)

Callers 1

ShowDemoWindowMethod · 0.85

Calls 2

ShowExampleMenuFileFunction · 0.85
MenuItemClass · 0.85

Tested by

no test coverage detected