Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 2584 in orxonox.OLD for orxonox/trunk/gui


Ignore:
Timestamp:
Oct 16, 2004, 1:30:26 PM (20 years ago)
Author:
bensch
Message:

orxonox/trunk/gui: walkThrough-function implemented, that walks down through all the widgets, and executes static functions (so far: listOptions, setOptions) on them

Location:
orxonox/trunk/gui
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • orxonox/trunk/gui/orxonox_gui.cc

    r2583 r2584  
    9090  exec->setFilename ("~/.orxonox.conf");
    9191  exec->readFromFile (orxonoxGUI);
    92   orxonoxGUI->listOptions();
     92  orxonoxGUI->walkThrough(orxonoxGUI->listOptions);
    9393
    9494  orxonoxGUI->showall ();
     
    131131}
    132132
    133 void Widget::listOptions ()
    134 {
    135   /**
    136    * This is For listing all the Options witch are located beneath this Widget.
    137    */
    138   if (this->is_option >= 1)
    139     cout << static_cast<Option*>(this)->option_name <<" is : " << static_cast<Option*>(this)->value <<endl;
    140 
     133void Widget::walkThrough (void (*function)(Widget*))
     134{
     135  function(this);
    141136  switch (this->is_option)
    142137    {
    143138    case -1:
    144       static_cast<Container*>(this)->down->listOptions ();
     139      static_cast<Container*>(this)->down->walkThrough (function);
    145140      break;
    146141    case -2:
    147       static_cast<Box*>(this)->down->listOptions ();
     142      static_cast<Box*>(this)->down->walkThrough (function);
    148143      break;
    149144    }
    150145
    151146  if (this->next != NULL)
    152     this->next->listOptions ();
    153 }
    154 
    155 void Widget::setOptions ()
     147    this->next->walkThrough(function);
     148}
     149
     150
     151void Widget::listOptions (Widget* widget)
    156152{
    157153  /**
    158154   * This is For listing all the Options witch are located beneath this Widget.
    159155   */
    160   if (this->is_option >= 1)
    161     static_cast<Option*>(this)->redraw();// <<" is : " << static_cast<Option*>(this)->value <<endl;
    162 
    163   switch (this->is_option)
    164     {
    165     case -1:
    166       static_cast<Container*>(this)->down->setOptions ();
    167       break;
    168     case -2:
    169       static_cast<Box*>(this)->down->setOptions ();
    170       break;
    171     }
    172 
    173   if (this->next != NULL)
    174     this->next->setOptions ();
     156  if (widget->is_option >= 1)
     157    cout << static_cast<Option*>(widget)->option_name <<" is : " << static_cast<Option*>(widget)->value <<endl;
     158}
     159
     160void Widget::setOptions (Widget* widget)
     161{
     162  /**
     163   * This is For listing all the Options witch are located beneath this Widget.
     164   */
     165  if (widget->is_option >= 1)
     166    static_cast<Option*>(widget)->redraw();// <<" is : " << static_cast<Option*>(this)->value <<endl;
    175167}
    176168
  • orxonox/trunk/gui/orxonox_gui.h

    r2581 r2584  
    4040  void connectSignal (char* event, void* extObj, gint (*signal)(GtkWidget*, GdkEvent*, void *));
    4141  void show ();
    42   void listOptions ();
    43   void setOptions ();
     42
     43  void walkThrough (void (*function)(Widget*));
     44  static void listOptions (Widget* widget);
     45  static void setOptions (Widget* widget);
    4446
    4547};
  • orxonox/trunk/gui/orxonox_gui_exec.cc

    r2581 r2584  
    146146          sprintf (Variable, "%s", Buffer);
    147147        }
    148       widget->setOptions();
     148      widget->walkThrough(widget->setOptions);
    149149    }
    150150}
Note: See TracChangeset for help on using the changeset viewer.