| 5884 | } |
| 5885 | |
| 5886 | void ImGui::ShowStyleEditor(ImGuiStyle* ref) |
| 5887 | { |
| 5888 | // You can pass in a reference ImGuiStyle structure to compare to, revert to and save to |
| 5889 | // (without a reference style pointer, we will use one compared locally as a reference) |
| 5890 | ImGuiStyle& style = ImGui::GetStyle(); |
| 5891 | static ImGuiStyle ref_saved_style; |
| 5892 | |
| 5893 | // Default to using internal storage as reference |
| 5894 | static bool init = true; |
| 5895 | if (init && ref == NULL) |
| 5896 | ref_saved_style = style; |
| 5897 | init = false; |
| 5898 | if (ref == NULL) |
| 5899 | ref = &ref_saved_style; |
| 5900 | |
| 5901 | ImGui::PushItemWidth(ImGui::GetWindowWidth() * 0.50f); |
| 5902 | |
| 5903 | if (ImGui::ShowStyleSelector("Colors##Selector")) |
| 5904 | ref_saved_style = style; |
| 5905 | ImGui::ShowFontSelector("Fonts##Selector"); |
| 5906 | |
| 5907 | // Simplified Settings (expose floating-pointer border sizes as boolean representing 0.0f or 1.0f) |
| 5908 | if (ImGui::SliderFloat("FrameRounding", &style.FrameRounding, 0.0f, 12.0f, "%.0f")) |
| 5909 | style.GrabRounding = style.FrameRounding; // Make GrabRounding always the same value as FrameRounding |
| 5910 | { bool border = (style.WindowBorderSize > 0.0f); if (ImGui::Checkbox("WindowBorder", &border)) { style.WindowBorderSize = border ? 1.0f : 0.0f; } } |
| 5911 | ImGui::SameLine(); |
| 5912 | { bool border = (style.FrameBorderSize > 0.0f); if (ImGui::Checkbox("FrameBorder", &border)) { style.FrameBorderSize = border ? 1.0f : 0.0f; } } |
| 5913 | ImGui::SameLine(); |
| 5914 | { bool border = (style.PopupBorderSize > 0.0f); if (ImGui::Checkbox("PopupBorder", &border)) { style.PopupBorderSize = border ? 1.0f : 0.0f; } } |
| 5915 | |
| 5916 | // Save/Revert button |
| 5917 | if (ImGui::Button("Save Ref")) |
| 5918 | *ref = ref_saved_style = style; |
| 5919 | ImGui::SameLine(); |
| 5920 | if (ImGui::Button("Revert Ref")) |
| 5921 | style = *ref; |
| 5922 | ImGui::SameLine(); |
| 5923 | HelpMarker( |
| 5924 | "Save/Revert in local non-persistent storage. Default Colors definition are not affected. " |
| 5925 | "Use \"Export\" below to save them somewhere."); |
| 5926 | |
| 5927 | ImGui::Separator(); |
| 5928 | |
| 5929 | if (ImGui::BeginTabBar("##tabs", ImGuiTabBarFlags_None)) |
| 5930 | { |
| 5931 | if (ImGui::BeginTabItem("Sizes")) |
| 5932 | { |
| 5933 | ImGui::Text("Main"); |
| 5934 | ImGui::SliderFloat2("WindowPadding", (float*)&style.WindowPadding, 0.0f, 20.0f, "%.0f"); |
| 5935 | ImGui::SliderFloat2("FramePadding", (float*)&style.FramePadding, 0.0f, 20.0f, "%.0f"); |
| 5936 | ImGui::SliderFloat2("CellPadding", (float*)&style.CellPadding, 0.0f, 20.0f, "%.0f"); |
| 5937 | ImGui::SliderFloat2("ItemSpacing", (float*)&style.ItemSpacing, 0.0f, 20.0f, "%.0f"); |
| 5938 | ImGui::SliderFloat2("ItemInnerSpacing", (float*)&style.ItemInnerSpacing, 0.0f, 20.0f, "%.0f"); |
| 5939 | ImGui::SliderFloat2("TouchExtraPadding", (float*)&style.TouchExtraPadding, 0.0f, 10.0f, "%.0f"); |
| 5940 | ImGui::SliderFloat("IndentSpacing", &style.IndentSpacing, 0.0f, 30.0f, "%.0f"); |
| 5941 | ImGui::SliderFloat("ScrollbarSize", &style.ScrollbarSize, 1.0f, 20.0f, "%.0f"); |
| 5942 | ImGui::SliderFloat("GrabMinSize", &style.GrabMinSize, 1.0f, 20.0f, "%.0f"); |
| 5943 | ImGui::Text("Borders"); |
nothing calls this directly
no test coverage detected