MCPcopy Create free account
hub / github.com/clementgallet/libTAS / ShowStyleEditor

Method ShowStyleEditor

src/external/imgui/imgui_demo.cpp:6477–6753  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

6475}
6476
6477void ImGui::ShowStyleEditor(ImGuiStyle* ref)
6478{
6479 IMGUI_DEMO_MARKER("Tools/Style Editor");
6480 // You can pass in a reference ImGuiStyle structure to compare to, revert to and save to
6481 // (without a reference style pointer, we will use one compared locally as a reference)
6482 ImGuiStyle& style = ImGui::GetStyle();
6483 static ImGuiStyle ref_saved_style;
6484
6485 // Default to using internal storage as reference
6486 static bool init = true;
6487 if (init && ref == NULL)
6488 ref_saved_style = style;
6489 init = false;
6490 if (ref == NULL)
6491 ref = &ref_saved_style;
6492
6493 ImGui::PushItemWidth(ImGui::GetWindowWidth() * 0.50f);
6494
6495 if (ImGui::ShowStyleSelector("Colors##Selector"))
6496 ref_saved_style = style;
6497 ImGui::ShowFontSelector("Fonts##Selector");
6498
6499 // Simplified Settings (expose floating-pointer border sizes as boolean representing 0.0f or 1.0f)
6500 if (ImGui::SliderFloat("FrameRounding", &style.FrameRounding, 0.0f, 12.0f, "%.0f"))
6501 style.GrabRounding = style.FrameRounding; // Make GrabRounding always the same value as FrameRounding
6502 { bool border = (style.WindowBorderSize > 0.0f); if (ImGui::Checkbox("WindowBorder", &border)) { style.WindowBorderSize = border ? 1.0f : 0.0f; } }
6503 ImGui::SameLine();
6504 { bool border = (style.FrameBorderSize > 0.0f); if (ImGui::Checkbox("FrameBorder", &border)) { style.FrameBorderSize = border ? 1.0f : 0.0f; } }
6505 ImGui::SameLine();
6506 { bool border = (style.PopupBorderSize > 0.0f); if (ImGui::Checkbox("PopupBorder", &border)) { style.PopupBorderSize = border ? 1.0f : 0.0f; } }
6507
6508 // Save/Revert button
6509 if (ImGui::Button("Save Ref"))
6510 *ref = ref_saved_style = style;
6511 ImGui::SameLine();
6512 if (ImGui::Button("Revert Ref"))
6513 style = *ref;
6514 ImGui::SameLine();
6515 HelpMarker(
6516 "Save/Revert in local non-persistent storage. Default Colors definition are not affected. "
6517 "Use \"Export\" below to save them somewhere.");
6518
6519 ImGui::Separator();
6520
6521 if (ImGui::BeginTabBar("##tabs", ImGuiTabBarFlags_None))
6522 {
6523 if (ImGui::BeginTabItem("Sizes"))
6524 {
6525 ImGui::SeparatorText("Main");
6526 ImGui::SliderFloat2("WindowPadding", (float*)&style.WindowPadding, 0.0f, 20.0f, "%.0f");
6527 ImGui::SliderFloat2("FramePadding", (float*)&style.FramePadding, 0.0f, 20.0f, "%.0f");
6528 ImGui::SliderFloat2("ItemSpacing", (float*)&style.ItemSpacing, 0.0f, 20.0f, "%.0f");
6529 ImGui::SliderFloat2("ItemInnerSpacing", (float*)&style.ItemInnerSpacing, 0.0f, 20.0f, "%.0f");
6530 ImGui::SliderFloat2("TouchExtraPadding", (float*)&style.TouchExtraPadding, 0.0f, 10.0f, "%.0f");
6531 ImGui::SliderFloat("IndentSpacing", &style.IndentSpacing, 0.0f, 30.0f, "%.0f");
6532 ImGui::SliderFloat("ScrollbarSize", &style.ScrollbarSize, 1.0f, 20.0f, "%.0f");
6533 ImGui::SliderFloat("GrabMinSize", &style.GrabMinSize, 1.0f, 20.0f, "%.0f");
6534

Callers

nothing calls this directly

Calls 9

ShowStyleSelectorFunction · 0.85
GetStyleColorNameFunction · 0.85
ImVec2Function · 0.85
DragFloatFunction · 0.85
DrawMethod · 0.80
PassFilterMethod · 0.80
AddCircleMethod · 0.80
HelpMarkerFunction · 0.70

Tested by

no test coverage detected