void CAView::updateDraw() { CAView* v = this->getSuperview(); CC_RETURN_IF(v == NULL); while (v == v->getSuperview()) { CC_BREAK_IF(v == NULL); CC_RETURN_IF(v->isVisible()); } SET_DIRTY_RECURSIVELY(); this->reViewlayout(); CAApplication::getApplication()->updateDraw(); }
CAResponder* getLastResponder(CATouch* touch, const CAVector<CAView*>& subviews) { CAResponder* lastResponder = NULL; for (CAVector<CAView*>::const_reverse_iterator itr=subviews.rbegin(); itr!=subviews.rend(); itr++) { CAView* subview = *itr; if (subview->isVisible()) { if (CAViewController* viewController = dynamic_cast<CAViewController*>(subview->getContentContainer())) { CC_CONTINUE_IF(!viewController->isTouchEnabled()); DPoint point = subview->convertTouchToNodeSpace(touch); if (subview->getBounds().containsPoint(point)) { lastResponder = viewController; break; } } else { CC_CONTINUE_IF(!subview->isTouchEnabled()); DPoint point = subview->convertTouchToNodeSpace(touch); if (subview->getBounds().containsPoint(point)) { lastResponder = subview; break; } } } } return lastResponder; }
std::vector<CAResponder*> CATouchController::getEventListener(CATouch* touch, CAView* view) { CAResponder* responder = view; std::vector<CAResponder*> vector; do { vector.push_back(responder); CAResponder* nextResponder = NULL; if (CAView* view = dynamic_cast<CAView*>(responder)) { if (view->getViewDelegate()) { nextResponder = view->nextResponder(); } else { view->sortAllSubviews(); CAVector<CAView*>::const_reverse_iterator itr; for (itr=view->getSubviews().rbegin(); itr!=view->getSubviews().rend(); itr++) { CAView* subview = *itr; if (subview->isVisible() && subview->isTouchEnabled()) { CCPoint point = subview->convertTouchToNodeSpace(touch); if (subview->getBounds().containsPoint(point)) { nextResponder = subview; break; } } } } } else if (CAViewController* viewController = dynamic_cast<CAViewController*>(responder)) { CAVector<CAView*>::const_reverse_iterator itr; for (itr=viewController->getView()->getSubviews().rbegin(); itr!=viewController->getView()->getSubviews().rend(); itr++) { CAView* subview = *itr; if (subview->isVisible() && subview->isTouchEnabled()) { CCPoint point = subview->convertTouchToNodeSpace(touch); if (subview->getBounds().containsPoint(point)) { nextResponder = subview; break; } } } } responder = nextResponder; } while (responder); return vector; }