Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 8017 in orxonox.OLD for branches


Ignore:
Timestamp:
May 31, 2006, 11:17:33 AM (18 years ago)
Author:
bensch
Message:

gui: Vertical/Horizontral 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

    r8016 r8017  
    6262    std::vector<GLGuiWidget*>::iterator delWidget = std::find(this->children.begin(), this->children.end(), widget);
    6363    if (delWidget != this->children.end())
     64    {
     65      (*delWidget)->setParentWidget(NULL);
    6466      this->children.erase(delWidget);
     67    }
     68    this->resize();
    6569  }
    6670
     
    103107  void GLGuiBox::resize()
    104108  {
    105     float height = this->borderSize();
    106     float width = 0.0f;
    107     std::vector<GLGuiWidget*>::iterator widget;
     109    if (orientation() == OrxGui::Vertical)
     110    {
     111      float height = this->borderSize();
     112      float width = 0.0f;
     113      std::vector<GLGuiWidget*>::iterator widget;
    108114
    109     // find out how big the Widgets are.
    110     for (widget = this->children.begin(); widget != this->children.end(); ++widget)
     115      // find out how big the Widgets are.
     116      for (widget = this->children.begin(); widget != this->children.end(); ++widget)
     117      {
     118        (*widget)->setRelCoor2D(this->borderSize(), height);
     119        height += (*widget)->getSizeY2D();
     120        width = fmax(width, (*widget)->getSizeX2D());
     121      }
     122
     123      width += this->borderSize() * 2.0;
     124      height += this->borderSize(); /* *2 done further up */
     125
     126      printf("%f %f\n", width, height);
     127      this->setSize2D(width, height);
     128    }
     129    else
    111130    {
    112       (*widget)->setRelCoor2D(this->borderSize(), height);
    113       height += (*widget)->getSizeY2D();
    114       width = fmax(width, (*widget)->getSizeX2D());
     131      float height = this->borderSize();
     132      float width = this->borderSize();
     133      std::vector<GLGuiWidget*>::iterator widget;
     134
     135      // find out how big the Widgets are.
     136      for (widget = this->children.begin(); widget != this->children.end(); ++widget)
     137      {
     138        (*widget)->setRelCoor2D(width, this->borderSize());
     139        height = fmax(height, (*widget)->getSizeY2D());
     140        width += (*widget)->getSizeX2D();
     141      }
     142
     143      width += this->borderSize() ;
     144      height += this->borderSize(); /* *2 done further up */
     145
     146      printf("%f %f\n", width, height);
     147      this->setSize2D(width, height);
    115148    }
     149    GLGuiWidget::resize();
    116150
    117     width += this->borderSize() * 2.0;
    118     height += this->borderSize(); /* *2 done further up */
    119 
    120     printf("%f %f\n", width, height);
    121     this->setSize2D(width, height);
    122     GLGuiWidget::resize();
    123151    // resize everything.
    124152    //for (widget = this->children.begin(); widget != this->children.end(); ++widget)
  • branches/gui/src/lib/gui/gl_gui/glgui_box.h

    r8003 r8017  
    2121
    2222  public:
    23     GLGuiBox(OrxGui::Orientation orientation = OrxGui::Horizontal);
     23    GLGuiBox(OrxGui::Orientation orientation = OrxGui::Vertical);
    2424    virtual ~GLGuiBox();
    2525
    2626    /** @returns the Orientation of the Box */
    2727    OrxGui::Orientation orientation() const { return this->_orientation; };
     28    /** @param orientation the Orientation of the Box */
    2829    void setOrientation(OrxGui::Orientation orientation) { this->_orientation = orientation; };
    2930
Note: See TracChangeset for help on using the changeset viewer.