On Tue, 2006-09-12 at 11:28 -0500, Matt Hoosier wrote: > On 9/12/06, Murray Cumming <[EMAIL PROTECTED]> wrote: > > > Hi, > > > > > > This is a friendly inquiry to see whether the wrappings for > > > GtkAccelGroup's "connect" and "connect_by_path" methods have been > > > omitted by design. > > > > > > > > > http://developer.gnome.org/doc/API/2.0/gtk/gtk-Keyboard-Accelerators.html#gtk-accel-group-connect > > > > > > The .hg file for the AccelGroup class has those two methods tucked > > > inside an _IGNORE() block, but no comment exists to say whether > > > there's fundamental brokenness about them, or perhaps they just > > > haven't been requested up to this point. > > > > The main reason that they are not wrapped is that they take GClosure > > parameters, which suggests that they are some funky thing only needed for > > GTK+ internals or only needed rarely. > > > > Hopefully the same effect can be achieved with other parts of the API. > > Does that seem to be the case? > > > > For instance, by specifying the accelerator and callback slot when > > creating the Gtk::Action. I don't understand why anybody would want a > > separate callback for an accelerator, instead of one callback for both the > > accelerator and normal activation. > > Okay, that seems reasonable. I suppose that the slot gets attached by > fetching the Gtk::Action::signal_activate object, but how does one > specify the actual accelerator (for purposes of argument, suppose it's > the Escape key) that should be used to activate the action? I don't > see any obvious function on the Action class which attaches an > accelerator. > > Suppose we've got the following already: > > Gtk::Window w; > Glib::RefPtr<Gtk::Action> refAction = Gtk::Action::create (); > Glib::RefPtr<Gtk::AccelGroup> refGroup = Gtk::AccelGroup::create (); > > w.add_accel_group (w); > refAction.signal_activate ().connect ( ... ); > // what next?
You can specify an accelerator when you add the action to an ActionGroup: http://www.gtkmm.org/docs/gtkmm-2.4/docs/reference/html/classGtk_1_1ActionGroup.html You should not need to create an AccelGroup manually, but if you have some need for that, I can find out how that works. There's more here on the basics here: http://www.gtkmm.org/docs/gtkmm-2.4/docs/tutorial/html/ch11.html I think, you can also specify the accelerator in the UI definition. That's mentioned here, though the format is not clear: http://developer.gnome.org/doc/API/2.0/gtk/GtkUIManager.html > This question seems to be straying into just questions about Gtk+ API; > feel free to direct me to gtk-list instead. -- Murray Cumming [EMAIL PROTECTED] www.murrayc.com www.openismus.com _______________________________________________ gtkmm-list mailing list [email protected] http://mail.gnome.org/mailman/listinfo/gtkmm-list
