Commit 00326d33 authored by William Jon McCann's avatar William Jon McCann Committed by Matthias Clasen
parent 8db2ba42
......@@ -349,6 +349,10 @@ gtk_button_box_set_layout (GtkButtonBox *widget,
if (priv->layout_style != layout_style)
{
priv->layout_style = layout_style;
if (priv->layout_style == GTK_BUTTONBOX_EXPAND)
gtk_box_set_homogeneous (GTK_BOX (widget), TRUE);
else
gtk_box_set_homogeneous (GTK_BOX (widget), FALSE);
g_object_notify (G_OBJECT (widget), "layout-style");
gtk_widget_queue_resize (GTK_WIDGET (widget));
}
......@@ -416,15 +420,25 @@ gtk_button_box_set_child_secondary (GtkButtonBox *widget,
GtkWidget *child,
gboolean is_secondary)
{
GtkButtonBox *bbox;
g_return_if_fail (GTK_IS_BUTTON_BOX (widget));
g_return_if_fail (GTK_IS_WIDGET (child));
g_return_if_fail (gtk_widget_get_parent (child) == GTK_WIDGET (widget));
bbox = GTK_BUTTON_BOX (widget);
g_object_set_data (G_OBJECT (child),
GTK_BOX_SECONDARY_CHILD,
is_secondary ? GINT_TO_POINTER (1) : NULL);
gtk_widget_child_notify (child, "secondary");
if (bbox->priv->layout_style == GTK_BUTTONBOX_EXPAND)
{
gtk_box_set_child_packing (GTK_BOX (bbox), child, TRUE, TRUE, 0,
is_secondary ? GTK_PACK_START : GTK_PACK_END);
}
if (gtk_widget_get_visible (GTK_WIDGET (widget)) &&
gtk_widget_get_visible (child))
gtk_widget_queue_resize (child);
......@@ -714,6 +728,7 @@ gtk_button_box_size_request (GtkWidget *widget,
case GTK_BUTTONBOX_START:
case GTK_BUTTONBOX_END:
case GTK_BUTTONBOX_CENTER:
case GTK_BUTTONBOX_EXPAND:
if (orientation == GTK_ORIENTATION_HORIZONTAL)
requisition->width = total_size + ((nvis_children - 1)*spacing);
else
......@@ -827,6 +842,13 @@ gtk_button_box_size_allocate (GtkWidget *widget,
bbox = GTK_BUTTON_BOX (widget);
priv = bbox->priv;
if (priv->layout_style == GTK_BUTTONBOX_EXPAND)
{
GTK_WIDGET_CLASS (gtk_button_box_parent_class)->size_allocate (widget, allocation);
return;
}
orientation = gtk_orientable_get_orientation (GTK_ORIENTABLE (widget));
spacing = gtk_box_get_spacing (GTK_BOX (widget));
......
......@@ -162,6 +162,7 @@ typedef enum
* @GTK_BUTTONBOX_END: Buttons are grouped towards the end of the box,
* (on the right for a HBox, or the bottom for a VBox).
* @GTK_BUTTONBOX_CENTER: Buttons are centered in the box. Since 2.12.
* @GTK_BUTTONBOX_EXPAND: Buttons expand to fill the box. Since 3.12.
*
* Used to dictate the style that a #GtkButtonBox uses to layout the buttons it
* contains. (See also: #GtkVButtonBox and #GtkHButtonBox).
......@@ -172,7 +173,8 @@ typedef enum
GTK_BUTTONBOX_EDGE,
GTK_BUTTONBOX_START,
GTK_BUTTONBOX_END,
GTK_BUTTONBOX_CENTER
GTK_BUTTONBOX_CENTER,
GTK_BUTTONBOX_EXPAND
} GtkButtonBoxStyle;
......
......@@ -28,6 +28,7 @@ static const char* styles[] = { "GTK_BUTTONBOX_SPREAD",
"GTK_BUTTONBOX_START",
"GTK_BUTTONBOX_END",
"GTK_BUTTONBOX_CENTER",
"GTK_BUTTONBOX_EXPAND",
NULL};
static const char* types[] = { "GtkHButtonBox",
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment