Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 8003 in orxonox.OLD for branches/gui/src/lib


Ignore:
Timestamp:
May 31, 2006, 12:21:36 AM (19 years ago)
Author:
bensch
Message:

gui: introducing a Box

Location:
branches/gui/src/lib/gui/gl_gui
Files:
2 edited

Legend:

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

    r8002 r8003  
    5050
    5151    this->children.push_back(widget);
     52    this->addChild2D(widget);
     53
     54    this->resize();
    5255  }
    5356
     
    5760    assert(widget == NULL);
    5861
    59     this->children.remove(widget);
     62    std::vector<GLGuiWidget*>::iterator delWidget = std::find(this->children.begin(), this->children.end(), widget);
     63    if (delWidget != this->children.end())
     64      this->children.erase(delWidget);
     65  }
     66
     67  void GLGuiBox::clear()
     68  {
     69    this->children.clear();
     70    this->resize();
    6071  }
    6172
    6273  void GLGuiBox::showAll()
    6374  {
    64     std::list<GLGuiWidget*>::iterator itC = this->children.begin();
     75    std::vector<GLGuiWidget*>::iterator itC = this->children.begin();
    6576    while (itC != this->children.end())
    6677    {
     
    7788  void GLGuiBox::hideAll()
    7889  {
    79     std::list<GLGuiWidget*>::iterator itC = this->children.begin();
     90    std::vector<GLGuiWidget*>::iterator itC = this->children.begin();
    8091    while (itC != this->children.end())
    8192    {
     
    90101  }
    91102
     103  void GLGuiBox::resize()
     104  {
     105    float height = 0.0f;
     106    float width = 0.0f;
     107    std::vector<GLGuiWidget*>::iterator widget;
     108
     109    // find out how big the Widgets are.
     110    for (widget = this->children.begin(); widget != this->children.end(); ++widget)
     111    {
     112      (*widget)->setAbsCoor2D(0, height);
     113      height += (*widget)->getSizeY2D();
     114      width = fmax(width, (*widget)->getSizeX2D());
     115    }
     116
     117    GLGuiWidget::resize();
     118    // resize everything.
     119    //for (widget = this->children.begin(); widget != this->children.end(); ++widget)
     120    //{}
     121  }
    92122
    93123  /**
    94    * draws the GLGuiBox
     124   * @brief draws the GLGuiBox
    95125   */
    96126  void GLGuiBox::draw() const
    97127  {
     128    this->beginDraw();
     129    GLGuiWidget::draw();
     130    this->endDraw();
    98131  }
    99132}
  • branches/gui/src/lib/gui/gl_gui/glgui_box.h

    r8002 r8003  
    2424    virtual ~GLGuiBox();
    2525
    26     void init();
    2726    /** @returns the Orientation of the Box */
    2827    OrxGui::Orientation orientation() const { return this->_orientation; };
     
    3837    virtual void draw() const;
    3938
    40   private:
     39  protected:
    4140    virtual void resize();
    4241
    43     Orientation              _orientation;
    44     std::list<GLGuiWidget*>  children;
     42  private:
     43    void init();
     44
     45    Orientation                _orientation;
     46    std::vector<GLGuiWidget*>  children;
    4547  };
    4648}
Note: See TracChangeset for help on using the changeset viewer.