ui/qt/container.h

changeset 67
f72c4f01bf4a
parent 66
8d490d97aab8
child 68
bd9fb6476b80
equal deleted inserted replaced
66:8d490d97aab8 67:f72c4f01bf4a
32 #include "toolkit.h" 32 #include "toolkit.h"
33 #include "window.h" 33 #include "window.h"
34 34
35 #include <string.h> 35 #include <string.h>
36 #include <QBoxLayout> 36 #include <QBoxLayout>
37 #include <QGridLayout>
37 38
38 #define ui_lb2bool(b) ((b) == UI_LAYOUT_TRUE ? TRUE : FALSE) 39 #define ui_lb2bool(b) ((b) == UI_LAYOUT_TRUE ? TRUE : FALSE)
39 #define ui_bool2lb(b) ((b) ? UI_LAYOUT_TRUE : UI_LAYOUT_FALSE) 40 #define ui_bool2lb(b) ((b) ? UI_LAYOUT_TRUE : UI_LAYOUT_FALSE)
40 #define ui_reset_layout(layout) memset(&(layout), 0, sizeof(UiLayout)) 41 #define ui_reset_layout(layout) memset(&(layout), 0, sizeof(UiLayout))
41 42
48 }; 49 };
49 typedef enum UiLayoutBool UiLayoutBool; 50 typedef enum UiLayoutBool UiLayoutBool;
50 51
51 struct UiLayout { 52 struct UiLayout {
52 UiLayoutBool fill; 53 UiLayoutBool fill;
54 bool newline;
53 }; 55 };
54 56
55 struct UiContainer { 57 struct UiContainer {
56 UiLayout layout; 58 UiLayout layout;
57 59
67 UiBoxContainer(QBoxLayout *box); 69 UiBoxContainer(QBoxLayout *box);
68 70
69 virtual void add(QWidget *widget, bool fill); 71 virtual void add(QWidget *widget, bool fill);
70 }; 72 };
71 73
74 class UiGridContainer : public UiContainer {
75 public:
76 QGridLayout *grid;
77 int x = 0;
78 int y = 0;
79 QSpacerItem *space = NULL;
80
81 UiGridContainer(QGridLayout *grid);
82
83 virtual void add(QWidget *widget, bool fill);
84 };
85
72 #endif /* CONTAINER_H */ 86 #endif /* CONTAINER_H */
73 87

mercurial