Re: Drop down MenuToolButton



Have you read about menus and toolbars in the gtkmm tutorial, chapter 12?
http://developer.gnome.org/gtkmm-tutorial/stable/
It contains an example with UIManager. However there is no example of a menu in a toolbar. I don't think that's possible. The description of Gtk::UIManager at
http://developer.gnome.org/gtkmm/stable/classGtk_1_1UIManager.html#details
says "every menuitem must have a menubar or popup in its ancestry". A toolbar won't do, it seems.

Kjell

2013-03-02 19:45, Steve Holmes skrev:
Hi everyone,

I'm trying to create a drop-down menu on a toolbar using the UIManager and I can't figure it out. The documentation mentions something about specifying a Gtk::MenuToolButton as a proxy for the associated action but I'm not sure how to do that. One thing I thought was that I could manually create it like this:

Gtk::MenuToolButton* menu_button = manage(new Gtk::MenuToolButton());
menu_button->set_related_action(ref_manager_action_group->get_action("MyAction");

and then for the ui string:

<ui>...
...
<toolbar name="Toolbar">
  <toolitem action="MyAction">
    <menu action='ToolMenu'>
     <menuitem action="Action1">
     <menuitem action="Action2">
    </menu>
   </toolitem>
</toolbar>
...
</ui>

Any help is appreciated!

Steve


--
Steve Holmes
M: 416-791-3868




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