ui/qt/container.h

changeset 66
8d490d97aab8
parent 56
87e3a5dc66dd
child 67
f72c4f01bf4a
equal deleted inserted replaced
65:4697592e24ba 66:8d490d97aab8
30 #define CONTAINER_H 30 #define CONTAINER_H
31 31
32 #include "toolkit.h" 32 #include "toolkit.h"
33 #include "window.h" 33 #include "window.h"
34 34
35 #include <string.h>
36 #include <QBoxLayout>
37
38 #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_reset_layout(layout) memset(&(layout), 0, sizeof(UiLayout))
41
42 typedef struct UiLayout UiLayout;
43
44 enum UiLayoutBool {
45 UI_LAYOUT_UNDEFINED = 0,
46 UI_LAYOUT_TRUE,
47 UI_LAYOUT_FALSE,
48 };
49 typedef enum UiLayoutBool UiLayoutBool;
50
51 struct UiLayout {
52 UiLayoutBool fill;
53 };
35 54
36 struct UiContainer { 55 struct UiContainer {
37 virtual void add(QWidget *widget) = 0; 56 UiLayout layout;
57
58 virtual void add(QWidget *widget, bool fill) = 0;
38 }; 59 };
39 60
40 class UiWindowContainer : public UiContainer { 61 class UiBoxContainer : public UiContainer {
41 public: 62 public:
42 QMainWindow *window; 63 QBoxLayout *box;
64 bool hasStretchedWidget = false;
65 QSpacerItem *space;
43 66
44 UiWindowContainer(QMainWindow *window); 67 UiBoxContainer(QBoxLayout *box);
45 68
46 virtual void add(QWidget *widget); 69 virtual void add(QWidget *widget, bool fill);
47 }; 70 };
48 71
49 #endif /* CONTAINER_H */ 72 #endif /* CONTAINER_H */
50 73

mercurial