[Gtk-sharp-list] How the bindings work

Dave Joyner d4ljoyn@yahoo.com
Thu, 7 Aug 2003 03:28:09 -0700 (PDT)


I'm trying to get a better grasp on this topic.  The
gtk2 source seems to
suggest that
a -1 in width and height request is valid, example
from gtkwidget.c:

 g_object_class_install_property (gobject_class,
       PROP_HEIGHT_REQUEST,
            g_param_spec_int ("height_request",
            _("Height request"),
            _("Override for height request of the
widget, or -1 if natural
request should be used"),
            -1,
            G_MAXINT,
            -1,
            G_PARAM_READWRITE));
I don't know exactly what the authors mean by a
'natural' request, but I
have returned -1 from the size_request method of
widgets and the effect is
that the container will then respond with a 'real'
size when it calls the
size_allocate method.

So when trying to get the size of a widget I've used
widget->allocation
instead, and I could be all wrong.  In Gtk# this is
the Allocation property
of Gtk.Widget.

Comments from get size request
/**
 * gtk_widget_get_size_request:
 * @widget: a #GtkWidget
 * @width: return location for width, or %NULL
 * @height: return location for height, or %NULL
 *
 * Gets the size request that was explicitly set for
the widget using
 * gtk_widget_set_size_request().  A value of -1
stored in @width or
 * @height indicates that that dimension has not been
set explicitly
 * and the natural requisition of the widget will be
used intead.
....


Dave Joyner

----- Original Message -----
From: "Miguel de Icaza" <miguel@ximian.com>
To: <erik@snowedin.net>
Cc: <gtk-sharp-list@lists.ximian.com>
Sent: Wednesday, August 06, 2003 4:08 PM
Subject: Re: [Gtk-sharp-list] How the bindings work


> Hello,
>
> > This returns a valid width and height.  It doesn't
make sense that you'd
> > have to pack/display/realize a widget before you
get its size because if
> > you are implementing a new container, you need to
know the size of the
> > widget before you can lay it out.
>
> I was under the impression that a label for instance
needs to get its
> resources computed before it can say `I am this
big', which typically
> involves getting the widget realized, so it can
fetch the font metrics.
>
> I can be wrong of course.
> _______________________________________________
> Gtk-sharp-list maillist  - 
Gtk-sharp-list@lists.ximian.com
>
http://lists.ximian.com/mailman/listinfo/gtk-sharp-list


__________________________________
Do you Yahoo!?
Yahoo! SiteBuilder - Free, easy-to-use web site design software
http://sitebuilder.yahoo.com