Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 4071 in orxonox.OLD for orxonox/trunk/src/lib


Ignore:
Timestamp:
May 5, 2005, 11:30:32 PM (20 years ago)
Author:
bensch
Message:

orxonox/trunk/gui: new isOption-tag of Widgets: optionType

Location:
orxonox/trunk/src/lib/gui/gui
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • orxonox/trunk/src/lib/gui/gui/gui_exec.cc

    r4068 r4071  
    177177{
    178178  int counter = 0;
    179   while(counter < depth &&((widget->isOption>0
     179  while(counter < depth &&((widget->optionType > GUI_NOTHING
    180180                              &&(static_cast<Option*>(widget)->isSaveable()))
    181                              ||(widget->isOption<0
     181                             ||(widget->optionType < GUI_NOTHING
    182182                                && static_cast<Packer*>(widget)->getGroupName())))
    183183    {
     
    187187 
    188188  // check if it is a Packer, and if it is, check if it has a name and if there is something in it.
    189   if(widget->isOption <0)
     189  if(widget->optionType < GUI_NOTHING)
    190190    {
    191191      if(static_cast<Packer*>(widget)->getGroupName())
     
    200200        }
    201201    }
    202   //  if(widget->isOption == 0)
    203   //    printf("%s\n",widget->title);
    204   if(widget->isOption >= 1)
     202
     203  if(widget->optionType > GUI_NOTHING)
    205204    if (static_cast<Option*>(widget)->isSaveable())
    206205      {
     
    280279    {
    281280      PRINT(5)("Located Option %s.\n", widget->title);
    282       if(widget->isOption >= 1)
     281      if(widget->optionType > GUI_NOTHING)
    283282        static_cast<Option*>(widget)->load(info->variableValue);
    284283    }
     
    305304    }
    306305
    307   if(widget->isOption < 0)
     306  if(widget->optionType < GUI_NOTHING)
    308307    {
    309308      if(static_cast<Packer*>(widget)->getGroupName() &&
  • orxonox/trunk/src/lib/gui/gui/gui_flags.cc

    r4056 r4071  
    7676{
    7777  FlagInfo* info =(FlagInfo*)flagInfo;
    78   if(widget->isOption >= 1)
     78  if(widget->optionType > GUI_NOTHING)
    7979    if (static_cast<Option*>(widget)->value != static_cast<Option*>(widget)->defaultValue )
    8080      {
     
    9090          }
    9191
    92         if(static_cast<Option*>(widget)->isOption == 2)
     92        if(static_cast<Option*>(widget)->optionType > GUI_BOOL)
    9393          {
    9494            info->flagsLabel->appendText("=");
  • orxonox/trunk/src/lib/gui/gui/gui_gtk.cc

    r4069 r4071  
    222222    return this;
    223223
    224   if (this->isOption < 0 && static_cast<Packer*>(this)->down)
     224  if (this->optionType < GUI_NOTHING && static_cast<Packer*>(this)->down)
    225225    {
    226226      Widget* tmp = static_cast<Packer*>(this)->down->findWidgetByName(name, depth+1);
     
    243243{
    244244  function(this);
    245   if (this->isOption < 0)
     245  if (this->optionType < GUI_NOTHING)
    246246    {
    247247      static_cast<Packer*>(this)->down->walkThrough(function, depth+1);
     
    261261{
    262262  function(this, data);
    263   if (this->isOption < 0)
     263  if (this->optionType < GUI_NOTHING)
    264264    {
    265265      static_cast<Packer*>(this)->down->walkThrough(function, data, depth+1);
     
    275275void Widget::listOptionsAndGroups(Widget* widget)
    276276{
    277   if (widget->isOption < 0 && static_cast<Packer*>(widget)->groupName)
     277  if (widget->optionType < GUI_NOTHING && static_cast<Packer*>(widget)->groupName)
    278278    PRINT(0)("[%s]\n", static_cast<Packer*>(widget)->groupName);
    279   if (widget->isOption >= 1)
     279  if (widget->optionType > GUI_NOTHING)
    280280    {
    281281      Widget::listOptions(widget);
     
    289289void Widget::listOptions(Widget* widget)
    290290{
    291   if(widget->isOption >= 1)
     291  if(widget->optionType > GUI_NOTHING)
    292292    PRINT(0)("  %s is %s\n", static_cast<Option*>(widget)->title, static_cast<Option*>(widget)->save());
    293293}
     
    301301{
    302302 
    303   if (widget->isOption >= 1)
     303  if (widget->optionType > GUI_NOTHING)
    304304    {
    305305      int* count =(int*)data;
     
    320320Widget* Widget::findOptionByNumber(int* number, unsigned int depth)
    321321{
    322   if (isOption > 0)
     322  if (optionType > GUI_NOTHING)
    323323    {
    324324      --*number;
     
    328328        }
    329329    }
    330   if (this->isOption < 0 && static_cast<Packer*>(this)->down)
     330  if (this->optionType < GUI_NOTHING && static_cast<Packer*>(this)->down)
    331331    {
    332332      Widget* tmp = static_cast<Packer*>(this)->down->findOptionByNumber(number, depth+1);
     
    346346void Widget::listGroups(Widget* widget)
    347347{
    348   if (widget->isOption < 0 && static_cast<Packer*>(widget)->groupName)
     348  if (widget->optionType < GUI_NOTHING && static_cast<Packer*>(widget)->groupName)
    349349    PRINT(0)("[%s]\n", static_cast<Packer*>(widget)->groupName);
    350350}
     
    358358{
    359359  int* count = (int*)data;
    360   if (widget->isOption < 0 && static_cast<Packer*>(widget)->groupName)
     360  if (widget->optionType < GUI_NOTHING && static_cast<Packer*>(widget)->groupName)
    361361    PRINT(0)("%d: [%s]\n", ++*count, static_cast<Packer*>(widget)->groupName);
    362362}
     
    369369Widget* Widget::findGroupByNumber(int* number, unsigned int depth)
    370370{
    371   if (isOption < 0 && static_cast<Packer*>(this)->groupName)
     371  if (optionType < GUI_NOTHING && static_cast<Packer*>(this)->groupName)
    372372    {
    373373      --*number;
     
    377377        }
    378378    }
    379   if (this->isOption < 0 && static_cast<Packer*>(this)->down)
     379  if (this->optionType < GUI_NOTHING && static_cast<Packer*>(this)->down)
    380380    {
    381381      Widget* tmp = static_cast<Packer*>(this)->down->findGroupByNumber(number, depth+1);
     
    395395void Widget::setOptions(Widget* widget)
    396396{
    397   if (widget->isOption >= 1)
     397  if (widget->optionType > GUI_NOTHING)
    398398    static_cast<Option*>(widget)->redraw();
    399399}
     
    406406void Widget::redrawOptions(Widget* widget)
    407407{
    408   if (widget->isOption >= 1)
     408  if (widget->optionType > GUI_NOTHING)
    409409    static_cast<Option*>(widget)->redraw();
    410410}
     
    415415void Widget::flagCheck(Widget* widget, void* flagName)
    416416{
    417   if (widget->isOption>=1)
     417  if (widget->optionType > GUI_NOTHING)
    418418    {     
    419419      Option* option =(Option*)widget;
     
    567567Container::Container(void)
    568568{
    569   this->isOption = -1;
     569  this->optionType = GUI_CONTAINER;
    570570}
    571571
     
    814814EventBox::EventBox(const char* eventBoxName)
    815815{
    816   this->isOption = -1;
    817 
    818816#ifdef HAVE_GTK2
    819817  this->widget = gtk_event_box_new();
     
    842840Box::Box(char boxtype)
    843841{
    844   this->isOption = -2;
     842  this->optionType = GUI_BOX;
    845843
    846844#ifdef HAVE_GTK2
     
    10551053Button::Button(char* buttonName)
    10561054{
    1057   isOption = 0;
     1055  this->optionType = GUI_NOTHING;
    10581056
    10591057#ifdef HAVE_GTK2
     
    11151113CheckButton::CheckButton(const char* buttonName)
    11161114{
    1117   this->isOption = 1;
     1115  this->optionType = GUI_BOOL;
    11181116
    11191117#ifdef HAVE_GTK2
     
    12051203Slider::Slider(const char* slidername, int start, int end)
    12061204{
    1207   this->isOption = 2;
     1205  this->optionType = GUI_INT;
    12081206
    12091207  this->start = start;
     
    13291327void Menu::init(void)
    13301328{
    1331   this->isOption = 2;
     1329  this->optionType = GUI_INT;
    13321330  this->firstItem = NULL;
    13331331
     
    14431441OptionLabel::OptionLabel(const char* label, const char* value)
    14441442{
    1445   this->isOption = 5;
     1443  this->optionType = GUI_CHAR_ARRAY;
    14461444  cValue = NULL;
    14471445
     
    15331531Label:: Label(const char* text)
    15341532{
    1535   this->isOption = 0;
     1533  this->optionType = GUI_NOTHING;
    15361534 
    15371535#ifdef HAVE_GTK2
     
    16291627ProgressBar::ProgressBar(const char* label)
    16301628{
    1631   this->isOption = 0;
     1629  this->optionType = GUI_NOTHING;
    16321630  this->progress = 0.0;
    16331631  this->totalSize = 0.0;
     
    17281726void Image::init(const char* name)
    17291727{
    1730   isOption = 0;
     1728  optionType = GUI_NOTHING;
    17311729
    17321730  if (this->title)
     
    17461744FileDialog::FileDialog(const char* fileDialogName)
    17471745{
    1748   this->isOption = 0;
     1746  this->optionType = GUI_NOTHING;
    17491747  this->isOpen = false;
    17501748  this->changeOption = NULL;
  • orxonox/trunk/src/lib/gui/gui/gui_gtk.h

    r4068 r4071  
    3232
    3333// enumerator for different GuiOption-Types
    34 enum GUI_OPTION {GUI_CONTAINER = -2,
    35                  GUI_BOX = -1,
     34enum GUI_OPTION {GUI_BOX = -2,
     35                 GUI_CONTAINER = -1,
    3636                 GUI_NOTHING = 0,
    3737                 GUI_BOOL = 1,
     
    6464  void walkThrough(void(*function)(Widget*), unsigned int depth);
    6565  void walkThrough(void(*function)(Widget*, void*), void* data, unsigned int depth);
    66   static void listOptionsAndGroups(Widget* widget);
    67   static void listOptions(Widget* widget);
    68   static void listOptions(Widget* widget, void* data);
    69   Widget* findOptionByNumber(int* number, unsigned int depth);
    70   static void listGroups(Widget* widget);
    71   static void listGroups(Widget* widget, void* data);
    72   Widget* findGroupByNumber(int* number, unsigned int depth);
    73   static void setOptions(Widget* widget);
    74   static void redrawOptions(Widget* widget);
    75   static void flagCheck(Widget* widget, void* flagName);
     66   static void listOptionsAndGroups(Widget* widget);
     67   static void listOptions(Widget* widget);
     68   static void listOptions(Widget* widget, void* data);
     69   Widget* findOptionByNumber(int* number, unsigned int depth);
     70   static void listGroups(Widget* widget);
     71   static void listGroups(Widget* widget, void* data);
     72   Widget* findGroupByNumber(int* number, unsigned int depth);
     73   static void setOptions(Widget* widget);
     74   static void redrawOptions(Widget* widget);
     75   static void flagCheck(Widget* widget, void* flagName);
    7676 
    7777#ifdef HAVE_GTK2
     
    104104#endif /* HAVE_GTK2 */
    105105
    106   int isOption;                     //!< with this Paramenter one can set the option-type: -2:Container, -1: Box, 0: not an Option, 1: Bool-option, 2: int-option, 3: float option, 4:char option, 5: char* option
    107  
     106  GUI_OPTION optionType;            //!< The Type of the Widget.
    108107  char* title;                      //!< The name of the Widget. Some do display it, Options need it to save;
    109108};
     
    142141  Container(void);
    143142  virtual ~Container(void);
     143
    144144  void setBorderWidth(int borderwidth);
    145145  void fill(Widget* lowerWidget);
Note: See TracChangeset for help on using the changeset viewer.