1 /* GTK - The GIMP Toolkit
2 * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2 of the License, or (at your option) any later version.
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library; if not, write to the
16 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
17 * Boston, MA 02111-1307, USA.
21 * Modified by the GTK+ Team and others 1997-2000. See the AUTHORS
22 * file for a list of people on the GTK+ Team. See the ChangeLog
23 * files for a list of changes. These files are distributed with
24 * GTK+ at ftp://ftp.gtk.org/pub/gtk/.
29 * @Short_description: A container for arranging buttons
30 * @Title: GtkButtonBox
32 * A button box should be used to provide a consistent layout of buttons
33 * throughout your application. The layout/spacing can be altered by the
34 * programmer, or if desired, by the user to alter the 'feel' of a
35 * program to a small degree.
37 * gtk_button_box_get_layout() and gtk_button_box_set_layout() retrieve and
38 * alter the method used to spread the buttons in a button box across the
39 * container, respectively.
41 * The main purpose of GtkButtonBox is to make sure the children have all the
42 * same size. GtkButtonBox gives all children the same size, but it does allow
43 * 'outliers' to keep their own larger size. To force all children to be
44 * strictly the same size without exceptions, you can set the
45 * #GtkButtonBox::homogeneous property to %TRUE.
47 * To excempt individual children from homogeneous sizing regardless of their
48 * 'outlier' status, you can set the #GtkButtonBox::non-homogeneous child
56 #include "gtkorientable.h"
57 #include "gtktypebuiltins.h"
58 #include "gtkprivate.h"
59 #include "gtksizerequest.h"
64 struct _GtkButtonBoxPrivate
66 GtkButtonBoxStyle layout_style;
77 CHILD_PROP_NONHOMOGENEOUS
80 #define GTK_BOX_SECONDARY_CHILD "gtk-box-secondary-child"
81 #define GTK_BOX_NON_HOMOGENEOUS "gtk-box-non-homogeneous"
83 static void gtk_button_box_set_property (GObject *object,
87 static void gtk_button_box_get_property (GObject *object,
91 static void gtk_button_box_get_preferred_width (GtkWidget *widget,
94 static void gtk_button_box_get_preferred_height (GtkWidget *widget,
97 static void gtk_button_box_get_preferred_width_for_height (GtkWidget *widget,
101 static void gtk_button_box_get_preferred_height_for_width (GtkWidget *widget,
106 static void gtk_button_box_size_allocate (GtkWidget *widget,
107 GtkAllocation *allocation);
108 static void gtk_button_box_remove (GtkContainer *container,
110 static void gtk_button_box_set_child_property (GtkContainer *container,
115 static void gtk_button_box_get_child_property (GtkContainer *container,
121 #define DEFAULT_CHILD_MIN_WIDTH 85
122 #define DEFAULT_CHILD_MIN_HEIGHT 27
123 #define DEFAULT_CHILD_IPAD_X 4
124 #define DEFAULT_CHILD_IPAD_Y 0
125 #define DEFAULT_LAYOUT_STYLE GTK_BUTTONBOX_EDGE
127 G_DEFINE_TYPE (GtkButtonBox, gtk_button_box, GTK_TYPE_BOX)
130 gtk_button_box_class_init (GtkButtonBoxClass *class)
132 GtkWidgetClass *widget_class;
133 GObjectClass *gobject_class;
134 GtkContainerClass *container_class;
136 gobject_class = G_OBJECT_CLASS (class);
137 widget_class = (GtkWidgetClass*) class;
138 container_class = (GtkContainerClass*) class;
140 gobject_class->set_property = gtk_button_box_set_property;
141 gobject_class->get_property = gtk_button_box_get_property;
143 widget_class->get_preferred_width = gtk_button_box_get_preferred_width;
144 widget_class->get_preferred_height = gtk_button_box_get_preferred_height;
145 widget_class->get_preferred_width_for_height = gtk_button_box_get_preferred_width_for_height;
146 widget_class->get_preferred_height_for_width = gtk_button_box_get_preferred_height_for_width;
147 widget_class->size_allocate = gtk_button_box_size_allocate;
149 container_class->remove = gtk_button_box_remove;
150 container_class->set_child_property = gtk_button_box_set_child_property;
151 container_class->get_child_property = gtk_button_box_get_child_property;
152 gtk_container_class_handle_border_width (container_class);
154 /* FIXME we need to override the "spacing" property on GtkBox once
155 * libgobject allows that.
157 gtk_widget_class_install_style_property (widget_class,
158 g_param_spec_int ("child-min-width",
159 P_("Minimum child width"),
160 P_("Minimum width of buttons inside the box"),
163 DEFAULT_CHILD_MIN_WIDTH,
164 GTK_PARAM_READABLE));
166 gtk_widget_class_install_style_property (widget_class,
167 g_param_spec_int ("child-min-height",
168 P_("Minimum child height"),
169 P_("Minimum height of buttons inside the box"),
172 DEFAULT_CHILD_MIN_HEIGHT,
173 GTK_PARAM_READABLE));
175 gtk_widget_class_install_style_property (widget_class,
176 g_param_spec_int ("child-internal-pad-x",
177 P_("Child internal width padding"),
178 P_("Amount to increase child's size on either side"),
181 DEFAULT_CHILD_IPAD_X,
182 GTK_PARAM_READABLE));
184 gtk_widget_class_install_style_property (widget_class,
185 g_param_spec_int ("child-internal-pad-y",
186 P_("Child internal height padding"),
187 P_("Amount to increase child's size on the top and bottom"),
190 DEFAULT_CHILD_IPAD_Y,
191 GTK_PARAM_READABLE));
192 g_object_class_install_property (gobject_class,
194 g_param_spec_enum ("layout-style",
196 P_("How to lay out the buttons in the box. Possible values are: spread, edge, start and end"),
197 GTK_TYPE_BUTTON_BOX_STYLE,
198 DEFAULT_LAYOUT_STYLE,
199 GTK_PARAM_READWRITE));
201 gtk_container_class_install_child_property (container_class,
202 CHILD_PROP_SECONDARY,
203 g_param_spec_boolean ("secondary",
205 P_("If TRUE, the child appears in a secondary group of children, suitable for, e.g., help buttons"),
207 GTK_PARAM_READWRITE));
209 gtk_container_class_install_child_property (container_class,
210 CHILD_PROP_NONHOMOGENEOUS,
211 g_param_spec_boolean ("non-homogeneous",
212 P_("Non-Homogeneous"),
213 P_("If TRUE, the child will not be subject to homogeneous sizing"),
215 GTK_PARAM_READWRITE));
217 g_type_class_add_private (class, sizeof (GtkButtonBoxPrivate));
221 gtk_button_box_init (GtkButtonBox *button_box)
223 GtkButtonBoxPrivate *priv;
225 button_box->priv = G_TYPE_INSTANCE_GET_PRIVATE (button_box,
227 GtkButtonBoxPrivate);
228 priv = button_box->priv;
230 gtk_box_set_spacing (GTK_BOX (button_box), 0);
231 priv->layout_style = DEFAULT_LAYOUT_STYLE;
235 gtk_button_box_set_property (GObject *object,
242 case PROP_LAYOUT_STYLE:
243 gtk_button_box_set_layout (GTK_BUTTON_BOX (object),
244 g_value_get_enum (value));
247 G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
253 gtk_button_box_get_property (GObject *object,
258 GtkButtonBoxPrivate *priv = GTK_BUTTON_BOX (object)->priv;
262 case PROP_LAYOUT_STYLE:
263 g_value_set_enum (value, priv->layout_style);
266 G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
272 gtk_button_box_set_child_property (GtkContainer *container,
280 case CHILD_PROP_SECONDARY:
281 gtk_button_box_set_child_secondary (GTK_BUTTON_BOX (container), child,
282 g_value_get_boolean (value));
284 case CHILD_PROP_NONHOMOGENEOUS:
285 gtk_button_box_set_child_non_homogeneous (GTK_BUTTON_BOX (container), child,
286 g_value_get_boolean (value));
289 GTK_CONTAINER_WARN_INVALID_CHILD_PROPERTY_ID (container, property_id, pspec);
295 gtk_button_box_get_child_property (GtkContainer *container,
303 case CHILD_PROP_SECONDARY:
304 g_value_set_boolean (value,
305 gtk_button_box_get_child_secondary (GTK_BUTTON_BOX (container),
308 case CHILD_PROP_NONHOMOGENEOUS:
309 g_value_set_boolean (value,
310 gtk_button_box_get_child_non_homogeneous (GTK_BUTTON_BOX (container),
314 GTK_CONTAINER_WARN_INVALID_CHILD_PROPERTY_ID (container, property_id, pspec);
320 gtk_button_box_remove (GtkContainer *container,
323 /* clear is_secondary and nonhomogeneous flag in case the widget
324 * is added to another container
326 gtk_button_box_set_child_secondary (GTK_BUTTON_BOX (container), widget, FALSE);
327 gtk_button_box_set_child_non_homogeneous (GTK_BUTTON_BOX (container), widget, FALSE);
329 GTK_CONTAINER_CLASS (gtk_button_box_parent_class)->remove (container, widget);
333 * gtk_button_box_set_layout:
334 * @widget: a #GtkButtonBox
335 * @layout_style: the new layout style
337 * Changes the way buttons are arranged in their container.
340 gtk_button_box_set_layout (GtkButtonBox *widget,
341 GtkButtonBoxStyle layout_style)
343 GtkButtonBoxPrivate *priv;
345 g_return_if_fail (GTK_IS_BUTTON_BOX (widget));
349 if (priv->layout_style != layout_style)
351 priv->layout_style = layout_style;
352 g_object_notify (G_OBJECT (widget), "layout-style");
353 gtk_widget_queue_resize (GTK_WIDGET (widget));
358 * gtk_button_box_get_layout:
359 * @widget: a #GtkButtonBox
361 * Retrieves the method being used to arrange the buttons in a button box.
363 * Returns: the method used to lay out buttons in @widget.
366 gtk_button_box_get_layout (GtkButtonBox *widget)
368 g_return_val_if_fail (GTK_IS_BUTTON_BOX (widget), DEFAULT_LAYOUT_STYLE);
370 return widget->priv->layout_style;
374 * gtk_button_box_get_child_secondary:
375 * @widget: a #GtkButtonBox
376 * @child: a child of @widget
378 * Returns whether @child should appear in a secondary group of children.
380 * Return value: whether @child should appear in a secondary group of children.
385 gtk_button_box_get_child_secondary (GtkButtonBox *widget,
388 g_return_val_if_fail (GTK_IS_BUTTON_BOX (widget), FALSE);
389 g_return_val_if_fail (GTK_IS_WIDGET (child), FALSE);
391 return (g_object_get_data (G_OBJECT (child), GTK_BOX_SECONDARY_CHILD) != NULL);
395 * gtk_button_box_set_child_secondary
396 * @widget: a #GtkButtonBox
397 * @child: a child of @widget
398 * @is_secondary: if %TRUE, the @child appears in a secondary group of the
401 * Sets whether @child should appear in a secondary group of children.
402 * A typical use of a secondary child is the help button in a dialog.
404 * This group appears after the other children if the style
405 * is %GTK_BUTTONBOX_START, %GTK_BUTTONBOX_SPREAD or
406 * %GTK_BUTTONBOX_EDGE, and before the other children if the style
407 * is %GTK_BUTTONBOX_END. For horizontal button boxes, the definition
408 * of before/after depends on direction of the widget (see
409 * gtk_widget_set_direction()). If the style is %GTK_BUTTONBOX_START
410 * or %GTK_BUTTONBOX_END, then the secondary children are aligned at
411 * the other end of the button box from the main children. For the
412 * other styles, they appear immediately next to the main children.
415 gtk_button_box_set_child_secondary (GtkButtonBox *widget,
417 gboolean is_secondary)
419 g_return_if_fail (GTK_IS_BUTTON_BOX (widget));
420 g_return_if_fail (GTK_IS_WIDGET (child));
421 g_return_if_fail (gtk_widget_get_parent (child) == GTK_WIDGET (widget));
423 g_object_set_data (G_OBJECT (child),
424 GTK_BOX_SECONDARY_CHILD,
425 is_secondary ? GINT_TO_POINTER (1) : NULL);
426 gtk_widget_child_notify (child, "secondary");
428 if (gtk_widget_get_visible (GTK_WIDGET (widget)) &&
429 gtk_widget_get_visible (child))
430 gtk_widget_queue_resize (child);
433 /* Ask children how much space they require and round up
434 * to match minimum size and internal padding.
435 * Returns the size each single child should have.
438 gtk_button_box_child_requisition (GtkWidget *widget,
440 gint *nvis_secondaries,
445 GList *children, *list;
451 GtkRequisition child_requisition;
454 gint child_min_width;
455 gint child_min_height;
458 gboolean homogeneous;
461 g_return_if_fail (GTK_IS_BUTTON_BOX (widget));
463 bbox = GTK_BUTTON_BOX (widget);
465 homogeneous = gtk_box_get_homogeneous (GTK_BOX (widget));
467 gtk_widget_style_get (widget,
468 "child-min-width", &child_min_width,
469 "child-min-height", &child_min_height,
470 "child-internal-pad-x", &ipad_x,
471 "child-internal-pad-y", &ipad_y,
476 list = children = _gtk_box_get_children (GTK_BOX (bbox));
477 needed_width = child_min_width;
478 needed_height = child_min_height;
487 child = children->data;
488 children = children->next;
490 if (gtk_widget_get_visible (child))
493 gtk_widget_get_preferred_size (child,
494 &child_requisition, NULL);
495 avg_w += child_requisition.width + ipad_w;
496 avg_h += child_requisition.height + ipad_h;
499 avg_w /= MAX (nchildren, 1);
500 avg_h /= MAX (nchildren, 1);
502 *widths = g_new (gint, nchildren);
503 *heights = g_new (gint, nchildren);
510 gboolean is_secondary;
511 gboolean non_homogeneous;
513 child = children->data;
514 children = children->next;
516 if (gtk_widget_get_visible (child))
518 is_secondary = gtk_button_box_get_child_secondary (bbox, child);
519 non_homogeneous = gtk_button_box_get_child_non_homogeneous (bbox, child);
524 gtk_widget_get_preferred_size (child, &child_requisition, NULL);
527 (!non_homogeneous && (child_requisition.width + ipad_w < avg_w * 1.5)))
530 if (child_requisition.width + ipad_w > needed_width)
531 needed_width = child_requisition.width + ipad_w;
535 (*widths)[i] = child_requisition.width + ipad_w;
539 (!non_homogeneous && (child_requisition.height + ipad_h < avg_h * 1.5)))
542 if (child_requisition.height + ipad_h > needed_height)
543 needed_height = child_requisition.height + ipad_h;
547 (*heights)[i] = child_requisition.height + ipad_h;
556 for (i = 0; i < nchildren; i++)
558 if ((*widths)[i] == -1)
559 (*widths)[i] = needed_width;
560 if ((*heights)[i] == -1)
561 (*heights)[i] = needed_height;
565 *nvis_children = nchildren;
567 if (nvis_secondaries)
568 *nvis_secondaries = nsecondaries;
572 gtk_button_box_size_request (GtkWidget *widget,
573 GtkRequisition *requisition)
575 GtkButtonBoxPrivate *priv;
581 GtkOrientation orientation;
586 bbox = GTK_BUTTON_BOX (widget);
589 orientation = gtk_orientable_get_orientation (GTK_ORIENTABLE (widget));
590 spacing = gtk_box_get_spacing (GTK_BOX (widget));
592 gtk_button_box_child_requisition (widget,
599 for (i = 0; i < nvis_children; i++)
601 if (orientation == GTK_ORIENTATION_HORIZONTAL)
603 total_size += widths[i];
604 max_size = MAX (max_size, heights[i]);
608 total_size += heights[i];
609 max_size = MAX (max_size, widths[i]);
615 if (nvis_children == 0)
617 requisition->width = 0;
618 requisition->height = 0;
622 switch (priv->layout_style)
624 case GTK_BUTTONBOX_SPREAD:
625 if (orientation == GTK_ORIENTATION_HORIZONTAL)
626 requisition->width = total_size + ((nvis_children + 1)*spacing);
628 requisition->height = total_size + ((nvis_children + 1)*spacing);
631 case GTK_BUTTONBOX_EDGE:
632 case GTK_BUTTONBOX_START:
633 case GTK_BUTTONBOX_END:
634 case GTK_BUTTONBOX_CENTER:
635 if (orientation == GTK_ORIENTATION_HORIZONTAL)
636 requisition->width = total_size + ((nvis_children - 1)*spacing);
638 requisition->height = total_size + ((nvis_children - 1)*spacing);
642 g_assert_not_reached ();
646 if (orientation == GTK_ORIENTATION_HORIZONTAL)
647 requisition->height = max_size;
649 requisition->width = max_size;
654 gtk_button_box_get_preferred_width (GtkWidget *widget,
658 GtkRequisition requisition;
660 gtk_button_box_size_request (widget, &requisition);
662 *minimum = *natural = requisition.width;
666 gtk_button_box_get_preferred_height (GtkWidget *widget,
670 GtkRequisition requisition;
672 gtk_button_box_size_request (widget, &requisition);
674 *minimum = *natural = requisition.height;
678 gtk_button_box_get_preferred_width_for_height (GtkWidget *widget,
683 gtk_button_box_get_preferred_width (widget, minimum, natural);
687 gtk_button_box_get_preferred_height_for_width (GtkWidget *widget,
692 gtk_button_box_get_preferred_height (widget, minimum, natural);
696 gtk_button_box_size_allocate (GtkWidget *widget,
697 GtkAllocation *allocation)
699 GtkButtonBoxPrivate *priv;
701 GList *children, *list;
702 GtkAllocation child_allocation;
708 gint secondary_x = 0;
709 gint secondary_y = 0;
712 gint childspacing = 0;
714 GtkOrientation orientation;
724 bbox = GTK_BUTTON_BOX (widget);
727 orientation = gtk_orientable_get_orientation (GTK_ORIENTABLE (widget));
728 spacing = gtk_box_get_spacing (GTK_BOX (widget));
730 gtk_widget_style_get (widget,
731 "child-internal-pad-x", &ipad_x,
732 "child-internal-pad-y", &ipad_y,
734 gtk_button_box_child_requisition (widget,
739 n_primaries = nvis_children - n_secondaries;
742 if (orientation == GTK_ORIENTATION_HORIZONTAL)
748 list = children = _gtk_box_get_children (GTK_BOX (widget));
753 child = children->data;
754 children = children->next;
756 if (gtk_widget_get_visible (child))
758 if (gtk_button_box_get_child_secondary (bbox, child))
759 secondary_size += sizes[i];
761 primary_size += sizes[i];
765 total_size = primary_size + secondary_size;
767 gtk_widget_set_allocation (widget, allocation);
769 if (orientation == GTK_ORIENTATION_HORIZONTAL)
770 width = allocation->width;
772 height = allocation->height;
774 switch (priv->layout_style)
776 case GTK_BUTTONBOX_SPREAD:
778 if (orientation == GTK_ORIENTATION_HORIZONTAL)
780 childspacing = (width - total_size) / (nvis_children + 1);
781 x = allocation->x + childspacing;
782 secondary_x = x + primary_size + n_primaries * childspacing;
786 childspacing = (height - total_size) / (nvis_children + 1);
787 y = allocation->y + childspacing;
788 secondary_y = y + primary_size + n_primaries * childspacing;
793 case GTK_BUTTONBOX_EDGE:
795 if (orientation == GTK_ORIENTATION_HORIZONTAL)
797 if (nvis_children >= 2)
799 childspacing = (width - total_size) / (nvis_children - 1);
801 secondary_x = x + primary_size + n_primaries * childspacing;
803 else if (nvis_children == 1)
805 /* one child, just center */
806 childspacing = width;
807 x = secondary_x = allocation->x
808 + (allocation->width - widths[0]) / 2;
812 /* zero children, meh */
813 childspacing = width;
814 x = secondary_x = allocation->x + allocation->width / 2;
819 if (nvis_children >= 2)
821 childspacing = (height - total_size) / (nvis_children - 1);
823 secondary_y = y + primary_size + n_primaries * childspacing;
825 else if (nvis_children == 1)
827 /* one child, just center */
828 childspacing = height;
829 y = secondary_y = allocation->y
830 + (allocation->height - heights[0]) / 2;
834 /* zero children, meh */
835 childspacing = height;
836 y = secondary_y = allocation->y + allocation->height / 2;
842 case GTK_BUTTONBOX_START:
844 if (orientation == GTK_ORIENTATION_HORIZONTAL)
846 childspacing = spacing;
848 secondary_x = allocation->x + allocation->width
849 - secondary_size - spacing * (n_secondaries - 1);
853 childspacing = spacing;
855 secondary_y = allocation->y + allocation->height
856 - secondary_size - spacing * (n_secondaries - 1);
861 case GTK_BUTTONBOX_END:
863 if (orientation == GTK_ORIENTATION_HORIZONTAL)
865 childspacing = spacing;
866 x = allocation->x + allocation->width
867 - primary_size - spacing * (n_primaries - 1);
868 secondary_x = allocation->x;
872 childspacing = spacing;
873 y = allocation->y + allocation->height
874 - primary_size - spacing * (n_primaries - 1);
875 secondary_y = allocation->y;
880 case GTK_BUTTONBOX_CENTER:
882 if (orientation == GTK_ORIENTATION_HORIZONTAL)
884 childspacing = spacing;
887 - (primary_size + spacing * (n_primaries - 1))) / 2
888 + (secondary_size + n_secondaries * spacing) / 2;
889 secondary_x = allocation->x;
893 childspacing = spacing;
896 - (primary_size + spacing * (n_primaries - 1))) / 2
897 + (secondary_size + n_secondaries * spacing) / 2;
898 secondary_y = allocation->y;
904 g_assert_not_reached ();
914 child = children->data;
915 children = children->next;
917 if (gtk_widget_get_visible (child))
919 child_allocation.width = widths[i];
920 child_allocation.height = heights[i];
922 if (orientation == GTK_ORIENTATION_HORIZONTAL)
924 child_allocation.y = allocation->y + (allocation->height - child_allocation.height) / 2;
926 if (gtk_button_box_get_child_secondary (bbox, child))
928 child_allocation.x = secondary_x;
929 secondary_x += child_allocation.width + childspacing;
933 child_allocation.x = x;
934 x += child_allocation.width + childspacing;
937 if (gtk_widget_get_direction (widget) == GTK_TEXT_DIR_RTL)
938 child_allocation.x = (allocation->x + allocation->width)
939 - (child_allocation.x + child_allocation.width - allocation->x);
943 child_allocation.x = allocation->x + (allocation->width - child_allocation.width) / 2;
945 if (gtk_button_box_get_child_secondary (bbox, child))
947 child_allocation.y = secondary_y;
948 secondary_y += child_allocation.height + childspacing;
952 child_allocation.y = y;
953 y += child_allocation.height + childspacing;
957 gtk_widget_size_allocate (child, &child_allocation);
968 * gtk_button_box_new:
969 * @orientation: the box' orientation.
971 * Creates a new #GtkButtonBox.
973 * Return value: a new #GtkButtonBox.
978 gtk_button_box_new (GtkOrientation orientation)
980 return g_object_new (GTK_TYPE_BUTTON_BOX,
981 "orientation", orientation,
986 * gtk_button_box_get_child_non_homogeneous:
987 * @widget: a #GtkButtonBox
988 * @child: a child of @widget
990 * Returns whether the child is exempted from homogenous
993 * Returns: %TRUE if the child is not subject to homogenous sizing
998 gtk_button_box_get_child_non_homogeneous (GtkButtonBox *widget,
1001 g_return_val_if_fail (GTK_IS_BUTTON_BOX (widget), FALSE);
1002 g_return_val_if_fail (GTK_IS_WIDGET (child), FALSE);
1004 return (g_object_get_data (G_OBJECT (child), GTK_BOX_NON_HOMOGENEOUS) != NULL);
1008 * gtk_button_box_set_child_non_homogeneous:
1009 * @widget: a #GtkButtonBox
1010 * @child: a child of @widget
1011 * @non_homogeneous: the new value
1013 * Sets whether the child is exempted from homogeous sizing.
1018 gtk_button_box_set_child_non_homogeneous (GtkButtonBox *widget,
1020 gboolean non_homogeneous)
1022 g_return_if_fail (GTK_IS_BUTTON_BOX (widget));
1023 g_return_if_fail (GTK_IS_WIDGET (child));
1024 g_return_if_fail (gtk_widget_get_parent (child) == GTK_WIDGET (widget));
1026 g_object_set_data (G_OBJECT (child),
1027 GTK_BOX_NON_HOMOGENEOUS,
1028 non_homogeneous ? GINT_TO_POINTER (1) : NULL);
1029 gtk_widget_child_notify (child, "non-homogeneous");
1031 if (gtk_widget_get_visible (GTK_WIDGET (widget)) &&
1032 gtk_widget_get_visible (child))
1033 gtk_widget_queue_resize (child);