[Gtk-sharp-list] Gtk# constructors

Lee Mallabone gnome@fonicmonkey.net
18 Feb 2003 09:57:46 -0500


I'm a bit concerned about the constructors in Gtk#. Gtk.HBox for example
has these constructors:

1: protected HBox(uint gtype) : base(gtype) {}
2: public HBox(IntPtr raw) : base(raw) {}
3: protected HBox() : base(){}
4: public HBox(bool homogeneous, int spacing)

Number 4 is the only one an application programmer cares about, I think.
Number 3 looks really odd - I followed the class hierarchy up to
GLib.Object, and its constructor just does:

public Object () {
   needs_ref = false;

which means, (as far as I can tell), that the internal Gtk C object
Handle is never instantiated, so you end up with an object that will
probably crash if you call instance methods on it.

Apart from number 4, should any of these constructors really be present?

At the very least, I think they're confusing for new Gtk# users,
(especially the fact that number 2 is public).


Lee Mallabone <gnome@fonicmonkey.net>