Пример #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
LuaEventHandler * CCBProxy::getHandler(const int handler){
	CCObject *o;
	LuaEventHandler *h;
	CCARRAY_FOREACH(_handlers, o){
		h = (LuaEventHandler *)o;
		if(h->getHandler() == handler){
			return h;
		}
	}
Пример #3
0
bool LuaTableView::ccTouchBegan(CCTouch *t, CCEvent *e){
	bool r = CCScrollView::ccTouchBegan(t, e);
	if(r){
		CCTableViewCell *c = cellForTouch(t);
		LuaEventHandler *h = dynamic_cast<LuaEventHandler *>(m_pTableViewDelegate);
		if(c && h){
			h->tableCellTouchBegan(this, c, t);
		}
	}
	return r;
}
Пример #4
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);
}
Пример #5
0
	virtual void scrollViewDidZoom(CCScrollView *s){
		CCTableView::scrollViewDidZoom(s);
		_handler->scrollViewDidZoom(this);
	}
Пример #6
0
	virtual void scrollViewDidScroll(CCScrollView *s){
		CCTableView::scrollViewDidScroll(s);
		_handler->scrollViewDidScroll(this);
		updateScroll();
	}
Пример #7
0
LuaEventHandler * LuaEventHandler::create(lua_State *l){
	LuaEventHandler *h = new LuaEventHandler();
	h->_lua = l == NULL? luaStateForEngine() : l;
	h->autorelease();
	return h;
}