96 std::string indent(indent_level * 2,
' ');
99 auto* label_prop =
const_cast<WidgetDefinition&
>(widget).GetProperty(
"label");
100 std::string label = label_prop ? label_prop->string_value :
"Widget";
105 indent + absl::StrFormat(
"if (gui::ThemedButton(\"%s\")) {\n", label);
107 code += indent + absl::StrFormat(
" %s();\n", widget.
callback_name);
109 code += indent +
"}\n";
114 absl::StrFormat(
"if (gui::PrimaryButton(\"%s\")) {\n", label);
116 code += indent + absl::StrFormat(
" %s();\n", widget.
callback_name);
118 code += indent +
"}\n";
123 indent + absl::StrFormat(
"if (gui::DangerButton(\"%s\")) {\n", label);
125 code += indent + absl::StrFormat(
" %s();\n", widget.
callback_name);
127 code += indent +
"}\n";
133 std::string icon = icon_prop ? icon_prop->string_value :
ICON_MD_LABEL;
134 code += indent + absl::StrFormat(
"gui::SectionHeader(\"%s\", \"%s\");\n",
140 code += indent +
"if (gui::BeginPropertyTable(\"props\")) {\n";
141 code += indent +
" // Add property rows here\n";
142 code += indent +
" gui::EndPropertyTable();\n";
143 code += indent +
"}\n";
149 std::string value = value_prop ? value_prop->string_value :
"Value";
150 code += indent + absl::StrFormat(
"gui::PropertyRow(\"%s\", \"%s\");\n",
158 int columns = columns_prop ? columns_prop->int_value : 2;
161 "if (gui::LayoutHelpers::BeginTableWithTheming(\"table\", "
164 code += indent +
" // Table contents\n";
165 code += indent +
" gui::LayoutHelpers::EndTableWithTheming();\n";
166 code += indent +
"}\n";
172 indent + absl::StrFormat(
"if (gui::AutoButton(\"%s\")) {\n", label);
174 code += indent + absl::StrFormat(
" %s();\n", widget.
callback_name);
176 code += indent +
"}\n";
182 ImVec2 size = size_prop ? size_prop->vec2_value : ImVec2(300, 200);
183 code += indent +
"ImVec2 canvas_size;\n";
186 "gui::LayoutHelpers::BeginCanvasPanel(\"canvas\", &canvas_size);\n";
187 code += indent +
"// Custom drawing code here\n";
188 code += indent +
"gui::LayoutHelpers::EndCanvasPanel();\n";
195 std::string icon = icon_prop ? icon_prop->string_value :
ICON_MD_WINDOW;
196 code += indent + absl::StrFormat(
"gui::PanelHeader(\"%s\", \"%s\");\n",
202 code += indent + absl::StrFormat(
"// TODO: Yaze widget: %s\n",