Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 8629 in orxonox.OLD


Ignore:
Timestamp:
Jun 20, 2006, 2:29:37 PM (18 years ago)
Author:
bensch
Message:

orxonox/gui: rasterized (strange look, but ok)

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

Legend:

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

    r8627 r8629  
    2727  {
    2828    this->init();
     29
    2930    this->setRowCount(rows);
    3031    this->setColumnCount(columns);
     
    4748    this->setFocusable(true);
    4849    this->setClickable(true);
    49 
    50     this->resize();
    5150  }
    5251
     
    5655
    5756    unsigned int currentRowCount = this->rowCount();
     57
     58    this->_rowHeights.resize(rowCount, 20);
     59
    5860    this->_entries.resize(rowCount);
    5961    for (unsigned int i = currentRowCount; i < this->rowCount(); ++i)
     
    6668    assert(this->checkIntegrity());
    6769    this->repositionText(currentRowCount, 0);
     70
     71
     72    this->resize();
    6873
    6974    if (!this->isVisible())
     
    9499    this->repositionText(0, currentColumnCount);
    95100
     101    this->resize();
    96102    if (!this->isVisible())
    97103      this->hiding();
     
    134140  /// TODO.
    135141  void GLGuiTable::setRowHeight(unsigned int row, unsigned int size)
    136   {}
     142{}
    137143
    138144
     
    165171  void GLGuiTable::resize()
    166172  {
     173    Vector2D size;
     174    unsigned int i;
     175    for(i = 0; i < this->columnCount(); ++i)
     176      size.x += this->_columnWidths[i];
     177
     178    for(i = 0; i < this->rowCount(); ++i)
     179      size.y += this->_rowHeights[i];
     180
     181    this->setSize2D(size);
     182    this->setSize2D( size + Vector2D(borderLeft() + borderRight(), borderTop() + borderBottom()));
     183
    167184    GLGuiWidget::resize();
    168185  }
     
    176193        this->_entries[j][i].setColor(this->foregroundColor());
    177194    }
     195
    178196  }
    179197
     
    214232    GLGuiWidget::draw();
    215233
     234    float columnPos = 0.0f;
     235    float rowPos = 0.0f;
     236
     237    unsigned int i;
     238    glColor4fv(&this->foregroundColor()[0]);
     239    glLineWidth(1.5);
     240    glBegin(GL_LINES);
     241
     242    glVertex2f(0, 0);
     243    glVertex2f(0, this->getSizeY2D());
     244    for (i = 0; i < this->columnCount(); ++i)
     245    {
     246      columnPos +=this->_columnWidths[i];
     247      glVertex2f(columnPos, 0);
     248      glVertex2f(columnPos, this->getSizeY2D());
     249    }
     250
     251    glVertex2f(0, 0);
     252    glVertex2f(this->getSizeX2D(), 0);
     253    for (i = 0; i < this->rowCount(); ++i)
     254    {
     255      rowPos +=this->_rowHeights[i];
     256      glVertex2f(0, rowPos);
     257      glVertex2f(this->getSizeX2D(), rowPos);
     258    }
     259
     260
     261    glEnd();
    216262    //     this->frontMaterial().select();
    217263    //     GLGuiWidget::drawRect(this->frontRect());
     
    224270  {
    225271    float columnPos = 0.0f;
    226     float rowPos;
     272    float rowPos = 0.0f;
    227273    unsigned int i, j;
    228274    for (i = 0; i< fromLeft; ++i)
    229     {
    230275      columnPos+=this->_columnWidths[i];
    231     }
     276    for (i = 0; i < fromTop; ++i)
     277      rowPos += this->_rowHeights[i];
    232278
    233279    for (i = fromLeft; i < this->columnCount(); ++i)
     
    238284      this->_headers[i].setLineWidth(_columnWidths[i]);
    239285
    240       rowPos = 10.0f;
     286      float rowPosI = rowPos;
    241287      for (j = fromTop; j < this->rowCount(); ++j)
    242288      {
    243         this->_entries[j][i].setRelCoor2D(columnPos, rowPos);
     289        this->_entries[j][i].setRelCoor2D(columnPos, rowPosI);
    244290        this->_entries[j][i].setLineWidth(_columnWidths[i]);
    245         rowPos += 10.0f;
     291        rowPosI += _rowHeights[j];
    246292      }
    247293      columnPos+=this->_columnWidths[i];
  • branches/gui/src/lib/gui/gl/glgui_table.h

    r8626 r8629  
    6060    virtual bool processEvent(const Event& event);
    6161
    62 
    6362  private:
    6463    void init();
     
    7271    TableTextList                _headers;
    7372    std::vector<float>           _columnWidths;
     73    std::vector<float>           _rowHeights;
    7474
    7575    std::vector<TableTextList>   _entries;     //!< inner is by column, outer is by row.
Note: See TracChangeset for help on using the changeset viewer.