Re: Drop down MenuToolButton



Thanks Giuseppe, your code is very helpful.

I ended up using something very similar after reading a Gtk-Perl tutorial. My previous reply on the list gives the site url and the code I ended up using.

Forgive me if this is a dumb question but what does the underscore bracket '_(' do in the set_tooltip_text() parameter? I've seen the same thing used in C++ examples but I always got errors when I tried to compile so I removed them.

regards,
Steve

On Tue, Mar 5, 2013 at 9:55 AM, Giuseppe Penone <giuspen gmail com> wrote:
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 <kjell ahlstedt bredband net> wrote:
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="">     <menu action="">      <menuitem action="">      <menuitem action="">     </menu>
   </toolitem>
</toolbar>
...
</ui>

Any help is appreciated!

Steve


--
Steve Holmes
M: 416-791-3868


_______________________________________________
gtkmm-list mailing list
gtkmm-list gnome org
https://mail.gnome.org/mailman/listinfo/gtkmm-list


_______________________________________________
gtkmm-list mailing list
gtkmm-list gnome org
https://mail.gnome.org/mailman/listinfo/gtkmm-list




--
Steve Holmes
M: 416-791-3868


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