Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: orxonox.OLD/orxonox/trunk/gui/orxonox_gui_flags.cc @ 2581

Last change on this file since 2581 was 2581, checked in by bensch, 20 years ago

orxonox/trunk/gui: gui now ready for including Orxonox-Crew-Logo

File size: 2.4 KB
Line 
1/*
2   orxonox - the future of 3D-vertical-scrollers
3
4   Copyright (C) 2004 orx
5
6   This program is free software; you can redistribute it and/or modify
7   it under the terms of the GNU General Public License as published by
8   the Free Software Foundation; either version 2, or (at your option)
9   any later version.
10
11   This program is distributed in the hope that it will be useful,
12   but WITHOUT ANY WARRANTY; without even the implied warranty of
13   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14   GNU General Public License for more details.
15
16   You should have received a copy of the GNU General Public License
17   along with this program; if not, write to the Free Software Foundation,
18   Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 
19
20
21   ### File Specific:
22   main-programmer: Benjamin Grauer
23
24*/
25
26#include "orxonox_gui_flags.h"
27#include <iostream.h>
28
29
30OrxonoxGuiFlags::OrxonoxGuiFlags (Widget* widget)
31{
32  flagText = (char*) malloc (1024);
33
34  flagsFrame = new Frame ("Orxonox-Startup-Flags:");
35  flagsBox = new Box ('v');
36
37  flagsLabel = new Label ();
38  flagsBox->fill (flagsLabel);
39  shortFlags = new CheckButton ("shortFlags");
40  flagsBox->fill (shortFlags);
41
42  flagsFrame->fill (flagsBox);
43}
44
45Frame* OrxonoxGuiFlags::getFrame ()
46{
47  return flagsFrame;
48}
49
50void OrxonoxGuiFlags::setTextFromFlags (Widget* widget)
51{
52  sprintf (flagText, "");
53  strcat (flagText, "orxonox");
54  FlagsText (widget);
55  flagsLabel->setText (flagText);
56}
57
58void OrxonoxGuiFlags::FlagsText(Widget* widget)
59{
60  if (widget->is_option >= 1)
61    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, "")))
62      {
63        if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(shortFlags->widget)))
64          {
65            strcat (flagText, " -");
66            strcat (flagText, static_cast<Option*>(widget)->flag_name_short);
67          }
68        else
69          {
70            strcat (flagText, " --");
71            strcat (flagText, static_cast<Option*>(widget)->flag_name);
72          }
73        if (static_cast<Option*>(widget)->is_option == 2)
74          {
75            sprintf (flagText, "%s=%i", flagText, static_cast<Option*>(widget)->value);
76          }
77      }
78  switch (widget->is_option)
79    {
80    case -1:
81      FlagsText (static_cast<Container*>(widget)->down);
82      break;
83    case -2:
84      FlagsText (static_cast<Box*>(widget)->down);
85      break;
86    } 
87 
88  if (widget->next != NULL)
89    FlagsText (widget->next);
90}
91
92
Note: See TracBrowser for help on using the repository browser.