Style Editor: Sneakily adding a combo box to change colors (#707)

This commit is contained in:
omar 2017-11-18 19:10:01 +01:00
parent 331eac511e
commit c1b5eab868

View File

@ -1852,6 +1852,16 @@ void ImGui::ShowTestWindow(bool* p_open)
void ImGui::ShowStyleEditor(ImGuiStyle* ref) void ImGui::ShowStyleEditor(ImGuiStyle* ref)
{ {
ImGuiStyle& style = ImGui::GetStyle(); ImGuiStyle& style = ImGui::GetStyle();
ImGui::PushItemWidth(ImGui::GetWindowWidth() * 0.55f);
// Style selector
static int style_idx = 0;
if (ImGui::Combo("Colors##Selector", &style_idx, "Classic\0Dark\0"))
switch (style_idx)
{
case 0: ImGui::StyleColorsClassic(); break;
case 1: ImGui::StyleColorsDark(); break;
}
// You can pass in a reference ImGuiStyle structure to compare to, revert to and save to (else it compares to the default style) // You can pass in a reference ImGuiStyle structure to compare to, revert to and save to (else it compares to the default style)
const ImGuiStyle default_style; // Default style const ImGuiStyle default_style; // Default style
@ -1865,8 +1875,6 @@ void ImGui::ShowStyleEditor(ImGuiStyle* ref)
*ref = style; *ref = style;
} }
ImGui::PushItemWidth(ImGui::GetWindowWidth() * 0.55f);
if (ImGui::TreeNode("Rendering")) if (ImGui::TreeNode("Rendering"))
{ {
ImGui::Checkbox("Anti-aliased lines", &style.AntiAliasedLines); ImGui::SameLine(); ShowHelpMarker("When disabling anti-aliasing lines, you'll probably want to disable borders in your style as well."); ImGui::Checkbox("Anti-aliased lines", &style.AntiAliasedLines); ImGui::SameLine(); ShowHelpMarker("When disabling anti-aliasing lines, you'll probably want to disable borders in your style as well.");