Browse Source

Demo: Tweaked example menu with colors + menu items, was currently particularly inconvenient for Nav. Will rework later. (#787)

pull/1608/head
omar 7 years ago
parent
commit
6f366fff6b
  1. 7
      imgui_demo.cpp

7
imgui_demo.cpp

@ -2330,15 +2330,16 @@ static void ShowExampleMenuFile()
}
if (ImGui::BeginMenu("Colors"))
{
ImGui::PushStyleVar(ImGuiStyleVar_FramePadding, ImVec2(0,0));
float sz = ImGui::GetTextLineHeight();
for (int i = 0; i < ImGuiCol_COUNT; i++)
{
const char* name = ImGui::GetStyleColorName((ImGuiCol)i);
ImGui::ColorButton(name, ImGui::GetStyleColorVec4((ImGuiCol)i));
ImVec2 p = ImGui::GetCursorScreenPos();
ImGui::GetWindowDrawList()->AddRectFilled(p, ImVec2(p.x+sz, p.y+sz), ImGui::GetColorU32((ImGuiCol)i));
ImGui::Dummy(ImVec2(sz, sz));
ImGui::SameLine();
ImGui::MenuItem(name);
}
ImGui::PopStyleVar();
ImGui::EndMenu();
}
if (ImGui::BeginMenu("Disabled", false)) // Disabled

Loading…
Cancel
Save