Murray has seen part of this already WRT my template problems on
c.l.c++.
I've written a widget derived from Gtk::OptionMenu. This is a
template class which works with objects, rather than the standard
Gtk::MenuItems. The derived Gtk::MenuItem template class
(ObjectMenuItem) contains an object, and the standard history and
set_menu methods are overridden to work with objects. I know this
will be obsoleted in GTK+ 2.4 with ¿GtkAction?, but I need to use 2.2
for the time being ;-).
This appears to work correctly. However, while it works fine in
interfaces constructed "by hand", it doesn't work with Glade and
get_widget_derived():
(gladeexamplewindow:2270): Gtk-CRITICAL **: file gtkmenu.c: line 865 (gtk_menu_popup): assertion `GTK_IS_MENU (menu)' failed
(gladeexamplewindow:2270): Gtk-CRITICAL **: file gtkmenu.c: line 1088 (gtk_menu_get_active): assertion `GTK_IS_MENU (menu)' failed
Does Gtk::OptionMenu not work correctly with get_widget_derived, or is
this a bug in my code? The menu /does/ exist, since I can query what
the currently selected object is...
I've attached a copy of the class (it's very simple), together with a
couple of simple testcases to illustrate its use (and the above
error).
Many thanks,
Roger
--
Roger Leigh
Printing on GNU/Linux? http://gimp-print.sourceforge.net/
GPG Public Key: 0x25BFB848. Please sign and encrypt your mail.
Attachment:
objectoptionmenu.tar.bz2
Description: Gtkmm ObjectOptionMenu class and testcases