Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: orxonox.OLD/orxonox/branches/old.chris/gui/orxonox_gui_flags.cc @ 3244

Last change on this file since 3244 was 2058, checked in by chris, 20 years ago

orxonox/branches/chris: Trunk remerged into my branch started on SDL reconfiguration

File size: 1.6 KB
Line 
1#include "orxonox_gui_flags.h"
2#include <iostream.h>
3
4
5OrxonoxGuiFlags::OrxonoxGuiFlags (Widget* widget)
6{
7  flagText = (char*) malloc (1024);
8
9  flagsFrame = new Frame ("Orxonox-Startup-Flags:");
10  flagsBox = new Box ('v');
11
12  flagsLabel = new Label ();
13  flagsBox->fill (flagsLabel);
14  shortFlags = new CheckButton ("shortFlags");
15  flagsBox->fill (shortFlags);
16
17  flagsFrame->fill (flagsBox);
18}
19
20Frame* OrxonoxGuiFlags::getFrame ()
21{
22  return flagsFrame;
23}
24
25void OrxonoxGuiFlags::setTextFromFlags (Widget* widget)
26{
27  sprintf (flagText, "");
28  strcat (flagText, "orxonox");
29  FlagsText (widget);
30  flagsLabel->setText (flagText);
31}
32
33void OrxonoxGuiFlags::FlagsText(Widget* widget)
34{
35  if (widget->is_option >= 1)
36    if  (static_cast<Option*>(widget)->value != static_cast<Option*>(widget)->default_value && (strcmp (static_cast<Option*>(widget)->flag_name, "") || strcmp (static_cast<Option*>(widget)->flag_name_short, "")))
37      {
38        if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(shortFlags->widget)))
39          {
40            strcat (flagText, " -");
41            strcat (flagText, static_cast<Option*>(widget)->flag_name_short);
42          }
43        else
44          {
45            strcat (flagText, " --");
46            strcat (flagText, static_cast<Option*>(widget)->flag_name);
47          }
48        if (static_cast<Option*>(widget)->is_option == 2)
49          {
50            sprintf (flagText, "%s=%i", flagText, static_cast<Option*>(widget)->value);
51          }
52      }
53  switch (widget->is_option)
54    {
55    case -1:
56      FlagsText (static_cast<Container*>(widget)->down);
57      break;
58    case -2:
59      FlagsText (static_cast<Box*>(widget)->down);
60      break;
61    } 
62 
63  if (widget->next != NULL)
64    FlagsText (widget->next);
65}
66
67
Note: See TracBrowser for help on using the repository browser.