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

This commit is contained in:
omar 2018-01-24 17:08:37 +01:00
parent 455989b8b1
commit 6f366fff6b
1 changed files with 4 additions and 3 deletions

View File

@ -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