2012-06-14 05:19:13 +08:00
|
|
|
#include "ButtonTestLayer.h"
|
|
|
|
|
|
|
|
USING_NS_CC;
|
|
|
|
USING_NS_CC_EXT;
|
2013-10-15 18:00:03 +08:00
|
|
|
using namespace cocosbuilder;
|
2012-06-14 05:19:13 +08:00
|
|
|
|
2012-06-19 16:31:26 +08:00
|
|
|
ButtonTestLayer::ButtonTestLayer()
|
2013-06-20 14:17:10 +08:00
|
|
|
: mControlEventLabel(NULL)
|
2012-06-19 16:31:26 +08:00
|
|
|
{}
|
|
|
|
|
|
|
|
ButtonTestLayer::~ButtonTestLayer()
|
|
|
|
{
|
2013-06-20 14:17:10 +08:00
|
|
|
CC_SAFE_RELEASE(mControlEventLabel);
|
2012-06-19 16:31:26 +08:00
|
|
|
}
|
|
|
|
|
2013-07-24 18:17:20 +08:00
|
|
|
SEL_MenuHandler ButtonTestLayer::onResolveCCBCCMenuItemSelector(Object * pTarget, const char * pSelectorName) {
|
2012-06-14 05:19:13 +08:00
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
2013-07-26 15:22:45 +08:00
|
|
|
Control::Handler ButtonTestLayer::onResolveCCBCCControlSelector(Object * pTarget, const char * pSelectorName) {
|
2013-07-27 21:44:49 +08:00
|
|
|
CCB_SELECTORRESOLVER_CCCONTROL_GLUE(this, "onCCControlButtonClicked", ButtonTestLayer::onControlButtonClicked);
|
2012-06-15 09:16:54 +08:00
|
|
|
|
2012-06-14 05:19:13 +08:00
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
2013-06-20 14:17:10 +08:00
|
|
|
bool ButtonTestLayer::onAssignCCBMemberVariable(Object * pTarget, const char * pMemberVariableName, Node * pNode) {
|
2013-07-27 21:44:49 +08:00
|
|
|
CCB_MEMBERVARIABLEASSIGNER_GLUE(this, "mCCControlEventLabel", LabelBMFont *, this->mControlEventLabel);
|
2012-06-15 09:16:54 +08:00
|
|
|
|
2012-06-14 16:32:52 +08:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2013-10-15 18:00:03 +08:00
|
|
|
void ButtonTestLayer::onControlButtonClicked(cocos2d::Object *pSender, Control::EventType pControlEvent) {
|
2013-06-20 14:17:10 +08:00
|
|
|
switch(pControlEvent) {
|
2013-07-26 14:37:26 +08:00
|
|
|
case Control::EventType::TOUCH_DOWN:
|
2013-06-20 14:17:10 +08:00
|
|
|
this->mControlEventLabel->setString("Touch Down.");
|
2012-06-14 16:32:52 +08:00
|
|
|
break;
|
2013-07-26 14:37:26 +08:00
|
|
|
case Control::EventType::DRAG_INSIDE:
|
2013-06-20 14:17:10 +08:00
|
|
|
this->mControlEventLabel->setString("Touch Drag Inside.");
|
2012-06-14 16:32:52 +08:00
|
|
|
break;
|
2013-07-26 14:37:26 +08:00
|
|
|
case Control::EventType::DRAG_OUTSIDE:
|
2013-06-20 14:17:10 +08:00
|
|
|
this->mControlEventLabel->setString("Touch Drag Outside.");
|
2012-06-14 16:32:52 +08:00
|
|
|
break;
|
2013-07-26 14:37:26 +08:00
|
|
|
case Control::EventType::DRAG_ENTER:
|
2013-06-20 14:17:10 +08:00
|
|
|
this->mControlEventLabel->setString("Touch Drag Enter.");
|
2012-06-14 16:32:52 +08:00
|
|
|
break;
|
2013-07-26 14:37:26 +08:00
|
|
|
case Control::EventType::DRAG_EXIT:
|
2013-06-20 14:17:10 +08:00
|
|
|
this->mControlEventLabel->setString("Touch Drag Exit.");
|
2012-06-14 16:32:52 +08:00
|
|
|
break;
|
2013-07-26 14:37:26 +08:00
|
|
|
case Control::EventType::TOUCH_UP_INSIDE:
|
2013-06-20 14:17:10 +08:00
|
|
|
this->mControlEventLabel->setString("Touch Up Inside.");
|
2012-06-14 16:32:52 +08:00
|
|
|
break;
|
2013-07-26 14:37:26 +08:00
|
|
|
case Control::EventType::TOUCH_UP_OUTSIDE:
|
2013-06-20 14:17:10 +08:00
|
|
|
this->mControlEventLabel->setString("Touch Up Outside.");
|
2012-06-14 16:32:52 +08:00
|
|
|
break;
|
2013-07-26 14:37:26 +08:00
|
|
|
case Control::EventType::TOUCH_CANCEL:
|
2013-06-20 14:17:10 +08:00
|
|
|
this->mControlEventLabel->setString("Touch Cancel.");
|
2012-06-14 16:32:52 +08:00
|
|
|
break;
|
2013-07-26 14:37:26 +08:00
|
|
|
case Control::EventType::VALUE_CHANGED:
|
2013-06-20 14:17:10 +08:00
|
|
|
this->mControlEventLabel->setString("Value Changed.");
|
2012-06-14 16:32:52 +08:00
|
|
|
break;
|
|
|
|
default:
|
|
|
|
assert(false); // OH SHIT!
|
|
|
|
}
|
2012-06-14 05:19:13 +08:00
|
|
|
}
|