ui/gtk/container.c

changeset 75
efe2f65bea17
parent 74
55718d4ed227
child 94
d51e334c1439
equal deleted inserted replaced
74:55718d4ed227 75:efe2f65bea17
61 } 61 }
62 62
63 void ui_frame_container_add(UiContainer *ct, GtkWidget *widget, UiBool fill) { 63 void ui_frame_container_add(UiContainer *ct, GtkWidget *widget, UiBool fill) {
64 gtk_container_add(GTK_CONTAINER(ct->widget), widget); 64 gtk_container_add(GTK_CONTAINER(ct->widget), widget);
65 ui_reset_layout(ct->layout); 65 ui_reset_layout(ct->layout);
66 ct->current = widget;
66 } 67 }
67 68
68 69
69 /* -------------------- Box Container -------------------- */ 70 /* -------------------- Box Container -------------------- */
70 UiContainer* ui_box_container(UiObject *obj, GtkWidget *box) { 71 UiContainer* ui_box_container(UiObject *obj, GtkWidget *box) {
93 94
94 UiBool expand = fill; 95 UiBool expand = fill;
95 gtk_box_pack_start(GTK_BOX(ct->widget), widget, expand, fill, 0); 96 gtk_box_pack_start(GTK_BOX(ct->widget), widget, expand, fill, 0);
96 97
97 ui_reset_layout(ct->layout); 98 ui_reset_layout(ct->layout);
99 ct->current = widget;
98 } 100 }
99 101
100 UiContainer* ui_grid_container(UiObject *obj, GtkWidget *grid) { 102 UiContainer* ui_grid_container(UiObject *obj, GtkWidget *grid) {
101 UiGridContainer *ct = ucx_mempool_calloc( 103 UiGridContainer *ct = ucx_mempool_calloc(
102 obj->ctx->mempool, 104 obj->ctx->mempool,
123 125
124 gtk_grid_attach(GTK_GRID(ct->widget), widget, grid->x, grid->y, 1, 1); 126 gtk_grid_attach(GTK_GRID(ct->widget), widget, grid->x, grid->y, 1, 1);
125 grid->x++; 127 grid->x++;
126 128
127 ui_reset_layout(ct->layout); 129 ui_reset_layout(ct->layout);
130 ct->current = widget;
128 } 131 }
129 #endif 132 #endif
130 #ifdef UI_GTK2 133 #ifdef UI_GTK2
131 void ui_grid_container_add(UiContainer *ct, GtkWidget *widget, UiBool fill) { 134 void ui_grid_container_add(UiContainer *ct, GtkWidget *widget, UiBool fill) {
132 UiGridContainer *grid = (UiGridContainer*)ct; 135 UiGridContainer *grid = (UiGridContainer*)ct;
143 if(grid->x > grid->width || grid->y > grid->height) { 146 if(grid->x > grid->width || grid->y > grid->height) {
144 grid->width = nw; 147 grid->width = nw;
145 grid->height = grid->y + 1; 148 grid->height = grid->y + 1;
146 gtk_table_resize(GTK_TABLE(ct->widget), grid->width, grid->height); 149 gtk_table_resize(GTK_TABLE(ct->widget), grid->width, grid->height);
147 } 150 }
151
152 ui_reset_layout(ct->layout);
153 ct->current = widget;
148 } 154 }
149 #endif 155 #endif
150 156
151 UiContainer* ui_tabview_container(UiObject *obj, GtkWidget *tabview) { 157 UiContainer* ui_tabview_container(UiObject *obj, GtkWidget *tabview) {
152 UiTabViewContainer *ct = ucx_mempool_calloc( 158 UiTabViewContainer *ct = ucx_mempool_calloc(
161 void ui_tabview_container_add(UiContainer *ct, GtkWidget *widget, UiBool fill) { 167 void ui_tabview_container_add(UiContainer *ct, GtkWidget *widget, UiBool fill) {
162 gtk_notebook_append_page( 168 gtk_notebook_append_page(
163 GTK_NOTEBOOK(ct->widget), 169 GTK_NOTEBOOK(ct->widget),
164 widget, 170 widget,
165 gtk_label_new(ct->layout.label)); 171 gtk_label_new(ct->layout.label));
172
173 ui_reset_layout(ct->layout);
174 ct->current = widget;
166 } 175 }
167 176
168 177
169 UIWIDGET ui_vbox(UiObject *obj) { 178 UIWIDGET ui_vbox(UiObject *obj) {
170 UiContainer *ct = uic_get_current_container(obj); 179 UiContainer *ct = uic_get_current_container(obj);
269 } 278 }
270 279
271 void ui_split_container_add1(UiContainer *ct, GtkWidget *widget, UiBool fill) { 280 void ui_split_container_add1(UiContainer *ct, GtkWidget *widget, UiBool fill) {
272 // TODO: remove 281 // TODO: remove
273 gtk_paned_pack1(GTK_PANED(ct->widget), widget, TRUE, FALSE); 282 gtk_paned_pack1(GTK_PANED(ct->widget), widget, TRUE, FALSE);
283
284 ui_reset_layout(ct->layout);
285 ct->current = widget;
274 } 286 }
275 287
276 void ui_split_container_add2(UiContainer *ct, GtkWidget *widget, UiBool fill) { 288 void ui_split_container_add2(UiContainer *ct, GtkWidget *widget, UiBool fill) {
277 gtk_paned_pack2(GTK_PANED(ct->widget), widget, TRUE, FALSE); 289 gtk_paned_pack2(GTK_PANED(ct->widget), widget, TRUE, FALSE);
290
291 ui_reset_layout(ct->layout);
292 ct->current = widget;
278 } 293 }
279 294
280 295
281 /* -------------------- Document Tabview -------------------- */ 296 /* -------------------- Document Tabview -------------------- */
282 static void page_change(GtkNotebook *notebook, GtkWidget *page, guint page_num, gpointer data) { 297 static void page_change(GtkNotebook *notebook, GtkWidget *page, guint page_num, gpointer data) {

mercurial