예제 #1
0
	virtual void ccTouchEnded(CCTouch *pTouch, CCEvent *pEvent){
		if(!isVisible()){
			return;
		}
		CCTableViewCell *cell = cellForTouch(pTouch);
		if(cell){
			CCTableViewDelegate *dele = getTableViewDelegate();
			LuaEventHandler *h = dynamic_cast<LuaEventHandler *>(dele);
#if COCOS2D_VERSION >= 0x00030000
			Array *touches = _touches;
#else
			CCArray *touches = m_pTouches;
#endif
			if(touches->count() == 1 && !isTouchMoved()){
				if(h){	h->tableCellTouched(this, cell, pTouch);}
				else{	dele->tableCellTouched(this, cell);}
				dele->tableCellUnhighlight(this, cell);
			}else if(h){
				h->tableCellTouchEnded(this, cell, pTouch);
			}
		}else{
			printf("LuaTableView.touchEnded cell is null %f,%f\n", pTouch->getLocation().x, pTouch->getLocation().y);
		}
		CCScrollView::ccTouchEnded(pTouch, pEvent);
	}
예제 #2
0
void MenuItem::endTouch(cocos2d::CCTouch *touch) {
    if (!_touched) {
        return;
    }
    
    unselected();
    if (hasTouched(touch) && (!isTouchMoved(touch))) {
        activate();
    }
}
예제 #3
0
void MenuItem::ccTouchMoved(cocos2d::CCTouch *pTouch, cocos2d::CCEvent *pEvent) {
    if (!_touched) {
        return;
    }
    
    if (hasTouched(pTouch) && (!isTouchMoved(pTouch))) {
        selected();
    } else {
        unselected();
    }
}
예제 #4
0
///重写当移动时回调
void CTableView::ccTouchMoved(CCTouch *pTouch, CCEvent *pEvent)
{
	CCScrollView::ccTouchMoved(pTouch, pEvent);

    if (m_pTouchedCell && isTouchMoved()) {
        if(m_pTableViewDelegate != NULL) {
            m_pTableViewDelegate->tableCellUnhighlight(this, m_pTouchedCell);
        }
		((CTableViewCell*)m_pTouchedCell)->unselected();
        m_pTouchedCell = NULL;
    }
}
예제 #5
0
void LuaTableView::ccTouchEnded(CCTouch *pTouch, CCEvent *pEvent){
	if(!isVisible()){
		return;
	}
	CCTableViewCell *cell = cellForTouch(pTouch);
	if(cell){
		LuaEventHandler *h = dynamic_cast<LuaEventHandler *>(m_pTableViewDelegate);
		if(m_pTouches->count() == 1 && !isTouchMoved()){
			if(h){	h->tableCellTouched(this, cell, pTouch);}
			else{	m_pTableViewDelegate->tableCellTouched(this, cell);}
		}else if(h){
			h->tableCellTouchEnded(this, cell, pTouch);
		}
	}else{
		printf("LTV.touchEnded cell is null %f,%f\n", pTouch->getLocation().x, pTouch->getLocation().y);
	}
	CCScrollView::ccTouchEnded(pTouch, pEvent);
}
예제 #6
0
void WXTableView::onTouchMoved(CCTouch *pTouch, CCEvent *pEvent)
{
	if (!this->isVisible()) 
	{
		return;
	}
	ScrollView::onTouchMoved(pTouch, pEvent);
	m_lastPoint = pTouch->getLocation();
	float dx = m_beginPoint.x - m_lastPoint.x;
	float dy = m_beginPoint.y - m_lastPoint.y;
	if ((-m_fMoveDelta < dx &&  dx < m_fMoveDelta) && (-m_fMoveDelta < dy && dy < m_fMoveDelta))
	{
		_touchMoved = false;
	}
	if (_touchedCell && isTouchMoved())
	{
		if(_tableViewDelegate != NULL)
		{
			_tableViewDelegate->tableCellUnhighlight(this, _touchedCell);
		}
		_touchedCell = NULL;
	}
}