[Gtk-sharp-list] GInterface implementation
Murray Cumming
murrayc@murrayc.com
Sat, 17 Apr 2004 10:27:57 +0200
On Sat, 2004-04-17 at 00:25, Rachel Hestilow wrote:
> Essentially the problem is the same as with non-signal virtual methods
> -- there is no easy way of implementing/overriding methods
> automatically; instead for each method in the interface you'd need to
> keep a delegate around for the life of the object. Additionally,
> interfaces pose an additional problem in that there's no base class you
> can put glue code in; you'd need a helper class of some sort that
> managed the native<->managed conversions.
We manage this in gtkmm, but we have to use multiple virtual
inheritance, so that our Glib::Object and Glib::Interface classes share
a Glib::ObjectBase base class, and share the data in that base class.
Here's an explanatory inheritance diagram:
http://www.gtkmm.org/docs/gtkmm-2.4/docs/reference/html/classGtk_1_1TreeStore.html
If you don't have multiple inheritance in C#, you might be able to use
aggregation instead.
> I get the feeling that it's mostly GtkCellRenderer that people are going
> to want to implement.
GtkCellRenderer is not a GInterface, but you do need to register a new
GType when derving a new CellRenderer, and it has vfuncs that you need
to override.
Overriding the TreeModel Interface is fairly common though.
--
Murray Cumming
www.murrayc.com
murrayc@murrayc.com