Handling text change ...



Hello people, 

I make my first experiences with Gtkmm and I like it. 
I started creating a window with Glade3 and wrote the code to display
it. 
Now I have a question: 
I added the same signal handler to one ImageMenuItem and ToolButton that
looks, till now, like this:

26 void Test::signal_connect_disconnect(Gtk::ImageMenuItem* menuitem,
Gtk::ToolButton* toolbutton)
 27 {
 28         Gtk::StockID id(toolbutton->get_stock_id());
 29
 30         Gtk::Image* c = Gtk::manage(new
Gtk::Image(Gtk::StockID("gtk-connect"),
Gtk::IconSize(Gtk::ICON_SIZE_MENU)));
 31         Gtk::Image* d = Gtk::manage(new
Gtk::Image(Gtk::StockID("gtk-disconnect"),
Gtk::IconSize(Gtk::ICON_SIZE_MENU)));
 32
 33         if (id == Gtk::Stock::CONNECT)
 34         {
 35                 menuitem->set_image(*d);
 36                 toolbutton->set_stock_id(Gtk::Stock::DISCONNECT);
 37         }
 38         else
 39         {
 40                 menuitem->set_image(*c);
 41                 toolbutton->set_stock_id(Gtk::Stock::CONNECT);
 42         }
 43 }

Finally my question, when i change the image/stock item, who can i also
change the text of the menuitem and toolbox at the same time. 
I looked in the documentation, but I can't find any way to change simply
the label text of the MenuItem? 
Or should the text change automatically when i change the stock item, at
least the text of the toolbutton could to this, not?

Any ideas, 
-moe-






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