Acciones

Primero cree las Actions y añádaselas a un ActionGroup, con ActionGroup::add().

Los argumentos de Action::create() especifican el nombre de la acción y cómo aparecerá en los menús y las barras de herramientas.

También puede especificar un manejador de señales cuando llame a ActionGroup::add(). Se llamará a este manejador de señales cuando se active la acción a través de un elemento del menú o un botón de la barra de herramientas.

Tenga en cuenta que debe especificar acciones para submenús así como para elementos del menú.

Por ejemplo:

m_refActionGroup = Gtk::ActionGroup::create();

m_refActionGroup->add( Gtk::Action::create("MenuFile", "_File") );
m_refActionGroup->add( Gtk::Action::create("New", "_New"),
  sigc::mem_fun(*this, &ExampleWindow::on_action_file_new) );
m_refActionGroup->add( Gtk::Action::create("ExportData", "Export Data"),
  sigc::mem_fun(*this, &ExampleWindow::on_action_file_open) );
m_refActionGroup->add( Gtk::Action::create("Quit", "_Quit"),
  sigc::mem_fun(*this, &ExampleWindow::on_action_file_quit) );

Note that this is where we specify the names of the actions as they will be seen by users in menus and toolbars. Therefore, this is where you should make strings translatable, by putting them inside the _() macro.