ui/qt/container.h

changeset 66
8d490d97aab8
parent 56
87e3a5dc66dd
child 67
f72c4f01bf4a
--- a/ui/qt/container.h	Mon Jan 05 18:47:07 2015 +0100
+++ b/ui/qt/container.h	Wed Jan 07 17:25:33 2015 +0100
@@ -32,18 +32,41 @@
 #include "toolkit.h"
 #include "window.h"
 
+#include <string.h>
+#include <QBoxLayout>
 
-struct UiContainer {
-    virtual void add(QWidget *widget) = 0;
+#define ui_lb2bool(b) ((b) == UI_LAYOUT_TRUE ? TRUE : FALSE)
+#define ui_bool2lb(b) ((b) ? UI_LAYOUT_TRUE : UI_LAYOUT_FALSE)
+#define ui_reset_layout(layout) memset(&(layout), 0, sizeof(UiLayout))
+
+typedef struct UiLayout UiLayout;
+
+enum UiLayoutBool {
+    UI_LAYOUT_UNDEFINED = 0,
+    UI_LAYOUT_TRUE,
+    UI_LAYOUT_FALSE,
+};
+typedef enum UiLayoutBool UiLayoutBool;
+
+struct UiLayout {
+    UiLayoutBool fill;
 };
 
-class UiWindowContainer : public UiContainer {
-public:  
-    QMainWindow *window;
+struct UiContainer {
+    UiLayout layout;
     
-    UiWindowContainer(QMainWindow *window);
+    virtual void add(QWidget *widget, bool fill) = 0;
+};
+
+class UiBoxContainer : public UiContainer {
+public:
+    QBoxLayout  *box;
+    bool        hasStretchedWidget = false;
+    QSpacerItem *space;
     
-    virtual void add(QWidget *widget);
+    UiBoxContainer(QBoxLayout *box);
+    
+    virtual void add(QWidget *widget, bool fill);
 };
 
 #endif	/* CONTAINER_H */

mercurial