diff options
author | Jasper St. Pierre <jstpierre@mecheye.net> | 2013-11-01 15:07:21 -0400 |
---|---|---|
committer | Jasper St. Pierre <jstpierre@mecheye.net> | 2013-11-01 16:51:42 -0400 |
commit | 7fb047cdc3912abe13098cb2ccb1f3056dc1f61a (patch) | |
tree | 6ddb054cd089f3853adfd5f3bc157a2b5f28cba0 /gtk/gtkbox.c | |
parent | 810f73381f4d01519d599f1a042bb84dbf27a1b7 (diff) | |
download | gtk+-wip/css-is-awesome.tar.gz |
gtkbox: Add support for padding using the new helper APIswip/css-is-awesome
Now, finally, we can have padded boxes! And look at that implementation!
That's how easy it is to add correct box model behavior to your widgets!
I'll be fixing a whole slew of these now...
Note that some reftests need fixing, not because this actually breaks
anything, but because Raleigh has a really silly style: * { padding: 2px; }
and reftests often use GtkBox to emulate other widgets like grids. We need
to add some CSS that resets all properties to make sure that this padding
isn't added to the boxes when trying to e.g. emulate grids.
Obviously, Raleigh is pretty broken here regardless, but layout tests like
this shouldn't be affected by style.
Adwaita is perfectly fine.
Diffstat (limited to 'gtk/gtkbox.c')
-rw-r--r-- | gtk/gtkbox.c | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/gtk/gtkbox.c b/gtk/gtkbox.c index cb2539954e..eaf323b42b 100644 --- a/gtk/gtkbox.c +++ b/gtk/gtkbox.c @@ -1226,6 +1226,7 @@ gtk_box_get_preferred_width (GtkWidget *widget, gint *natural_size) { gtk_box_get_size (widget, GTK_ORIENTATION_HORIZONTAL, minimum_size, natural_size, NULL, NULL); + _gtk_widget_adjust_preferred_width (widget, minimum_size, natural_size); } static void @@ -1234,6 +1235,7 @@ gtk_box_get_preferred_height (GtkWidget *widget, gint *natural_size) { gtk_box_get_size (widget, GTK_ORIENTATION_VERTICAL, minimum_size, natural_size, NULL, NULL); + _gtk_widget_adjust_preferred_height (widget, minimum_size, natural_size); } static void @@ -1528,10 +1530,14 @@ gtk_box_get_preferred_width_for_height (GtkWidget *widget, GtkBox *box = GTK_BOX (widget); GtkBoxPrivate *private = box->priv; + _gtk_widget_adjust_for_height (widget, &height); + if (private->orientation == GTK_ORIENTATION_VERTICAL) gtk_box_compute_size_for_opposing_orientation (box, height, minimum_width, natural_width, NULL, NULL); else gtk_box_compute_size_for_orientation (box, height, minimum_width, natural_width); + + _gtk_widget_adjust_preferred_width (widget, minimum_width, natural_width); } static void @@ -1545,6 +1551,8 @@ gtk_box_get_preferred_height_and_baseline_for_width (GtkWidget *widget, GtkBox *box = GTK_BOX (widget); GtkBoxPrivate *private = box->priv; + _gtk_widget_adjust_for_width (widget, &width); + if (width < 0) gtk_box_get_size (widget, GTK_ORIENTATION_VERTICAL, minimum_height, natural_height, minimum_baseline, natural_baseline); else @@ -1560,6 +1568,9 @@ gtk_box_get_preferred_height_and_baseline_for_width (GtkWidget *widget, gtk_box_compute_size_for_orientation (box, width, minimum_height, natural_height); } } + + _gtk_widget_adjust_preferred_height (widget, minimum_height, natural_height); + _gtk_widget_adjust_baseline (widget, minimum_baseline, natural_baseline); } static void |