Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 8626 in orxonox.OLD


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

repositioning Text

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

Legend:

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

    r8619 r8626  
    6565
    6666    assert(this->checkIntegrity());
    67     this->debug();
     67    this->repositionText(currentRowCount, 0);
    6868
    6969    if (!this->isVisible())
     
    7575    unsigned int i;
    7676    unsigned int currentColumnCount = this->columnCount();
     77
     78    this->_columnWidths.resize(columnCount, 100);
    7779
    7880    // setup Headers.
     
    8991    }
    9092    assert(this->checkIntegrity());
    91     this->debug();
     93
     94    this->repositionText(0, currentColumnCount);
    9295
    9396    if (!this->isVisible())
     
    111114  }
    112115
    113   void GLGuiTable::setEntry(unsigned int column, unsigned int row, const std::string& name)
     116  void GLGuiTable::setEntry(unsigned int row, unsigned int column, const std::string& name)
    114117  {
    115118    if (column >= this->columnCount() )
     
    125128    for (unsigned int i = 0; i < this->rowCount(); ++i)
    126129      this->_entries[i][column].setLineWidth(size);
    127 
    128   }
     130  }
     131
     132
    129133
    130134  /// TODO.
    131135  void GLGuiTable::setRowHeight(unsigned int row, unsigned int size)
    132 {}
     136  {}
    133137
    134138
     
    217221
    218222
     223  void GLGuiTable::repositionText(unsigned int fromLeft, unsigned int fromTop)
     224  {
     225    float columnPos = 0.0f;
     226    unsigned int i, j;
     227    for (i = 0; i< fromLeft; ++i)
     228    {
     229      columnPos+=this->_columnWidths[i];
     230    }
     231
     232    for (i = fromLeft; i < this->columnCount(); ++i)
     233    {
     234      this->_headers[i].setRelCoor2D(columnPos, 0);
     235
     236      for (j = fromTop; j < this->rowCount(); ++j)
     237      {
     238
     239      }
     240      columnPos+=this->_columnWidths[i];
     241    }
     242  }
     243
    219244  /**
    220245   * @brief applies the GLGuiNotifiers Settings to a single Text of the GLGuiNotifier.
     
    224249  {
    225250    text->setSize(this->textSize());
    226     //text->setLineWidth( );
     251    text->setLineWidth( this->_columnWidths[column] );
    227252    text->setFont("fonts/final_frontier.ttf", (int)this->textSize());
    228253
     
    257282    for (unsigned int i = 0; i < this->rowCount(); ++i)
    258283      if (this->_entries[i].size() != this->columnCount())
    259     {
    260       PRINTF(1)("COLUMN-COUNT OF ROW %d WRONG (is %d should be %d)\n", i, this->_entries[i].size(), this->columnCount());
    261       retVal = false;
    262     }
     284      {
     285        PRINTF(1)("COLUMN-COUNT OF ROW %d WRONG (is %d should be %d)\n", i, this->_entries[i].size(), this->columnCount());
     286        retVal = false;
     287      }
    263288    return retVal;
    264289  }
  • branches/gui/src/lib/gui/gl/glgui_table.h

    r8619 r8626  
    3939    void setHeader(const std::vector<std::string>& headerNames);
    4040
    41     void setEntry(unsigned int column, unsigned int row, const std::string& name);
     41    void setEntry(unsigned int row, unsigned int column, const std::string& name);
    4242
    4343    void setColumnWidth(unsigned int column, float size);
     
    6464    void init();
    6565
     66    void repositionText(unsigned int fromLeft, unsigned int fromTop);
    6667    void applyTextSettings(unsigned int row, unsigned int column, LimitedWidthText* text);
    6768    bool checkIntegrity() const;
     
    7071    typedef std::vector<LimitedWidthText> TableTextList;
    7172    TableTextList                _headers;
     73    std::vector<float>           _columnWidths;
     74
    7275    std::vector<TableTextList>   _entries;     //!< inner is by column, outer is by row.
    7376
Note: See TracChangeset for help on using the changeset viewer.