ui/motif/container.h

changeset 60
7cd1b8890302
parent 52
25e5390cce41
child 61
7ee124a58fe3
--- a/ui/motif/container.h	Thu Jan 01 11:23:43 2015 +0100
+++ b/ui/motif/container.h	Thu Jan 01 14:13:37 2015 +0100
@@ -31,19 +31,47 @@
 
 #include "../ui/toolkit.h"
 #include <ucx/list.h>
+#include <string.h>
 
 #ifdef	__cplusplus
 extern "C" {
 #endif
 
+#define ui_reset_layout(layout) memset(&(layout), 0, sizeof(UiLayout))
+    
 typedef struct MotifTabbedPane MotifTabbedPane;
 typedef struct UiTab           UiTab;
+typedef struct UiBoxContainer  UiBoxContainer;
 
-typedef Widget (*ui_container_add_f)(UiContainer*, Arg*, int*);
+typedef Widget (*ui_container_add_f)(UiContainer*, Arg*, int*, UiBool);
+
+typedef struct UiLayout UiLayout;
+typedef enum UiLayoutBool UiLayoutBool;
+
+
+enum UiLayoutBool {
+    UI_LAYOUT_UNDEFINED = 0,
+    UI_LAYOUT_TRUE,
+    UI_LAYOUT_FALSE,
+};
+
+struct UiLayout {
+    UiLayoutBool fill;
+};
 
 struct UiContainer {
-    Widget widget;
-    Widget (*add)(UiContainer*, Arg *, int*);
+    Widget   widget;
+    Widget   (*prepare)(UiContainer*, Arg *, int*, UiBool);
+    void     (*add)(UiContainer*, Widget);
+    UiLayout layout;
+};
+
+struct UiBoxContainer {
+    UiContainer container;
+    Widget prev_widget;
+    Widget filled_widget;
+    UiBool cur_fill;
+    UiBool has_fill;
 };
 
 struct MotifTabbedPane {
@@ -61,7 +89,13 @@
     
 
 UiContainer* ui_frame_container(UiObject *obj, Widget frame);
-Widget ui_frame_container_add(UiContainer *ct, Arg *args, int *n);
+Widget ui_frame_container_prepare(UiContainer *ct, Arg *args, int *n, UiBool fill);
+void ui_frame_container_add(UiContainer *ct, Widget widget);
+
+UiContainer* ui_vbox_container(UiObject *obj, Widget box);
+Widget ui_vbox_container_prepare(UiContainer *ct, Arg *args, int *n, UiBool fill);
+void ui_vbox_container_add(UiContainer *ct, Widget widget);
+
 void ui_tab_button_callback(Widget widget, UiTab *tab, XtPointer d);
 void ui_change_tab(MotifTabbedPane *pane, UiTab *tab);
 

mercurial