If it can be of any help, I faced the same problem and end up doing the
toolbar with ui manager and then adding
a menutoolbutton later.

I paste my few lines of code (in python, don't have this in gtkmm) if can
be of help:

inst.recent_menu_2 = gtk.Menu()
...
menu_toolbutton = gtk.MenuToolButton("gtk-open")
menu_toolbutton.set_tooltip_text(_("Open a CherryTree Document"))
menu_toolbutton.set_arrow_tooltip_text(_("Open a Recent CherryTree
Document"))
menu_toolbutton.set_menu(inst.recent_menu_2)
menu_toolbutton.connect("clicked", inst.file_open)
inst.ui.get_widget("/ToolBar").insert(menu_toolbutton, 9)

Cheers,
Giuseppe.


On Tue, Mar 5, 2013 at 3:42 PM, Kjell Ahlstedt
<[email protected]>wrote:

> Have you read about menus and toolbars in the gtkmm tutorial, chapter 12?
> http://developer.gnome.org/**gtkmm-tutorial/stable/<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<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
>>
>>
> ______________________________**_________________
> gtkmm-list mailing list
> [email protected]
> https://mail.gnome.org/**mailman/listinfo/gtkmm-list<https://mail.gnome.org/mailman/listinfo/gtkmm-list>
>
_______________________________________________
gtkmm-list mailing list
[email protected]
https://mail.gnome.org/mailman/listinfo/gtkmm-list

Reply via email to