Re: Subclassing in Gtk+ 3.0



2009/12/7 David Nečas <yeti physics muni cz>:
>
> Hello, how is subclassing intended to work in Gtk+ 3.0?
>
> Now I subclass GtkButton with
>
> struct _MyButton {
>    GtkButton parent;
>    /* My fields go here. */
>    ...
> };
>
> According to
>
>    http://mail.gnome.org/archives/gtk-devel-list/2008-June/msg00014.html
>
> object struct definitions will be moved to private files.  So I will not
> be able to do the above because GtkButton is not available (note the I'm
> not talking about access to GtkButton fields, the above code simply
> won't compile with GtkButton being an incomplete type).
>
> So, what will replace this mechanism?

Currently in preparation for 3.0, all structure members are getting accessors
so that subclasses can continue to access the data, I'm not sure whats the
ultimate plan with GSEAL(), if the data will migrate to private structures or
not.

Regardless; you can count on GtkButton being a complete type (whether it
includes the members, or includes them in an obfuscated/sealed manner),
you just cant access members like GTK_BIN (button)->child in the same
way anymore (you must use accessor functions always).

Cheers,
        -Tristan


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