MCPcopy Create free account
hub / github.com/MKXJun/DirectX11-With-Windows-SDK / ShowExampleMenuFile

Function ShowExampleMenuFile

ImGui/imgui_demo.cpp:6373–6451  ·  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

6371// Note that shortcuts are currently provided for display only
6372// (future version will add explicit flags to BeginMenu() to request processing shortcuts)
6373static void ShowExampleMenuFile()
6374{
6375 IMGUI_DEMO_MARKER("Examples/Menu");
6376 ImGui::MenuItem("(demo menu)", NULL, false, false);
6377 if (ImGui::MenuItem("New")) {}
6378 if (ImGui::MenuItem("Open", "Ctrl+O")) {}
6379 if (ImGui::BeginMenu("Open Recent"))
6380 {
6381 ImGui::MenuItem("fish_hat.c");
6382 ImGui::MenuItem("fish_hat.inl");
6383 ImGui::MenuItem("fish_hat.h");
6384 if (ImGui::BeginMenu("More.."))
6385 {
6386 ImGui::MenuItem("Hello");
6387 ImGui::MenuItem("Sailor");
6388 if (ImGui::BeginMenu("Recurse.."))
6389 {
6390 ShowExampleMenuFile();
6391 ImGui::EndMenu();
6392 }
6393 ImGui::EndMenu();
6394 }
6395 ImGui::EndMenu();
6396 }
6397 if (ImGui::MenuItem("Save", "Ctrl+S")) {}
6398 if (ImGui::MenuItem("Save As..")) {}
6399
6400 ImGui::Separator();
6401 IMGUI_DEMO_MARKER("Examples/Menu/Options");
6402 if (ImGui::BeginMenu("Options"))
6403 {
6404 static bool enabled = true;
6405 ImGui::MenuItem("Enabled", "", &enabled);
6406 ImGui::BeginChild("child", ImVec2(0, 60), true);
6407 for (int i = 0; i < 10; i++)
6408 ImGui::Text("Scrolling Text %d", i);
6409 ImGui::EndChild();
6410 static float f = 0.5f;
6411 static int n = 0;
6412 ImGui::SliderFloat("Value", &f, 0.0f, 1.0f);
6413 ImGui::InputFloat("Input", &f, 0.1f);
6414 ImGui::Combo("Combo", &n, "Yes\0No\0Maybe\0\0");
6415 ImGui::EndMenu();
6416 }
6417
6418 IMGUI_DEMO_MARKER("Examples/Menu/Colors");
6419 if (ImGui::BeginMenu("Colors"))
6420 {
6421 float sz = ImGui::GetTextLineHeight();
6422 for (int i = 0; i < ImGuiCol_COUNT; i++)
6423 {
6424 const char* name = ImGui::GetStyleColorName((ImGuiCol)i);
6425 ImVec2 p = ImGui::GetCursorScreenPos();
6426 ImGui::GetWindowDrawList()->AddRectFilled(p, ImVec2(p.x + sz, p.y + sz), ImGui::GetColorU32((ImGuiCol)i));
6427 ImGui::Dummy(ImVec2(sz, sz));
6428 ImGui::SameLine();
6429 ImGui::MenuItem(name);
6430 }

Callers 4

ShowDemoWindowMethod · 0.85
ShowDemoWindowLayoutFunction · 0.85
ShowDemoWindowPopupsFunction · 0.85

Calls 3

ImVec2Function · 0.85
SliderFloatFunction · 0.85
AddRectFilledMethod · 0.80

Tested by

no test coverage detected