Changeset 3423 in orxonox.OLD for orxonox/trunk/src/gui/orxonox_gui_flags.cc
- Timestamp:
- Feb 27, 2005, 7:11:19 PM (19 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
orxonox/trunk/src/gui/orxonox_gui_flags.cc
r3158 r3423 28 28 /** 29 29 \brief Creates the Flags-Frame 30 \param widget The Widget from which the data will be parsed31 30 */ 32 OrxonoxGuiFlags::OrxonoxGuiFlags (Widget* widget)31 OrxonoxGuiFlags::OrxonoxGuiFlags(void) 33 32 { 34 flagText = (char*) malloc (1024); 33 this->flagsFrame = new Frame("Orxonox-Startup-Flags:"); 34 this->flagsBox = new Box('v'); 35 35 36 flagsFrame = new Frame ("Orxonox-Startup-Flags:"); 37 flagsBox = new Box ('v'); 36 this->flagsLabel = new Label(); 37 this->flagsLabel->setSize(260,60); 38 this->flagsBox->fill(flagsLabel); 39 this->shortFlags = new CheckButton("shortFlags"); 40 this->flagsBox->fill(shortFlags); 38 41 39 flagsLabel = new Label (); 40 flagsLabel->setSize (260,60); 41 flagsBox->fill (flagsLabel); 42 shortFlags = new CheckButton ("shortFlags"); 43 flagsBox->fill (shortFlags); 42 this->flagsFrame->fill(flagsBox); 43 } 44 44 45 flagsFrame->fill (flagsBox); 45 /** 46 \brief Destructs the Flags-stuff 47 */ 48 OrxonoxGuiFlags::~OrxonoxGuiFlags(void) 49 { 50 // nothing to do here 46 51 } 47 52 … … 50 55 \returns Frame that holds the Flagtext. 51 56 */ 52 Widget* OrxonoxGuiFlags::getWidget ()57 Widget* OrxonoxGuiFlags::getWidget(void) 53 58 { 54 return flagsFrame;59 return this->flagsFrame; 55 60 } 56 61 … … 59 64 \param widget the Widget from which on to scan for deeper Options and their settings. 60 65 */ 61 void OrxonoxGuiFlags::setTextFromFlags 66 void OrxonoxGuiFlags::setTextFromFlags(Widget* widget) 62 67 { 63 sprintf (flagText, ""); 64 strcat (flagText, "orxonox"); 65 FlagsText (widget); 66 flagsLabel->setText (flagText); 68 FlagInfo flagInfo; 69 flagInfo.shortFlags = this->shortFlags; 70 flagInfo.flagsLabel = this->flagsLabel; 71 72 this->flagsLabel->ereaseText(); 73 this->flagsLabel->appendText("orxonox"); 74 widget->walkThrough(OrxonoxGuiFlags::flagsText, &flagInfo, 0); 75 // flagsLabel->setTitle(flagText); 67 76 } 68 77 … … 70 79 \brief this actually sets the flagtext, and appends it to flagText 71 80 \param widget like OrxonoxGuiFlags::setTextFromFlags(widget) 81 \param flagInfo Information aboout the Flag that should be updated. 72 82 */ 73 void OrxonoxGuiFlags:: FlagsText(Widget* widget)83 void OrxonoxGuiFlags::flagsText(Widget* widget, void* flagInfo) 74 84 { 75 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 )) 85 FlagInfo* info =(FlagInfo*)flagInfo; 86 if(widget->isOption >= 1) 87 if (static_cast<Option*>(widget)->value != static_cast<Option*>(widget)->defaultValue ) 77 88 { 78 if (shortFlags->isActive())89 if(info->shortFlags->isActive() && static_cast<Option*>(widget)->flagNameShort) 79 90 { 80 strcat (flagText," -");81 strcat (flagText,static_cast<Option*>(widget)->flagNameShort);91 info->flagsLabel->appendText(" -"); 92 info->flagsLabel->appendText(static_cast<Option*>(widget)->flagNameShort); 82 93 } 83 else 94 else if(!info->shortFlags->isActive() && static_cast<Option*>(widget)->flagName) 84 95 { 85 strcat (flagText," --");86 strcat (flagText,static_cast<Option*>(widget)->flagName);96 info->flagsLabel->appendText(" --"); 97 info->flagsLabel->appendText(static_cast<Option*>(widget)->flagName); 87 98 } 88 if (static_cast<Option*>(widget)->isOption == 2) 99 100 if(static_cast<Option*>(widget)->isOption == 2) 89 101 { 90 sprintf (flagText, "%s=%i", flagText, static_cast<Option*>(widget)->value); 102 info->flagsLabel->appendText("="); 103 info->flagsLabel->appendInt(static_cast<Option*>(widget)->value); 91 104 } 92 105 } 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 106 }
Note: See TracChangeset
for help on using the changeset viewer.