I am using the library gtkmm in C++. This is the part of the code where I define "Open":
Gtk::ImageMenuItem *menuOpen = Gtk::manage(new Gtk::ImageMenuItem(Gtk::Stock::OPEN));
menuFile->append(*menuOpen);
I want "Open" to be greyed out if I cannot click on it, but I don't know the method which allows to do that. Any suggestions?
Thank you for your help.
In gtkmm 3 both
Gtk::ImageMenuItem
andGtk::Stock
have been deprecated, so it is best not to use them. Just useGtk::MenuItem
only with the text set to"_Open"
.All widgets in gtkmm derive from
Gtk::Widget
. The method to use isGtk::Widget::set_sensitive(bool)
.To grey out or make insensitive your menu, use:
To re-enable the menu item:
If you want to find out if it is greyed out or not, use: