| 107:b34bd1557c6c | 108:77254bd6dccb |
|---|---|
| 39 #include <QTabWidget> | 39 #include <QTabWidget> |
| 40 #include <QStackedWidget> | 40 #include <QStackedWidget> |
| 41 #include <QSplitter> | 41 #include <QSplitter> |
| 42 | 42 |
| 43 #define UI_APPLY_LAYOUT(layout, args) \ | 43 #define UI_APPLY_LAYOUT(layout, args) \ |
| 44 layout.fill = args.fill; \ | 44 layout.fill = args->fill; \ |
| 45 layout.hexpand = args.hexpand; \ | 45 layout.hexpand = args->hexpand; \ |
| 46 layout.vexpand = args.vexpand; \ | 46 layout.vexpand = args->vexpand; \ |
| 47 layout.hfill = args.hfill; \ | 47 layout.hfill = args->hfill; \ |
| 48 layout.vfill = args.vfill; \ | 48 layout.vfill = args->vfill; \ |
| 49 layout.override_defaults = args.override_defaults; \ | 49 layout.override_defaults = args->override_defaults; \ |
| 50 layout.colspan = args.colspan; \ | 50 layout.colspan = args->colspan; \ |
| 51 layout.rowspan = args.rowspan | 51 layout.rowspan = args->rowspan |
| 52 | 52 |
| 53 #define ui_reset_layout(layout) memset(&(layout), 0, sizeof(UiLayout)) | 53 #define ui_reset_layout(layout) memset(&(layout), 0, sizeof(UiLayout)) |
| 54 #define ui_lb2bool(b) ((b) == UI_LAYOUT_TRUE ? TRUE : FALSE) | 54 #define ui_lb2bool(b) ((b) == UI_LAYOUT_TRUE ? TRUE : FALSE) |
| 55 #define ui_bool2lb(b) ((b) ? UI_LAYOUT_TRUE : UI_LAYOUT_FALSE) | 55 #define ui_bool2lb(b) ((b) ? UI_LAYOUT_TRUE : UI_LAYOUT_FALSE) |
| 56 | 56 |
| 62 UI_LAYOUT_FALSE, | 62 UI_LAYOUT_FALSE, |
| 63 } UiLayoutBool; | 63 } UiLayoutBool; |
| 64 | 64 |
| 65 typedef struct UiLayout UiLayout; | 65 typedef struct UiLayout UiLayout; |
| 66 struct UiLayout { | 66 struct UiLayout { |
| 67 UiTri fill; | 67 UiBool fill; |
| 68 UiBool newline; | 68 UiBool newline; |
| 69 char *label; | 69 char *label; |
| 70 UiBool hexpand; | 70 UiBool hexpand; |
| 71 UiBool vexpand; | 71 UiBool vexpand; |
| 72 UiBool hfill; | 72 UiBool hfill; |
| 79 | 79 |
| 80 struct UiContainerPrivate { | 80 struct UiContainerPrivate { |
| 81 UiLayout layout; | 81 UiLayout layout; |
| 82 UIWIDGET current; | 82 UIWIDGET current; |
| 83 | 83 |
| 84 virtual void add(QWidget *widget, bool fill) = 0; | 84 virtual void add(QWidget *widget) = 0; |
| 85 virtual void end() {} | 85 virtual void end() {} |
| 86 }; | 86 }; |
| 87 | 87 |
| 88 class UiBoxContainer : public UiContainerPrivate { | 88 class UiBoxContainer : public UiContainerPrivate { |
| 89 public: | 89 public: |
| 91 bool hasStretchedWidget = false; | 91 bool hasStretchedWidget = false; |
| 92 QSpacerItem *space; | 92 QSpacerItem *space; |
| 93 | 93 |
| 94 UiBoxContainer(QBoxLayout *box); | 94 UiBoxContainer(QBoxLayout *box); |
| 95 | 95 |
| 96 virtual void add(QWidget *widget, bool fill); | 96 virtual void add(QWidget *widget); |
| 97 }; | 97 }; |
| 98 | 98 |
| 99 class UiGridContainer : public UiContainerPrivate { | 99 class UiGridContainer : public UiContainerPrivate { |
| 100 public: | 100 public: |
| 101 QGridLayout *grid; | 101 QGridLayout *grid; |
| 118 bool def_hexpand, | 118 bool def_hexpand, |
| 119 bool def_vexpand, | 119 bool def_vexpand, |
| 120 bool def_hfill, | 120 bool def_hfill, |
| 121 bool def_vfill); | 121 bool def_vfill); |
| 122 | 122 |
| 123 virtual void add(QWidget *widget, bool fill); | 123 virtual void add(QWidget *widget); |
| 124 virtual void end(); | 124 virtual void end(); |
| 125 }; | 125 }; |
| 126 | 126 |
| 127 void ui_container_add(UiObject *obj, UiContainerPrivate *ct); | 127 void ui_container_add(UiObject *obj, UiContainerPrivate *ct); |
| 128 | 128 |