Changeset 3299 in orxonox.OLD for orxonox/branches/updater/src/gui
- Timestamp:
- Dec 27, 2004, 2:02:11 PM (20 years ago)
- Location:
- orxonox/branches/updater/src/gui
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
orxonox/branches/updater/src/gui/orxonox_gui.h
r3187 r3299 28 28 ~OrxonoxGui (); 29 29 30 void copyOptionsToGameStruct(); 30 31 }; 31 32 32 33 33 34 34 #endif /* _ORXONOX_GUI_H */ -
orxonox/branches/updater/src/gui/orxonox_gui_flags.cc
r3287 r3299 32 32 OrxonoxGuiFlags::OrxonoxGuiFlags (Widget* widget) 33 33 { 34 flagText = (char*) malloc (1024); 34 this->flagsFrame = new Frame ("Orxonox-Startup-Flags:"); 35 this->flagsBox = new Box ('v'); 35 36 36 flagsFrame = new Frame ("Orxonox-Startup-Flags:"); 37 flagsBox = new Box ('v'); 37 this->flagsLabel = new Label (); 38 this->flagsLabel->setSize (260,60); 39 this->flagsBox->fill (flagsLabel); 40 this->shortFlags = new CheckButton ("shortFlags"); 41 this->flagsBox->fill (shortFlags); 38 42 39 flagsLabel = new Label (); 40 flagsLabel->setSize (260,60); 41 flagsBox->fill (flagsLabel); 42 shortFlags = new CheckButton ("shortFlags"); 43 flagsBox->fill (shortFlags); 44 45 flagsFrame->fill (flagsBox); 43 this->flagsFrame->fill (flagsBox); 46 44 } 47 45 … … 52 50 Widget* OrxonoxGuiFlags::getWidget () 53 51 { 54 return flagsFrame;52 return this->flagsFrame; 55 53 } 56 54 … … 61 59 void OrxonoxGuiFlags::setTextFromFlags (Widget* widget) 62 60 { 63 sprintf (flagText, ""); 64 strcat (flagText, "orxonox"); 65 FlagsText (widget); 66 flagsLabel->setTitle(flagText); 61 FlagInfo flagInfo; 62 flagInfo.shortFlags = this->shortFlags; 63 flagInfo.flagsLabel = this->flagsLabel; 64 65 this->flagsLabel->ereaseText(); 66 this->flagsLabel->appendText("orxonox"); 67 widget->walkThrough(OrxonoxGuiFlags::flagsText, &flagInfo, 0); 68 // flagsLabel->setTitle(flagText); 67 69 } 68 70 … … 71 73 \param widget like OrxonoxGuiFlags::setTextFromFlags(widget) 72 74 */ 73 void OrxonoxGuiFlags:: FlagsText(Widget* widget)75 void OrxonoxGuiFlags::flagsText(Widget* widget, void* flagInfo) 74 76 { 77 FlagInfo* info = (FlagInfo*)flagInfo; 75 78 if (widget->isOption >= 1) 76 if (static_cast<Option*>(widget)->value != static_cast<Option*>(widget)->defaultValue && (static_cast<Option*>(widget)->flagName || static_cast<Option*>(widget)->flagNameShort ))79 if (static_cast<Option*>(widget)->value != static_cast<Option*>(widget)->defaultValue ) 77 80 { 78 if ( shortFlags->isActive())81 if (info->shortFlags->isActive() && static_cast<Option*>(widget)->flagNameShort) 79 82 { 80 strcat (flagText," -");81 strcat (flagText,static_cast<Option*>(widget)->flagNameShort);83 info->flagsLabel->appendText(" -"); 84 info->flagsLabel->appendText(static_cast<Option*>(widget)->flagNameShort); 82 85 } 83 else 86 else if (!info->shortFlags->isActive() && static_cast<Option*>(widget)->flagName) 84 87 { 85 strcat (flagText," --");86 strcat (flagText,static_cast<Option*>(widget)->flagName);88 info->flagsLabel->appendText(" --"); 89 info->flagsLabel->appendText(static_cast<Option*>(widget)->flagName); 87 90 } 91 88 92 if (static_cast<Option*>(widget)->isOption == 2) 89 93 { 90 sprintf (flagText, "%s=%i", flagText, static_cast<Option*>(widget)->value); 94 info->flagsLabel->appendText("="); 95 info->flagsLabel->appendInt(static_cast<Option*>(widget)->value); 91 96 } 92 97 } 93 switch (widget->isOption)94 {95 case -1:96 FlagsText (static_cast<Container*>(widget)->down);97 break;98 case -2:99 FlagsText (static_cast<Box*>(widget)->down);100 break;101 }102 103 if (widget->next != NULL)104 FlagsText (widget->next);105 98 } -
orxonox/branches/updater/src/gui/orxonox_gui_flags.h
r3187 r3299 17 17 CheckButton* shortFlags; //!< CheckButton to change the display of short and long flags \todo show long if long not availible... 18 18 Label* flagsLabel; //!< The Label of the Flags 19 char* flagText; //!< The Text of the Label. \todo Delete when Object is destroyed.20 19 21 20 public: … … 24 23 25 24 void setTextFromFlags (Widget* widget); 26 void OrxonoxGuiFlags::FlagsText(Widget* widget);25 static void flagsText(Widget* widget, void* flagInfo); 27 26 27 struct FlagInfo 28 { 29 CheckButton* shortFlags; 30 Label* flagsLabel; 31 }; 28 32 Widget* getWidget (); 29 33 }; -
orxonox/branches/updater/src/gui/orxonox_gui_gtk.cc
r3298 r3299 1513 1513 1514 1514 /** 1515 \brief ereases the Text of a Label 1516 */ 1517 void Label::ereaseText(void) 1518 { 1519 this->setTitle(""); 1520 } 1521 1522 /** 1523 \brief appends some Text to a Label 1524 \param textToAppend The text that will be appended to this Label 1525 */ 1526 void Label::appendText(char* textToAppend) 1527 { 1528 if (this->title) 1529 { 1530 char* tmpTitle = new char[strlen(this->title)+strlen(textToAppend)+1]; 1531 strcpy(tmpTitle, title); 1532 strcat(tmpTitle, textToAppend); 1533 delete []this->title; 1534 this->title = tmpTitle; 1535 } 1536 else 1537 { 1538 this->title = new char[strlen(textToAppend)]; 1539 } 1540 1541 #ifdef HAVE_GTK2 1542 gtk_label_set_text (GTK_LABEL (this->widget), title); 1543 #endif /* HAVE_GTK2 */ 1544 } 1545 1546 /** 1547 \brief Appends some integer to the Label 1548 \param intToAppend The Int that will be added. 1549 1550 it does this by just converting the int into a char* and send it to appendText 1551 */ 1552 void Label::appendInt(int intToAppend) 1553 { 1554 char append [20]; 1555 sprintf(append, "%d", intToAppend); 1556 this->appendText(append); 1557 } 1558 1559 1560 /** 1515 1561 \brief get the Text of a Label 1516 1562 \return The Text the Label holds. -
orxonox/branches/updater/src/gui/orxonox_gui_gtk.h
r3296 r3299 316 316 }; 317 317 318 //! A CharLabel is a simple Label, that holds a char*, and will be updated, if changed.318 //! A OptionLabel is a simple Label, that holds a char*, and will be updated, if changed. 319 319 class OptionLabel : public Option 320 320 { … … 347 347 348 348 void setTitle(char* text); 349 void ereaseText(void); 350 void appendText(char* textToAppend); 351 void appendInt(int intToAppend); 349 352 char* getText (); 350 353 }; -
orxonox/branches/updater/src/gui/rc
r2595 r3299 120 120 # just listed in this document for the users reference. 121 121 122 widget_class "GtkWindow" style "window"123 widget_class "GtkFrame" style "window"124 widget_class "Gtk*EventBox" style "window"125 widget_class "GtkDialog" style "window"126 widget_class "GtkFileSelection" style "window"127 widget_class "*Gtk*Scale" style "scale"128 widget_class "*GtkCheckButton*" style "toggle_button"129 widget_class "*Gtk*Menu*" style "toggle_button"130 widget_class "*GtkRadioButton*" style "toggle_button"131 widget_class "*GtkButton*" style "button"132 widget_class "*Ruler" style "ruler"133 widget_class "*GtkText" style "text"134 widget_class "*GtkLabel" style "text"122 widget_class "GtkWindow" style "window" 123 widget_class "GtkFrame" style "window" 124 widget_class "Gtk*EventBox" style "window" 125 widget_class "GtkDialog" style "window" 126 widget_class "GtkFileSelection" style "window" 127 widget_class "*Gtk*Scale" style "scale" 128 widget_class "*GtkCheckButton*" style "toggle_button" 129 widget_class "*Gtk*Menu*" style "toggle_button" 130 widget_class "*GtkRadioButton*" style "toggle_button" 131 widget_class "*GtkButton*" style "button" 132 widget_class "*Ruler" style "ruler" 133 widget_class "*GtkText" style "text" 134 widget_class "*GtkLabel" style "text" 135 135 136 136
Note: See TracChangeset
for help on using the changeset viewer.