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::Stock have been deprecated, so it is best not to use them. Just use
Gtk::MenuItem only with the text set to
All widgets in gtkmm derive from
Gtk::Widget. The method to use is
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:
bool am_i_sensitive = menuOpen->get_sensitive();