Beispiel #1
0
void CButton::onTouchEnded(Touch* pTouch, float fDuration)
{
	CC_WIDGET_LONGCLICK_ONTOUCHENDED;

	if( m_pSelectedImage )
	{
		Point touchPointInView = _parent->convertToNodeSpace(pTouch->getLocation());
		if( getBoundingBox().containsPoint(touchPointInView) )
		{
			CC_SAFE_SET_VISIBLE(m_pNormalImage, true);
			m_pSelectedImage->setVisible(false);
			executeClickHandler(this);
		}
		else
		{
			CC_SAFE_SET_VISIBLE(m_pNormalImage, true);
			m_pSelectedImage->setVisible(false);
		}
	}
	else
	{
		Point touchPointInView = _parent->convertToNodeSpace(pTouch->getLocation());
		if( getBoundingBox().containsPoint(touchPointInView) )
		{
			CC_SAFE_SET_VISIBLE(m_pNormalImage, true);
			executeClickHandler(this);
		}
		CC_SAFE_SET_VISIBLE(m_pNormalImage, true);
	}
}
Beispiel #2
0
void CCheckBox::onTouchEnded(CCTouch* pTouch, float fDuration)
{
	CC_WIDGET_LONGCLICK_ONTOUCHENDED;

	CCPoint tPoint = m_pParent->convertToNodeSpace(pTouch->getLocation());
	if( boundingBox().containsPoint(tPoint) )
	{
		if( isChecked() )
		{
			setChecked(false);
		}
		else
		{
			setChecked(true);
		}
		executeClickHandler(this);
	}
	else
	{
		if( isChecked() )
		{
			SAFE_SET_VISIBLE(m_pNormalPress, false);
			SAFE_SET_VISIBLE(m_pNormal, false);
			SAFE_SET_VISIBLE(m_pCheckedPress, false);
			SAFE_SET_VISIBLE(m_pChecked, true);
		}
		else
		{
			SAFE_SET_VISIBLE(m_pNormalPress, false);
			SAFE_SET_VISIBLE(m_pNormal, true);
			SAFE_SET_VISIBLE(m_pCheckedPress, false);
			SAFE_SET_VISIBLE(m_pChecked, false);
		}
	}
}
Beispiel #3
0
void ArmatureBtn::onTouchEnded(Touch *pTouch, float fDuration)
{
	Point touchPointInView = _parent->convertToNodeSpace(pTouch->getLocation());
	if( getBoundingBox().containsPoint(touchPointInView) )
	{
		executeClickHandler(this);
	}
	this->getAnimation()->play("normal",0,1);
}
Beispiel #4
0
void CImageView::onTouchEnded(CCTouch *pTouch, float fDuration)
{
	CC_WIDGET_LONGCLICK_ONTOUCHENDED;

	CCPoint touchPointInView = m_pParent->convertToNodeSpace(pTouch->getLocation());
	if( boundingBox().containsPoint(touchPointInView) )
	{
		executeClickHandler(this);
	}
}
Beispiel #5
0
void CColorView::onTouchEnded(Touch* pTouch, float fDuration)
{
	CC_WIDGET_LONGCLICK_ONTOUCHENDED;

	Point tPoint = _parent->convertTouchToNodeSpace(pTouch);
	if( getBoundingBox().containsPoint(tPoint) )
	{
		executeClickHandler(this);
	}
}
Beispiel #6
0
void CircleMenu::onTouchEnded(Touch *touch, float fDuration)
{
	m_isMouseDown = false;
	
	Vector<Node*> vet = this->getChildren();
	int length = vet.size();
	Node *pChild = nullptr;
	for (int j = 0; j < length; j++){
		if (vet.at(j)->getLocalZOrder() == length - 1){
			pChild = vet.at(j);
			break;
		}
	}
	if (pChild->getBoundingBox().containsPoint(convertToNodeSpace(touch->getLocation()))){
		executeClickHandler(pChild);
	}
}