Changeset 8649 in orxonox.OLD
- Timestamp:
- Jun 20, 2006, 11:56:57 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
r8647 r8649 27 27 */ 28 28 GLGuiTable::GLGuiTable (unsigned int rows, unsigned int columns) 29 : _selected(-1, -1), _focused(-1, -1) 29 30 { 30 31 this->init(); … … 165 166 if (event.type == EV_MOUSE_MOTION) 166 167 { 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); 169 169 return true; 170 170 } … … 233 233 GLGuiWidget::draw(); 234 234 235 float columnPos = 0.0f;236 float rowPos = 0.0f;235 float columnPos = this->borderLeft(); 236 float rowPos = this->borderTop(); 237 237 238 238 unsigned int i; … … 266 266 267 267 268 void GLGuiTable::pixelPositionToElement(const Vector2D& pixelPosition, unsigned int* row, unsignedint* column)268 void GLGuiTable::pixelPositionToElement(const Vector2D& pixelPosition, int* row, int* column) 269 269 { 270 270 *row = 0; … … 273 273 float rowPos = 0.0f; 274 274 275 for (*row = 0; *row < this->rowCount(); (*row)++)275 for (*row = 0; *row < (int)this->rowCount(); (*row)++) 276 276 { 277 277 if (pixelPosition.y > rowPos && pixelPosition.y < (rowPos += _rowHeights[*row])) 278 278 break; 279 279 } 280 for (*column = 0; *column < this->columnCount(); (*column)++)280 for (*column = 0; *column < (int)this->columnCount(); (*column)++) 281 281 { 282 282 if (pixelPosition.x > columnPos && pixelPosition.x < (columnPos += _columnWidths[*column])) -
branches/gui/src/lib/gui/gl/glgui_table.h
r8633 r8649 62 62 void init(); 63 63 64 void pixelPositionToElement(const Vector2D& pixelPosition, unsigned int* row, unsignedint* column);64 void pixelPositionToElement(const Vector2D& pixelPosition, int* row, int* column); 65 65 void repositionText(unsigned int fromLeft, unsigned int fromTop); 66 66 void applyTextSettings(unsigned int row, unsigned int column, LimitedWidthText* text); … … 68 68 69 69 private: 70 typedef struct Entry { 71 Entry(int row, int column) :row(row), column(column) {}; 72 int row; 73 int column; 74 }; 75 70 76 typedef std::vector<LimitedWidthText> TableTextList; 71 77 TableTextList _headers; … … 75 81 std::vector<TableTextList> _entries; //!< inner is by column, outer is by row. 76 82 83 Entry _selected; 84 Entry _focused; 85 77 86 78 87 };
Note: See TracChangeset
for help on using the changeset viewer.