disabling a MenuItem easily when using Menu_Helpers?



I've created some menus with the Gtk::Menu_Helpers interface as shown but
now I would like to be able to call set_sensitive(false) on some of the
entries to disable them.  One way I found of doing this is simply creating
a MenuList like so and referring to the index of the MenuItem I care about
by number:

   void MainWindow::on_menu_help_about()
   {
      Gtk::Menu::MenuList& menulist = m_editmenu.items();
      menulist[0].set_sensitive(false);
   }

Unfortunately this seems a rather restrictive way of doing things since it
assumes that I know the menu layout beforehand.  I know that in gtk if you
use a call like gtk_item_factory_get_widget(item_factory,
"path/to/menu/item") you can get a handle to the widget and disable the
menu entry.

Is there an equivalent way to do this in gtkmm when you construct the
MenuList with the Menu_Helpers interface as shown above or would I have to
build the Menu up manually?  I suppose I could use a hash table, constants
or something else for a more convenient way to use the [] indexing but
even then it seems less than ideal.

I know, I'm probably trying to have my cake and eat it too...

-- 
Philip Lowman






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