mirror of
https://github.com/Drezil/imgui.git
synced 2024-11-15 01:17:00 +00:00
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"))
|
if (ImGui::BeginMenu("Colors"))
|
||||||
{
|
{
|
||||||
ImGui::PushStyleVar(ImGuiStyleVar_FramePadding, ImVec2(0,0));
|
float sz = ImGui::GetTextLineHeight();
|
||||||
for (int i = 0; i < ImGuiCol_COUNT; i++)
|
for (int i = 0; i < ImGuiCol_COUNT; i++)
|
||||||
{
|
{
|
||||||
const char* name = ImGui::GetStyleColorName((ImGuiCol)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::SameLine();
|
||||||
ImGui::MenuItem(name);
|
ImGui::MenuItem(name);
|
||||||
}
|
}
|
||||||
ImGui::PopStyleVar();
|
|
||||||
ImGui::EndMenu();
|
ImGui::EndMenu();
|
||||||
}
|
}
|
||||||
if (ImGui::BeginMenu("Disabled", false)) // Disabled
|
if (ImGui::BeginMenu("Disabled", false)) // Disabled
|
||||||
|
Loading…
Reference in New Issue
Block a user