Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: orxonox.OLD/trunk/src/lib/gui/gtk/gui_flags.cc @ 8327

Last change on this file since 8327 was 8145, checked in by bensch, 19 years ago

trunk: merged the gui back
merged with command:
svn merge -r8114:HEAD https://svn.orxonox.net/orxonox/branches/gui .
→ no conflicts

File size: 2.9 KB
RevLine 
[2581]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
[4047]26#include "gui_flags.h"
[2018]27
[2588]28/**
[4836]29 *  Creates the Flags-Frame
[2588]30*/
[4746]31GuiFlags::GuiFlags()
[2018]32{
[3423]33  this->flagsFrame = new Frame("Orxonox-Startup-Flags:");
34  this->flagsBox = new Box('v');
[2018]35
[3423]36  this->flagsLabel = new Label();
37  this->flagsLabel->setSize(260,60);
38  this->flagsBox->fill(flagsLabel);
39  this->shortFlags = new CheckButton("shortFlags");
[4132]40  this->shortFlags->setDefaultValue(0);
[3423]41  this->flagsBox->fill(shortFlags);
[2018]42
[3423]43  this->flagsFrame->fill(flagsBox);
[4024]44  this->setMainWidget(flagsFrame);
[3423]45}
[2018]46
[3423]47/**
[4836]48 *  Destructs the Flags-stuff
[3423]49*/
[4746]50GuiFlags::~GuiFlags()
[3423]51{
52  // nothing to do here
[2018]53}
54
[2588]55/**
[4836]56 *  Sets the Flags from widget downwards.
57 * @param widget the Widget from which on to scan for deeper Options and their settings.
[2588]58*/
[4056]59void GuiFlags::setTextFromFlags(Widget* widget)
[2018]60{
[3423]61  FlagInfo flagInfo;
62  flagInfo.shortFlags = this->shortFlags;
63  flagInfo.flagsLabel = this->flagsLabel;
64
65  this->flagsLabel->ereaseText();
[4052]66  this->flagsLabel->appendText(executable);
[4056]67  widget->walkThrough(GuiFlags::flagsText, &flagInfo, 0);
[3423]68  //  flagsLabel->setTitle(flagText);
[2018]69}
70
[2588]71/**
[4836]72  *  this actually sets the flagtext, and appends it to flagText
73  * @param widget like GuiFlags::setTextFromFlags(widget)
74  * @param flagInfo Information aboout the Flag that should be updated.
[2588]75*/
[4056]76void GuiFlags::flagsText(Widget* widget, void* flagInfo)
[2018]77{
[3423]78  FlagInfo* info =(FlagInfo*)flagInfo;
[4071]79  if(widget->optionType > GUI_NOTHING)
[3423]80    if (static_cast<Option*>(widget)->value != static_cast<Option*>(widget)->defaultValue )
[2018]81      {
[3423]82        if(info->shortFlags->isActive() && static_cast<Option*>(widget)->flagNameShort)
[2018]83          {
[3423]84            info->flagsLabel->appendText(" -");
85            info->flagsLabel->appendText(static_cast<Option*>(widget)->flagNameShort);
[2018]86          }
[3423]87        else if(!info->shortFlags->isActive() && static_cast<Option*>(widget)->flagName)
[2018]88          {
[3423]89            info->flagsLabel->appendText(" --");
90            info->flagsLabel->appendText(static_cast<Option*>(widget)->flagName);
[2018]91          }
[3423]92
[4071]93        if(static_cast<Option*>(widget)->optionType > GUI_BOOL)
[2018]94          {
[3423]95            info->flagsLabel->appendText("=");
96            info->flagsLabel->appendInt(static_cast<Option*>(widget)->value);
[2018]97          }
98      }
99}
Note: See TracBrowser for help on using the repository browser.