ui/gtk/container.c

branch
newapi
changeset 260
eebb0626d020
parent 253
087cc9216f28
child 267
79dd183dd4cb
equal deleted inserted replaced
259:8cce275d2847 260:eebb0626d020
139 } 139 }
140 if(vexpand) { 140 if(vexpand) {
141 gtk_widget_set_vexpand(widget, TRUE); 141 gtk_widget_set_vexpand(widget, TRUE);
142 } 142 }
143 143
144 int gwidth = ct->layout.gridwidth > 0 ? ct->layout.gridwidth : 1; 144 int colspan = ct->layout.colspan > 0 ? ct->layout.colspan : 1;
145 145 int rowspan = ct->layout.rowspan > 0 ? ct->layout.rowspan : 1;
146 gtk_grid_attach(GTK_GRID(ct->widget), widget, grid->x, grid->y, gwidth, 1); 146
147 grid->x += gwidth; 147 gtk_grid_attach(GTK_GRID(ct->widget), widget, grid->x, grid->y, colspan, rowspan);
148 grid->x += colspan;
148 149
149 ui_reset_layout(ct->layout); 150 ui_reset_layout(ct->layout);
150 ct->current = widget; 151 ct->current = widget;
151 } 152 }
152 #endif 153 #endif
168 if(ct->layout.vexpand != UI_LAYOUT_UNDEFINED) { 169 if(ct->layout.vexpand != UI_LAYOUT_UNDEFINED) {
169 vexpand = ct->layout.vexpand; 170 vexpand = ct->layout.vexpand;
170 } 171 }
171 GtkAttachOptions xoptions = hexpand ? GTK_FILL | GTK_EXPAND : GTK_FILL; 172 GtkAttachOptions xoptions = hexpand ? GTK_FILL | GTK_EXPAND : GTK_FILL;
172 GtkAttachOptions yoptions = vexpand ? GTK_FILL | GTK_EXPAND : GTK_FILL; 173 GtkAttachOptions yoptions = vexpand ? GTK_FILL | GTK_EXPAND : GTK_FILL;
174
175 int colspan = ct->layout.colspan > 0 ? ct->layout.colspan : 1;
176 int rowspan = ct->layout.rowspan > 0 ? ct->layout.rowspan : 1;
177 // TODO: use colspan/rowspan
173 178
174 gtk_table_attach(GTK_TABLE(ct->widget), widget, grid->x, grid->x+1, grid->y, grid->y+1, xoptions, yoptions, 0, 0); 179 gtk_table_attach(GTK_TABLE(ct->widget), widget, grid->x, grid->x+1, grid->y, grid->y+1, xoptions, yoptions, 0, 0);
175 grid->x++; 180 grid->x++;
176 int nw = grid->x > grid->width ? grid->x : grid->width; 181 int nw = grid->x > grid->width ? grid->x : grid->width;
177 if(grid->x > grid->width || grid->y > grid->height) { 182 if(grid->x > grid->width || grid->y > grid->height) {
365 void ui_layout_vexpand(UiObject *obj, UiBool expand) { 370 void ui_layout_vexpand(UiObject *obj, UiBool expand) {
366 UiContainer *ct = uic_get_current_container(obj); 371 UiContainer *ct = uic_get_current_container(obj);
367 ct->layout.vexpand = expand; 372 ct->layout.vexpand = expand;
368 } 373 }
369 374
370 void ui_layout_gridwidth(UiObject *obj, int width) {
371 UiContainer *ct = uic_get_current_container(obj);
372 ct->layout.gridwidth = width;
373 }
374
375 void ui_layout_colspan(UiObject* obj, int cols) { 375 void ui_layout_colspan(UiObject* obj, int cols) {
376 UiContainer* ct = uic_get_current_container(obj); 376 UiContainer* ct = uic_get_current_container(obj);
377 ct->layout.colspan = cols; 377 ct->layout.colspan = cols;
378 } 378 }
379 379

mercurial