| 744 | } |
| 745 | |
| 746 | void GuiGameListMenuCtrl::setSelected(S32 index) |
| 747 | { |
| 748 | if (index == NO_ROW) |
| 749 | { |
| 750 | // deselection |
| 751 | mSelected = NO_ROW; |
| 752 | return; |
| 753 | } |
| 754 | |
| 755 | if (! isValidRowIndex(index)) |
| 756 | { |
| 757 | return; |
| 758 | } |
| 759 | |
| 760 | if (! isRowEnabled(index)) |
| 761 | { |
| 762 | // row is disabled, it can't be selected |
| 763 | return; |
| 764 | } |
| 765 | |
| 766 | mSelected = mClamp(index, 0, mRows.size() - 1); |
| 767 | |
| 768 | //If we're childed to a scroll container, make sure us changing rows has our new position visible |
| 769 | GuiScrollCtrl* scroll = dynamic_cast<GuiScrollCtrl*>(getParent()); |
| 770 | if (scroll) |
| 771 | { |
| 772 | scroll->scrollRectVisible(getRowBounds(mSelected)); |
| 773 | } |
| 774 | } |
| 775 | |
| 776 | bool GuiGameListMenuCtrl::isRowEnabled(S32 index) const |
| 777 | { |
no test coverage detected