| 3272 | } |
| 3273 | |
| 3274 | void 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"); |
nothing calls this directly
no test coverage detected