Mercurial > dwindows
comparison gtk4/dw.c @ 2367:0f340646a2ca
GTK4: GtkPictures should be centered, not filled... don't clobber the
alignment during box packing.
author | bsmith@81767d24-ef19-dc11-ae90-00e081727c95 |
---|---|
date | Sun, 14 Mar 2021 04:48:33 +0000 |
parents | b3efaae95735 |
children | ec90b552b266 |
comparison
equal
deleted
inserted
replaced
2366:b3efaae95735 | 2367:0f340646a2ca |
---|---|
2640 DW_FUNCTION_RETURN(dw_bitmap_new, HWND) | 2640 DW_FUNCTION_RETURN(dw_bitmap_new, HWND) |
2641 DW_FUNCTION_RESTORE_PARAM1(cid, ULONG) | 2641 DW_FUNCTION_RESTORE_PARAM1(cid, ULONG) |
2642 { | 2642 { |
2643 GtkWidget *tmp = gtk_picture_new(); | 2643 GtkWidget *tmp = gtk_picture_new(); |
2644 gtk_picture_set_can_shrink(GTK_PICTURE(tmp), TRUE); | 2644 gtk_picture_set_can_shrink(GTK_PICTURE(tmp), TRUE); |
2645 gtk_picture_set_keep_aspect_ratio(GTK_PICTURE(tmp), TRUE); | |
2646 gtk_widget_set_halign(GTK_WIDGET(tmp), GTK_ALIGN_CENTER); | |
2647 gtk_widget_set_valign(GTK_WIDGET(tmp), GTK_ALIGN_CENTER); | |
2645 gtk_widget_show(tmp); | 2648 gtk_widget_show(tmp); |
2646 g_object_set_data(G_OBJECT(tmp), "_dw_id", GINT_TO_POINTER(cid)); | 2649 g_object_set_data(G_OBJECT(tmp), "_dw_id", GINT_TO_POINTER(cid)); |
2647 DW_FUNCTION_RETURN_THIS(tmp); | 2650 DW_FUNCTION_RETURN_THIS(tmp); |
2648 } | 2651 } |
2649 | 2652 |
8261 index = boxcount; | 8264 index = boxcount; |
8262 | 8265 |
8263 g_object_set_data(G_OBJECT(item), "_dw_table", box); | 8266 g_object_set_data(G_OBJECT(item), "_dw_table", box); |
8264 /* Set the expand attribute on the widgets now instead of the container */ | 8267 /* Set the expand attribute on the widgets now instead of the container */ |
8265 gtk_widget_set_vexpand(item, vsize); | 8268 gtk_widget_set_vexpand(item, vsize); |
8266 gtk_widget_set_valign(item, vsize ? GTK_ALIGN_FILL : GTK_ALIGN_START); | |
8267 gtk_widget_set_hexpand(item, hsize); | 8269 gtk_widget_set_hexpand(item, hsize); |
8268 gtk_widget_set_halign(item, hsize ? GTK_ALIGN_FILL : GTK_ALIGN_START); | 8270 /* Don't clobber the center alignment on pictures */ |
8271 if(!GTK_IS_PICTURE(item)) | |
8272 { | |
8273 gtk_widget_set_valign(item, vsize ? GTK_ALIGN_FILL : GTK_ALIGN_START); | |
8274 gtk_widget_set_halign(item, hsize ? GTK_ALIGN_FILL : GTK_ALIGN_START); | |
8275 } | |
8269 /* Set pad for each margin direction on the widget */ | 8276 /* Set pad for each margin direction on the widget */ |
8270 _dw_widget_set_pad(item, pad); | 8277 _dw_widget_set_pad(item, pad); |
8271 /* Add to the grid using insert... | 8278 /* Add to the grid using insert... |
8272 * rows for vertical boxes and columns for horizontal. | 8279 * rows for vertical boxes and columns for horizontal. |
8273 */ | 8280 */ |