2012-04-19 14:35:52 +08:00
|
|
|
/*
|
|
|
|
*
|
|
|
|
* Helper class to store targets and selectors (and eventually, params?) in the same CCMutableArray. Basically a very crude form of a NSInvocation
|
|
|
|
*/
|
|
|
|
#ifndef __CCINVOCATION_H__
|
|
|
|
#define __CCINVOCATION_H__
|
|
|
|
|
2012-06-19 13:50:11 +08:00
|
|
|
#include "cocoa/CCObject.h"
|
2012-07-20 14:05:52 +08:00
|
|
|
#include "ExtensionMacros.h"
|
2012-04-19 14:35:52 +08:00
|
|
|
|
2012-04-27 18:47:49 +08:00
|
|
|
NS_CC_EXT_BEGIN
|
2012-04-19 14:35:52 +08:00
|
|
|
|
2012-06-20 18:09:11 +08:00
|
|
|
/**
|
|
|
|
* @addtogroup GUI
|
|
|
|
* @{
|
|
|
|
* @addtogroup control_extension
|
|
|
|
* @{
|
|
|
|
*/
|
|
|
|
|
2012-04-19 14:35:52 +08:00
|
|
|
typedef unsigned int CCControlEvent;
|
|
|
|
|
2012-07-19 17:22:36 +08:00
|
|
|
typedef void (cocos2d::CCObject::*SEL_CCControlHandler)(cocos2d::CCObject*, CCControlEvent);
|
2012-06-07 05:31:14 +08:00
|
|
|
|
|
|
|
#define cccontrol_selector(_SELECTOR) (SEL_CCControlHandler)(&_SELECTOR)
|
|
|
|
|
2012-07-20 14:05:52 +08:00
|
|
|
class CCInvocation : public cocos2d::CCObject
|
2012-04-19 14:35:52 +08:00
|
|
|
{
|
2012-06-07 05:31:14 +08:00
|
|
|
CC_SYNTHESIZE_READONLY(SEL_CCControlHandler, m_action, Action);
|
2012-04-19 14:35:52 +08:00
|
|
|
CC_SYNTHESIZE_READONLY(CCObject*, m_target, Target);
|
|
|
|
CC_SYNTHESIZE_READONLY(CCControlEvent, m_controlEvent, ControlEvent);
|
|
|
|
|
|
|
|
public:
|
2012-07-19 17:22:36 +08:00
|
|
|
CCInvocation(cocos2d::CCObject* target, SEL_CCControlHandler action, CCControlEvent controlEvent);
|
2012-04-19 14:35:52 +08:00
|
|
|
|
2012-07-19 17:22:36 +08:00
|
|
|
void invoke(cocos2d::CCObject* sender);
|
2012-04-19 14:35:52 +08:00
|
|
|
};
|
|
|
|
|
2012-06-20 18:09:11 +08:00
|
|
|
// end of GUI group
|
|
|
|
/// @}
|
|
|
|
/// @}
|
|
|
|
|
2012-04-27 18:47:49 +08:00
|
|
|
NS_CC_EXT_END
|
2012-04-19 14:35:52 +08:00
|
|
|
|
2012-04-16 18:58:43 +08:00
|
|
|
#endif
|