| 224 int colspan = layout->colspan > 0 ? layout->colspan : 1; |
222 int colspan = layout->colspan > 0 ? layout->colspan : 1; |
| 225 int rowspan = layout->rowspan > 0 ? layout->rowspan : 1; |
223 int rowspan = layout->rowspan > 0 ? layout->rowspan : 1; |
| 226 |
224 |
| 227 gtk_grid_attach(GTK_GRID(ct->widget), widget, grid->x, grid->y, colspan, rowspan); |
225 gtk_grid_attach(GTK_GRID(ct->widget), widget, grid->x, grid->y, colspan, rowspan); |
| 228 grid->x += colspan; |
226 grid->x += colspan; |
| 229 |
|
| 230 grid->container.current = widget; |
|
| 231 } |
227 } |
| 232 #endif |
228 #endif |
| 233 #ifdef UI_GTK2 |
229 #ifdef UI_GTK2 |
| 234 void ui_grid_container_add(UiContainerPrivate *ct, GtkWidget *widget) { |
230 void ui_grid_container_add(UiContainerPrivate *ct, GtkWidget *widget) { |
| 235 UiGridContainer *grid = (UiGridContainer*)ct; |
231 UiGridContainer *grid = (UiGridContainer*)ct; |
| 286 } |
282 } |
| 287 |
283 |
| 288 void ui_frame_container_add(UiContainerPrivate *ct, GtkWidget *widget, UiLayout *layout) { |
284 void ui_frame_container_add(UiContainerPrivate *ct, GtkWidget *widget, UiLayout *layout) { |
| 289 widget = ui_gtk_set_margin(widget, layout->margin, layout->margin_left, layout->margin_right, layout->margin_top, layout->margin_bottom); |
285 widget = ui_gtk_set_margin(widget, layout->margin, layout->margin_left, layout->margin_right, layout->margin_top, layout->margin_bottom); |
| 290 FRAME_SET_CHILD(ct->widget, widget); |
286 FRAME_SET_CHILD(ct->widget, widget); |
| 291 ct->current = widget; |
|
| 292 } |
287 } |
| 293 |
288 |
| 294 UiContainerX* ui_expander_container(UiObject *obj, GtkWidget *expander) { |
289 UiContainerX* ui_expander_container(UiObject *obj, GtkWidget *expander) { |
| 295 UiContainerPrivate *ct = cxCalloc( |
290 UiContainerPrivate *ct = cxCalloc( |
| 296 obj->ctx->allocator, |
291 obj->ctx->allocator, |
| 302 } |
297 } |
| 303 |
298 |
| 304 void ui_expander_container_add(UiContainerPrivate *ct, GtkWidget *widget, UiLayout *layout) { |
299 void ui_expander_container_add(UiContainerPrivate *ct, GtkWidget *widget, UiLayout *layout) { |
| 305 widget = ui_gtk_set_margin(widget, layout->margin, layout->margin_left, layout->margin_right, layout->margin_top, layout->margin_bottom); |
300 widget = ui_gtk_set_margin(widget, layout->margin, layout->margin_left, layout->margin_right, layout->margin_top, layout->margin_bottom); |
| 306 EXPANDER_SET_CHILD(ct->widget, widget); |
301 EXPANDER_SET_CHILD(ct->widget, widget); |
| 307 ct->current = widget; |
|
| 308 } |
302 } |
| 309 |
303 |
| 310 void ui_scrolledwindow_container_add(UiContainerPrivate *ct, GtkWidget *widget, UiLayout *layout) { |
304 void ui_scrolledwindow_container_add(UiContainerPrivate *ct, GtkWidget *widget, UiLayout *layout) { |
| 311 widget = ui_gtk_set_margin(widget, layout->margin, layout->margin_left, layout->margin_right, layout->margin_top, layout->margin_bottom); |
305 widget = ui_gtk_set_margin(widget, layout->margin, layout->margin_left, layout->margin_right, layout->margin_top, layout->margin_bottom); |
| 312 // TODO: check if the widget implements GtkScrollable |
306 // TODO: check if the widget implements GtkScrollable |
| 313 SCROLLEDWINDOW_SET_CHILD(ct->widget, widget); |
307 SCROLLEDWINDOW_SET_CHILD(ct->widget, widget); |
| 314 ct->current = widget; |
|
| 315 } |
308 } |
| 316 |
309 |
| 317 UiContainerX* ui_scrolledwindow_container(UiObject *obj, GtkWidget *scrolledwindow) { |
310 UiContainerX* ui_scrolledwindow_container(UiObject *obj, GtkWidget *scrolledwindow) { |
| 318 UiContainerPrivate *ct = cxCalloc( |
311 UiContainerPrivate *ct = cxCalloc( |
| 319 obj->ctx->allocator, |
312 obj->ctx->allocator, |
| 340 fprintf(stderr, "UI Error: widget is not a tabview"); |
333 fprintf(stderr, "UI Error: widget is not a tabview"); |
| 341 return; |
334 return; |
| 342 } |
335 } |
| 343 widget = ui_gtk_set_margin(widget, layout->margin, layout->margin_left, layout->margin_right, layout->margin_top, layout->margin_bottom); |
336 widget = ui_gtk_set_margin(widget, layout->margin, layout->margin_left, layout->margin_right, layout->margin_top, layout->margin_bottom); |
| 344 data->add_tab(ct->widget, -1, layout->label, widget); |
337 data->add_tab(ct->widget, -1, layout->label, widget); |
| 345 |
|
| 346 ct->current = widget; |
|
| 347 } |
338 } |
| 348 |
339 |
| 349 #ifdef UI_GTK2 |
340 #ifdef UI_GTK2 |
| 350 |
341 |
| 351 static void alignment_child_visibility_changed(GtkWidget *widget, gpointer user_data) { |
342 static void alignment_child_visibility_changed(GtkWidget *widget, gpointer user_data) { |