[Gtk-sharp-list] GType registration for subclassing

Mike Kestner mkestner@ximian.com
24 Dec 2002 18:50:12 -0600

Ho Ho Ho!

I hacked support for GType registration of GObject subclasses today.  It
was a pretty fun hack, traveling through the bowels of GType
introspection and System.Reflection.  :)

So the remaining hurdle is virtual method overriding.  I'm going to try
to pull together my thoughts on the problem and post them to try to get
some dialog going on it.

For the record, here's a clip from the Subclass.cs sample to show the
boilerplate involved in type registration:

public class MyButton : Gtk.Button {
    static uint gtype = 0;

    public MyButton () : base (GType) {}

    public static new uint GType {
        get {
            if (gtype == 0)
                gtype = RegisterGType (typeof (MyButton));
            return gtype;
Mike Kestner <mkestner@ximian.com>