3#include "absl/strings/str_format.h"
8namespace layout_designer {
11 ImGuiStyle& style = ImGui::GetStyle();
43 const ImGuiStyle& style = ImGui::GetStyle();
77 code +=
"// Theme Configuration - Generated by Layout Designer\n";
78 code +=
"void ApplyTheme() {\n";
79 code +=
" ImGuiStyle& style = ImGui::GetStyle();\n\n";
81 code +=
" // Padding\n";
82 code += absl::StrFormat(
" style.WindowPadding = ImVec2(%.1ff, %.1ff);\n",
84 code += absl::StrFormat(
" style.FramePadding = ImVec2(%.1ff, %.1ff);\n",
86 code += absl::StrFormat(
" style.CellPadding = ImVec2(%.1ff, %.1ff);\n",
88 code += absl::StrFormat(
" style.ItemSpacing = ImVec2(%.1ff, %.1ff);\n",
91 absl::StrFormat(
" style.ItemInnerSpacing = ImVec2(%.1ff, %.1ff);\n\n",
94 code +=
" // Rounding\n";
95 code += absl::StrFormat(
" style.WindowRounding = %.1ff;\n",
window_rounding);
96 code += absl::StrFormat(
" style.ChildRounding = %.1ff;\n",
child_rounding);
97 code += absl::StrFormat(
" style.FrameRounding = %.1ff;\n",
frame_rounding);
98 code += absl::StrFormat(
" style.PopupRounding = %.1ff;\n",
popup_rounding);
99 code += absl::StrFormat(
" style.ScrollbarRounding = %.1ff;\n",
101 code += absl::StrFormat(
" style.GrabRounding = %.1ff;\n",
grab_rounding);
102 code += absl::StrFormat(
" style.TabRounding = %.1ff;\n\n",
tab_rounding);
104 code +=
" // Borders\n";
105 code += absl::StrFormat(
" style.WindowBorderSize = %.1ff;\n",
116 code +=
" // Sizes\n";
117 code += absl::StrFormat(
" style.IndentSpacing = %.1ff;\n",
indent_spacing);
118 code += absl::StrFormat(
" style.ScrollbarSize = %.1ff;\n",
scrollbar_size);
119 code += absl::StrFormat(
" style.GrabMinSize = %.1ff;\n",
grab_min_size);
131 bool modified =
false;
134 ImGui::TextDisabled(
"Configure visual styling");
137 if (ImGui::Button(
"Load from Current")) {
142 if (ImGui::Button(
"Apply to App")) {
146 if (ImGui::Button(
"Reset")) {
164 if (ImGui::CollapsingHeader(
167 ImGui::SliderFloat2(
"Window Padding", &properties.
window_padding.x, 0.0f,
169 ImGui::SliderFloat2(
"Frame Padding", &properties.
frame_padding.x, 0.0f,
171 ImGui::SliderFloat2(
"Cell Padding", &properties.
cell_padding.x, 0.0f, 20.0f,
173 ImGui::SliderFloat2(
"Item Spacing", &properties.
item_spacing.x, 0.0f, 20.0f,
176 0.0f, 20.0f,
"%.0f");
181 if (ImGui::CollapsingHeader(
184 ImGui::SliderFloat(
"Window Rounding", &properties.
window_rounding, 0.0f,
186 ImGui::SliderFloat(
"Child Rounding", &properties.
child_rounding, 0.0f,
188 ImGui::SliderFloat(
"Frame Rounding", &properties.
frame_rounding, 0.0f,
190 ImGui::SliderFloat(
"Popup Rounding", &properties.
popup_rounding, 0.0f,
193 0.0f, 12.0f,
"%.0f");
194 ImGui::SliderFloat(
"Grab Rounding", &properties.
grab_rounding, 0.0f, 12.0f,
196 ImGui::SliderFloat(
"Tab Rounding", &properties.
tab_rounding, 0.0f, 12.0f,
202 if (ImGui::CollapsingHeader(
213 ImGui::SliderFloat(
"Tab Border", &properties.
tab_border_size, 0.0f, 2.0f,
219 if (ImGui::CollapsingHeader(
221 show_sizes_ ? ImGuiTreeNodeFlags_DefaultOpen : 0)) {
222 ImGui::SliderFloat(
"Indent Spacing", &properties.
indent_spacing, 0.0f,
224 ImGui::SliderFloat(
"Scrollbar Size", &properties.
scrollbar_size, 1.0f,
226 ImGui::SliderFloat(
"Grab Min Size", &properties.
grab_min_size, 1.0f, 20.0f,
void DrawSizesSection(ThemeProperties &properties)
void DrawBordersSection(ThemeProperties &properties)
void DrawPaddingSection(ThemeProperties &properties)
bool Draw(ThemeProperties &properties)
Draw the theme properties editor.
void DrawRoundingSection(ThemeProperties &properties)
#define ICON_MD_ROUNDED_CORNER
#define ICON_MD_SPACE_BAR
#define ICON_MD_BORDER_ALL
#define ICON_MD_STRAIGHTEN
Encapsulates ImGui style properties for visual design.
std::string GenerateStyleCode() const
ImVec2 item_inner_spacing