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, see <http://www.gnu.org/licenses/>.
19 * Modified by the GTK+ Team and others 1997-2000. See the AUTHORS
20 * file for a list of people on the GTK+ Team. See the ChangeLog
21 * files for a list of changes. These files are distributed with
22 * GTK+ at ftp://ftp.gtk.org/pub/gtk/.
27 * @Short_description: A container for arranging buttons
28 * @Title: GtkButtonBox
30 * A button box should be used to provide a consistent layout of buttons
31 * throughout your application. The layout/spacing can be altered by the
32 * programmer, or if desired, by the user to alter the 'feel' of a
33 * program to a small degree.
35 * gtk_button_box_get_layout() and gtk_button_box_set_layout() retrieve and
36 * alter the method used to spread the buttons in a button box across the
37 * container, respectively.
39 * The main purpose of GtkButtonBox is to make sure the children have all the
40 * same size. GtkButtonBox gives all children the same size, but it does allow
41 * 'outliers' to keep their own larger size. To force all children to be
42 * strictly the same size without exceptions, you can set the
43 * #GtkButtonBox:homogeneous property to %TRUE.
45 * To excempt individual children from homogeneous sizing regardless of their
46 * 'outlier' status, you can set the #GtkButtonBox:non-homogeneous child
54 #include "gtkboxprivate.h"
55 #include "gtkorientable.h"
56 #include "gtktypebuiltins.h"
57 #include "gtkprivate.h"
58 #include "gtksizerequest.h"
63 struct _GtkButtonBoxPrivate
65 GtkButtonBoxStyle layout_style;
76 CHILD_PROP_NONHOMOGENEOUS
79 #define GTK_BOX_SECONDARY_CHILD "gtk-box-secondary-child"
80 #define GTK_BOX_NON_HOMOGENEOUS "gtk-box-non-homogeneous"
82 static void gtk_button_box_set_property (GObject *object,
86 static void gtk_button_box_get_property (GObject *object,
90 static void gtk_button_box_get_preferred_width (GtkWidget *widget,
93 static void gtk_button_box_get_preferred_height (GtkWidget *widget,
96 static void gtk_button_box_get_preferred_width_for_height (GtkWidget *widget,
100 static void gtk_button_box_get_preferred_height_for_width (GtkWidget *widget,
105 static void gtk_button_box_size_allocate (GtkWidget *widget,
106 GtkAllocation *allocation);
107 static void gtk_button_box_remove (GtkContainer *container,
109 static void gtk_button_box_set_child_property (GtkContainer *container,
114 static void gtk_button_box_get_child_property (GtkContainer *container,
120 #define DEFAULT_CHILD_MIN_WIDTH 85
121 #define DEFAULT_CHILD_MIN_HEIGHT 27
122 #define DEFAULT_CHILD_IPAD_X 4
123 #define DEFAULT_CHILD_IPAD_Y 0
124 #define DEFAULT_LAYOUT_STYLE GTK_BUTTONBOX_EDGE
126 G_DEFINE_TYPE (GtkButtonBox, gtk_button_box, GTK_TYPE_BOX)
129 gtk_button_box_class_init (GtkButtonBoxClass *class)
131 GtkWidgetClass *widget_class;
132 GObjectClass *gobject_class;
133 GtkContainerClass *container_class;
135 gobject_class = G_OBJECT_CLASS (class);
136 widget_class = (GtkWidgetClass*) class;
137 container_class = (GtkContainerClass*) class;
139 gobject_class->set_property = gtk_button_box_set_property;
140 gobject_class->get_property = gtk_button_box_get_property;
142 widget_class->get_preferred_width = gtk_button_box_get_preferred_width;
143 widget_class->get_preferred_height = gtk_button_box_get_preferred_height;
144 widget_class->get_preferred_width_for_height = gtk_button_box_get_preferred_width_for_height;
145 widget_class->get_preferred_height_for_width = gtk_button_box_get_preferred_height_for_width;
146 widget_class->size_allocate = gtk_button_box_size_allocate;
148 container_class->remove = gtk_button_box_remove;
149 container_class->set_child_property = gtk_button_box_set_child_property;
150 container_class->get_child_property = gtk_button_box_get_child_property;
151 gtk_container_class_handle_border_width (container_class);
153 /* FIXME we need to override the "spacing" property on GtkBox once
154 * libgobject allows that.
156 gtk_widget_class_install_style_property (widget_class,
157 g_param_spec_int ("child-min-width",
158 P_("Minimum child width"),
159 P_("Minimum width of buttons inside the box"),
162 DEFAULT_CHILD_MIN_WIDTH,
163 GTK_PARAM_READABLE));
165 gtk_widget_class_install_style_property (widget_class,
166 g_param_spec_int ("child-min-height",
167 P_("Minimum child height"),
168 P_("Minimum height of buttons inside the box"),
171 DEFAULT_CHILD_MIN_HEIGHT,
172 GTK_PARAM_READABLE));
174 gtk_widget_class_install_style_property (widget_class,
175 g_param_spec_int ("child-internal-pad-x",
176 P_("Child internal width padding"),
177 P_("Amount to increase child's size on either side"),
180 DEFAULT_CHILD_IPAD_X,
181 GTK_PARAM_READABLE));
183 gtk_widget_class_install_style_property (widget_class,
184 g_param_spec_int ("child-internal-pad-y",
185 P_("Child internal height padding"),
186 P_("Amount to increase child's size on the top and bottom"),
189 DEFAULT_CHILD_IPAD_Y,
190 GTK_PARAM_READABLE));
191 g_object_class_install_property (gobject_class,
193 g_param_spec_enum ("layout-style",
195 P_("How to lay out the buttons in the box. Possible values are: spread, edge, start and end"),
196 GTK_TYPE_BUTTON_BOX_STYLE,
197 DEFAULT_LAYOUT_STYLE,
198 GTK_PARAM_READWRITE));
200 gtk_container_class_install_child_property (container_class,
201 CHILD_PROP_SECONDARY,
202 g_param_spec_boolean ("secondary",
204 P_("If TRUE, the child appears in a secondary group of children, suitable for, e.g., help buttons"),
206 GTK_PARAM_READWRITE));
208 gtk_container_class_install_child_property (container_class,
209 CHILD_PROP_NONHOMOGENEOUS,
210 g_param_spec_boolean ("non-homogeneous",
211 P_("Non-Homogeneous"),
212 P_("If TRUE, the child will not be subject to homogeneous sizing"),
214 GTK_PARAM_READWRITE));
216 g_type_class_add_private (class, sizeof (GtkButtonBoxPrivate));
220 gtk_button_box_init (GtkButtonBox *button_box)
222 GtkButtonBoxPrivate *priv;
224 button_box->priv = G_TYPE_INSTANCE_GET_PRIVATE (button_box,
226 GtkButtonBoxPrivate);
227 priv = button_box->priv;
229 gtk_box_set_spacing (GTK_BOX (button_box), 0);
230 priv->layout_style = DEFAULT_LAYOUT_STYLE;
234 gtk_button_box_set_property (GObject *object,
241 case PROP_LAYOUT_STYLE:
242 gtk_button_box_set_layout (GTK_BUTTON_BOX (object),
243 g_value_get_enum (value));
246 G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
252 gtk_button_box_get_property (GObject *object,
257 GtkButtonBoxPrivate *priv = GTK_BUTTON_BOX (object)->priv;
261 case PROP_LAYOUT_STYLE:
262 g_value_set_enum (value, priv->layout_style);
265 G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
271 gtk_button_box_set_child_property (GtkContainer *container,
279 case CHILD_PROP_SECONDARY:
280 gtk_button_box_set_child_secondary (GTK_BUTTON_BOX (container), child,
281 g_value_get_boolean (value));
283 case CHILD_PROP_NONHOMOGENEOUS:
284 gtk_button_box_set_child_non_homogeneous (GTK_BUTTON_BOX (container), child,
285 g_value_get_boolean (value));
288 GTK_CONTAINER_WARN_INVALID_CHILD_PROPERTY_ID (container, property_id, pspec);
294 gtk_button_box_get_child_property (GtkContainer *container,
302 case CHILD_PROP_SECONDARY:
303 g_value_set_boolean (value,
304 gtk_button_box_get_child_secondary (GTK_BUTTON_BOX (container),
307 case CHILD_PROP_NONHOMOGENEOUS:
308 g_value_set_boolean (value,
309 gtk_button_box_get_child_non_homogeneous (GTK_BUTTON_BOX (container),
313 GTK_CONTAINER_WARN_INVALID_CHILD_PROPERTY_ID (container, property_id, pspec);
319 gtk_button_box_remove (GtkContainer *container,
322 /* clear is_secondary and nonhomogeneous flag in case the widget
323 * is added to another container
325 gtk_button_box_set_child_secondary (GTK_BUTTON_BOX (container), widget, FALSE);
326 gtk_button_box_set_child_non_homogeneous (GTK_BUTTON_BOX (container), widget, FALSE);
328 GTK_CONTAINER_CLASS (gtk_button_box_parent_class)->remove (container, widget);
332 * gtk_button_box_set_layout:
333 * @widget: a #GtkButtonBox
334 * @layout_style: the new layout style
336 * Changes the way buttons are arranged in their container.
339 gtk_button_box_set_layout (GtkButtonBox *widget,
340 GtkButtonBoxStyle layout_style)
342 GtkButtonBoxPrivate *priv;
344 g_return_if_fail (GTK_IS_BUTTON_BOX (widget));
348 if (priv->layout_style != layout_style)
350 priv->layout_style = layout_style;
351 g_object_notify (G_OBJECT (widget), "layout-style");
352 gtk_widget_queue_resize (GTK_WIDGET (widget));
357 * gtk_button_box_get_layout:
358 * @widget: a #GtkButtonBox
360 * Retrieves the method being used to arrange the buttons in a button box.
362 * Returns: the method used to lay out buttons in @widget.
365 gtk_button_box_get_layout (GtkButtonBox *widget)
367 g_return_val_if_fail (GTK_IS_BUTTON_BOX (widget), DEFAULT_LAYOUT_STYLE);
369 return widget->priv->layout_style;
373 * gtk_button_box_get_child_secondary:
374 * @widget: a #GtkButtonBox
375 * @child: a child of @widget
377 * Returns whether @child should appear in a secondary group of children.
379 * Return value: whether @child should appear in a secondary group of children.
384 gtk_button_box_get_child_secondary (GtkButtonBox *widget,
387 g_return_val_if_fail (GTK_IS_BUTTON_BOX (widget), FALSE);
388 g_return_val_if_fail (GTK_IS_WIDGET (child), FALSE);
390 return (g_object_get_data (G_OBJECT (child), GTK_BOX_SECONDARY_CHILD) != NULL);
394 * gtk_button_box_set_child_secondary:
395 * @widget: a #GtkButtonBox
396 * @child: a child of @widget
397 * @is_secondary: if %TRUE, the @child appears in a secondary group of the
400 * Sets whether @child should appear in a secondary group of children.
401 * A typical use of a secondary child is the help button in a dialog.
403 * This group appears after the other children if the style
404 * is %GTK_BUTTONBOX_START, %GTK_BUTTONBOX_SPREAD or
405 * %GTK_BUTTONBOX_EDGE, and before the other children if the style
406 * is %GTK_BUTTONBOX_END. For horizontal button boxes, the definition
407 * of before/after depends on direction of the widget (see
408 * gtk_widget_set_direction()). If the style is %GTK_BUTTONBOX_START
409 * or %GTK_BUTTONBOX_END, then the secondary children are aligned at
410 * the other end of the button box from the main children. For the
411 * other styles, they appear immediately next to the main children.
414 gtk_button_box_set_child_secondary (GtkButtonBox *widget,
416 gboolean is_secondary)
418 g_return_if_fail (GTK_IS_BUTTON_BOX (widget));
419 g_return_if_fail (GTK_IS_WIDGET (child));
420 g_return_if_fail (gtk_widget_get_parent (child) == GTK_WIDGET (widget));
422 g_object_set_data (G_OBJECT (child),
423 GTK_BOX_SECONDARY_CHILD,
424 is_secondary ? GINT_TO_POINTER (1) : NULL);
425 gtk_widget_child_notify (child, "secondary");
427 if (gtk_widget_get_visible (GTK_WIDGET (widget)) &&
428 gtk_widget_get_visible (child))
429 gtk_widget_queue_resize (child);
432 /* Ask children how much space they require and round up
433 * to match minimum size and internal padding.
434 * Returns the size each single child should have.
437 gtk_button_box_child_requisition (GtkWidget *widget,
439 gint *nvis_secondaries,
444 GList *children, *list;
450 GtkRequisition child_requisition;
453 gint child_min_width;
454 gint child_min_height;
457 gboolean homogeneous;
460 g_return_if_fail (GTK_IS_BUTTON_BOX (widget));
462 bbox = GTK_BUTTON_BOX (widget);
464 homogeneous = gtk_box_get_homogeneous (GTK_BOX (widget));
466 gtk_widget_style_get (widget,
467 "child-min-width", &child_min_width,
468 "child-min-height", &child_min_height,
469 "child-internal-pad-x", &ipad_x,
470 "child-internal-pad-y", &ipad_y,
475 list = children = _gtk_box_get_children (GTK_BOX (bbox));
476 needed_width = child_min_width;
477 needed_height = child_min_height;
486 child = children->data;
487 children = children->next;
489 if (gtk_widget_get_visible (child))
492 gtk_widget_get_preferred_size (child,
493 &child_requisition, NULL);
494 avg_w += child_requisition.width + ipad_w;
495 avg_h += child_requisition.height + ipad_h;
498 avg_w /= MAX (nchildren, 1);
499 avg_h /= MAX (nchildren, 1);
501 *widths = g_new (gint, nchildren);
502 *heights = g_new (gint, nchildren);
509 gboolean is_secondary;
510 gboolean non_homogeneous;
512 child = children->data;
513 children = children->next;
515 if (gtk_widget_get_visible (child))
517 is_secondary = gtk_button_box_get_child_secondary (bbox, child);
518 non_homogeneous = gtk_button_box_get_child_non_homogeneous (bbox, child);
523 gtk_widget_get_preferred_size (child, &child_requisition, NULL);
526 (!non_homogeneous && (child_requisition.width + ipad_w < avg_w * 1.5)))
529 if (child_requisition.width + ipad_w > needed_width)
530 needed_width = child_requisition.width + ipad_w;
534 (*widths)[i] = child_requisition.width + ipad_w;
538 (!non_homogeneous && (child_requisition.height + ipad_h < avg_h * 1.5)))
541 if (child_requisition.height + ipad_h > needed_height)
542 needed_height = child_requisition.height + ipad_h;
546 (*heights)[i] = child_requisition.height + ipad_h;
555 for (i = 0; i < nchildren; i++)
557 if ((*widths)[i] == -1)
558 (*widths)[i] = needed_width;
559 if ((*heights)[i] == -1)
560 (*heights)[i] = needed_height;
564 *nvis_children = nchildren;
566 if (nvis_secondaries)
567 *nvis_secondaries = nsecondaries;
571 gtk_button_box_size_request (GtkWidget *widget,
572 GtkRequisition *requisition)
574 GtkButtonBoxPrivate *priv;
580 GtkOrientation orientation;
585 bbox = GTK_BUTTON_BOX (widget);
588 orientation = gtk_orientable_get_orientation (GTK_ORIENTABLE (widget));
589 spacing = gtk_box_get_spacing (GTK_BOX (widget));
591 gtk_button_box_child_requisition (widget,
598 for (i = 0; i < nvis_children; i++)
600 if (orientation == GTK_ORIENTATION_HORIZONTAL)
602 total_size += widths[i];
603 max_size = MAX (max_size, heights[i]);
607 total_size += heights[i];
608 max_size = MAX (max_size, widths[i]);
614 if (nvis_children == 0)
616 requisition->width = 0;
617 requisition->height = 0;
621 switch (priv->layout_style)
623 case GTK_BUTTONBOX_SPREAD:
624 if (orientation == GTK_ORIENTATION_HORIZONTAL)
625 requisition->width = total_size + ((nvis_children + 1)*spacing);
627 requisition->height = total_size + ((nvis_children + 1)*spacing);
630 case GTK_BUTTONBOX_EDGE:
631 case GTK_BUTTONBOX_START:
632 case GTK_BUTTONBOX_END:
633 case GTK_BUTTONBOX_CENTER:
634 if (orientation == GTK_ORIENTATION_HORIZONTAL)
635 requisition->width = total_size + ((nvis_children - 1)*spacing);
637 requisition->height = total_size + ((nvis_children - 1)*spacing);
641 g_assert_not_reached ();
645 if (orientation == GTK_ORIENTATION_HORIZONTAL)
646 requisition->height = max_size;
648 requisition->width = max_size;
653 gtk_button_box_get_preferred_width (GtkWidget *widget,
657 GtkRequisition requisition;
659 gtk_button_box_size_request (widget, &requisition);
661 *minimum = *natural = requisition.width;
665 gtk_button_box_get_preferred_height (GtkWidget *widget,
669 GtkRequisition requisition;
671 gtk_button_box_size_request (widget, &requisition);
673 *minimum = *natural = requisition.height;
677 gtk_button_box_get_preferred_width_for_height (GtkWidget *widget,
682 gtk_button_box_get_preferred_width (widget, minimum, natural);
686 gtk_button_box_get_preferred_height_for_width (GtkWidget *widget,
691 gtk_button_box_get_preferred_height (widget, minimum, natural);
695 gtk_button_box_size_allocate (GtkWidget *widget,
696 GtkAllocation *allocation)
698 GtkButtonBoxPrivate *priv;
700 GList *children, *list;
701 GtkAllocation child_allocation;
707 gint secondary_x = 0;
708 gint secondary_y = 0;
711 gint childspacing = 0;
713 GtkOrientation orientation;
723 bbox = GTK_BUTTON_BOX (widget);
726 orientation = gtk_orientable_get_orientation (GTK_ORIENTABLE (widget));
727 spacing = gtk_box_get_spacing (GTK_BOX (widget));
729 gtk_widget_style_get (widget,
730 "child-internal-pad-x", &ipad_x,
731 "child-internal-pad-y", &ipad_y,
733 gtk_button_box_child_requisition (widget,
738 n_primaries = nvis_children - n_secondaries;
741 if (orientation == GTK_ORIENTATION_HORIZONTAL)
747 list = children = _gtk_box_get_children (GTK_BOX (widget));
752 child = children->data;
753 children = children->next;
755 if (gtk_widget_get_visible (child))
757 if (gtk_button_box_get_child_secondary (bbox, child))
758 secondary_size += sizes[i];
760 primary_size += sizes[i];
764 total_size = primary_size + secondary_size;
766 gtk_widget_set_allocation (widget, allocation);
768 if (orientation == GTK_ORIENTATION_HORIZONTAL)
769 width = allocation->width;
771 height = allocation->height;
773 switch (priv->layout_style)
775 case GTK_BUTTONBOX_SPREAD:
777 if (orientation == GTK_ORIENTATION_HORIZONTAL)
779 childspacing = (width - total_size) / (nvis_children + 1);
780 x = allocation->x + childspacing;
781 secondary_x = x + primary_size + n_primaries * childspacing;
785 childspacing = (height - total_size) / (nvis_children + 1);
786 y = allocation->y + childspacing;
787 secondary_y = y + primary_size + n_primaries * childspacing;
792 case GTK_BUTTONBOX_EDGE:
794 if (orientation == GTK_ORIENTATION_HORIZONTAL)
796 if (nvis_children >= 2)
798 childspacing = (width - total_size) / (nvis_children - 1);
800 secondary_x = x + primary_size + n_primaries * childspacing;
802 else if (nvis_children == 1)
804 /* one child, just center */
805 childspacing = width;
806 x = secondary_x = allocation->x
807 + (allocation->width - widths[0]) / 2;
811 /* zero children, meh */
812 childspacing = width;
813 x = secondary_x = allocation->x + allocation->width / 2;
818 if (nvis_children >= 2)
820 childspacing = (height - total_size) / (nvis_children - 1);
822 secondary_y = y + primary_size + n_primaries * childspacing;
824 else if (nvis_children == 1)
826 /* one child, just center */
827 childspacing = height;
828 y = secondary_y = allocation->y
829 + (allocation->height - heights[0]) / 2;
833 /* zero children, meh */
834 childspacing = height;
835 y = secondary_y = allocation->y + allocation->height / 2;
841 case GTK_BUTTONBOX_START:
843 if (orientation == GTK_ORIENTATION_HORIZONTAL)
845 childspacing = spacing;
847 secondary_x = allocation->x + allocation->width
848 - secondary_size - spacing * (n_secondaries - 1);
852 childspacing = spacing;
854 secondary_y = allocation->y + allocation->height
855 - secondary_size - spacing * (n_secondaries - 1);
860 case GTK_BUTTONBOX_END:
862 if (orientation == GTK_ORIENTATION_HORIZONTAL)
864 childspacing = spacing;
865 x = allocation->x + allocation->width
866 - primary_size - spacing * (n_primaries - 1);
867 secondary_x = allocation->x;
871 childspacing = spacing;
872 y = allocation->y + allocation->height
873 - primary_size - spacing * (n_primaries - 1);
874 secondary_y = allocation->y;
879 case GTK_BUTTONBOX_CENTER:
881 if (orientation == GTK_ORIENTATION_HORIZONTAL)
883 childspacing = spacing;
886 - (primary_size + spacing * (n_primaries - 1))) / 2
887 + (secondary_size + n_secondaries * spacing) / 2;
888 secondary_x = allocation->x;
892 childspacing = spacing;
895 - (primary_size + spacing * (n_primaries - 1))) / 2
896 + (secondary_size + n_secondaries * spacing) / 2;
897 secondary_y = allocation->y;
903 g_assert_not_reached ();
913 child = children->data;
914 children = children->next;
916 if (gtk_widget_get_visible (child))
918 child_allocation.width = widths[i];
919 child_allocation.height = heights[i];
921 if (orientation == GTK_ORIENTATION_HORIZONTAL)
923 child_allocation.y = allocation->y + (allocation->height - child_allocation.height) / 2;
925 if (gtk_button_box_get_child_secondary (bbox, child))
927 child_allocation.x = secondary_x;
928 secondary_x += child_allocation.width + childspacing;
932 child_allocation.x = x;
933 x += child_allocation.width + childspacing;
936 if (gtk_widget_get_direction (widget) == GTK_TEXT_DIR_RTL)
937 child_allocation.x = (allocation->x + allocation->width)
938 - (child_allocation.x + child_allocation.width - allocation->x);
942 child_allocation.x = allocation->x + (allocation->width - child_allocation.width) / 2;
944 if (gtk_button_box_get_child_secondary (bbox, child))
946 child_allocation.y = secondary_y;
947 secondary_y += child_allocation.height + childspacing;
951 child_allocation.y = y;
952 y += child_allocation.height + childspacing;
956 gtk_widget_size_allocate (child, &child_allocation);
967 * gtk_button_box_new:
968 * @orientation: the box' orientation.
970 * Creates a new #GtkButtonBox.
972 * Return value: a new #GtkButtonBox.
977 gtk_button_box_new (GtkOrientation orientation)
979 return g_object_new (GTK_TYPE_BUTTON_BOX,
980 "orientation", orientation,
985 * gtk_button_box_get_child_non_homogeneous:
986 * @widget: a #GtkButtonBox
987 * @child: a child of @widget
989 * Returns whether the child is exempted from homogenous
992 * Returns: %TRUE if the child is not subject to homogenous sizing
997 gtk_button_box_get_child_non_homogeneous (GtkButtonBox *widget,
1000 g_return_val_if_fail (GTK_IS_BUTTON_BOX (widget), FALSE);
1001 g_return_val_if_fail (GTK_IS_WIDGET (child), FALSE);
1003 return (g_object_get_data (G_OBJECT (child), GTK_BOX_NON_HOMOGENEOUS) != NULL);
1007 * gtk_button_box_set_child_non_homogeneous:
1008 * @widget: a #GtkButtonBox
1009 * @child: a child of @widget
1010 * @non_homogeneous: the new value
1012 * Sets whether the child is exempted from homogeous sizing.
1017 gtk_button_box_set_child_non_homogeneous (GtkButtonBox *widget,
1019 gboolean non_homogeneous)
1021 g_return_if_fail (GTK_IS_BUTTON_BOX (widget));
1022 g_return_if_fail (GTK_IS_WIDGET (child));
1023 g_return_if_fail (gtk_widget_get_parent (child) == GTK_WIDGET (widget));
1025 g_object_set_data (G_OBJECT (child),
1026 GTK_BOX_NON_HOMOGENEOUS,
1027 non_homogeneous ? GINT_TO_POINTER (1) : NULL);
1028 gtk_widget_child_notify (child, "non-homogeneous");
1030 if (gtk_widget_get_visible (GTK_WIDGET (widget)) &&
1031 gtk_widget_get_visible (child))
1032 gtk_widget_queue_resize (child);