MCPcopy Create free account
hub / github.com/danoon2/Boxedwine / ShowStyleEditor

Method ShowStyleEditor

lib/imgui/imgui_demo.cpp:3274–3521  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3272}
3273
3274void ImGui::ShowStyleEditor(ImGuiStyle* ref)
3275{
3276 // You can pass in a reference ImGuiStyle structure to compare to, revert to and save to (else it compares to an internally stored reference)
3277 ImGuiStyle& style = ImGui::GetStyle();
3278 static ImGuiStyle ref_saved_style;
3279
3280 // Default to using internal storage as reference
3281 static bool init = true;
3282 if (init && ref == NULL)
3283 ref_saved_style = style;
3284 init = false;
3285 if (ref == NULL)
3286 ref = &ref_saved_style;
3287
3288 ImGui::PushItemWidth(ImGui::GetWindowWidth() * 0.50f);
3289
3290 if (ImGui::ShowStyleSelector("Colors##Selector"))
3291 ref_saved_style = style;
3292 ImGui::ShowFontSelector("Fonts##Selector");
3293
3294 // Simplified Settings
3295 if (ImGui::SliderFloat("FrameRounding", &style.FrameRounding, 0.0f, 12.0f, "%.0f"))
3296 style.GrabRounding = style.FrameRounding; // Make GrabRounding always the same value as FrameRounding
3297 { bool window_border = (style.WindowBorderSize > 0.0f); if (ImGui::Checkbox("WindowBorder", &window_border)) style.WindowBorderSize = window_border ? 1.0f : 0.0f; }
3298 ImGui::SameLine();
3299 { bool frame_border = (style.FrameBorderSize > 0.0f); if (ImGui::Checkbox("FrameBorder", &frame_border)) style.FrameBorderSize = frame_border ? 1.0f : 0.0f; }
3300 ImGui::SameLine();
3301 { bool popup_border = (style.PopupBorderSize > 0.0f); if (ImGui::Checkbox("PopupBorder", &popup_border)) style.PopupBorderSize = popup_border ? 1.0f : 0.0f; }
3302
3303 // Save/Revert button
3304 if (ImGui::Button("Save Ref"))
3305 *ref = ref_saved_style = style;
3306 ImGui::SameLine();
3307 if (ImGui::Button("Revert Ref"))
3308 style = *ref;
3309 ImGui::SameLine();
3310 HelpMarker("Save/Revert in local non-persistent storage. Default Colors definition are not affected. Use \"Export\" below to save them somewhere.");
3311
3312 ImGui::Separator();
3313
3314 if (ImGui::BeginTabBar("##tabs", ImGuiTabBarFlags_None))
3315 {
3316 if (ImGui::BeginTabItem("Sizes"))
3317 {
3318 ImGui::Text("Main");
3319 ImGui::SliderFloat2("WindowPadding", (float*)&style.WindowPadding, 0.0f, 20.0f, "%.0f");
3320 ImGui::SliderFloat2("FramePadding", (float*)&style.FramePadding, 0.0f, 20.0f, "%.0f");
3321 ImGui::SliderFloat2("ItemSpacing", (float*)&style.ItemSpacing, 0.0f, 20.0f, "%.0f");
3322 ImGui::SliderFloat2("ItemInnerSpacing", (float*)&style.ItemInnerSpacing, 0.0f, 20.0f, "%.0f");
3323 ImGui::SliderFloat2("TouchExtraPadding", (float*)&style.TouchExtraPadding, 0.0f, 10.0f, "%.0f");
3324 ImGui::SliderFloat("IndentSpacing", &style.IndentSpacing, 0.0f, 30.0f, "%.0f");
3325 ImGui::SliderFloat("ScrollbarSize", &style.ScrollbarSize, 1.0f, 20.0f, "%.0f");
3326 ImGui::SliderFloat("GrabMinSize", &style.GrabMinSize, 1.0f, 20.0f, "%.0f");
3327 ImGui::Text("Borders");
3328 ImGui::SliderFloat("WindowBorderSize", &style.WindowBorderSize, 0.0f, 1.0f, "%.0f");
3329 ImGui::SliderFloat("ChildBorderSize", &style.ChildBorderSize, 0.0f, 1.0f, "%.0f");
3330 ImGui::SliderFloat("PopupBorderSize", &style.PopupBorderSize, 0.0f, 1.0f, "%.0f");
3331 ImGui::SliderFloat("FrameBorderSize", &style.FrameBorderSize, 0.0f, 1.0f, "%.0f");

Callers

nothing calls this directly

Calls 8

HelpMarkerFunction · 0.85
ImVec2Class · 0.85
ImVec4Class · 0.85
DrawMethod · 0.80
PassFilterMethod · 0.80
FindGlyphNoFallbackMethod · 0.80
AddRectMethod · 0.80
RenderCharMethod · 0.80

Tested by

no test coverage detected