Menus and Toolbars

There are specific APIs for menus and toolbars, but you should usually deal with them together, creating Gio::SimpleActions that you can refer to in both menus and toolbars. In this way you can handle activation of the action instead of responding to the menu and toolbar items separately. And you can enable or disable both the menu and toolbar item via the action. Gtk::Builder can create menus and toolbars.

This involves the use of the Gio::SimpleActionGroup, Gio::SimpleAction and Gtk::Builder classes, all of which should be instantiated via their create() methods, which return RefPtrs.

Gtk::ActionGroup, Gtk::Action with its subclasses and Gtk::UIManager has been an alternative. These classes are deprecated from gtkmm version 3.22 and should not be used in newly-written code.