Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: orxonox.OLD/orxonox/branches/gui/guicc/orxonox_gui_flags.cc @ 2008

Last change on this file since 2008 was 2000, checked in by bensch, 21 years ago

orxonox/branches/gui/guicc: added forgotten files.

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  bzero (flagText, 1);
28
29  strcat (flagText, "orxonox");
30  FlagsText (widget);
31  flagsLabel->setText (flagText);
32}
33
34void OrxonoxGuiFlags::FlagsText(Widget* widget)
35{
36  if (widget->is_option >= 1)
37    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, "")))
38      {
39        if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(shortFlags->widget)))
40          {
41            strcat (flagText, " -");
42            strcat (flagText, static_cast<Option*>(widget)->flag_name_short);
43          }
44        else
45          {
46            strcat (flagText, " --");
47            strcat (flagText, static_cast<Option*>(widget)->flag_name);
48          }
49        if (static_cast<Option*>(widget)->is_option == 2)
50          {
51            sprintf (flagText, "%s=%i", flagText, static_cast<Option*>(widget)->value);
52          }
53      }
54  switch (widget->is_option)
55    {
56    case -1:
57      FlagsText (static_cast<Container*>(widget)->down);
58      break;
59    case -2:
60      FlagsText (static_cast<Box*>(widget)->down);
61      break;
62    } 
63 
64  if (widget->next != NULL)
65    FlagsText (widget->next);
66}
67
68
Note: See TracBrowser for help on using the repository browser.