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",
90 code += absl::StrFormat(
" style.ItemInnerSpacing = ImVec2(%.1ff, %.1ff);\n\n",
93 code +=
" // Rounding\n";
94 code += absl::StrFormat(
" style.WindowRounding = %.1ff;\n",
window_rounding);
95 code += absl::StrFormat(
" style.ChildRounding = %.1ff;\n",
child_rounding);
96 code += absl::StrFormat(
" style.FrameRounding = %.1ff;\n",
frame_rounding);
97 code += absl::StrFormat(
" style.PopupRounding = %.1ff;\n",
popup_rounding);
99 code += absl::StrFormat(
" style.GrabRounding = %.1ff;\n",
grab_rounding);
100 code += absl::StrFormat(
" style.TabRounding = %.1ff;\n\n",
tab_rounding);
102 code +=
" // Borders\n";
107 code += absl::StrFormat(
" style.TabBorderSize = %.1ff;\n\n",
tab_border_size);
109 code +=
" // Sizes\n";
110 code += absl::StrFormat(
" style.IndentSpacing = %.1ff;\n",
indent_spacing);
111 code += absl::StrFormat(
" style.ScrollbarSize = %.1ff;\n",
scrollbar_size);
112 code += absl::StrFormat(
" style.GrabMinSize = %.1ff;\n",
grab_min_size);
124 bool modified =
false;
127 ImGui::TextDisabled(
"Configure visual styling");
130 if (ImGui::Button(
"Load from Current")) {
135 if (ImGui::Button(
"Apply to App")) {
139 if (ImGui::Button(
"Reset")) {
159 ImGui::SliderFloat2(
"Window Padding", &properties.
window_padding.x, 0.0f, 20.0f,
"%.0f");
160 ImGui::SliderFloat2(
"Frame Padding", &properties.
frame_padding.x, 0.0f, 20.0f,
"%.0f");
161 ImGui::SliderFloat2(
"Cell Padding", &properties.
cell_padding.x, 0.0f, 20.0f,
"%.0f");
162 ImGui::SliderFloat2(
"Item Spacing", &properties.
item_spacing.x, 0.0f, 20.0f,
"%.0f");
163 ImGui::SliderFloat2(
"Item Inner Spacing", &properties.
item_inner_spacing.x, 0.0f, 20.0f,
"%.0f");
170 ImGui::SliderFloat(
"Window Rounding", &properties.
window_rounding, 0.0f, 12.0f,
"%.0f");
171 ImGui::SliderFloat(
"Child Rounding", &properties.
child_rounding, 0.0f, 12.0f,
"%.0f");
172 ImGui::SliderFloat(
"Frame Rounding", &properties.
frame_rounding, 0.0f, 12.0f,
"%.0f");
173 ImGui::SliderFloat(
"Popup Rounding", &properties.
popup_rounding, 0.0f, 12.0f,
"%.0f");
174 ImGui::SliderFloat(
"Scrollbar Rounding", &properties.
scrollbar_rounding, 0.0f, 12.0f,
"%.0f");
175 ImGui::SliderFloat(
"Grab Rounding", &properties.
grab_rounding, 0.0f, 12.0f,
"%.0f");
176 ImGui::SliderFloat(
"Tab Rounding", &properties.
tab_rounding, 0.0f, 12.0f,
"%.0f");
183 ImGui::SliderFloat(
"Window Border", &properties.
window_border_size, 0.0f, 2.0f,
"%.0f");
184 ImGui::SliderFloat(
"Child Border", &properties.
child_border_size, 0.0f, 2.0f,
"%.0f");
185 ImGui::SliderFloat(
"Popup Border", &properties.
popup_border_size, 0.0f, 2.0f,
"%.0f");
186 ImGui::SliderFloat(
"Frame Border", &properties.
frame_border_size, 0.0f, 2.0f,
"%.0f");
187 ImGui::SliderFloat(
"Tab Border", &properties.
tab_border_size, 0.0f, 2.0f,
"%.0f");
193 show_sizes_ ? ImGuiTreeNodeFlags_DefaultOpen : 0)) {
194 ImGui::SliderFloat(
"Indent Spacing", &properties.
indent_spacing, 0.0f, 30.0f,
"%.0f");
195 ImGui::SliderFloat(
"Scrollbar Size", &properties.
scrollbar_size, 1.0f, 20.0f,
"%.0f");
196 ImGui::SliderFloat(
"Grab Min Size", &properties.
grab_min_size, 1.0f, 20.0f,
"%.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