Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 8649 in orxonox.OLD for branches/gui


Ignore:
Timestamp:
Jun 20, 2006, 11:56:57 PM (18 years ago)
Author:
bensch
Message:

better draw

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

Legend:

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

    r8647 r8649  
    2727   */
    2828  GLGuiTable::GLGuiTable (unsigned int rows, unsigned int columns)
     29  : _selected(-1, -1), _focused(-1, -1)
    2930  {
    3031    this->init();
     
    165166    if (event.type == EV_MOUSE_MOTION)
    166167    {
    167       unsigned int row, column;
    168       this->pixelPositionToElement((OrxGui::GLGuiHandler::getInstance()->cursorPositionRel(this)), &row, &column);
     168      this->pixelPositionToElement((OrxGui::GLGuiHandler::getInstance()->cursorPositionRel(this)), &this->_focused.row, &this->_focused.column);
    169169      return true;
    170170    }
     
    233233    GLGuiWidget::draw();
    234234
    235     float columnPos = 0.0f;
    236     float rowPos = 0.0f;
     235    float columnPos = this->borderLeft();
     236    float rowPos = this->borderTop();
    237237
    238238    unsigned int i;
     
    266266
    267267
    268   void GLGuiTable::pixelPositionToElement(const Vector2D& pixelPosition, unsigned int* row, unsigned int* column)
     268  void GLGuiTable::pixelPositionToElement(const Vector2D& pixelPosition, int* row, int* column)
    269269  {
    270270    *row = 0;
     
    273273    float rowPos = 0.0f;
    274274
    275     for (*row = 0; *row < this->rowCount(); (*row)++)
     275    for (*row = 0; *row < (int)this->rowCount(); (*row)++)
    276276    {
    277277      if (pixelPosition.y > rowPos  && pixelPosition.y  < (rowPos += _rowHeights[*row]))
    278278        break;
    279279    }
    280     for (*column = 0; *column < this->columnCount(); (*column)++)
     280    for (*column = 0; *column < (int)this->columnCount(); (*column)++)
    281281    {
    282282      if (pixelPosition.x > columnPos && pixelPosition.x  < (columnPos += _columnWidths[*column]))
  • branches/gui/src/lib/gui/gl/glgui_table.h

    r8633 r8649  
    6262    void init();
    6363
    64     void pixelPositionToElement(const Vector2D& pixelPosition, unsigned int* row, unsigned int* column);
     64    void pixelPositionToElement(const Vector2D& pixelPosition, int* row, int* column);
    6565    void repositionText(unsigned int fromLeft, unsigned int fromTop);
    6666    void applyTextSettings(unsigned int row, unsigned int column, LimitedWidthText* text);
     
    6868
    6969  private:
     70    typedef struct Entry {
     71      Entry(int row, int column) :row(row), column(column) {};
     72      int  row;
     73      int  column;
     74    };
     75
    7076    typedef std::vector<LimitedWidthText> TableTextList;
    7177    TableTextList                _headers;
     
    7581    std::vector<TableTextList>   _entries;     //!< inner is by column, outer is by row.
    7682
     83    Entry                        _selected;
     84    Entry                        _focused;
     85
    7786
    7887  };
Note: See TracChangeset for help on using the changeset viewer.