mirror of https://github.com/ocornut/imgui
Demo: Tweaked example menu with colors + menu items, was currently particularly inconvenient for Nav. Will rework later. (#787)
This commit is contained in:
parent
455989b8b1
commit
6f366fff6b
|
@ -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…
Reference in New Issue