Re: GTK function to test whether GETWidget is a button/edit/columned list/whatever



On Sat, Oct 23, 2004 at 02:40:29PM -0600, Neil Zanella wrote:
Thanks,

I see there are lots of macros in GTK. As a matter of fact I was just wondering
what the difference is between:

(GtkWidget *) foo and GTK_WIDGET(foo)

and so on for such GTK_WINDOW, G_OBJECT, etc... kind of macros.

Thanks,

Neil


On Sat, 23 Oct 2004 22:05:11 +0200, David Necas (Yeti)
<yeti physics muni cz> wrote:
On Sat, Oct 23, 2004 at 01:47:34PM -0600, Neil Zanella wrote:
I wonder whether GTK has a function to test a given widget to see
whether it is a
button/edit/columned list/whatever.

GTK_IS_BUTTON(widget)
GTK_IS_EDITABLE(widget)
GTK_IS_...(widget)

For normal classes, GTK_FOO(bar) ends up as (GtkFoo*)bar,
except it checks if the cast is possible (this can be
disabled).

If GtkFoo is an interface (GtkFoo*)bar is simply wrong (the
pointer must be offset to point to the interface).

The moral is to always use GTK_FOO().

Yeti


--
Dynamic IP address is not a crime.



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]