void CCTouchDispatcher::removeDelegate(CCTouchDelegate *pDelegate) { if (pDelegate == NULL) { return; } if (! m_bLocked) { forceRemoveDelegate(pDelegate); } else { /* If pHandler is contained in m_pHandlersToAdd, if so remove it from m_pHandlersToAdd and retrun. * Refer issue #752(cocos2d-x) */ CCTouchHandler *pHandler = findHandler(m_pHandlersToAdd, pDelegate); if (pHandler) { m_pHandlersToAdd->removeObject(pHandler); return; } ccCArrayAppendValue(m_pHandlersToRemove, pDelegate); m_bToRemove = true; } }
void CCKeypadDispatcher::removeDelegate(v8::Handle<v8::Object> pDelegate) { if (pDelegate.IsEmpty() || pDelegate->IsNull()) { return; } if (! m_bLocked) { forceRemoveDelegate(pDelegate); } else { CCKeypadHandler* pHandler = NULL; CCObject* pObj = NULL; void* delegateKey = this->getJSCCallFunc()->getHash(pDelegate); CCARRAY_FOREACH(m_pDelegates, pObj) { pHandler = (CCKeypadHandler*)pObj; JSKeypadDelegate *keypadDelegate = dynamic_cast<JSKeypadDelegate*>(pHandler); if (keypadDelegate && this->getJSCCallFunc()->getHash(keypadDelegate->mJSDelegate) == delegateKey) { ccCArrayAppendValue(m_pHandlersToRemove, pHandler); break; } } m_bToRemove = true; }
/** Appends values from plusArr to arr. Behavior undefined if arr doesn't have enough capacity. */ void ccCArrayAppendArray(ccCArray *arr, ccCArray *plusArr) { for( ssize_t i = 0; i < plusArr->num; i++) { ccCArrayAppendValue(arr, plusArr->arr[i]); } }
/** Appends values from plusArr to arr. Behavior undefined if arr doesn't have enough capacity. */ void ccCArrayAppendArray(ccCArray *arr, ccCArray *plusArr) { unsigned int i; for( i = 0; i < plusArr->num; i++) { ccCArrayAppendValue(arr, plusArr->arr[i]); } }
void CCScrollWheelDispatcher::removeDelegate(CCScrollWheelDelegate *pDelegate) { if (!pDelegate) { return; } if (!m_bLocked) { forceRemoveDelegate(pDelegate); } else { ccCArrayAppendValue(m_pDelegatesToRemove, pDelegate); m_bToRemove = true; } }
void CCKeypadDispatcher::removeDelegate(CCKeypadDelegate* pDelegate) { if (!pDelegate) { return; } if (! m_bLocked) { forceRemoveDelegate(pDelegate); } else { ccCArrayAppendValue(m_pHandlersToRemove, pDelegate); m_bToRemove = true; } }
void CCScrollWheelDispatcher::addDelegate(CCScrollWheelDelegate *pDelegate) { if (!pDelegate) { return; } if (!m_bLocked) { forceAddDelegate(pDelegate); } else { ccCArrayAppendValue(m_pDelegatesToAdd, pDelegate); m_bToAdd = true; } }
/** Appends an value. Capacity of arr is increased if needed. */ void ccCArrayAppendValueWithResize(ccCArray *arr, void* value) { ccCArrayEnsureExtraCapacity(arr, 1); ccCArrayAppendValue(arr, value); }