diff -r 81c4f73236a4 -r c3f2f16fa4b8 ui/qt/container.h --- a/ui/qt/container.h Sat Oct 04 14:54:25 2025 +0200 +++ b/ui/qt/container.h Sun Oct 19 21:20:08 2025 +0200 @@ -40,60 +40,26 @@ #include #include -#define UI_APPLY_LAYOUT(layout, args) \ - layout.fill = args->fill; \ - layout.hexpand = args->hexpand; \ - layout.vexpand = args->vexpand; \ - layout.hfill = args->hfill; \ - layout.vfill = args->vfill; \ - layout.override_defaults = args->override_defaults; \ - layout.colspan = args->colspan; \ - layout.rowspan = args->rowspan - -#define ui_reset_layout(layout) memset(&(layout), 0, sizeof(UiLayout)) -#define ui_lb2bool(b) ((b) == UI_LAYOUT_TRUE ? TRUE : FALSE) -#define ui_bool2lb(b) ((b) ? UI_LAYOUT_TRUE : UI_LAYOUT_FALSE) - #define ui_obj_container(obj) (UiContainerPrivate*)((UiContainerX*)obj->container_end)->container -typedef enum UiLayoutBool { - UI_LAYOUT_UNDEFINED = 0, - UI_LAYOUT_TRUE, - UI_LAYOUT_FALSE, -} UiLayoutBool; +struct UiContainerPrivate { + UIWIDGET current; + UiContainerX *container; -typedef struct UiLayout UiLayout; -struct UiLayout { - UiBool fill; - UiBool newline; - char *label; - UiBool hexpand; - UiBool vexpand; - UiBool hfill; - UiBool vfill; - UiBool override_defaults; - int width; - int colspan; - int rowspan; -}; - -struct UiContainerPrivate { - UiLayout layout; - UIWIDGET current; - - virtual void add(QWidget *widget) = 0; + virtual void add(QWidget *widget, UiLayout& layout) = 0; virtual void end() {} }; class UiBoxContainer : public UiContainerPrivate { public: - QBoxLayout *box; - bool hasStretchedWidget = false; - QSpacerItem *space; + QBoxLayout *box; + bool hasStretchedWidget = false; + QSpacerItem *space; + QBoxLayout::Direction direction; UiBoxContainer(QBoxLayout *box); - virtual void add(QWidget *widget); + virtual void add(QWidget *widget, UiLayout& layout); }; class UiGridContainer : public UiContainerPrivate { @@ -120,11 +86,13 @@ bool def_hfill, bool def_vfill); - virtual void add(QWidget *widget); + virtual void add(QWidget *widget, UiLayout& layout); virtual void end(); }; -void ui_container_add(UiObject *obj, UiContainerPrivate *ct); +void ui_obj_add_container(UiObject *obj, UiContainerPrivate *ct); + +QWidget* ui_widget_set_margin(QWidget *w, int left, int right, int top, int bottom); #endif /* CONTAINER_H */