9namespace layout_designer {
25 if (prop.name == name) {
34 children.push_back(std::move(child));
55 widgets.push_back(std::move(widget));
63 if (widget->
id ==
id) {
66 for (
auto& child : widget->
children) {
67 if (
auto* found = search(child.get())) {
75 if (
auto* found = search(widget.get())) {
83 std::vector<WidgetDefinition*> result;
87 result.push_back(widget);
88 for (
auto& child : widget->children) {
94 collect(widget.get());
102 if (error_message) *error_message =
"Panel ID cannot be empty";
107 std::set<std::string> ids;
108 for (
const auto& widget :
widgets) {
109 if (ids.count(widget->id)) {
110 if (error_message) *error_message =
"Duplicate widget ID: " + widget->id;
113 ids.insert(widget->id);
120 auto now = std::chrono::system_clock::now();
122 now.time_since_epoch()).count();
177 default:
return "Unknown";
288 std::vector<WidgetProperty> props;
298 props.push_back(prop);
305 label.
name =
"label";
308 props.push_back(label);
314 props.push_back(size);
320 label.
name =
"label";
323 props.push_back(label);
326 checked.
name =
"checked";
329 props.push_back(checked);
335 label.
name =
"label";
338 props.push_back(label);
344 props.push_back(hint);
347 buffer_size.
name =
"buffer_size";
350 props.push_back(buffer_size);
356 label.
name =
"label";
359 props.push_back(label);
362 min_val.
name =
"min";
365 props.push_back(min_val);
368 max_val.
name =
"max";
371 props.push_back(max_val);
379 id.string_value =
"table";
383 columns.
name =
"columns";
386 props.push_back(columns);
389 flags.
name =
"flags";
392 props.push_back(flags);
401 props.push_back(size);
404 bg_color.
name =
"background";
406 bg_color.
color_value = ImVec4(0.2f, 0.2f, 0.2f, 1.0f);
407 props.push_back(bg_color);
#define ICON_MD_ACCOUNT_TREE
#define ICON_MD_CHECK_BOX
#define ICON_MD_TEXT_FIELDS
#define ICON_MD_TABLE_CHART
#define ICON_MD_SMART_BUTTON
#define ICON_MD_CHECK_CIRCLE
#define ICON_MD_HORIZONTAL_RULE
#define ICON_MD_RADIO_BUTTON_CHECKED
#define ICON_MD_LINEAR_SCALE
#define ICON_MD_ARROW_DROP_DOWN
std::vector< WidgetProperty > GetDefaultProperties(WidgetType type)
Get default properties for a widget type.
WidgetType
Types of ImGui widgets available in the designer.
const char * GetWidgetTypeName(WidgetType type)
Get human-readable name for widget type.
bool IsContainerWidget(WidgetType type)
Check if widget type is a container.
bool RequiresEndCall(WidgetType type)
Check if widget type requires an End*() call.
const char * GetWidgetTypeIcon(WidgetType type)
Get icon for widget type.
void AddWidget(std::unique_ptr< WidgetDefinition > widget)
std::vector< std::unique_ptr< WidgetDefinition > > widgets
bool Validate(std::string *error_message=nullptr) const
std::vector< WidgetDefinition * > GetAllWidgets()
int64_t modified_timestamp
WidgetDefinition * FindWidget(const std::string &id)