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

Function ShowExampleMenuFile

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

Note that shortcuts are currently provided for display only (future version will add explicit flags to BeginMenu() to request processing shortcuts)

Source from the content-addressed store, hash-verified

6304// Note that shortcuts are currently provided for display only
6305// (future version will add explicit flags to BeginMenu() to request processing shortcuts)
6306static void ShowExampleMenuFile()
6307{
6308 IMGUI_DEMO_MARKER("Examples/Menu");
6309 ImGui::MenuItem("(demo menu)", NULL, false, false);
6310 if (ImGui::MenuItem("New")) {}
6311 if (ImGui::MenuItem("Open", "Ctrl+O")) {}
6312 if (ImGui::BeginMenu("Open Recent"))
6313 {
6314 ImGui::MenuItem("fish_hat.c");
6315 ImGui::MenuItem("fish_hat.inl");
6316 ImGui::MenuItem("fish_hat.h");
6317 if (ImGui::BeginMenu("More.."))
6318 {
6319 ImGui::MenuItem("Hello");
6320 ImGui::MenuItem("Sailor");
6321 if (ImGui::BeginMenu("Recurse.."))
6322 {
6323 ShowExampleMenuFile();
6324 ImGui::EndMenu();
6325 }
6326 ImGui::EndMenu();
6327 }
6328 ImGui::EndMenu();
6329 }
6330 if (ImGui::MenuItem("Save", "Ctrl+S")) {}
6331 if (ImGui::MenuItem("Save As..")) {}
6332
6333 ImGui::Separator();
6334 IMGUI_DEMO_MARKER("Examples/Menu/Options");
6335 if (ImGui::BeginMenu("Options"))
6336 {
6337 static bool enabled = true;
6338 ImGui::MenuItem("Enabled", "", &enabled);
6339 ImGui::BeginChild("child", ImVec2(0, 60), true);
6340 for (int i = 0; i < 10; i++)
6341 ImGui::Text("Scrolling Text %d", i);
6342 ImGui::EndChild();
6343 static float f = 0.5f;
6344 static int n = 0;
6345 ImGui::SliderFloat("Value", &f, 0.0f, 1.0f);
6346 ImGui::InputFloat("Input", &f, 0.1f);
6347 ImGui::Combo("Combo", &n, "Yes\0No\0Maybe\0\0");
6348 ImGui::EndMenu();
6349 }
6350
6351 IMGUI_DEMO_MARKER("Examples/Menu/Colors");
6352 if (ImGui::BeginMenu("Colors"))
6353 {
6354 float sz = ImGui::GetTextLineHeight();
6355 for (int i = 0; i < ImGuiCol_COUNT; i++)
6356 {
6357 const char* name = ImGui::GetStyleColorName((ImGuiCol)i);
6358 ImVec2 p = ImGui::GetCursorScreenPos();
6359 ImGui::GetWindowDrawList()->AddRectFilled(p, ImVec2(p.x + sz, p.y + sz), ImGui::GetColorU32((ImGuiCol)i));
6360 ImGui::Dummy(ImVec2(sz, sz));
6361 ImGui::SameLine();
6362 ImGui::MenuItem(name);
6363 }

Callers 4

ShowDemoWindowMethod · 0.85
ShowDemoWindowLayoutFunction · 0.85
ShowDemoWindowPopupsFunction · 0.85

Calls 4

MenuItemClass · 0.85
ImVec2Function · 0.85
SliderFloatFunction · 0.85
AddRectFilledMethod · 0.80

Tested by

no test coverage detected