Changeset 8629 in orxonox.OLD for branches/gui/src
- Timestamp:
- Jun 20, 2006, 2:29:37 PM (18 years ago)
- 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 27 27 { 28 28 this->init(); 29 29 30 this->setRowCount(rows); 30 31 this->setColumnCount(columns); … … 47 48 this->setFocusable(true); 48 49 this->setClickable(true); 49 50 this->resize();51 50 } 52 51 … … 56 55 57 56 unsigned int currentRowCount = this->rowCount(); 57 58 this->_rowHeights.resize(rowCount, 20); 59 58 60 this->_entries.resize(rowCount); 59 61 for (unsigned int i = currentRowCount; i < this->rowCount(); ++i) … … 66 68 assert(this->checkIntegrity()); 67 69 this->repositionText(currentRowCount, 0); 70 71 72 this->resize(); 68 73 69 74 if (!this->isVisible()) … … 94 99 this->repositionText(0, currentColumnCount); 95 100 101 this->resize(); 96 102 if (!this->isVisible()) 97 103 this->hiding(); … … 134 140 /// TODO. 135 141 void GLGuiTable::setRowHeight(unsigned int row, unsigned int size) 136 142 {} 137 143 138 144 … … 165 171 void GLGuiTable::resize() 166 172 { 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 167 184 GLGuiWidget::resize(); 168 185 } … … 176 193 this->_entries[j][i].setColor(this->foregroundColor()); 177 194 } 195 178 196 } 179 197 … … 214 232 GLGuiWidget::draw(); 215 233 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(); 216 262 // this->frontMaterial().select(); 217 263 // GLGuiWidget::drawRect(this->frontRect()); … … 224 270 { 225 271 float columnPos = 0.0f; 226 float rowPos ;272 float rowPos = 0.0f; 227 273 unsigned int i, j; 228 274 for (i = 0; i< fromLeft; ++i) 229 {230 275 columnPos+=this->_columnWidths[i]; 231 } 276 for (i = 0; i < fromTop; ++i) 277 rowPos += this->_rowHeights[i]; 232 278 233 279 for (i = fromLeft; i < this->columnCount(); ++i) … … 238 284 this->_headers[i].setLineWidth(_columnWidths[i]); 239 285 240 rowPos = 10.0f;286 float rowPosI = rowPos; 241 287 for (j = fromTop; j < this->rowCount(); ++j) 242 288 { 243 this->_entries[j][i].setRelCoor2D(columnPos, rowPos );289 this->_entries[j][i].setRelCoor2D(columnPos, rowPosI); 244 290 this->_entries[j][i].setLineWidth(_columnWidths[i]); 245 rowPos += 10.0f;291 rowPosI += _rowHeights[j]; 246 292 } 247 293 columnPos+=this->_columnWidths[i]; -
branches/gui/src/lib/gui/gl/glgui_table.h
r8626 r8629 60 60 virtual bool processEvent(const Event& event); 61 61 62 63 62 private: 64 63 void init(); … … 72 71 TableTextList _headers; 73 72 std::vector<float> _columnWidths; 73 std::vector<float> _rowHeights; 74 74 75 75 std::vector<TableTextList> _entries; //!< inner is by column, outer is by row.
Note: See TracChangeset
for help on using the changeset viewer.