X-Git-Url: http://pileus.org/git/?a=blobdiff_plain;f=gtk%2Fgtkaspectframe.c;h=4b77af282a021f8f5911b3243d3de0a61f772bf5;hb=6767541ead7cc150d1dd066d3b84d85559500c28;hp=2037cd578e52e91a579c6c4c690ee2ec9cb91350;hpb=a6e0fb92c6129edaecd4c60dde8a7cc21461e0e1;p=~andy%2Fgtk diff --git a/gtk/gtkaspectframe.c b/gtk/gtkaspectframe.c index 2037cd578..4b77af282 100644 --- a/gtk/gtkaspectframe.c +++ b/gtk/gtkaspectframe.c @@ -17,9 +17,7 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. + * License along with this library. If not, see . */ /* @@ -44,13 +42,17 @@ */ #include "config.h" + #include "gtkaspectframe.h" + +#include "gtksizerequest.h" + #include "gtkprivate.h" #include "gtkintl.h" -struct _GtkAspectFramePriv +struct _GtkAspectFramePrivate { GtkAllocation center_allocation; @@ -128,17 +130,17 @@ gtk_aspect_frame_class_init (GtkAspectFrameClass *class) TRUE, GTK_PARAM_READWRITE)); - g_type_class_add_private (class, sizeof (GtkAspectFramePriv)); + g_type_class_add_private (class, sizeof (GtkAspectFramePrivate)); } static void gtk_aspect_frame_init (GtkAspectFrame *aspect_frame) { - GtkAspectFramePriv *priv; + GtkAspectFramePrivate *priv; aspect_frame->priv = G_TYPE_INSTANCE_GET_PRIVATE (aspect_frame, GTK_TYPE_ASPECT_FRAME, - GtkAspectFramePriv); + GtkAspectFramePrivate); priv = aspect_frame->priv; priv->xalign = 0.5; @@ -154,7 +156,7 @@ gtk_aspect_frame_set_property (GObject *object, GParamSpec *pspec) { GtkAspectFrame *aspect_frame = GTK_ASPECT_FRAME (object); - GtkAspectFramePriv *priv = aspect_frame->priv; + GtkAspectFramePrivate *priv = aspect_frame->priv; switch (prop_id) { @@ -200,7 +202,7 @@ gtk_aspect_frame_get_property (GObject *object, GParamSpec *pspec) { GtkAspectFrame *aspect_frame = GTK_ASPECT_FRAME (object); - GtkAspectFramePriv *priv = aspect_frame->priv; + GtkAspectFramePrivate *priv = aspect_frame->priv; switch (prop_id) { @@ -229,8 +231,8 @@ gtk_aspect_frame_get_property (GObject *object, * the #GtkAspectFrame. This ranges from 0.0 (left aligned) * to 1.0 (right aligned) * @yalign: Vertical alignment of the child within the allocation of - * the #GtkAspectFrame. This ranges from 0.0 (left aligned) - * to 1.0 (right aligned) + * the #GtkAspectFrame. This ranges from 0.0 (top aligned) + * to 1.0 (bottom aligned) * @ratio: The desired aspect ratio. * @obey_child: If %TRUE, @ratio is ignored, and the aspect * ratio is taken from the requistion of the child. @@ -247,7 +249,7 @@ gtk_aspect_frame_new (const gchar *label, gboolean obey_child) { GtkAspectFrame *aspect_frame; - GtkAspectFramePriv *priv; + GtkAspectFramePrivate *priv; aspect_frame = g_object_new (GTK_TYPE_ASPECT_FRAME, NULL); @@ -270,8 +272,8 @@ gtk_aspect_frame_new (const gchar *label, * the #GtkAspectFrame. This ranges from 0.0 (left aligned) * to 1.0 (right aligned) * @yalign: Vertical alignment of the child within the allocation of - * the #GtkAspectFrame. This ranges from 0.0 (left aligned) - * to 1.0 (right aligned) + * the #GtkAspectFrame. This ranges from 0.0 (top aligned) + * to 1.0 (bottom aligned) * @ratio: The desired aspect ratio. * @obey_child: If %TRUE, @ratio is ignored, and the aspect * ratio is taken from the requistion of the child. @@ -285,7 +287,7 @@ gtk_aspect_frame_set (GtkAspectFrame *aspect_frame, gfloat ratio, gboolean obey_child) { - GtkAspectFramePriv *priv; + GtkAspectFramePrivate *priv; g_return_if_fail (GTK_IS_ASPECT_FRAME (aspect_frame)); @@ -334,11 +336,13 @@ gtk_aspect_frame_compute_child_allocation (GtkFrame *frame, GtkAllocation *child_allocation) { GtkAspectFrame *aspect_frame = GTK_ASPECT_FRAME (frame); - GtkAspectFramePriv *priv = aspect_frame->priv; + GtkAspectFramePrivate *priv = aspect_frame->priv; GtkBin *bin = GTK_BIN (frame); + GtkWidget *child; gdouble ratio; - if (bin->child && gtk_widget_get_visible (bin->child)) + child = gtk_bin_get_child (bin); + if (child && gtk_widget_get_visible (child)) { GtkAllocation full_allocation; @@ -346,7 +350,7 @@ gtk_aspect_frame_compute_child_allocation (GtkFrame *frame, { GtkRequisition child_requisition; - gtk_widget_get_child_requisition (bin->child, &child_requisition); + gtk_widget_get_preferred_size (child, &child_requisition, NULL); if (child_requisition.height != 0) { ratio = ((gdouble) child_requisition.width /