Changeset 1974 in orxonox.OLD for orxonox/branches
- Timestamp:
- Jun 17, 2004, 9:35:55 PM (20 years ago)
- Location:
- orxonox/branches/gui/guicc
- Files:
-
- 2 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 } -
orxonox/branches/gui/guicc/orxonox_gui.h
r1965 r1974 12 12 #include <gtk/gtkcheckbutton.h> 13 13 #include <gtk/gtkhscale.h> 14 #include <gtk/gtkoptionmenu.h> 15 #include <gtk/gtkmenu.h> 16 #include <gtk/gtkmenuitem.h> 14 17 15 18 … … 103 106 { 104 107 public: 105 Slider (char 108 Slider (char* slidername,int start, int end); 106 109 ~Slider(); 107 110 int i; 108 111 static gint OptionChange (GtkWidget *widget, Widget* slider); 109 112 }; 113 114 class Menu : public Option 115 { 116 public: 117 Menu(char* menuname, ...); 118 ~Menu(); 119 120 static gint OptionChange (GtkWidget *widget, Widget* menu); 121 }; 122 110 123 //gint orxonox_gui_quit ( GtkWidget *widget, GdkEvent *event, gpointer data); 111 124
Note: See TracChangeset
for help on using the changeset viewer.