registering custom widget types with gtype for libglademm



Hi,

I want to register custom widget types with GType and have libglademm
instantiate them automatically from Glade files.  A glade catalog xml
file allows me to create such glade files, currently using the simple
"parent" class approach where Glade treats derived types like their
parent.  Later it may be nice to actually see custom Gtkmm widgets
rendered in Glade, but that is not important for me at this point.

In py-gtk, I can simply do:

class PositionButton (gtk.SpinButton):
    # Register the type with glib.
    __gtype_name__ = 'PositionButton'


And all PositionButton widgets in the Glade file are instantiated as
PositionButton's when the Glade file is loaded.

What is the corresponding approach in Gtkmm?  I am aware of
get_widget_derived() which may allow to do this by wrapping the
instantiated Gtk object with a C++ class (is this how it works?) but
the approach in py-gtk above seems much more automatic and simpler to
use.

Thanks,
Marcus



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]