Changeset 8633 in orxonox.OLD for branches/gui/src
- Timestamp:
- Jun 20, 2006, 3:27:17 PM (19 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
r8631 r8633 18 18 #include "glgui_table.h" 19 19 #include "debug.h" 20 21 #include "glgui_handler.h" 20 22 21 23 namespace OrxGui … … 154 156 155 157 156 157 158 /** 158 159 * @brief Processes an Event. … … 162 163 bool GLGuiTable::processEvent(const Event& event) 163 164 { 165 if (event.type == EV_MOUSE_MOTION) 166 { 167 unsigned int row, column; 168 this->pixelPositionToElement((OrxGui::GLGuiHandler::getInstance()->cursorPositionRel(this)), &row, &column); 169 return true; 170 } 171 164 172 return false; 165 173 } … … 253 261 254 262 glEnd(); 255 // this->frontMaterial().select();256 // GLGuiWidget::drawRect(this->frontRect());257 263 258 264 this->endDraw(); 265 } 266 267 268 void GLGuiTable::pixelPositionToElement(const Vector2D& pixelPosition, unsigned int* row, unsigned int* column) 269 { 270 *row = 0; 271 *column = 0; 272 float columnPos = 0.0f; 273 float rowPos = 0.0f; 274 275 for (*row = 0; *row < this->rowCount(); *row++) 276 { 277 if (pixelPosition.x > rowPos && pixelPosition.x < (rowPos += _rowHeights[*row])) 278 break; 279 } 280 for (*column = 0; *column < this->columnCount(); *column++) 281 { 282 if (pixelPosition.y > columnPos && pixelPosition.y < (columnPos += _columnWidths[*column])) 283 break; 284 } 285 286 printf("%d %d\n", *row, *column); 259 287 } 260 288 -
branches/gui/src/lib/gui/gl/glgui_table.h
r8631 r8633 62 62 void init(); 63 63 64 void pixelPositionToElement(const Vector2D& pixelPosition, unsigned int* row, unsigned int* column); 64 65 void repositionText(unsigned int fromLeft, unsigned int fromTop); 65 66 void applyTextSettings(unsigned int row, unsigned int column, LimitedWidthText* text);
Note: See TracChangeset
for help on using the changeset viewer.