Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 5393 in orxonox.OLD for trunk/src/lib/gui/gl_gui/glgui_box.cc


Ignore:
Timestamp:
Oct 16, 2005, 2:28:55 PM (19 years ago)
Author:
bensch
Message:

orxonox/trunk: container-packing

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/lib/gui/gl_gui/glgui_box.cc

    r5391 r5393  
    1818#include "glgui_box.h"
    1919
     20#include "list.h"
     21
    2022using namespace std;
    2123
     
    3638GLGuiBox::~GLGuiBox()
    3739{
    38 
     40  delete this->children;
    3941}
    4042
     
    4547{
    4648  this->setClassID(CL_GLGUI_BOX, "GLGuiBox");
     49  this->children = new tList<GLGuiWidget>;
     50}
     51
     52void GLGuiBox::pack(GLGuiWidget* widget)
     53{
     54  if (widget == NULL)
     55    return;
     56
     57  this->children->add(widget);
     58}
     59
     60
     61void GLGuiBox::unpack(GLGuiWidget* widget)
     62{
     63  if (widget == NULL)
     64  {
     65    delete this->children;
     66    this->children = new tList<GLGuiWidget>;
     67  }
     68  else
     69  {
     70    this->children->remove(widget);
     71  }
     72}
     73
     74void GLGuiBox::showAll()
     75{
     76  tIterator<GLGuiWidget>* itC = this->children->getIterator();
     77  GLGuiWidget* enumC = itC->firstElement();
     78  while (enumC != NULL)
     79  {
     80    if (enumC->isA(CL_GLGUI_CONTAINER))
     81      static_cast<GLGuiContainer*>(enumC)->showAll();
     82    else
     83      enumC->show();
     84    enumC = itC->nextElement();
     85  }
     86  delete itC;
     87
     88  this->show();
    4789
    4890}
     91
     92void GLGuiBox::hideAll()
     93{
     94  tIterator<GLGuiWidget>* itC = this->children->getIterator();
     95  GLGuiWidget* enumC = itC->firstElement();
     96  while (enumC != NULL)
     97  {
     98    if (enumC->isA(CL_GLGUI_CONTAINER))
     99      static_cast<GLGuiContainer*>(enumC)->showAll();
     100    else
     101      enumC->hide();
     102    enumC = itC->nextElement();
     103  }
     104  delete itC;
     105
     106  this->hide();
     107}
     108
    49109
    50110/**
Note: See TracChangeset for help on using the changeset viewer.