| 219 | } |
| 220 | |
| 221 | void TableView::removeCellAtIndex(ssize_t idx) |
| 222 | { |
| 223 | if (idx == AX_INVALID_INDEX) |
| 224 | { |
| 225 | return; |
| 226 | } |
| 227 | |
| 228 | auto uCountOfItems = _dataSource->numberOfCellsInTableView(this); |
| 229 | if (0 == uCountOfItems || idx > uCountOfItems - 1) |
| 230 | { |
| 231 | return; |
| 232 | } |
| 233 | |
| 234 | ssize_t newIdx = 0; |
| 235 | |
| 236 | TableViewCell* cell = this->cellAtIndex(idx); |
| 237 | if (!cell) |
| 238 | { |
| 239 | return; |
| 240 | } |
| 241 | |
| 242 | newIdx = _cellsUsed.getIndex(cell); |
| 243 | |
| 244 | // remove first |
| 245 | this->_moveCellOutOfSight(cell); |
| 246 | |
| 247 | _indices->erase(idx); |
| 248 | this->_updateCellPositions(); |
| 249 | |
| 250 | for (ssize_t i = _cellsUsed.size() - 1; i > newIdx; i--) |
| 251 | { |
| 252 | cell = _cellsUsed.at(i); |
| 253 | this->_setIndexForCell(cell->getIdx() - 1, cell); |
| 254 | } |
| 255 | } |
| 256 | |
| 257 | TableViewCell* TableView::dequeueCell() |
| 258 | { |
no test coverage detected