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/.
31 #include "gtkprivate.h"
33 #include "gtkbuildable.h"
34 #include "gtksizerequest.h"
37 #define LABEL_SIDE_PAD 2
42 GtkWidget *label_widget;
49 GtkAllocation child_allocation;
50 GtkAllocation label_allocation;
63 static void gtk_frame_set_property (GObject *object,
67 static void gtk_frame_get_property (GObject *object,
71 static void gtk_frame_paint (GtkWidget *widget,
73 static gint gtk_frame_expose (GtkWidget *widget,
74 GdkEventExpose *event);
75 static void gtk_frame_size_allocate (GtkWidget *widget,
76 GtkAllocation *allocation);
77 static void gtk_frame_remove (GtkContainer *container,
79 static void gtk_frame_forall (GtkContainer *container,
80 gboolean include_internals,
82 gpointer callback_data);
84 static void gtk_frame_compute_child_allocation (GtkFrame *frame,
85 GtkAllocation *child_allocation);
86 static void gtk_frame_real_compute_child_allocation (GtkFrame *frame,
87 GtkAllocation *child_allocation);
90 static void gtk_frame_buildable_init (GtkBuildableIface *iface);
91 static void gtk_frame_buildable_add_child (GtkBuildable *buildable,
96 static void gtk_frame_size_request_init (GtkSizeRequestIface *iface);
97 static void gtk_frame_get_width (GtkSizeRequest *widget,
100 static void gtk_frame_get_height (GtkSizeRequest *widget,
103 static void gtk_frame_get_height_for_width (GtkSizeRequest *layout,
105 gint *minimum_height,
106 gint *natural_height);
107 static void gtk_frame_get_width_for_height (GtkSizeRequest *layout,
109 gint *minimum_height,
110 gint *natural_height);
113 G_DEFINE_TYPE_WITH_CODE (GtkFrame, gtk_frame, GTK_TYPE_BIN,
114 G_IMPLEMENT_INTERFACE (GTK_TYPE_BUILDABLE,
115 gtk_frame_buildable_init)
116 G_IMPLEMENT_INTERFACE (GTK_TYPE_SIZE_REQUEST,
117 gtk_frame_size_request_init))
120 gtk_frame_class_init (GtkFrameClass *class)
122 GObjectClass *gobject_class;
123 GtkWidgetClass *widget_class;
124 GtkContainerClass *container_class;
126 gobject_class = (GObjectClass*) class;
127 widget_class = GTK_WIDGET_CLASS (class);
128 container_class = GTK_CONTAINER_CLASS (class);
130 gobject_class->set_property = gtk_frame_set_property;
131 gobject_class->get_property = gtk_frame_get_property;
133 g_object_class_install_property (gobject_class,
135 g_param_spec_string ("label",
137 P_("Text of the frame's label"),
140 GTK_PARAM_WRITABLE));
141 g_object_class_install_property (gobject_class,
143 g_param_spec_float ("label-xalign",
145 P_("The horizontal alignment of the label"),
149 GTK_PARAM_READWRITE));
150 g_object_class_install_property (gobject_class,
152 g_param_spec_float ("label-yalign",
154 P_("The vertical alignment of the label"),
158 GTK_PARAM_READWRITE));
159 g_object_class_install_property (gobject_class,
161 g_param_spec_enum ("shadow", NULL,
162 P_("Deprecated property, use shadow_type instead"),
163 GTK_TYPE_SHADOW_TYPE,
164 GTK_SHADOW_ETCHED_IN,
165 GTK_PARAM_READWRITE));
166 g_object_class_install_property (gobject_class,
168 g_param_spec_enum ("shadow-type",
170 P_("Appearance of the frame border"),
171 GTK_TYPE_SHADOW_TYPE,
172 GTK_SHADOW_ETCHED_IN,
173 GTK_PARAM_READWRITE));
175 g_object_class_install_property (gobject_class,
177 g_param_spec_object ("label-widget",
179 P_("A widget to display in place of the usual frame label"),
181 GTK_PARAM_READWRITE));
183 widget_class->expose_event = gtk_frame_expose;
184 widget_class->size_allocate = gtk_frame_size_allocate;
186 container_class->remove = gtk_frame_remove;
187 container_class->forall = gtk_frame_forall;
189 class->compute_child_allocation = gtk_frame_real_compute_child_allocation;
191 g_type_class_add_private (class, sizeof (GtkFramePriv));
195 gtk_frame_buildable_init (GtkBuildableIface *iface)
197 iface->add_child = gtk_frame_buildable_add_child;
201 gtk_frame_buildable_add_child (GtkBuildable *buildable,
206 if (type && strcmp (type, "label") == 0)
207 gtk_frame_set_label_widget (GTK_FRAME (buildable), GTK_WIDGET (child));
209 gtk_container_add (GTK_CONTAINER (buildable), GTK_WIDGET (child));
211 GTK_BUILDER_WARN_INVALID_CHILD_TYPE (GTK_FRAME (buildable), type);
215 gtk_frame_init (GtkFrame *frame)
219 frame->priv = G_TYPE_INSTANCE_GET_PRIVATE (frame,
224 priv->label_widget = NULL;
225 priv->shadow_type = GTK_SHADOW_ETCHED_IN;
226 priv->label_xalign = 0.0;
227 priv->label_yalign = 0.5;
231 gtk_frame_set_property (GObject *object,
236 GtkFrame *frame = GTK_FRAME (object);
237 GtkFramePriv *priv = frame->priv;
242 gtk_frame_set_label (frame, g_value_get_string (value));
244 case PROP_LABEL_XALIGN:
245 gtk_frame_set_label_align (frame, g_value_get_float (value),
248 case PROP_LABEL_YALIGN:
249 gtk_frame_set_label_align (frame, priv->label_xalign,
250 g_value_get_float (value));
253 case PROP_SHADOW_TYPE:
254 gtk_frame_set_shadow_type (frame, g_value_get_enum (value));
256 case PROP_LABEL_WIDGET:
257 gtk_frame_set_label_widget (frame, g_value_get_object (value));
260 G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
266 gtk_frame_get_property (GObject *object,
271 GtkFrame *frame = GTK_FRAME (object);
272 GtkFramePriv *priv = frame->priv;
277 g_value_set_string (value, gtk_frame_get_label (frame));
279 case PROP_LABEL_XALIGN:
280 g_value_set_float (value, priv->label_xalign);
282 case PROP_LABEL_YALIGN:
283 g_value_set_float (value, priv->label_yalign);
286 case PROP_SHADOW_TYPE:
287 g_value_set_enum (value, priv->shadow_type);
289 case PROP_LABEL_WIDGET:
290 g_value_set_object (value,
292 G_OBJECT (priv->label_widget) : NULL);
295 G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
302 * @label: the text to use as the label of the frame
304 * Creates a new #GtkFrame, with optional label @label.
305 * If @label is %NULL, the label is omitted.
307 * Return value: a new #GtkFrame widget
310 gtk_frame_new (const gchar *label)
312 return g_object_new (GTK_TYPE_FRAME, "label", label, NULL);
316 gtk_frame_remove (GtkContainer *container,
319 GtkFrame *frame = GTK_FRAME (container);
320 GtkFramePriv *priv = frame->priv;
322 if (priv->label_widget == child)
323 gtk_frame_set_label_widget (frame, NULL);
325 GTK_CONTAINER_CLASS (gtk_frame_parent_class)->remove (container, child);
329 gtk_frame_forall (GtkContainer *container,
330 gboolean include_internals,
331 GtkCallback callback,
332 gpointer callback_data)
334 GtkBin *bin = GTK_BIN (container);
335 GtkFrame *frame = GTK_FRAME (container);
336 GtkFramePriv *priv = frame->priv;
339 child = gtk_bin_get_child (bin);
341 (* callback) (child, callback_data);
343 if (priv->label_widget)
344 (* callback) (priv->label_widget, callback_data);
348 * gtk_frame_set_label:
349 * @frame: a #GtkFrame
350 * @label: (allow-none): the text to use as the label of the frame
352 * Sets the text of the label. If @label is %NULL,
353 * the current label is removed.
356 gtk_frame_set_label (GtkFrame *frame,
359 g_return_if_fail (GTK_IS_FRAME (frame));
363 gtk_frame_set_label_widget (frame, NULL);
367 GtkWidget *child = gtk_label_new (label);
368 gtk_widget_show (child);
370 gtk_frame_set_label_widget (frame, child);
375 * gtk_frame_get_label:
376 * @frame: a #GtkFrame
378 * If the frame's label widget is a #GtkLabel, returns the
379 * text in the label widget. (The frame will have a #GtkLabel
380 * for the label widget if a non-%NULL argument was passed
381 * to gtk_frame_new().)
383 * Return value: the text in the label, or %NULL if there
384 * was no label widget or the lable widget was not
385 * a #GtkLabel. This string is owned by GTK+ and
386 * must not be modified or freed.
388 G_CONST_RETURN gchar *
389 gtk_frame_get_label (GtkFrame *frame)
393 g_return_val_if_fail (GTK_IS_FRAME (frame), NULL);
397 if (GTK_IS_LABEL (priv->label_widget))
398 return gtk_label_get_text (GTK_LABEL (priv->label_widget));
404 * gtk_frame_set_label_widget:
405 * @frame: a #GtkFrame
406 * @label_widget: the new label widget
408 * Sets the label widget for the frame. This is the widget that
409 * will appear embedded in the top edge of the frame as a
413 gtk_frame_set_label_widget (GtkFrame *frame,
414 GtkWidget *label_widget)
417 gboolean need_resize = FALSE;
419 g_return_if_fail (GTK_IS_FRAME (frame));
420 g_return_if_fail (label_widget == NULL || GTK_IS_WIDGET (label_widget));
421 g_return_if_fail (label_widget == NULL || label_widget->parent == NULL);
425 if (priv->label_widget == label_widget)
428 if (priv->label_widget)
430 need_resize = gtk_widget_get_visible (priv->label_widget);
431 gtk_widget_unparent (priv->label_widget);
434 priv->label_widget = label_widget;
438 priv->label_widget = label_widget;
439 gtk_widget_set_parent (label_widget, GTK_WIDGET (frame));
440 need_resize |= gtk_widget_get_visible (label_widget);
443 if (gtk_widget_get_visible (GTK_WIDGET (frame)) && need_resize)
444 gtk_widget_queue_resize (GTK_WIDGET (frame));
446 g_object_freeze_notify (G_OBJECT (frame));
447 g_object_notify (G_OBJECT (frame), "label-widget");
448 g_object_notify (G_OBJECT (frame), "label");
449 g_object_thaw_notify (G_OBJECT (frame));
453 * gtk_frame_get_label_widget:
454 * @frame: a #GtkFrame
456 * Retrieves the label widget for the frame. See
457 * gtk_frame_set_label_widget().
459 * Return value: the label widget, or %NULL if there is none.
462 gtk_frame_get_label_widget (GtkFrame *frame)
464 g_return_val_if_fail (GTK_IS_FRAME (frame), NULL);
466 return frame->priv->label_widget;
470 * gtk_frame_set_label_align:
471 * @frame: a #GtkFrame
472 * @xalign: The position of the label along the top edge
473 * of the widget. A value of 0.0 represents left alignment;
474 * 1.0 represents right alignment.
475 * @yalign: The y alignment of the label. A value of 0.0 aligns under
476 * the frame; 1.0 aligns above the frame. If the values are exactly
477 * 0.0 or 1.0 the gap in the frame won't be painted because the label
478 * will be completely above or below the frame.
480 * Sets the alignment of the frame widget's label. The
481 * default values for a newly created frame are 0.0 and 0.5.
484 gtk_frame_set_label_align (GtkFrame *frame,
490 g_return_if_fail (GTK_IS_FRAME (frame));
494 xalign = CLAMP (xalign, 0.0, 1.0);
495 yalign = CLAMP (yalign, 0.0, 1.0);
497 g_object_freeze_notify (G_OBJECT (frame));
498 if (xalign != priv->label_xalign)
500 priv->label_xalign = xalign;
501 g_object_notify (G_OBJECT (frame), "label-xalign");
504 if (yalign != priv->label_yalign)
506 priv->label_yalign = yalign;
507 g_object_notify (G_OBJECT (frame), "label-yalign");
510 g_object_thaw_notify (G_OBJECT (frame));
511 gtk_widget_queue_resize (GTK_WIDGET (frame));
515 * gtk_frame_get_label_align:
516 * @frame: a #GtkFrame
517 * @xalign: (allow-none): location to store X alignment of frame's label, or %NULL
518 * @yalign: (allow-none): location to store X alignment of frame's label, or %NULL
520 * Retrieves the X and Y alignment of the frame's label. See
521 * gtk_frame_set_label_align().
524 gtk_frame_get_label_align (GtkFrame *frame,
530 g_return_if_fail (GTK_IS_FRAME (frame));
535 *xalign = priv->label_xalign;
537 *yalign = priv->label_yalign;
541 * gtk_frame_set_shadow_type:
542 * @frame: a #GtkFrame
543 * @type: the new #GtkShadowType
545 * Sets the shadow type for @frame.
548 gtk_frame_set_shadow_type (GtkFrame *frame,
554 g_return_if_fail (GTK_IS_FRAME (frame));
558 if ((GtkShadowType) priv->shadow_type != type)
560 widget = GTK_WIDGET (frame);
561 priv->shadow_type = type;
562 g_object_notify (G_OBJECT (frame), "shadow-type");
564 if (gtk_widget_is_drawable (widget))
566 gtk_widget_queue_draw (widget);
569 gtk_widget_queue_resize (widget);
574 * gtk_frame_get_shadow_type:
575 * @frame: a #GtkFrame
577 * Retrieves the shadow type of the frame. See
578 * gtk_frame_set_shadow_type().
580 * Return value: the current shadow type of the frame.
583 gtk_frame_get_shadow_type (GtkFrame *frame)
585 g_return_val_if_fail (GTK_IS_FRAME (frame), GTK_SHADOW_ETCHED_IN);
587 return frame->priv->shadow_type;
591 gtk_frame_paint (GtkWidget *widget,
596 gint x, y, width, height;
598 if (gtk_widget_is_drawable (widget))
600 frame = GTK_FRAME (widget);
603 x = priv->child_allocation.x - widget->style->xthickness;
604 y = priv->child_allocation.y - widget->style->ythickness;
605 width = priv->child_allocation.width + 2 * widget->style->xthickness;
606 height = priv->child_allocation.height + 2 * widget->style->ythickness;
608 if (priv->label_widget)
614 if (gtk_widget_get_direction (widget) == GTK_TEXT_DIR_LTR)
615 xalign = priv->label_xalign;
617 xalign = 1 - priv->label_xalign;
619 height_extra = MAX (0, priv->label_allocation.height - widget->style->ythickness)
620 - priv->label_yalign * priv->label_allocation.height;
622 height += height_extra;
624 x2 = widget->style->xthickness + (priv->child_allocation.width - priv->label_allocation.width - 2 * LABEL_PAD - 2 * LABEL_SIDE_PAD) * xalign + LABEL_SIDE_PAD;
626 /* If the label is completely over or under the frame we can omit the gap */
627 if (priv->label_yalign == 0.0 || priv->label_yalign == 1.0)
628 gtk_paint_shadow (widget->style, widget->window,
629 widget->state, priv->shadow_type,
630 area, widget, "frame",
631 x, y, width, height);
633 gtk_paint_shadow_gap (widget->style, widget->window,
634 widget->state, priv->shadow_type,
635 area, widget, "frame",
638 x2, priv->label_allocation.width + 2 * LABEL_PAD);
641 gtk_paint_shadow (widget->style, widget->window,
642 widget->state, priv->shadow_type,
643 area, widget, "frame",
644 x, y, width, height);
649 gtk_frame_expose (GtkWidget *widget,
650 GdkEventExpose *event)
652 if (gtk_widget_is_drawable (widget))
654 gtk_frame_paint (widget, &event->area);
656 GTK_WIDGET_CLASS (gtk_frame_parent_class)->expose_event (widget, event);
663 gtk_frame_size_allocate (GtkWidget *widget,
664 GtkAllocation *allocation)
666 GtkFrame *frame = GTK_FRAME (widget);
667 GtkFramePriv *priv = frame->priv;
668 GtkBin *bin = GTK_BIN (widget);
669 GtkAllocation new_allocation;
672 widget->allocation = *allocation;
674 gtk_frame_compute_child_allocation (frame, &new_allocation);
676 /* If the child allocation changed, that means that the frame is drawn
677 * in a new place, so we must redraw the entire widget.
679 if (gtk_widget_get_mapped (widget)
682 (new_allocation.x != priv->child_allocation.x ||
683 new_allocation.y != priv->child_allocation.y ||
684 new_allocation.width != priv->child_allocation.width ||
685 new_allocation.height != priv->child_allocation.height)
688 gdk_window_invalidate_rect (widget->window, &widget->allocation, FALSE);
690 child = gtk_bin_get_child (bin);
691 if (child && gtk_widget_get_visible (child))
692 gtk_widget_size_allocate (child, &new_allocation);
694 priv->child_allocation = new_allocation;
696 if (priv->label_widget && gtk_widget_get_visible (priv->label_widget))
698 gint nat_width, width, height;
701 if (gtk_widget_get_direction (widget) == GTK_TEXT_DIR_LTR)
702 xalign = priv->label_xalign;
704 xalign = 1 - priv->label_xalign;
706 gtk_size_request_get_width (GTK_SIZE_REQUEST (priv->label_widget), NULL, &nat_width);
707 width = new_allocation.width - 2 * LABEL_PAD - 2 * LABEL_SIDE_PAD;
708 width = MIN (width, nat_width);
710 gtk_size_request_get_height_for_width (GTK_SIZE_REQUEST (priv->label_widget), width,
714 priv->label_allocation.x = priv->child_allocation.x + LABEL_SIDE_PAD +
715 (new_allocation.width - width - 2 * LABEL_PAD - 2 * LABEL_SIDE_PAD) * xalign + LABEL_PAD;
717 priv->label_allocation.width = width;
720 priv->label_allocation.y = priv->child_allocation.y - MAX (height, widget->style->ythickness);
721 priv->label_allocation.height = height;
723 gtk_widget_size_allocate (priv->label_widget, &priv->label_allocation);
728 gtk_frame_compute_child_allocation (GtkFrame *frame,
729 GtkAllocation *child_allocation)
731 g_return_if_fail (GTK_IS_FRAME (frame));
732 g_return_if_fail (child_allocation != NULL);
734 GTK_FRAME_GET_CLASS (frame)->compute_child_allocation (frame, child_allocation);
738 gtk_frame_real_compute_child_allocation (GtkFrame *frame,
739 GtkAllocation *child_allocation)
741 GtkFramePriv *priv = frame->priv;
742 GtkWidget *widget = GTK_WIDGET (frame);
743 GtkAllocation *allocation = &widget->allocation;
747 border_width = gtk_container_get_border_width (GTK_CONTAINER (frame));
749 if (priv->label_widget)
751 gint nat_width, width, height;
753 gtk_size_request_get_width (GTK_SIZE_REQUEST (priv->label_widget), NULL, &nat_width);
755 width = widget->allocation.width;
756 width -= 2 * LABEL_PAD + 2 * LABEL_SIDE_PAD;
757 width -= (border_width + GTK_WIDGET (widget)->style->xthickness) * 2;
759 width = MIN (width, nat_width);
761 gtk_size_request_get_height_for_width (GTK_SIZE_REQUEST (priv->label_widget), width,
764 top_margin = MAX (height, widget->style->ythickness);
767 top_margin = widget->style->ythickness;
769 child_allocation->x = border_width + widget->style->xthickness;
770 child_allocation->width = MAX(1, (gint)allocation->width - child_allocation->x * 2);
772 child_allocation->y = border_width + top_margin;
773 child_allocation->height = MAX (1, ((gint)allocation->height - child_allocation->y -
775 (gint)widget->style->ythickness));
777 child_allocation->x += allocation->x;
778 child_allocation->y += allocation->y;
782 gtk_frame_get_size (GtkSizeRequest *request,
783 GtkOrientation orientation,
787 GtkWidget *widget = GTK_WIDGET (request);
789 GtkFrame *frame = GTK_FRAME (widget);
790 GtkFramePriv *priv = frame->priv;
791 GtkBin *bin = GTK_BIN (widget);
792 gint child_min, child_nat;
793 gint minimum, natural;
796 if (priv->label_widget && gtk_widget_get_visible (priv->label_widget))
798 if (orientation == GTK_ORIENTATION_HORIZONTAL)
800 gtk_size_request_get_width (GTK_SIZE_REQUEST (priv->label_widget),
801 &child_min, &child_nat);
802 minimum = child_min + 2 * LABEL_PAD + 2 * LABEL_SIDE_PAD;
803 natural = child_nat + 2 * LABEL_PAD + 2 * LABEL_SIDE_PAD;
807 gtk_size_request_get_height (GTK_SIZE_REQUEST (priv->label_widget),
808 &child_min, &child_nat);
809 minimum = MAX (0, child_min - widget->style->ythickness);
810 natural = MAX (0, child_nat - widget->style->ythickness);
819 child = gtk_bin_get_child (bin);
820 if (child && gtk_widget_get_visible (child))
822 if (orientation == GTK_ORIENTATION_HORIZONTAL)
824 gtk_size_request_get_width (GTK_SIZE_REQUEST (child),
825 &child_min, &child_nat);
826 minimum = MAX (minimum, child_min);
827 natural = MAX (natural, child_nat);
831 gtk_size_request_get_height (GTK_SIZE_REQUEST (child),
832 &child_min, &child_nat);
833 minimum += child_min;
834 natural += child_nat;
838 border_width = gtk_container_get_border_width (GTK_CONTAINER (widget));
840 if (orientation == GTK_ORIENTATION_HORIZONTAL)
842 minimum += (border_width + GTK_WIDGET (widget)->style->xthickness) * 2;
843 natural += (border_width + GTK_WIDGET (widget)->style->xthickness) * 2;
847 minimum += (border_width + GTK_WIDGET (widget)->style->ythickness) * 2;
848 natural += (border_width + GTK_WIDGET (widget)->style->ythickness) * 2;
852 *minimum_size = minimum;
855 *natural_size = natural;
859 gtk_frame_get_width (GtkSizeRequest *widget,
863 gtk_frame_get_size (widget, GTK_ORIENTATION_HORIZONTAL, minimum_size, natural_size);
867 gtk_frame_get_height (GtkSizeRequest *widget,
871 gtk_frame_get_size (widget, GTK_ORIENTATION_VERTICAL, minimum_size, natural_size);
876 gtk_frame_get_height_for_width (GtkSizeRequest *request,
878 gint *minimum_height,
879 gint *natural_height)
881 GtkWidget *widget = GTK_WIDGET (request);
883 GtkFrame *frame = GTK_FRAME (widget);
884 GtkFramePriv *priv = frame->priv;
885 GtkBin *bin = GTK_BIN (widget);
886 gint child_min, child_nat, label_width;
887 gint minimum, natural;
890 border_width = gtk_container_get_border_width (GTK_CONTAINER (widget));
891 minimum = (border_width + GTK_WIDGET (widget)->style->ythickness) * 2;
892 natural = (border_width + GTK_WIDGET (widget)->style->ythickness) * 2;
894 width -= (border_width + GTK_WIDGET (widget)->style->xthickness) * 2;
895 label_width = width - 2 * LABEL_PAD + 2 * LABEL_SIDE_PAD;
897 if (priv->label_widget && gtk_widget_get_visible (priv->label_widget))
899 gtk_size_request_get_height_for_width (GTK_SIZE_REQUEST (priv->label_widget),
900 label_width, &child_min, &child_nat);
901 minimum += child_min;
902 natural += child_nat;
905 child = gtk_bin_get_child (bin);
906 if (child && gtk_widget_get_visible (child))
908 gtk_size_request_get_height_for_width (GTK_SIZE_REQUEST (priv->label_widget),
909 width, &child_min, &child_nat);
910 minimum += child_min;
911 natural += child_nat;
915 *minimum_height = minimum;
918 *natural_height = natural;
922 gtk_frame_get_width_for_height (GtkSizeRequest *widget,
927 gtk_size_request_get_width (widget, minimum_width, natural_width);
931 gtk_frame_size_request_init (GtkSizeRequestIface *iface)
933 iface->get_width = gtk_frame_get_width;
934 iface->get_height = gtk_frame_get_height;
935 iface->get_height_for_width = gtk_frame_get_height_for_width;
936 iface->get_width_for_height = gtk_frame_get_width_for_height;