New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Added Method to create a CCMenuItemToggle from a CCArray with a target selector #2143
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -714,6 +714,24 @@ CCArray* CCMenuItemToggle::getSubItems() | |
return m_pSubItems; | ||
} | ||
|
||
CCMenuItemToggle * CCMenuItemToggle::createWithTarget(CCObject* target, SEL_MenuHandler selector, CCArray* menuItems) | ||
{ | ||
CCMenuItemToggle *pRet = new CCMenuItemToggle(); | ||
pRet->CCMenuItem::initWithTarget(target, selector); | ||
pRet->m_pSubItems = CCArray::create(); | ||
pRet->m_pSubItems->retain(); | ||
|
||
for (int z=0; z < menuItems->count(); z++) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should not determine the validation of menuItems? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Validation can be added but are you sure that we have validation for cases as well while creating a CCMenuItemToggle object? I didn't find any. Check the method body of:
and
|
||
{ | ||
CCMenuItem* menuItem = (CCMenuItem*)menuItems->objectAtIndex(z); | ||
pRet->m_pSubItems->addObject(menuItem); | ||
} | ||
|
||
pRet->m_uSelectedIndex = UINT_MAX; | ||
pRet->setSelectedIndex(0); | ||
return pRet; | ||
} | ||
|
||
CCMenuItemToggle * CCMenuItemToggle::createWithTarget(CCObject* target, SEL_MenuHandler selector, CCMenuItem* item, ...) | ||
{ | ||
va_list args; | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should not determine the return value of pRet and initWithTarget?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, I didn't get your statement.