Changeset 2587 in orxonox.OLD for orxonox/trunk/gui
- Timestamp:
- Oct 17, 2004, 12:48:07 AM (20 years ago)
- Location:
- orxonox/trunk/gui
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
orxonox/trunk/gui/orxonox_gui.cc
r2586 r2587 582 582 * Creates an Menu-Item-list out of multiple input. Consider, that the last input argument has to be "lastItem" for this to work. 583 583 */ 584 this->init(); 585 this->setTitle(menuname); 586 587 char *itemName; 588 589 va_start (itemlist, menuname); 590 while (strcmp (itemName = va_arg (itemlist, char*), "lastItem")) 591 { 592 this->addItem(itemName); 593 } 594 va_end(itemlist); 595 596 gtk_option_menu_set_menu (GTK_OPTION_MENU (widget), menu); 597 this->connectSignal ("changed", this->OptionChange); 598 } 599 600 void Menu::init(void) 601 { 584 602 is_option = 2; 585 603 value = 0; 586 604 next = NULL; 587 option_name = menuname;588 605 flag_name = ""; 589 606 flag_name_short = ""; 590 607 default_value = 0; 591 char *tmp;592 va_list itemlist;593 608 widget = gtk_option_menu_new (); 594 GtkWidget* menu = gtk_menu_new (); 595 GtkWidget* item; 596 597 va_start (itemlist, menuname); 598 while (strcmp (tmp = va_arg (itemlist, char*), "lastItem")) 599 { 600 item = gtk_menu_item_new_with_label (tmp); 601 gtk_menu_shell_append(GTK_MENU_SHELL (menu), item); 602 } 603 va_end(itemlist); 604 605 gtk_option_menu_set_menu (GTK_OPTION_MENU (widget), menu); 606 this->connectSignal ("changed", this->OptionChange); 607 } 608 609 void Menu::init(void) 610 { 609 menu = gtk_menu_new (); 610 611 } 612 613 void Menu::setTitle(char* title) 614 { 615 option_name = title; 616 } 617 618 void Menu::addItem (char* itemName) 619 { 620 item = gtk_menu_item_new_with_label (itemName); 621 gtk_menu_shell_append(GTK_MENU_SHELL (menu), item); 611 622 } 612 623 -
orxonox/trunk/gui/orxonox_gui.h
r2586 r2587 178 178 class Menu : public Option 179 179 { 180 private: 181 GtkWidget* menu; 182 GtkWidget* item; 183 va_list itemlist; 184 180 185 public: 181 186 Menu (char* menuname, ...); 182 187 ~Menu (); 183 void init(void); /// HAS TO BE IMPLEMENTED!! most difficult :-) 184 188 void init(void); 189 190 void setTitle(char* title); 191 192 void addItem(char* itemName); 185 193 static gint OptionChange (GtkWidget* widget, Widget* menu); 186 194 void redraw();
Note: See TracChangeset
for help on using the changeset viewer.