Merge pull request #421 from leon-li/master

add CCMenuItem::setTarget
This commit is contained in:
minggo 2011-07-26 18:48:24 -07:00
commit 33e85bdc53
2 changed files with 611 additions and 602 deletions

View File

@ -74,6 +74,9 @@ namespace cocos2d{
* If pszFunctionName is NULL, then unregister it. * If pszFunctionName is NULL, then unregister it.
*/ */
virtual void registerScriptHandler(const char* pszFunctionName); virtual void registerScriptHandler(const char* pszFunctionName);
/** set the target/selector of the menu item*/
void setTarget(SelectorProtocol *rec, SEL_MenuHandler selector);
protected: protected:
SelectorProtocol* m_pListener; SelectorProtocol* m_pListener;
SEL_MenuHandler m_pfnSelector; SEL_MenuHandler m_pfnSelector;

View File

@ -123,6 +123,12 @@ namespace cocos2d{
return m_bIsSelected; return m_bIsSelected;
} }
void CCMenuItem::setTarget(SelectorProtocol *rec, SEL_MenuHandler selector)
{
m_pListener = rec;
m_pfnSelector = selector;
}
// //
//CCMenuItemLabel //CCMenuItemLabel
// //