Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Dec 29, 2004, 12:05:29 AM (19 years ago)
Author:
bensch
Message:

orxonox/branches/updater: Now in non-gtk-mode, the Gui will ask questions for what Option to change… it is kind of sexy, but you can not change the Option yet. but this will follow.
I am now going into holydays till 1.1.2005: I hope you all have a good 'rutsch' into the new year.
cheers bensch

PS: I do not believe that anyone reads this, but anyways it was fun writing it :)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • orxonox/branches/updater/src/gui/orxonox_gui_gtk.cc

    r3304 r3305  
    3737extern OrxonoxGuiFlags* flags;
    3838
    39 #ifdef HAVE_GTK2
    4039/**
    4140   \brief Initializes the Guis GTK-stuff.
     
    4342   \param argv The Argument strings.
    4443*/
    45 bool initGTK(int argc, char *argv[])
    46 {
     44bool initGUI(int argc, char *argv[])
     45{
     46#ifdef HAVE_GTK2
    4747#ifdef HAVE_GTHREAD
    4848  PRINTF(3)("Initializing the ThreadSystem of the GUI\n");
     
    5252  gtk_init (&argc, &argv);
    5353  gtk_rc_parse( "rc" );
    54 }
     54#endif /* HAVE_GTK2 */
     55}
     56
    5557
    5658/**
    5759   \brief enters the GTK-main-loop
    5860*/
    59 bool mainloopGTK(void)
    60 {
     61bool mainloopGUI(void)
     62{
     63#ifdef HAVE_GTK2
    6164  gdk_threads_enter();
    6265  gtk_main();
    6366  gdk_threads_leave();
    6467  delete Window::mainWindow;
    65 }
    66 #endif /* HAVE_GTK2 */
     68#endif /* HAVE_GTK2 */
     69}
    6770
    6871
     
    154157Widget* Widget::findWidgetByName(char* name, unsigned int depth)
    155158{
    156   Widget* tmp = NULL;
    157159
    158160  if (this->title && !strcmp(this->title, name))
     
    160162
    161163  if (this->isOption < 0 && static_cast<Packer*>(this)->down)
    162     tmp = static_cast<Packer*>(this)->down->findWidgetByName(name, depth+1);
    163   if (tmp)
    164     return tmp;
    165 
     164    {
     165      Widget* tmp = static_cast<Packer*>(this)->down->findWidgetByName(name, depth+1);
     166      if (tmp)
     167        return tmp;
     168    }
    166169 
    167170  if (depth>0 && this->next)
     
    206209
    207210/**
    208     \brief This is for listing the option of "widget"
     211    \brief This is for listing the options of "widget"
    209212    \param widget specifies the widget that should be listed
    210213*/
    211 void Widget::listOptions (Widget* widget)
     214void Widget::listOptionsAndGroups (Widget* widget)
    212215{
    213216  if (widget->isOption < 0 && static_cast<Packer*>(widget)->groupName)
     
    219222}
    220223
     224/**
     225    \brief This is for listing the options of "widget"
     226    \param widget specifies the widget that should be listed
     227*/
     228void Widget::listOptions (Widget* widget)
     229{
     230  if (widget->isOption >= 1 && widget->isOption <= 3)
     231    cout << "  " << static_cast<Option*>(widget)->title <<" is : " << static_cast<Option*>(widget)->value <<endl;
     232  else if (widget->isOption == 5)
     233    cout << "  " << static_cast<Option*>(widget)->title <<" is : " << static_cast<OptionLabel*>(widget)->cValue <<endl;
     234}
     235
     236/**
     237    \brief This is for listing the options of "widget"
     238    \param widget specifies the widget that should be listed
     239    \param data A Counter, that always knows how many Options have been found yet.
     240*/
     241void Widget::listOptions (Widget* widget, void* data)
     242{
     243 
     244  if (widget->isOption >= 1 && widget->isOption <= 3)
     245    {
     246      int* count = (int*)data;
     247      *count = *count +1;
     248      cout << *count << ": " << static_cast<Option*>(widget)->title <<" is : " << static_cast<Option*>(widget)->value <<endl;
     249    }
     250  else if (widget->isOption == 5)
     251    {
     252      int* count = (int*)data;
     253      *count = *count +1;
     254      cout << *count << ": " << static_cast<Option*>(widget)->title <<" is : " << static_cast<OptionLabel*>(widget)->cValue <<endl;
     255    }
     256}
     257
     258/**
     259    \brief Finds an Option by a given number (the n'th option found away from this Widget)
     260    \param number The Count of options to wait (by reference)
     261    \param depth The depth of the sarch. if 0 it will not search next pointer
     262   
     263    \todo should return Option* would be much sexier.
     264*/
     265Widget* Widget::findOptionByNumber(int* number, unsigned int depth)
     266{
     267  if (isOption > 0)
     268    {
     269      --*number;
     270      if (*number <= 0)
     271        {
     272          return this;
     273        }
     274    }
     275  if (this->isOption < 0 && static_cast<Packer*>(this)->down)
     276    {
     277      Widget* tmp = static_cast<Packer*>(this)->down->findOptionByNumber(number, depth+1);
     278      if (tmp)
     279        return tmp;
     280    }
     281  if (depth>0 && this->next)
     282    return this->next->findOptionByNumber(number, depth);
     283
     284  return NULL;
     285}
     286
     287/**
     288    \brief This is for listing the groups of "widget"
     289    \param widget specifies the widget that should be listed
     290*/
     291void Widget::listGroups(Widget* widget)
     292{
     293  if(widget->isOption < 0 && static_cast<Packer*>(widget)->groupName)
     294    cout << "[" << static_cast<Packer*>(widget)->groupName << "]\n";
     295}
     296
     297/**
     298    \brief This is for listing the Groups of "widget". It also displays the n'th number found.
     299    \param widget specifies the widget that should be listed
     300    \param data the Counter, that will show the number (this function will raise it by one if a Group is fount.
     301*/
     302void Widget::listGroups(Widget* widget, void* data)
     303{
     304  if(widget->isOption < 0 && static_cast<Packer*>(widget)->groupName)
     305    {
     306      int* count = (int*)data;
     307      *count = *count +1;
     308      cout << *count <<": [" << static_cast<Packer*>(widget)->groupName << "]\n";
     309    }
     310}
     311
     312/**
     313    \brief Finds a Group by a given number (the n'th Group found away from this Widget)
     314    \param number The Count of options to wait (by reference)
     315    \param depth The depth of the sarch. if 0 it will not search next pointer
     316*/
     317Widget* Widget::findGroupByNumber(int* number, unsigned int depth)
     318{
     319  if (isOption < 0 && static_cast<Packer*>(this)->groupName)
     320    {
     321      --*number;
     322      if (*number <= 0)
     323        {
     324          return this;
     325        }
     326    }
     327  if (this->isOption < 0 && static_cast<Packer*>(this)->down)
     328    {
     329      Widget* tmp = static_cast<Packer*>(this)->down->findGroupByNumber(number, depth+1);
     330      if (tmp)
     331        return tmp;
     332    }
     333  if (depth>0 && this->next)
     334    return this->next->findGroupByNumber(number, depth);
     335
     336  return NULL;
     337}
     338 
    221339/**
    222340    \brief This is for setting the option of "widget"
Note: See TracChangeset for help on using the changeset viewer.