summaryrefslogtreecommitdiff
path: root/gtk/gtkvbbox.c
diff options
context:
space:
mode:
authorTim Janik <timj@imendio.com>2007-02-08 12:11:02 +0000
committerTim Janik <timj@src.gnome.org>2007-02-08 12:11:02 +0000
commit8a8202ce13a8355b90e92d53dcc29b4b1e9d9189 (patch)
tree43fca773b0b99eaa448a3597886a0816d1edb6c6 /gtk/gtkvbbox.c
parentbd151b02f6466870c8d220faf6dbeb2cfb1c1299 (diff)
downloadgtk+-8a8202ce13a8355b90e92d53dcc29b4b1e9d9189.tar.gz
applied patch from Xan Lopez which adds GTK_BUTTONBOX_CENTER to
Thu Feb 8 13:07:08 2007 Tim Janik <timj@imendio.com> * applied patch from Xan Lopez which adds GTK_BUTTONBOX_CENTER to GtkButtonBox (bug #336159). * gtk/gtkenums.h: * gtk/gtkvbbox.c, gtk/gtkhbbox.c, gtk/gtkbbox.c: support GTK_BUTTONBOX_CENTER. * tests/testbbox.c: new button box test, which allows testing of the various button box properties. * tests/testgtk.c: added GTK_BUTTONBOX_CENTER. to button box test. svn path=/trunk/; revision=17276
Diffstat (limited to 'gtk/gtkvbbox.c')
-rw-r--r--gtk/gtkvbbox.c13
1 files changed, 12 insertions, 1 deletions
diff --git a/gtk/gtkvbbox.c b/gtk/gtkvbbox.c
index 4f5957cd6c..c7b7256807 100644
--- a/gtk/gtkvbbox.c
+++ b/gtk/gtkvbbox.c
@@ -84,7 +84,7 @@ void
gtk_vbutton_box_set_layout_default (GtkButtonBoxStyle layout)
{
g_return_if_fail (layout >= GTK_BUTTONBOX_DEFAULT_STYLE &&
- layout <= GTK_BUTTONBOX_END);
+ layout <= GTK_BUTTONBOX_CENTER);
default_layout_style = layout;
}
@@ -151,6 +151,7 @@ gtk_vbutton_box_size_request (GtkWidget *widget,
case GTK_BUTTONBOX_EDGE:
case GTK_BUTTONBOX_START:
case GTK_BUTTONBOX_END:
+ case GTK_BUTTONBOX_CENTER:
requisition->height =
nvis_children*child_height + ((nvis_children-1)*spacing);
break;
@@ -239,6 +240,16 @@ gtk_vbutton_box_size_allocate (GtkWidget *widget,
- GTK_CONTAINER (box)->border_width;
secondary_y = allocation->y + GTK_CONTAINER (box)->border_width;
break;
+ case GTK_BUTTONBOX_CENTER:
+ childspacing = spacing;
+ y = allocation->y +
+ (allocation->height
+ - (child_height * (nvis_children - n_secondaries)
+ + spacing * (nvis_children - n_secondaries - 1)))/2
+ + (n_secondaries * child_height + n_secondaries * spacing)/2
+ + GTK_CONTAINER (box)->border_width;
+ secondary_y = allocation->y + GTK_CONTAINER (box)->border_width;
+ break;
default:
g_assert_not_reached();
break;