ui/motif/container.h

changeset 112
c3f2f16fa4b8
parent 108
77254bd6dccb
child 113
dde28a806552
equal deleted inserted replaced
111:81c4f73236a4 112:c3f2f16fa4b8
60 #define ui_lb2bool(b) ((b) == UI_LAYOUT_TRUE ? TRUE : FALSE) 60 #define ui_lb2bool(b) ((b) == UI_LAYOUT_TRUE ? TRUE : FALSE)
61 #define ui_bool2lb(b) ((b) ? UI_LAYOUT_TRUE : UI_LAYOUT_FALSE) 61 #define ui_bool2lb(b) ((b) ? UI_LAYOUT_TRUE : UI_LAYOUT_FALSE)
62 62
63 #define ui_obj_container(obj) (UiContainerPrivate*)obj->container_end 63 #define ui_obj_container(obj) (UiContainerPrivate*)obj->container_end
64 64
65 typedef struct UiLayout UiLayout;
66
67 struct UiLayout {
68 UiBool fill;
69 UiBool newline;
70 char *label;
71 UiBool hexpand;
72 UiBool vexpand;
73 UiBool hfill;
74 UiBool vfill;
75 UiBool override_defaults;
76 int width;
77 int colspan;
78 int rowspan;
79 };
80 65
81 enum UiBoxOrientation { 66 enum UiBoxOrientation {
82 UI_BOX_VERTICAL = 0, 67 UI_BOX_VERTICAL = 0,
83 UI_BOX_HORIZONTAL 68 UI_BOX_HORIZONTAL
84 }; 69 };
86 typedef struct UiContainerPrivate UiContainerPrivate; 71 typedef struct UiContainerPrivate UiContainerPrivate;
87 72
88 73
89 struct UiContainerPrivate { 74 struct UiContainerPrivate {
90 UiContainerX container; 75 UiContainerX container;
91 Widget (*prepare)(UiContainerPrivate*, Arg *, int*); 76 Widget (*prepare)(UiContainerPrivate*, UiLayout *layout, Arg *, int*);
92 void (*add)(UiContainerPrivate*, Widget); 77 void (*add)(UiContainerPrivate*, Widget);
93 Widget widget; 78 Widget widget;
94 UiContainerType type; 79 UiContainerType type;
95 UiLayout layout;
96 }; 80 };
97 81
98 typedef struct UiBoxContainer { 82 typedef struct UiBoxContainer {
99 UiContainerPrivate container; 83 UiContainerPrivate container;
100 Dimension n; 84 Dimension n;
141 typedef struct UiTabViewContainer { 125 typedef struct UiTabViewContainer {
142 UiContainerPrivate container; 126 UiContainerPrivate container;
143 UiMotifTabView *tabview; 127 UiMotifTabView *tabview;
144 } UiTabViewContainer; 128 } UiTabViewContainer;
145 129
130 Widget ui_container_prepare(UiContainerPrivate *container, UiLayout *layout, Arg *args, int *n);
131 void ui_container_add(UiContainerPrivate *container, Widget widget);
132
146 void ui_motif_tabview_select(UiMotifTabView *tabview, int tab); 133 void ui_motif_tabview_select(UiMotifTabView *tabview, int tab);
147 void ui_motif_tabview_add_tab(UiMotifTabView *tabview, int index, const char *name, Widget child); 134 void ui_motif_tabview_add_tab(UiMotifTabView *tabview, int index, const char *name, Widget child);
148 void ui_motif_tabview_remove(UiMotifTabView *tabview, int index); 135 void ui_motif_tabview_remove(UiMotifTabView *tabview, int index);
149 void ui_motif_tabview_change_tab(UiMotifTabView *tabview, UiTab *tab); 136 void ui_motif_tabview_change_tab(UiMotifTabView *tabview, UiTab *tab);
150 int64_t ui_tabview_get(UiInteger *i); 137 int64_t ui_tabview_get(UiInteger *i);
151 void ui_tabview_set(UiInteger *i, int64_t value); 138 void ui_tabview_set(UiInteger *i, int64_t value);
152 139
153 Widget ui_tabview_container_prepare(UiContainerPrivate *ctn, Arg *args, int *n); 140 Widget ui_tabview_container_prepare(UiContainerPrivate *ctn, UiLayout *layout, Arg *args, int *n);
154 void ui_tabview_container_add(UiContainerPrivate *ctn, Widget widget); 141 void ui_tabview_container_add(UiContainerPrivate *ctn, Widget widget);
155 142
156 UiContainerX* ui_box_container(UiObject *obj, Widget grid, UiBoxOrientation orientation); 143 UiContainerX* ui_box_container(UiObject *obj, Widget grid, UiBoxOrientation orientation);
157 Widget ui_vbox_prepare(UiContainerPrivate *ctn, Arg *args, int *n); 144 Widget ui_vbox_prepare(UiContainerPrivate *ctn, UiLayout *layout, Arg *args, int *n);
158 Widget ui_hbox_prepare(UiContainerPrivate *ctn, Arg *args, int *n); 145 Widget ui_hbox_prepare(UiContainerPrivate *ctn, UiLayout *layout, Arg *args, int *n);
159 void ui_box_container_add(UiContainerPrivate *ctn, Widget widget); 146 void ui_box_container_add(UiContainerPrivate *ctn, Widget widget);
160 147
161 148
162 UiContainerX* ui_grid_container( 149 UiContainerX* ui_grid_container(
163 UiObject *obj, 150 UiObject *obj,
164 Widget grid, 151 Widget grid,
165 UiBool def_hexpand, 152 UiBool def_hexpand,
166 UiBool def_vexpand, 153 UiBool def_vexpand,
167 UiBool def_hfill, 154 UiBool def_hfill,
168 UiBool def_vfill); 155 UiBool def_vfill);
169 Widget ui_grid_container_prepare(UiContainerPrivate *ctn, Arg *args, int *n); 156 Widget ui_grid_container_prepare(UiContainerPrivate *ctn, UiLayout *layout, Arg *args, int *n);
170 void ui_grid_container_add(UiContainerPrivate *ctn, Widget widget); 157 void ui_grid_container_add(UiContainerPrivate *ctn, Widget widget);
171 158
172 #ifdef __cplusplus 159 #ifdef __cplusplus
173 } 160 }
174 #endif 161 #endif

mercurial