Re: Struct Example
- From: Tristan Van Berkom <vantr touchtunes com>
- To: Pablo Fischer <exilion yifan net>
- Cc: gtk-app-devel-list <gtk-app-devel-list gnome org>
- Subject: Re: Struct Example
- Date: Tue, 29 Oct 2002 10:14:51 -0500
you want to know how to make
a `class' in Gtk using
structs in C.
Its actually quite complicated
and I wont put it into the
scope of this mail.
Basicly the structure goes like this:
typedef struct {
GtkWidget widget; // parent instance
// memory section
/* ... the members of your object's
instance ... */
} GtkDerived;
typedef struct {
GtkWidgetClass parent_class;
/* methods and data from your class */
} GtkDerivedClass;
So an object in Gtk consists
of an instance structure and
a class structure.
The actual implementation is complicated.
It is quite trivial to copy-paste class/instance
initializers etc.. and write your own objects like
that (and I recommend you start that way).
For information on the implementation
start here:
http://developer.gnome.org/doc/API/2.0/gobject/gobject-gtype.html
Cheers,
-Tristan
Pablo Fischer wrote:
Hi;
Now, Im learning how to create structs (I know how to create classes,
but I never seen structs) but I would like to have an idea of how does
it (a struct) works in work in gtk2.
Someone have a complete example of a struct in gtk2?
Thanks!
Paul Fischer
_______________________________________________
gtk-app-devel-list mailing list
gtk-app-devel-list gnome org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]