| 6186 | } |
| 6187 | |
| 6188 | void ImGui::ShowStyleEditor(ImGuiStyle* ref) |
| 6189 | { |
| 6190 | IMGUI_DEMO_MARKER("Tools/Style Editor"); |
| 6191 | // You can pass in a reference ImGuiStyle structure to compare to, revert to and save to |
| 6192 | // (without a reference style pointer, we will use one compared locally as a reference) |
| 6193 | ImGuiStyle& style = ImGui::GetStyle(); |
| 6194 | static ImGuiStyle ref_saved_style; |
| 6195 | |
| 6196 | // Default to using internal storage as reference |
| 6197 | static bool init = true; |
| 6198 | if (init && ref == NULL) |
| 6199 | ref_saved_style = style; |
| 6200 | init = false; |
| 6201 | if (ref == NULL) |
| 6202 | ref = &ref_saved_style; |
| 6203 | |
| 6204 | ImGui::PushItemWidth(ImGui::GetWindowWidth() * 0.50f); |
| 6205 | |
| 6206 | if (ImGui::ShowStyleSelector("Colors##Selector")) |
| 6207 | ref_saved_style = style; |
| 6208 | ImGui::ShowFontSelector("Fonts##Selector"); |
| 6209 | |
| 6210 | // Simplified Settings (expose floating-pointer border sizes as boolean representing 0.0f or 1.0f) |
| 6211 | if (ImGui::SliderFloat("FrameRounding", &style.FrameRounding, 0.0f, 12.0f, "%.0f")) |
| 6212 | style.GrabRounding = style.FrameRounding; // Make GrabRounding always the same value as FrameRounding |
| 6213 | { bool border = (style.WindowBorderSize > 0.0f); if (ImGui::Checkbox("WindowBorder", &border)) { style.WindowBorderSize = border ? 1.0f : 0.0f; } } |
| 6214 | ImGui::SameLine(); |
| 6215 | { bool border = (style.FrameBorderSize > 0.0f); if (ImGui::Checkbox("FrameBorder", &border)) { style.FrameBorderSize = border ? 1.0f : 0.0f; } } |
| 6216 | ImGui::SameLine(); |
| 6217 | { bool border = (style.PopupBorderSize > 0.0f); if (ImGui::Checkbox("PopupBorder", &border)) { style.PopupBorderSize = border ? 1.0f : 0.0f; } } |
| 6218 | |
| 6219 | // Save/Revert button |
| 6220 | if (ImGui::Button("Save Ref")) |
| 6221 | *ref = ref_saved_style = style; |
| 6222 | ImGui::SameLine(); |
| 6223 | if (ImGui::Button("Revert Ref")) |
| 6224 | style = *ref; |
| 6225 | ImGui::SameLine(); |
| 6226 | HelpMarker( |
| 6227 | "Save/Revert in local non-persistent storage. Default Colors definition are not affected. " |
| 6228 | "Use \"Export\" below to save them somewhere."); |
| 6229 | |
| 6230 | ImGui::Separator(); |
| 6231 | |
| 6232 | if (ImGui::BeginTabBar("##tabs", ImGuiTabBarFlags_None)) |
| 6233 | { |
| 6234 | if (ImGui::BeginTabItem("Sizes")) |
| 6235 | { |
| 6236 | ImGui::Text("Main"); |
| 6237 | ImGui::SliderFloat2("WindowPadding", (float*)&style.WindowPadding, 0.0f, 20.0f, "%.0f"); |
| 6238 | ImGui::SliderFloat2("FramePadding", (float*)&style.FramePadding, 0.0f, 20.0f, "%.0f"); |
| 6239 | ImGui::SliderFloat2("CellPadding", (float*)&style.CellPadding, 0.0f, 20.0f, "%.0f"); |
| 6240 | ImGui::SliderFloat2("ItemSpacing", (float*)&style.ItemSpacing, 0.0f, 20.0f, "%.0f"); |
| 6241 | ImGui::SliderFloat2("ItemInnerSpacing", (float*)&style.ItemInnerSpacing, 0.0f, 20.0f, "%.0f"); |
| 6242 | ImGui::SliderFloat2("TouchExtraPadding", (float*)&style.TouchExtraPadding, 0.0f, 10.0f, "%.0f"); |
| 6243 | ImGui::SliderFloat("IndentSpacing", &style.IndentSpacing, 0.0f, 30.0f, "%.0f"); |
| 6244 | ImGui::SliderFloat("ScrollbarSize", &style.ScrollbarSize, 1.0f, 20.0f, "%.0f"); |
| 6245 | ImGui::SliderFloat("GrabMinSize", &style.GrabMinSize, 1.0f, 20.0f, "%.0f"); |
nothing calls this directly
no test coverage detected