| 304 | } |
| 305 | |
| 306 | void ListView::removeChild(ax::Node* child, bool cleanup) |
| 307 | { |
| 308 | Widget* widget = dynamic_cast<Widget*>(child); |
| 309 | if (nullptr != widget) |
| 310 | { |
| 311 | if (-1 != _curSelectedIndex) |
| 312 | { |
| 313 | auto removedIndex = getIndex(widget); |
| 314 | if (_curSelectedIndex > removedIndex) |
| 315 | { |
| 316 | _curSelectedIndex -= 1; |
| 317 | } |
| 318 | else if (_curSelectedIndex == removedIndex) |
| 319 | { |
| 320 | _curSelectedIndex = -1; |
| 321 | } |
| 322 | } |
| 323 | _items.eraseObject(widget); |
| 324 | onItemListChanged(); |
| 325 | } |
| 326 | |
| 327 | ScrollView::removeChild(child, cleanup); |
| 328 | requestDoLayout(); |
| 329 | } |
| 330 | |
| 331 | void ListView::removeAllChildren() |
| 332 | { |
nothing calls this directly
no test coverage detected