Changeset 1974 in orxonox.OLD for orxonox/branches/gui/guicc/orxonox_gui.cc
- Timestamp:
- Jun 17, 2004, 9:35:55 PM (21 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
orxonox/branches/gui/guicc/orxonox_gui.cc
r1973 r1974 21 21 slider->connectSignal ("value_changed", slider->OptionChange); 22 22 box->fill(slider); 23 23 Menu* menu = new Menu("test1", "no output", "verbose", "debug", "lastItem"); 24 menu->connectSignal ("changed", menu->OptionChange); 25 box->fill(menu); 24 26 orxonoxGUI->showall (); 25 27 … … 236 238 cout << static_cast<Slider*>(slider)->value << endl; 237 239 } 240 241 242 Menu::Menu(char* menuname, ...) 243 { 244 /** 245 * Creates an Menu-Item-list out of multiple input. Consider, that the last input argument has to be "lastItem" for this to work. 246 */ 247 char *tmp; 248 va_list itemlist; 249 widget = gtk_option_menu_new(); 250 GtkWidget* menu = gtk_menu_new (); 251 GtkWidget* item; 252 253 va_start(itemlist, menuname); 254 while (strcmp(tmp = va_arg(itemlist, char*), "lastItem")) 255 { 256 item = gtk_menu_item_new_with_label (tmp); 257 gtk_menu_shell_append(GTK_MENU_SHELL (menu), item); 258 } 259 va_end(itemlist); 260 261 gtk_option_menu_set_menu (GTK_OPTION_MENU (widget), menu); 262 } 263 264 gint Menu::OptionChange (GtkWidget *widget, Widget* menu) 265 { 266 /** 267 * Writes value, if changed on the Menu, to the object. 268 */ 269 static_cast<Menu*>(menu)->value = (int)gtk_option_menu_get_history (GTK_OPTION_MENU(menu->widget)); 270 cout << static_cast<Menu*>(menu)->value << endl; 271 }
Note: See TracChangeset
for help on using the changeset viewer.