| 8236 | } |
| 8237 | |
| 8238 | void ImGui::ShowStyleEditor(ImGuiStyle* ref) |
| 8239 | { |
| 8240 | IMGUI_DEMO_MARKER("Tools/Style Editor"); |
| 8241 | // You can pass in a reference ImGuiStyle structure to compare to, revert to and save to |
| 8242 | // (without a reference style pointer, we will use one compared locally as a reference) |
| 8243 | ImGuiStyle& style = ImGui::GetStyle(); |
| 8244 | static ImGuiStyle ref_saved_style; |
| 8245 | |
| 8246 | // Default to using internal storage as reference |
| 8247 | static bool init = true; |
| 8248 | if (init && ref == NULL) |
| 8249 | ref_saved_style = style; |
| 8250 | init = false; |
| 8251 | if (ref == NULL) |
| 8252 | ref = &ref_saved_style; |
| 8253 | |
| 8254 | ImGui::PushItemWidth(ImGui::GetWindowWidth() * 0.50f); |
| 8255 | |
| 8256 | if (ImGui::ShowStyleSelector("Colors##Selector")) |
| 8257 | ref_saved_style = style; |
| 8258 | ImGui::ShowFontSelector("Fonts##Selector"); |
| 8259 | |
| 8260 | // Simplified Settings (expose floating-pointer border sizes as boolean representing 0.0f or 1.0f) |
| 8261 | if (ImGui::SliderFloat("FrameRounding", &style.FrameRounding, 0.0f, 12.0f, "%.0f")) |
| 8262 | style.GrabRounding = style.FrameRounding; // Make GrabRounding always the same value as FrameRounding |
| 8263 | { bool border = (style.WindowBorderSize > 0.0f); if (ImGui::Checkbox("WindowBorder", &border)) { style.WindowBorderSize = border ? 1.0f : 0.0f; } } |
| 8264 | ImGui::SameLine(); |
| 8265 | { bool border = (style.FrameBorderSize > 0.0f); if (ImGui::Checkbox("FrameBorder", &border)) { style.FrameBorderSize = border ? 1.0f : 0.0f; } } |
| 8266 | ImGui::SameLine(); |
| 8267 | { bool border = (style.PopupBorderSize > 0.0f); if (ImGui::Checkbox("PopupBorder", &border)) { style.PopupBorderSize = border ? 1.0f : 0.0f; } } |
| 8268 | |
| 8269 | // Save/Revert button |
| 8270 | if (ImGui::Button("Save Ref")) |
| 8271 | *ref = ref_saved_style = style; |
| 8272 | ImGui::SameLine(); |
| 8273 | if (ImGui::Button("Revert Ref")) |
| 8274 | style = *ref; |
| 8275 | ImGui::SameLine(); |
| 8276 | HelpMarker( |
| 8277 | "Save/Revert in local non-persistent storage. Default Colors definition are not affected. " |
| 8278 | "Use \"Export\" below to save them somewhere."); |
| 8279 | |
| 8280 | ImGui::Separator(); |
| 8281 | |
| 8282 | if (ImGui::BeginTabBar("##tabs", ImGuiTabBarFlags_None)) |
| 8283 | { |
| 8284 | if (ImGui::BeginTabItem("Sizes")) |
| 8285 | { |
| 8286 | ImGui::SeparatorText("Main"); |
| 8287 | ImGui::SliderFloat2("WindowPadding", (float*)&style.WindowPadding, 0.0f, 20.0f, "%.0f"); |
| 8288 | ImGui::SliderFloat2("FramePadding", (float*)&style.FramePadding, 0.0f, 20.0f, "%.0f"); |
| 8289 | ImGui::SliderFloat2("ItemSpacing", (float*)&style.ItemSpacing, 0.0f, 20.0f, "%.0f"); |
| 8290 | ImGui::SliderFloat2("ItemInnerSpacing", (float*)&style.ItemInnerSpacing, 0.0f, 20.0f, "%.0f"); |
| 8291 | ImGui::SliderFloat2("TouchExtraPadding", (float*)&style.TouchExtraPadding, 0.0f, 10.0f, "%.0f"); |
| 8292 | ImGui::SliderFloat("IndentSpacing", &style.IndentSpacing, 0.0f, 30.0f, "%.0f"); |
| 8293 | ImGui::SliderFloat("ScrollbarSize", &style.ScrollbarSize, 1.0f, 20.0f, "%.0f"); |
| 8294 | ImGui::SliderFloat("GrabMinSize", &style.GrabMinSize, 1.0f, 20.0f, "%.0f"); |
| 8295 |
nothing calls this directly
no test coverage detected