Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 9620 in orxonox.OLD for branches


Ignore:
Timestamp:
Jul 30, 2006, 9:22:00 PM (18 years ago)
Author:
bensch
Message:

box is better and nicer implemented now

Location:
branches/proxy/src/lib/gui/gl
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • branches/proxy/src/lib/gui/gl/glgui_box.cc

    r9110 r9620  
    3636  */
    3737  GLGuiBox::~GLGuiBox()
    38   {}
     38  {
     39    // unpack all the widgets.
     40    while(!this->_children.empty())
     41    {
     42      /// not deleting children here.
     43      this->_children.front()->setParentWidget(NULL);
     44      this->_children.pop_front();
     45    }
     46  }
    3947
    4048  /**
     
    5058    assert (widget != NULL);
    5159
    52     this->children.push_back(widget);
     60    this->_children.push_back(widget);
    5361    widget->setParentWidget(this);
    5462
     
    6169    assert(widget != NULL);
    6270
    63     std::vector<GLGuiWidget*>::iterator delWidget = std::find(this->children.begin(), this->children.end(), widget);
    64     if (delWidget != this->children.end())
     71    std::list<GLGuiWidget*>::iterator delWidget = std::find(this->_children.begin(), this->_children.end(), widget);
     72    if (delWidget != this->_children.end())
    6573    {
    6674      (*delWidget)->setParentWidget(NULL);
    67       this->children.erase(delWidget);
     75      this->_children.erase(delWidget);
    6876    }
    6977    this->resize();
     
    7280  void GLGuiBox::clear()
    7381  {
    74     this->children.clear();
     82    this->_children.clear();
    7583    this->resize();
    7684  }
     
    7886  void GLGuiBox::showAll()
    7987  {
    80     std::vector<GLGuiWidget*>::iterator itC = this->children.begin();
    81     while (itC != this->children.end())
     88    std::list<GLGuiWidget*>::iterator itC = this->_children.begin();
     89    while (itC != this->_children.end())
    8290    {
    8391      if ((*itC)->isA(CL_GLGUI_CONTAINER))
     
    93101  void GLGuiBox::hideAll()
    94102  {
    95     std::vector<GLGuiWidget*>::iterator itC = this->children.begin();
    96     while (itC != this->children.end())
     103    std::list<GLGuiWidget*>::iterator itC = this->_children.begin();
     104    while (itC != this->_children.end())
    97105    {
    98106      if ((*itC)->isA(CL_GLGUI_CONTAINER))
     
    112120      float height = borderTop();
    113121      float width = 0.0f;
    114       std::vector<GLGuiWidget*>::iterator widget;
     122      std::list<GLGuiWidget*>::iterator widget;
    115123
    116124      // find out how big the Widgets are.
    117       for (widget = this->children.begin(); widget != this->children.end(); ++widget)
     125      for (widget = this->_children.begin(); widget != this->_children.end(); ++widget)
    118126      {
    119127        (*widget)->setRelCoor2D(borderLeft(), height);
     
    131139      float height = borderTop();
    132140      float width = borderLeft();
    133       std::vector<GLGuiWidget*>::iterator widget;
     141      std::list<GLGuiWidget*>::iterator widget;
    134142
    135143      // find out how big the Widgets are.
    136       for (widget = this->children.begin(); widget != this->children.end(); ++widget)
     144      for (widget = this->_children.begin(); widget != this->_children.end(); ++widget)
    137145      {
    138146        (*widget)->setRelCoor2D(width, borderTop());
     
    149157
    150158    // resize everything.
    151     //for (widget = this->children.begin(); widget != this->children.end(); ++widget)
     159    //for (widget = this->_children.begin(); widget != this->_children.end(); ++widget)
    152160    //{}
    153161  }
  • branches/proxy/src/lib/gui/gl/glgui_box.h

    r9546 r9620  
    3030
    3131    virtual void pack(GLGuiWidget* widget);
     32    void pack(GLGuiWidget* widget, std::list<GLGuiWidget*>::iterator pos);
     33    void pack(GLGuiWidget* widget, unsigned int position);
     34    //void
    3235    virtual void unpack(GLGuiWidget* widget);
    3336    virtual void clear();
     
    4548
    4649    Orientation                _orientation;
    47     std::vector<GLGuiWidget*>  children;
     50    std::list<GLGuiWidget*>    _children;
    4851  };
    4952}
  • branches/proxy/src/lib/gui/gl/glgui_container.cc

    r8619 r9620  
    4848
    4949
     50  void GLGuiContainer::removeChildWidget(GLGuiWidget* widget)
     51  {
     52    this->unpack(widget);
     53  }
     54
     55
    5056  /**
    5157   * draws the GLGuiContainer
  • branches/proxy/src/lib/gui/gl/glgui_container.h

    r8145 r9620  
    3838    virtual void draw();
    3939
     40  protected:
     41    virtual void removeChildWidget(GLGuiWidget* widget);
     42
    4043  private:
    4144    void init();
  • branches/proxy/src/lib/gui/gl/glgui_widget.cc

    r9406 r9620  
    7979    if (this == GLGuiWidget::selected())
    8080      this->unselect();
     81
     82    if (this->_parent != NULL)
     83      this->_parent->removeChildWidget(this);
    8184  }
    8285
  • branches/proxy/src/lib/gui/gl/glgui_widget.h

    r9406 r9620  
    270270    virtual void destroying();
    271271
     272    // unparent the widget and from this widget seen as parent
     273    virtual void removeChildWidget(GLGuiWidget* widget) {};
     274
    272275
    273276    virtual void debug(unsigned int level) const;
Note: See TracChangeset for help on using the changeset viewer.