Hi!Thanks to Murray's explanation on how to properly derive gtkmm objects from GTK+ objects, I was able to implement my idea on how to solve some annoying things with the way libglademm is implemented (Basically I solved the problems I had by simply using libglademm in the first place :-) ).
I've attached a copy of my code (including a small example). The idea is that it should have the following advantages to libglademm and get_widget_derived() in particular:
- Allow arbitrary constructor arguments for derived widget classes.- Straightforward creation of derived widgets, no Xml::create(), get_derived_widget(), etc.
- Hides more (most) glade stuff from the user.- Makes it easy to catch runtime errors when, for example, making a bunch of get_widget() calls by using exceptions.
Please keep in mind that this is a quick proof-of-concept hack. I'd like to hear your comments, as I suspect that the approach I'm using may not be 100% flawless.
Cheers, -- Christer Palm
Attachment:
XmlWidget.tar.gz
Description: GNU Zip compressed data