MCPcopy Create free account
hub / github.com/axmolengine/axmol / setSelectedIndex

Method setSelectedIndex

core/2d/MenuItem.cpp:828–844  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

826}
827
828void MenuItemToggle::setSelectedIndex(unsigned int index)
829{
830 if (index != _selectedIndex && !_subItems.empty())
831 {
832 _selectedIndex = index;
833 if (_selectedItem)
834 {
835 _selectedItem->removeFromParentAndCleanup(false);
836 }
837
838 _selectedItem = _subItems.at(_selectedIndex);
839 this->addChild(_selectedItem);
840 Vec2 s = _selectedItem->getContentSize();
841 this->setContentSize(s);
842 _selectedItem->setPosition(s.width / 2, s.height / 2);
843 }
844}
845
846void MenuItemToggle::selected()
847{

Callers 12

initWithCallbackMethod · 0.95
initWithItemMethod · 0.95
activateMethod · 0.95
createWithCallbackMethod · 0.45
onClickBackMethod · 0.45
runDemoMethod · 0.45
setReadMethod · 0.45
setFetchedMethod · 0.45
onSizeChangedMethod · 0.45
setRefreshStatusMethod · 0.45
onPullUpToRefreshMethod · 0.45
MenuLayer4Method · 0.45

Calls 7

emptyMethod · 0.45
atMethod · 0.45
addChildMethod · 0.45
getContentSizeMethod · 0.45
setContentSizeMethod · 0.45
setPositionMethod · 0.45

Tested by 1

MenuLayer4Method · 0.36