| 706 | // |
| 707 | |
| 708 | MenuItemToggle* 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 | |
| 732 | MenuItemToggle* MenuItemToggle::createWithCallback(const ccMenuCallback& callback, MenuItem* item, ...) |
| 733 | { |
nothing calls this directly
no test coverage detected