| 442 | } |
| 443 | |
| 444 | void TableView::_updateCellPositions() |
| 445 | { |
| 446 | ssize_t cellsCount = _dataSource->numberOfCellsInTableView(this); |
| 447 | _vCellsPositions.resize(cellsCount + 1, 0.0); |
| 448 | |
| 449 | if (cellsCount > 0) |
| 450 | { |
| 451 | float currentPos = 0; |
| 452 | Size cellSize; |
| 453 | for (int i = 0; i < cellsCount; i++) |
| 454 | { |
| 455 | _vCellsPositions[i] = currentPos; |
| 456 | cellSize = _dataSource->tableCellSizeForIndex(this, i); |
| 457 | switch (this->getDirection()) |
| 458 | { |
| 459 | case Direction::HORIZONTAL: |
| 460 | currentPos += cellSize.width; |
| 461 | break; |
| 462 | default: |
| 463 | currentPos += cellSize.height; |
| 464 | break; |
| 465 | } |
| 466 | } |
| 467 | _vCellsPositions[cellsCount] = currentPos; // 1 extra value allows us to get right/bottom of the last cell |
| 468 | } |
| 469 | } |
| 470 | |
| 471 | void TableView::scrollViewDidScroll(ScrollView* /*view*/) |
| 472 | { |