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

Method createWithCallback

core/2d/MenuItem.cpp:708–730  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

706//
707
708MenuItemToggle* MenuItemToggle::createWithCallback(const ccMenuCallback& callback, const Vector<MenuItem*>& menuItems)
709{
710 MenuItemToggle* ret = new MenuItemToggle();
711 ret->MenuItem::initWithCallback(callback);
712 ret->autorelease();
713#if AX_ENABLE_GC_FOR_NATIVE_OBJECTS
714 auto sEngine = ScriptEngineManager::getInstance()->getScriptEngine();
715 if (sEngine)
716 {
717 for (const auto& item : menuItems)
718 {
719 if (item)
720 {
721 sEngine->retainScriptObject(ret, item);
722 }
723 }
724 }
725#endif // AX_ENABLE_GC_FOR_NATIVE_OBJECTS
726 ret->_subItems = menuItems;
727 ret->_selectedIndex = UINT_MAX;
728 ret->setSelectedIndex(0);
729 return ret;
730}
731
732MenuItemToggle* MenuItemToggle::createWithCallback(const ccMenuCallback& callback, MenuItem* item, ...)
733{

Callers

nothing calls this directly

Calls 4

getInstanceFunction · 0.85
autoreleaseMethod · 0.80
setSelectedIndexMethod · 0.45
initWithCallbackMethod · 0.45

Tested by

no test coverage detected