questions about using Gtk_MenuItem and Gtk_MenuFactory


I have 2 questions that I couldn't find answers from documentation:

(1) The first arg of the public function
Gtk_MenuFactory::add_entries(GtkMenuEntry *entries, int nentries) is a
pointer to GtkMenuEntry. The third member of the GtkMenuEntry structure is
the callback function to call when this menu item is selected (by the
accelerator key, or with the mouse.) My question is how to set the
callback function to be a _member_ function of certain class instead of a
_general_ function? So far I have no success to use member functions as
callbacks (complier complains the conversion from void (*)() to
void (classname::*)() ).

(2) To get around with the above problem, I could manage to use
Gtk_MenuItem and Gtk_Menu widgets to create menus, and to use member
functions as callback functions. But I don't know how to bind keys to menu
item or to use accelerator to do that (e.g. <control>S to "Save" menu
item). The available public function "void 
Gtk_MenuItem::accelerator_text(const gchar *buffer)" did nothing in this
regards. I also don't know how to create Gtk_AcceleratorTable(Gtk_Object *
object, const gchar * signal_name, gchar accelerator_key, guint8
accelerator_mods) - what does each of the arguments mean? 

Thanks very much in advance!

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