MCPcopy Create free account
hub / github.com/IppClub/Dora-SSR / ShowStyleEditor

Method ShowStyleEditor

Source/3rdParty/imgui/imgui_demo.cpp:8373–8712  ·  view source on GitHub ↗

We omit the ImGui:: prefix in this function, as we don't expect user to be copy and pasting this code.

Source from the content-addressed store, hash-verified

8371
8372// We omit the ImGui:: prefix in this function, as we don't expect user to be copy and pasting this code.
8373void ImGui::ShowStyleEditor(ImGuiStyle* ref)
8374{
8375 IMGUI_DEMO_MARKER("Tools/Style Editor");
8376 // You can pass in a reference ImGuiStyle structure to compare to, revert to and save to
8377 // (without a reference style pointer, we will use one compared locally as a reference)
8378 ImGuiStyle& style = GetStyle();
8379 static ImGuiStyle ref_saved_style;
8380
8381 // Default to using internal storage as reference
8382 static bool init = true;
8383 if (init && ref == NULL)
8384 ref_saved_style = style;
8385 init = false;
8386 if (ref == NULL)
8387 ref = &ref_saved_style;
8388
8389 // The logic behind dynamically changing 'max_border_size' is to not encourage people to increase border size too much: it'll likely reveal lots of subtle rendering artifacts and this isn't a priority right now.
8390 // Note that _MainScale is currently internal PLEASE DO NOT USE IN YOUR CODE.
8391 const float default_border_size = (float)(int)style._MainScale;
8392 const float max_border_size = IM_MAX(default_border_size, 2.0f);
8393
8394 PushItemWidth(GetWindowWidth() * 0.50f);
8395
8396 {
8397 // General
8398 SeparatorText("General");
8399 if ((GetIO().BackendFlags & ImGuiBackendFlags_RendererHasTextures) == 0)
8400 {
8401 BulletText("Warning: Font scaling will NOT be smooth, because\nImGuiBackendFlags_RendererHasTextures is not set!");
8402 BulletText("For instructions, see:");
8403 SameLine();
8404 TextLinkOpenURL("docs/BACKENDS.md", "https://github.com/ocornut/imgui/blob/master/docs/BACKENDS.md");
8405 }
8406
8407 if (ShowStyleSelector("Colors##Selector"))
8408 ref_saved_style = style;
8409 ShowFontSelector("Fonts##Selector");
8410 if (DragFloat("FontSizeBase", &style.FontSizeBase, 0.20f, 5.0f, 100.0f, "%.0f"))
8411 style._NextFrameFontSizeBase = style.FontSizeBase; // FIXME: Temporary hack until we finish remaining work.
8412 SameLine(0.0f, 0.0f); Text(" (out %.2f)", GetFontSize());
8413 DragFloat("FontScaleMain", &style.FontScaleMain, 0.02f, 0.5f, 4.0f);
8414 //BeginDisabled(GetIO().ConfigDpiScaleFonts);
8415 DragFloat("FontScaleDpi", &style.FontScaleDpi, 0.02f, 0.5f, 4.0f);
8416 //SetItemTooltip("When io.ConfigDpiScaleFonts is set, this value is automatically overwritten.");
8417 //EndDisabled();
8418
8419 // Simplified Settings (expose floating-pointer border sizes as boolean representing 0.0f or 1.0f)
8420 if (SliderFloat("FrameRounding", &style.FrameRounding, 0.0f, 12.0f, "%.0f"))
8421 style.GrabRounding = style.FrameRounding; // Make GrabRounding always the same value as FrameRounding
8422 { bool border = (style.WindowBorderSize > 0.0f); if (Checkbox("WindowBorder", &border)) { style.WindowBorderSize = border ? default_border_size : 0.0f; } }
8423 SameLine();
8424 { bool border = (style.FrameBorderSize > 0.0f); if (Checkbox("FrameBorder", &border)) { style.FrameBorderSize = border ? default_border_size : 0.0f; } }
8425 SameLine();
8426 { bool border = (style.PopupBorderSize > 0.0f); if (Checkbox("PopupBorder", &border)) { style.PopupBorderSize = border ? default_border_size : 0.0f; } }
8427 }
8428
8429 // Save/Revert button
8430 if (Button("Save Ref"))

Callers

nothing calls this directly

Calls 15

SeparatorTextFunction · 0.85
BulletTextFunction · 0.85
ShowStyleSelectorFunction · 0.85
SliderFloatFunction · 0.85
CheckboxFunction · 0.85
BeginTabBarFunction · 0.85
BeginTabItemFunction · 0.85
SliderFloat2Function · 0.85
SliderAngleFunction · 0.85
GetTreeLinesFlagsNameFunction · 0.85
SelectableFunction · 0.85
ComboFunction · 0.85

Tested by

no test coverage detected