| 470 | } |
| 471 | |
| 472 | void ListBox::setSelected(sp<Control> c) |
| 473 | { |
| 474 | // A sanity check to make sure the selected control actually belongs to this list |
| 475 | bool found = false; |
| 476 | for (auto child : this->Controls) |
| 477 | { |
| 478 | if (child == c) |
| 479 | { |
| 480 | found = true; |
| 481 | break; |
| 482 | } |
| 483 | } |
| 484 | if (c && !found) |
| 485 | { |
| 486 | LogError( |
| 487 | "Trying set ListBox selected control to something that isn't a member of the list"); |
| 488 | } |
| 489 | this->selected = c; |
| 490 | this->setDirty(); |
| 491 | } |
| 492 | |
| 493 | sp<Control> ListBox::getSelectedItem() { return selected; } |
| 494 |
no test coverage detected