fixed #467 CCLayer:m_eTouchDelegateType = ccTouchDeletateAllBit all the time, which makes an error logic if adding standard touch delegate when CCTouchDispatcher::m_tLock = ture

This commit is contained in:
Walzer 2011-04-24 15:38:03 +08:00
parent 3e643d73a3
commit f7b294fe24
2 changed files with 27 additions and 19 deletions

View File

@ -40,13 +40,17 @@ typedef enum
class CCTouch;
class CCEvent;
class CCSet;
class CCTouchDispatcher;
class CC_DLL CCTouchDelegate
{
protected:
ccTouchDelegateFlag m_eTouchDelegateType;
public:
friend class CCTouchDispatcher; // only CCTouchDispatcher & children can change m_eTouchDelegateType
inline ccTouchDelegateFlag getTouchDelegateType(void) { return m_eTouchDelegateType; }
//! call the release() in child(layer or menu)
virtual void destroy(void) {}
//! call the retain() in child (layer or menu)

View File

@ -132,6 +132,8 @@ void CCTouchDispatcher::forceAddHandler(CCTouchHandler *pHandler, CCMutableArray
void CCTouchDispatcher::addStandardDelegate(CCTouchDelegate *pDelegate, int nPriority)
{
pDelegate->m_eTouchDelegateType = ccTouchDelegateStandardBit;
CCTouchHandler *pHandler = CCStandardTouchHandler::handlerWithDelegate(pDelegate, nPriority);
if (! m_bLocked)
{
@ -146,6 +148,8 @@ void CCTouchDispatcher::addStandardDelegate(CCTouchDelegate *pDelegate, int nPri
void CCTouchDispatcher::addTargetedDelegate(CCTouchDelegate *pDelegate, int nPriority, bool bSwallowsTouches)
{
pDelegate->m_eTouchDelegateType = ccTouchDelegateTargetedBit;
CCTouchHandler *pHandler = CCTargetedTouchHandler::handlerWithDelegate(pDelegate, nPriority, bSwallowsTouches);
if (! m_bLocked)
{