MCPcopy Create free account
hub / github.com/TorqueGameEngines/Torque3D / setSelected

Method setSelected

Engine/source/gui/controls/guiGameListMenuCtrl.cpp:746–774  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

744}
745
746void 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
776bool GuiGameListMenuCtrl::isRowEnabled(S32 index) const
777{

Callers 1

Calls 3

mClampFunction · 0.85
scrollRectVisibleMethod · 0.80
sizeMethod · 0.45

Tested by

no test coverage detected