MCPcopy Create free account
hub / github.com/BlitterStudio/amiberry / ShowStyleEditor

Method ShowStyleEditor

external/imgui/imgui_demo.cpp:8466–8805  ·  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

8464
8465// We omit the ImGui:: prefix in this function, as we don't expect user to be copy and pasting this code.
8466void ImGui::ShowStyleEditor(ImGuiStyle* ref)
8467{
8468 IMGUI_DEMO_MARKER("Tools/Style Editor");
8469 // You can pass in a reference ImGuiStyle structure to compare to, revert to and save to
8470 // (without a reference style pointer, we will use one compared locally as a reference)
8471 ImGuiStyle& style = GetStyle();
8472 static ImGuiStyle ref_saved_style;
8473
8474 // Default to using internal storage as reference
8475 static bool init = true;
8476 if (init && ref == NULL)
8477 ref_saved_style = style;
8478 init = false;
8479 if (ref == NULL)
8480 ref = &ref_saved_style;
8481
8482 // 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.
8483 // Note that _MainScale is currently internal PLEASE DO NOT USE IN YOUR CODE.
8484 const float default_border_size = (float)(int)style._MainScale;
8485 const float max_border_size = IM_MAX(default_border_size, 2.0f);
8486
8487 PushItemWidth(GetWindowWidth() * 0.50f);
8488
8489 {
8490 // General
8491 SeparatorText("General");
8492 if ((GetIO().BackendFlags & ImGuiBackendFlags_RendererHasTextures) == 0)
8493 {
8494 BulletText("Warning: Font scaling will NOT be smooth, because\nImGuiBackendFlags_RendererHasTextures is not set!");
8495 BulletText("For instructions, see:");
8496 SameLine();
8497 TextLinkOpenURL("docs/BACKENDS.md", "https://github.com/ocornut/imgui/blob/master/docs/BACKENDS.md");
8498 }
8499
8500 if (ShowStyleSelector("Colors##Selector"))
8501 ref_saved_style = style;
8502 ShowFontSelector("Fonts##Selector");
8503 if (DragFloat("FontSizeBase", &style.FontSizeBase, 0.20f, 5.0f, 100.0f, "%.0f"))
8504 style._NextFrameFontSizeBase = style.FontSizeBase; // FIXME: Temporary hack until we finish remaining work.
8505 SameLine(0.0f, 0.0f); Text(" (out %.2f)", GetFontSize());
8506 DragFloat("FontScaleMain", &style.FontScaleMain, 0.02f, 0.5f, 4.0f);
8507 //BeginDisabled(GetIO().ConfigDpiScaleFonts);
8508 DragFloat("FontScaleDpi", &style.FontScaleDpi, 0.02f, 0.5f, 4.0f);
8509 //SetItemTooltip("When io.ConfigDpiScaleFonts is set, this value is automatically overwritten.");
8510 //EndDisabled();
8511
8512 // Simplified Settings (expose floating-pointer border sizes as boolean representing 0.0f or 1.0f)
8513 if (SliderFloat("FrameRounding", &style.FrameRounding, 0.0f, 12.0f, "%.0f"))
8514 style.GrabRounding = style.FrameRounding; // Make GrabRounding always the same value as FrameRounding
8515 { bool border = (style.WindowBorderSize > 0.0f); if (Checkbox("WindowBorder", &border)) { style.WindowBorderSize = border ? default_border_size : 0.0f; } }
8516 SameLine();
8517 { bool border = (style.FrameBorderSize > 0.0f); if (Checkbox("FrameBorder", &border)) { style.FrameBorderSize = border ? default_border_size : 0.0f; } }
8518 SameLine();
8519 { bool border = (style.PopupBorderSize > 0.0f); if (Checkbox("PopupBorder", &border)) { style.PopupBorderSize = border ? default_border_size : 0.0f; } }
8520 }
8521
8522 // Save/Revert button
8523 if (Button("Save Ref"))

Callers

nothing calls this directly

Calls 7

HelpMarkerFunction · 0.85
GetTreeLinesFlagsNameFunction · 0.85
ImVec2Function · 0.85
PassFilterMethod · 0.80
AddCircleMethod · 0.80
DrawMethod · 0.45

Tested by

no test coverage detected