diff --git a/cocos/ui/UIDeprecated.h b/cocos/ui/UIDeprecated.h index 6e84204775..997e930fd3 100644 --- a/cocos/ui/UIDeprecated.h +++ b/cocos/ui/UIDeprecated.h @@ -39,6 +39,7 @@ CC_DEPRECATED_ATTRIBUTE const Widget::SizeType SIZE_ABSOLUTE = Widget::SizeType: CC_DEPRECATED_ATTRIBUTE const Widget::SizeType SIZE_PERCENT = Widget::SizeType::PERCENT; + } diff --git a/tests/cpp-tests/Classes/ExtensionsTest/CocoStudioSceneTest/SceneEditorTest.cpp b/tests/cpp-tests/Classes/ExtensionsTest/CocoStudioSceneTest/SceneEditorTest.cpp index 53a0d0697b..d2f2781d42 100644 --- a/tests/cpp-tests/Classes/ExtensionsTest/CocoStudioSceneTest/SceneEditorTest.cpp +++ b/tests/cpp-tests/Classes/ExtensionsTest/CocoStudioSceneTest/SceneEditorTest.cpp @@ -399,16 +399,17 @@ cocos2d::Node* UIComponentTest::createGameScene() ComRender *render = static_cast(_node->getChildByTag(10025)->getComponent("GUIComponent")); Widget* widget = static_cast(render->getNode()); Button* button = static_cast(widget->getChildByName("Button_156")); - button->addTouchEventListener(this, toucheventselector(UIComponentTest::touchEvent)); +// button->addTouchEventListener(this, toucheventselector(UIComponentTest::touchEvent)); + button->addTouchEventListener(CC_CALLBACK_2(UIComponentTest::touchEvent, this)); return node; } -void UIComponentTest::touchEvent(Ref *pSender, TouchEventType type) +void UIComponentTest::touchEvent(Ref *pSender, ui::Widget::TouchEventType type) { switch (type) { - case TOUCH_EVENT_BEGAN: + case ui::Widget::TouchEventType::BEGAN: { ComRender *pBlowFish = static_cast(_node->getChildByTag(10010)->getComponent("CCArmature")); pBlowFish->getNode()->runAction(CCMoveBy::create(10.0f, Vector2(-1000.0f, 0))); diff --git a/tests/cpp-tests/Classes/ExtensionsTest/CocoStudioSceneTest/SceneEditorTest.h b/tests/cpp-tests/Classes/ExtensionsTest/CocoStudioSceneTest/SceneEditorTest.h index 050e5339a7..3b3704e474 100644 --- a/tests/cpp-tests/Classes/ExtensionsTest/CocoStudioSceneTest/SceneEditorTest.h +++ b/tests/cpp-tests/Classes/ExtensionsTest/CocoStudioSceneTest/SceneEditorTest.h @@ -100,7 +100,7 @@ public: virtual void onEnter() override; virtual void onExit() override; cocos2d::Node* createGameScene(); - void touchEvent(cocos2d::Ref *pSender, cocos2d::ui::TouchEventType type); + void touchEvent(cocos2d::Ref *pSender, ui::Widget::TouchEventType type); private: cocos2d::Node* _node; }; diff --git a/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/CustomGUIScene.h b/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/CustomGUIScene.h index 09e14a24af..b685b6b1d5 100644 --- a/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/CustomGUIScene.h +++ b/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/CustomGUIScene.h @@ -19,7 +19,7 @@ public: void onTouchesBegan(const std::vector& touches, Event *event); // void onTouchesMoved(const std::vector& touches, Event *event); - void touchEvent(Ref* pSender, TouchEventType type); + void touchEvent(Ref* pSender, Widget::TouchEventType type); private: Vector2 _beginPos; diff --git a/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UIButtonTest/UIButtonTest.cpp b/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UIButtonTest/UIButtonTest.cpp index 221196c2b0..bcc8146bfe 100644 --- a/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UIButtonTest/UIButtonTest.cpp +++ b/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UIButtonTest/UIButtonTest.cpp @@ -39,7 +39,8 @@ bool UIButtonTest::init() Button* button = Button::create("cocosui/animationbuttonnormal.png", "cocosui/animationbuttonpressed.png"); button->setPosition(Vector2(widgetSize.width / 2.0f, widgetSize.height / 2.0f)); - button->addTouchEventListener(this, toucheventselector(UIButtonTest::touchEvent)); +// button->addTouchEventListener(this, toucheventselector(UIButtonTest::touchEvent)); + button->addTouchEventListener(CC_CALLBACK_2(UIButtonTest::touchEvent, this)); _uiLayer->addChild(button); return true; @@ -47,23 +48,23 @@ bool UIButtonTest::init() return false; } -void UIButtonTest::touchEvent(Ref *pSender, TouchEventType type) +void UIButtonTest::touchEvent(Ref *pSender, Widget::TouchEventType type) { switch (type) { - case TOUCH_EVENT_BEGAN: + case Widget::TouchEventType::BEGAN: _displayValueLabel->setText(String::createWithFormat("Touch Down")->getCString()); break; - case TOUCH_EVENT_MOVED: + case Widget::TouchEventType::MOVED: _displayValueLabel->setText(String::createWithFormat("Touch Move")->getCString()); break; - case TOUCH_EVENT_ENDED: + case Widget::TouchEventType::ENDED: _displayValueLabel->setText(String::createWithFormat("Touch Up")->getCString()); break; - case TOUCH_EVENT_CANCELED: + case Widget::TouchEventType::CANCELED: _displayValueLabel->setText(String::createWithFormat("Touch Cancelled")->getCString()); break; @@ -110,7 +111,8 @@ bool UIButtonTest_Scale9::init() button->setScale9Enabled(true); button->setPosition(Vector2(widgetSize.width / 2.0f, widgetSize.height / 2.0f)); button->setSize(Size(150, 70)); - button->addTouchEventListener(this, toucheventselector(UIButtonTest_Scale9::touchEvent)); +// button->addTouchEventListener(this, toucheventselector(UIButtonTest_Scale9::touchEvent)); + button->addTouchEventListener(CC_CALLBACK_2(UIButtonTest_Scale9::touchEvent, this)); _uiLayer->addChild(button); return true; @@ -118,23 +120,23 @@ bool UIButtonTest_Scale9::init() return false; } -void UIButtonTest_Scale9::touchEvent(Ref *pSender, TouchEventType type) +void UIButtonTest_Scale9::touchEvent(Ref *pSender, Widget::TouchEventType type) { switch (type) { - case TOUCH_EVENT_BEGAN: + case Widget::TouchEventType::BEGAN: _displayValueLabel->setText(String::createWithFormat("Touch Down")->getCString()); break; - case TOUCH_EVENT_MOVED: + case Widget::TouchEventType::MOVED: _displayValueLabel->setText(String::createWithFormat("Touch Move")->getCString()); break; - case TOUCH_EVENT_ENDED: + case Widget::TouchEventType::ENDED: _displayValueLabel->setText(String::createWithFormat("Touch Up")->getCString()); break; - case TOUCH_EVENT_CANCELED: + case Widget::TouchEventType::CANCELED: _displayValueLabel->setText(String::createWithFormat("Touch Cancelled")->getCString()); break; @@ -178,7 +180,8 @@ bool UIButtonTest_PressedAction::init() Button* button = Button::create("cocosui/animationbuttonnormal.png", "cocosui/animationbuttonpressed.png"); button->setPressedActionEnabled(true); button->setPosition(Vector2(widgetSize.width / 2.0f, widgetSize.height / 2.0f)); - button->addTouchEventListener(this, toucheventselector(UIButtonTest_PressedAction::touchEvent)); +// button->addTouchEventListener(this, toucheventselector(UIButtonTest_PressedAction::touchEvent)); + button->addTouchEventListener(CC_CALLBACK_2(UIButtonTest_PressedAction::touchEvent, this)); _uiLayer->addChild(button); return true; @@ -186,23 +189,23 @@ bool UIButtonTest_PressedAction::init() return false; } -void UIButtonTest_PressedAction::touchEvent(Ref *pSender, TouchEventType type) +void UIButtonTest_PressedAction::touchEvent(Ref *pSender, Widget::TouchEventType type) { switch (type) { - case TOUCH_EVENT_BEGAN: + case Widget::TouchEventType::BEGAN: _displayValueLabel->setText(String::createWithFormat("Touch Down")->getCString()); break; - case TOUCH_EVENT_MOVED: + case Widget::TouchEventType::MOVED: _displayValueLabel->setText(String::createWithFormat("Touch Move")->getCString()); break; - case TOUCH_EVENT_ENDED: + case Widget::TouchEventType::ENDED: _displayValueLabel->setText(String::createWithFormat("Touch Up")->getCString()); break; - case TOUCH_EVENT_CANCELED: + case Widget::TouchEventType::CANCELED: _displayValueLabel->setText(String::createWithFormat("Touch Cancelled")->getCString()); break; @@ -246,7 +249,8 @@ bool UIButtonTest_Title::init() Button* button = Button::create("cocosui/backtotoppressed.png", "cocosui/backtotopnormal.png"); button->setTitleText("Title Button"); button->setPosition(Vector2(widgetSize.width / 2.0f, widgetSize.height / 2.0f)); - button->addTouchEventListener(this, toucheventselector(UIButtonTest_Title::touchEvent)); +// button->addTouchEventListener(this, toucheventselector(UIButtonTest_Title::touchEvent)); + button->addTouchEventListener(CC_CALLBACK_2(UIButtonTest_Title::touchEvent, this)); _uiLayer->addChild(button); return true; @@ -255,23 +259,23 @@ bool UIButtonTest_Title::init() } -void UIButtonTest_Title::touchEvent(Ref *pSender, TouchEventType type) +void UIButtonTest_Title::touchEvent(Ref *pSender, Widget::TouchEventType type) { switch (type) { - case TOUCH_EVENT_BEGAN: + case Widget::TouchEventType::BEGAN: _displayValueLabel->setText(String::createWithFormat("Touch Down")->getCString()); break; - case TOUCH_EVENT_MOVED: + case Widget::TouchEventType::MOVED: _displayValueLabel->setText(String::createWithFormat("Touch Move")->getCString()); break; - case TOUCH_EVENT_ENDED: + case Widget::TouchEventType::ENDED: _displayValueLabel->setText(String::createWithFormat("Touch Up")->getCString()); break; - case TOUCH_EVENT_CANCELED: + case Widget::TouchEventType::CANCELED: _displayValueLabel->setText(String::createWithFormat("Touch Cancelled")->getCString()); break; diff --git a/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UIButtonTest/UIButtonTest.h b/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UIButtonTest/UIButtonTest.h index 7ac14a24f2..0cf2f01c8f 100644 --- a/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UIButtonTest/UIButtonTest.h +++ b/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UIButtonTest/UIButtonTest.h @@ -33,7 +33,7 @@ public: UIButtonTest(); ~UIButtonTest(); bool init(); - void touchEvent(Ref *pSender, TouchEventType type); + void touchEvent(Ref *pSender, Widget::TouchEventType type); protected: UI_SCENE_CREATE_FUNC(UIButtonTest) @@ -46,7 +46,7 @@ public: UIButtonTest_Scale9(); ~UIButtonTest_Scale9(); bool init(); - void touchEvent(Ref *pSender, TouchEventType type); + void touchEvent(Ref *pSender, Widget::TouchEventType type); protected: UI_SCENE_CREATE_FUNC(UIButtonTest_Scale9) @@ -59,7 +59,7 @@ public: UIButtonTest_PressedAction(); ~UIButtonTest_PressedAction(); bool init(); - void touchEvent(Ref *pSender, TouchEventType type); + void touchEvent(Ref *pSender, Widget::TouchEventType type); protected: UI_SCENE_CREATE_FUNC(UIButtonTest_PressedAction) @@ -72,7 +72,7 @@ public: UIButtonTest_Title(); ~UIButtonTest_Title(); bool init(); - void touchEvent(Ref *pSender, TouchEventType type); + void touchEvent(Ref *pSender, Widget::TouchEventType type); protected: UI_SCENE_CREATE_FUNC(UIButtonTest_Title) diff --git a/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UIButtonTest/UIButtonTest_Editor.cpp b/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UIButtonTest/UIButtonTest_Editor.cpp index 554e7763a0..26ab2f1ee6 100644 --- a/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UIButtonTest/UIButtonTest_Editor.cpp +++ b/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UIButtonTest/UIButtonTest_Editor.cpp @@ -30,18 +30,22 @@ bool UIButtonTest_Editor::init() Layout* root = static_cast(_layout->getChildByName("root_Panel")); Text* back_label = static_cast(Helper::seekWidgetByName(root, "back")); - back_label->addTouchEventListener(this, toucheventselector(UIScene_Editor::toGUIEditorTestScene)); +// back_label->addTouchEventListener(this, toucheventselector(UIScene_Editor::toGUIEditorTestScene)); + back_label->addTouchEventListener(CC_CALLBACK_2(UIScene_Editor::toGUIEditorTestScene, this)); _sceneTitle = static_cast(Helper::seekWidgetByName(root, "UItest")); Button* button = static_cast(Helper::seekWidgetByName(root, "Button_123")); - button->addTouchEventListener(this, toucheventselector(UIButtonTest_Editor::touchEvent)); +// button->addTouchEventListener(this, toucheventselector(UIButtonTest_Editor::touchEvent)); + button->addTouchEventListener(CC_CALLBACK_2(UIButtonTest_Editor::touchEvent, this)); Button* title_button = static_cast(Helper::seekWidgetByName(root, "Button_126")); - title_button->addTouchEventListener(this, toucheventselector(UIButtonTest_Editor::touchEvent)); +// title_button->addTouchEventListener(this, toucheventselector(UIButtonTest_Editor::touchEvent)); + title_button->addTouchEventListener(CC_CALLBACK_2(UIButtonTest_Editor::touchEvent, this)); Button* scale9_button = static_cast(Helper::seekWidgetByName(root, "Button_129")); - scale9_button->addTouchEventListener(this, toucheventselector(UIButtonTest_Editor::touchEvent)); +// scale9_button->addTouchEventListener(this, toucheventselector(UIButtonTest_Editor::touchEvent)); + scale9_button->addTouchEventListener(CC_CALLBACK_2(UIButtonTest_Editor::touchEvent, this)); _displayValueLabel = Text::create(); _displayValueLabel->setFontName("fonts/Marker Felt.ttf"); @@ -57,23 +61,23 @@ bool UIButtonTest_Editor::init() return false; } -void UIButtonTest_Editor::touchEvent(Ref *pSender, TouchEventType type) +void UIButtonTest_Editor::touchEvent(Ref *pSender, Widget::TouchEventType type) { switch (type) { - case TOUCH_EVENT_BEGAN: + case Widget::TouchEventType::BEGAN: _displayValueLabel->setText("Touch Down"); break; - case TOUCH_EVENT_MOVED: + case Widget::TouchEventType::MOVED: _displayValueLabel->setText("Touch Moved"); break; - case TOUCH_EVENT_ENDED: + case Widget::TouchEventType::ENDED: _displayValueLabel->setText("Touch Ended"); break; - case TOUCH_EVENT_CANCELED: + case Widget::TouchEventType::CANCELED: _displayValueLabel->setText("Touch Canceled"); break; diff --git a/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UIButtonTest/UIButtonTest_Editor.h b/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UIButtonTest/UIButtonTest_Editor.h index 9fac7b9590..1985dcb907 100644 --- a/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UIButtonTest/UIButtonTest_Editor.h +++ b/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UIButtonTest/UIButtonTest_Editor.h @@ -34,7 +34,7 @@ public: ~UIButtonTest_Editor(); bool init(); - void touchEvent(Ref* pSender, TouchEventType type); + void touchEvent(Ref* pSender, Widget::TouchEventType type); protected: UI_SCENE_EDITOR_CREATE_FUNC(UIButtonTest_Editor); diff --git a/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UICheckBoxTest/UICheckBoxTest_Editor.cpp b/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UICheckBoxTest/UICheckBoxTest_Editor.cpp index d267f8fa47..5fc82d4238 100644 --- a/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UICheckBoxTest/UICheckBoxTest_Editor.cpp +++ b/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UICheckBoxTest/UICheckBoxTest_Editor.cpp @@ -30,7 +30,7 @@ bool UICheckBoxTest_Editor::init() Layout* root = static_cast(_layout->getChildByName("root_Panel")); Text* back_label = static_cast(Helper::seekWidgetByName(root, "back")); - back_label->addTouchEventListener(this, toucheventselector(UIScene_Editor::toGUIEditorTestScene)); + back_label->addTouchEventListener(CC_CALLBACK_2(UIScene_Editor::toGUIEditorTestScene, this)); _sceneTitle = static_cast(Helper::seekWidgetByName(root, "UItest")); diff --git a/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UIFocusTest/UIFocusTest.cpp b/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UIFocusTest/UIFocusTest.cpp index 4dec52d51d..22059a3f78 100644 --- a/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UIFocusTest/UIFocusTest.cpp +++ b/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UIFocusTest/UIFocusTest.cpp @@ -60,9 +60,9 @@ bool UIFocusTestBase::init() return false; } -void UIFocusTestBase::onImageViewClicked(cocos2d::Ref *ref, TouchEventType touchType) +void UIFocusTestBase::onImageViewClicked(cocos2d::Ref *ref, Widget::TouchEventType touchType) { - if (touchType == TouchEventType::TOUCH_EVENT_ENDED) { + if (touchType == Widget::TouchEventType::ENDED) { Widget *w = (Widget*)ref; if (w->isFocusEnabled()) { w->setFocusEnabled(false); @@ -166,7 +166,7 @@ bool UIFocusTestHorizontal::init() ImageView *w = ImageView::create("cocosui/scrollviewbg.png"); w->setTouchEnabled(true); w->setTag(i); - w->addTouchEventListener(this, toucheventselector(UIFocusTestHorizontal::onImageViewClicked)); + w->addTouchEventListener(CC_CALLBACK_2(UIFocusTestHorizontal::onImageViewClicked, this)); _horizontalLayout->addChild(w); } @@ -179,7 +179,7 @@ bool UIFocusTestHorizontal::init() btn->setTitleText("Toggle Loop"); btn->setPosition(Vector2(60, winSize.height - 50)); btn->setTitleColor(Color3B::RED); - btn->addTouchEventListener(this, toucheventselector(UIFocusTestHorizontal::toggleFocusLoop)); + btn->addTouchEventListener(CC_CALLBACK_2(UIFocusTestHorizontal::toggleFocusLoop,this)); this->addChild(btn); @@ -191,9 +191,9 @@ bool UIFocusTestHorizontal::init() -void UIFocusTestHorizontal::toggleFocusLoop(cocos2d::Ref * pObjc, TouchEventType type) +void UIFocusTestHorizontal::toggleFocusLoop(cocos2d::Ref * pObjc, Widget::TouchEventType type) { - if (type == TouchEventType::TOUCH_EVENT_ENDED) { + if (type == Widget::TouchEventType::ENDED) { _horizontalLayout->setLoopFocus(!_horizontalLayout->isLoopFocus()); if (_horizontalLayout->isLoopFocus()) { _loopText->setText("loop enabled"); @@ -236,7 +236,7 @@ bool UIFocusTestVertical::init() ImageView *w = ImageView::create("cocosui/scrollviewbg.png"); w->setTouchEnabled(true); w->setTag(i); - w->addTouchEventListener(this, toucheventselector(UIFocusTestVertical::onImageViewClicked)); + w->addTouchEventListener(CC_CALLBACK_2(UIFocusTestVertical::onImageViewClicked, this)); _verticalLayout->addChild(w); if (i == 2) { w->requestFocus(); @@ -252,7 +252,7 @@ bool UIFocusTestVertical::init() btn->setTitleText("Toggle Loop"); btn->setPosition(Vector2(60, winSize.height - 50)); btn->setTitleColor(Color3B::RED); - btn->addTouchEventListener(this, toucheventselector(UIFocusTestHorizontal::toggleFocusLoop)); + btn->addTouchEventListener(CC_CALLBACK_2(UIFocusTestVertical::toggleFocusLoop, this)); this->addChild(btn); @@ -262,9 +262,9 @@ bool UIFocusTestVertical::init() } -void UIFocusTestVertical::toggleFocusLoop(cocos2d::Ref * pObjc, TouchEventType type) +void UIFocusTestVertical::toggleFocusLoop(cocos2d::Ref * pObjc, Widget::TouchEventType type) { - if (type == TouchEventType::TOUCH_EVENT_ENDED) { + if (type == Widget::TouchEventType::ENDED) { _verticalLayout->setLoopFocus(!_verticalLayout->isLoopFocus()); if (_verticalLayout->isLoopFocus()) { _loopText->setText("loop enabled"); @@ -308,7 +308,7 @@ bool UIFocusTestNestedLayout1::init() w->setTouchEnabled(true); w->setScaleX(2.5); w->setTag(i+count1); - w->addTouchEventListener(this, toucheventselector(UIFocusTestVertical::onImageViewClicked)); + w->addTouchEventListener(CC_CALLBACK_2(UIFocusTestNestedLayout1::onImageViewClicked, this)); _verticalLayout->addChild(w); } @@ -325,7 +325,7 @@ bool UIFocusTestNestedLayout1::init() w->setScaleY(2.0); w->setTouchEnabled(true); w->setTag(i+count1+count2); - w->addTouchEventListener(this, toucheventselector(UIFocusTestVertical::onImageViewClicked)); + w->addTouchEventListener(CC_CALLBACK_2(UIFocusTestNestedLayout1::onImageViewClicked, this)); hbox->addChild(w); } @@ -341,7 +341,7 @@ bool UIFocusTestNestedLayout1::init() ImageView *w = ImageView::create("cocosui/scrollviewbg.png"); w->setTouchEnabled(true); w->setTag(i+count1+count2+count3); - w->addTouchEventListener(this, toucheventselector(UIFocusTestVertical::onImageViewClicked)); + w->addTouchEventListener(CC_CALLBACK_2(UIFocusTestNestedLayout1::onImageViewClicked, this)); innerVBox->addChild(w); } @@ -354,7 +354,7 @@ bool UIFocusTestNestedLayout1::init() btn->setTitleText("Toggle Loop"); btn->setPosition(Vector2(60, winSize.height - 50)); btn->setTitleColor(Color3B::RED); - btn->addTouchEventListener(this, toucheventselector(UIFocusTestHorizontal::toggleFocusLoop)); + btn->addTouchEventListener(CC_CALLBACK_2(UIFocusTestNestedLayout1::toggleFocusLoop, this)); this->addChild(btn); @@ -364,9 +364,9 @@ bool UIFocusTestNestedLayout1::init() } -void UIFocusTestNestedLayout1::toggleFocusLoop(cocos2d::Ref * pObjc, TouchEventType type) +void UIFocusTestNestedLayout1::toggleFocusLoop(cocos2d::Ref * pObjc, Widget::TouchEventType type) { - if (type == TouchEventType::TOUCH_EVENT_ENDED) { + if (type == Widget::TouchEventType::ENDED) { _verticalLayout->setLoopFocus(!_verticalLayout->isLoopFocus()); if (_verticalLayout->isLoopFocus()) { _loopText->setText("loop enabled"); @@ -410,7 +410,7 @@ bool UIFocusTestNestedLayout2::init() w->setTouchEnabled(true); w->setTag(i+count1); w->setScaleY(2.4); - w->addTouchEventListener(this, toucheventselector(UIFocusTestVertical::onImageViewClicked)); + w->addTouchEventListener(CC_CALLBACK_2(UIFocusTestNestedLayout2::onImageViewClicked, this)); _horizontalLayout->addChild(w); } @@ -427,7 +427,7 @@ bool UIFocusTestNestedLayout2::init() w->setScaleX(2.0); w->setTouchEnabled(true); w->setTag(i+count1+count2); - w->addTouchEventListener(this, toucheventselector(UIFocusTestVertical::onImageViewClicked)); + w->addTouchEventListener(CC_CALLBACK_2(UIFocusTestNestedLayout2::onImageViewClicked, this)); vbox->addChild(w); } @@ -443,7 +443,7 @@ bool UIFocusTestNestedLayout2::init() ImageView *w = ImageView::create("cocosui/scrollviewbg.png"); w->setTouchEnabled(true); w->setTag(i+count1+count2+count3); - w->addTouchEventListener(this, toucheventselector(UIFocusTestVertical::onImageViewClicked)); + w->addTouchEventListener(CC_CALLBACK_2(UIFocusTestNestedLayout2::onImageViewClicked, this)); innerHBox->addChild(w); } @@ -456,7 +456,7 @@ bool UIFocusTestNestedLayout2::init() btn->setTitleText("Toggle Loop"); btn->setPosition(Vector2(60, winSize.height - 50)); btn->setTitleColor(Color3B::RED); - btn->addTouchEventListener(this, toucheventselector(UIFocusTestHorizontal::toggleFocusLoop)); + btn->addTouchEventListener(CC_CALLBACK_2(UIFocusTestNestedLayout2::toggleFocusLoop, this)); this->addChild(btn); @@ -466,9 +466,9 @@ bool UIFocusTestNestedLayout2::init() } -void UIFocusTestNestedLayout2::toggleFocusLoop(cocos2d::Ref * pObjc, TouchEventType type) +void UIFocusTestNestedLayout2::toggleFocusLoop(cocos2d::Ref * pObjc, Widget::TouchEventType type) { - if (type == TouchEventType::TOUCH_EVENT_ENDED) { + if (type == Widget::TouchEventType::ENDED) { _horizontalLayout->setLoopFocus(!_horizontalLayout->isLoopFocus()); if (_horizontalLayout->isLoopFocus()) { _loopText->setText("loop enabled"); @@ -529,7 +529,7 @@ bool UIFocusTestNestedLayout3::init() ImageView *w = ImageView::create("cocosui/scrollviewbg.png"); w->setTouchEnabled(true); w->setTag(j+firstVbox->getTag()+1); - w->addTouchEventListener(this, toucheventselector(UIFocusTestVertical::onImageViewClicked)); + w->addTouchEventListener(CC_CALLBACK_2(UIFocusTestBase::onImageViewClicked, this)); firstVbox->addChild(w); } @@ -550,7 +550,7 @@ bool UIFocusTestNestedLayout3::init() w->setLayoutParameter(bottomParams); w->setTouchEnabled(true); w->setTag(i+601); - w->addTouchEventListener(this, toucheventselector(UIFocusTestVertical::onImageViewClicked)); + w->addTouchEventListener(CC_CALLBACK_2(UIFocusTestBase::onImageViewClicked, this)); bottomHBox->addChild(w); } _verticalLayout->addChild(bottomHBox); @@ -566,7 +566,7 @@ bool UIFocusTestNestedLayout3::init() btn->setTitleText("Toggle Loop"); btn->setPosition(Vector2(60, winSize.height - 50)); btn->setTitleColor(Color3B::RED); - btn->addTouchEventListener(this, toucheventselector(UIFocusTestHorizontal::toggleFocusLoop)); + btn->addTouchEventListener(CC_CALLBACK_2(UIFocusTestNestedLayout3::toggleFocusLoop, this)); this->addChild(btn); @@ -576,9 +576,9 @@ bool UIFocusTestNestedLayout3::init() } -void UIFocusTestNestedLayout3::toggleFocusLoop(cocos2d::Ref * pObjc, TouchEventType type) +void UIFocusTestNestedLayout3::toggleFocusLoop(cocos2d::Ref * pObjc, Widget::TouchEventType type) { - if (type == TouchEventType::TOUCH_EVENT_ENDED) { + if (type == Widget::TouchEventType::ENDED) { _verticalLayout->setLoopFocus(!_verticalLayout->isLoopFocus()); if (_verticalLayout->isLoopFocus()) { _loopText->setText("loop enabled"); diff --git a/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UIFocusTest/UIFocusTest.h b/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UIFocusTest/UIFocusTest.h index db06c4149d..9f152487f7 100644 --- a/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UIFocusTest/UIFocusTest.h +++ b/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UIFocusTest/UIFocusTest.h @@ -26,7 +26,7 @@ public: virtual void onDownKeyPressed(); virtual void onFocusChanged(Widget* widgetLostFocus, Widget* widgetGetFocus); - void onImageViewClicked(Ref* ref, TouchEventType touchType); + void onImageViewClicked(Ref* ref, Widget::TouchEventType touchType); protected: Menu *_dpadMenu; @@ -42,7 +42,7 @@ public: bool init(); - void toggleFocusLoop(Ref*,TouchEventType); + void toggleFocusLoop(Ref*,Widget::TouchEventType); protected: UI_SCENE_CREATE_FUNC(UIFocusTestHorizontal); @@ -58,7 +58,7 @@ public: bool init(); - void toggleFocusLoop(Ref*,TouchEventType); + void toggleFocusLoop(Ref*,Widget::TouchEventType); protected: UI_SCENE_CREATE_FUNC(UIFocusTestVertical); Layout *_verticalLayout; @@ -73,7 +73,7 @@ public: bool init(); - void toggleFocusLoop(Ref*,TouchEventType); + void toggleFocusLoop(Ref*,Widget::TouchEventType); protected: UI_SCENE_CREATE_FUNC(UIFocusTestNestedLayout1); Layout *_verticalLayout; @@ -88,7 +88,7 @@ public: bool init(); - void toggleFocusLoop(Ref*,TouchEventType); + void toggleFocusLoop(Ref*,Widget::TouchEventType); protected: UI_SCENE_CREATE_FUNC(UIFocusTestNestedLayout2); Layout *_horizontalLayout; @@ -103,7 +103,7 @@ public: bool init(); - void toggleFocusLoop(Ref*,TouchEventType); + void toggleFocusLoop(Ref*,Widget::TouchEventType); protected: UI_SCENE_CREATE_FUNC(UIFocusTestNestedLayout3); Layout *_verticalLayout; diff --git a/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UIImageViewTest/UIImageViewTest_Editor.cpp b/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UIImageViewTest/UIImageViewTest_Editor.cpp index ffcab55cdd..c0cf97ad2e 100644 --- a/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UIImageViewTest/UIImageViewTest_Editor.cpp +++ b/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UIImageViewTest/UIImageViewTest_Editor.cpp @@ -19,7 +19,7 @@ bool UIImageViewTest_Editor::init() Layout* root = static_cast(_layout->getChildByName("root_Panel")); Text* back_label = static_cast(Helper::seekWidgetByName(root, "back")); - back_label->addTouchEventListener(this, toucheventselector(UIScene_Editor::toGUIEditorTestScene)); + back_label->addTouchEventListener(CC_CALLBACK_2(UIScene_Editor::toGUIEditorTestScene, this)); _sceneTitle = static_cast(Helper::seekWidgetByName(root, "UItest")); diff --git a/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UILayoutTest/UILayoutTest_Editor.cpp b/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UILayoutTest/UILayoutTest_Editor.cpp index e734cfa542..73bb29be55 100644 --- a/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UILayoutTest/UILayoutTest_Editor.cpp +++ b/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UILayoutTest/UILayoutTest_Editor.cpp @@ -29,7 +29,7 @@ bool UILayoutTest_Editor::init() Layout* root = static_cast(_layout->getChildByName("root_Panel")); Text* back_label = static_cast(Helper::seekWidgetByName(root, "back")); - back_label->addTouchEventListener(this, toucheventselector(UIScene_Editor::toGUIEditorTestScene)); + back_label->addTouchEventListener(CC_CALLBACK_2(UIScene_Editor::toGUIEditorTestScene, this)); _sceneTitle = static_cast(Helper::seekWidgetByName(root, "UItest")); @@ -38,7 +38,7 @@ bool UILayoutTest_Editor::init() left_button->setPosition(Vector2(_layout->getSize().width / 2 - left_button->getSize().width, left_button->getSize().height)); left_button->setTouchEnabled(true); - left_button->addTouchEventListener(this, toucheventselector(UIScene_Editor::previousCallback)); + left_button->addTouchEventListener(CC_CALLBACK_2(UIScene_Editor::previousCallback, this)); left_button->setLocalZOrder(_layout->getLocalZOrder() + 1); _layout->addChild(left_button); @@ -48,7 +48,7 @@ bool UILayoutTest_Editor::init() right_button->getSize().height)); right_button->setTouchEnabled(true); right_button->setLocalZOrder(_layout->getLocalZOrder() + 1); - right_button->addTouchEventListener(this, toucheventselector(UIScene_Editor::nextCallback)); + right_button->addTouchEventListener(CC_CALLBACK_2(UIScene_Editor::nextCallback, this)); _layout->addChild(right_button); return true; @@ -84,7 +84,7 @@ bool UILayoutTest_Color_Editor::init() Layout* root = static_cast(_layout->getChildByName("root_Panel")); Text* back_label = static_cast(Helper::seekWidgetByName(root, "back")); - back_label->addTouchEventListener(this, toucheventselector(UIScene_Editor::toGUIEditorTestScene)); + back_label->addTouchEventListener(CC_CALLBACK_2(UIScene_Editor::toGUIEditorTestScene, this)); _sceneTitle = static_cast(Helper::seekWidgetByName(root, "UItest")); @@ -93,7 +93,7 @@ bool UILayoutTest_Color_Editor::init() left_button->setPosition(Vector2(_layout->getSize().width / 2 - left_button->getSize().width, left_button->getSize().height)); left_button->setTouchEnabled(true); - left_button->addTouchEventListener(this, toucheventselector(UIScene_Editor::previousCallback)); + left_button->addTouchEventListener(CC_CALLBACK_2(UIScene_Editor::previousCallback, this)); left_button->setLocalZOrder(_layout->getLocalZOrder() + 1); _layout->addChild(left_button); @@ -103,7 +103,7 @@ bool UILayoutTest_Color_Editor::init() right_button->getSize().height)); right_button->setTouchEnabled(true); right_button->setLocalZOrder(_layout->getLocalZOrder() + 1); - right_button->addTouchEventListener(this, toucheventselector(UIScene_Editor::nextCallback)); + right_button->addTouchEventListener(CC_CALLBACK_2(UIScene_Editor::nextCallback, this)); _layout->addChild(right_button); return true; @@ -139,7 +139,7 @@ bool UILayoutTest_Gradient_Editor::init() Layout* root = static_cast(_layout->getChildByName("root_Panel")); Text* back_label = static_cast(Helper::seekWidgetByName(root, "back")); - back_label->addTouchEventListener(this, toucheventselector(UIScene_Editor::toGUIEditorTestScene)); + back_label->addTouchEventListener(CC_CALLBACK_2(UIScene_Editor::toGUIEditorTestScene, this)); _sceneTitle = static_cast(Helper::seekWidgetByName(root, "UItest")); @@ -148,7 +148,7 @@ bool UILayoutTest_Gradient_Editor::init() left_button->setPosition(Vector2(_layout->getSize().width / 2 - left_button->getSize().width, left_button->getSize().height)); left_button->setTouchEnabled(true); - left_button->addTouchEventListener(this, toucheventselector(UIScene_Editor::previousCallback)); + left_button->addTouchEventListener(CC_CALLBACK_2(UIScene_Editor::previousCallback, this)); left_button->setLocalZOrder(_layout->getLocalZOrder() + 1); _layout->addChild(left_button); @@ -158,7 +158,7 @@ bool UILayoutTest_Gradient_Editor::init() right_button->getSize().height)); right_button->setTouchEnabled(true); right_button->setLocalZOrder(_layout->getLocalZOrder() + 1); - right_button->addTouchEventListener(this, toucheventselector(UIScene_Editor::nextCallback)); + right_button->addTouchEventListener(CC_CALLBACK_2(UIScene_Editor::nextCallback, this)); _layout->addChild(right_button); return true; @@ -194,7 +194,7 @@ bool UILayoutTest_BackGroundImage_Editor::init() Layout* root = static_cast(_layout->getChildByName("root_Panel")); Text* back_label = static_cast(Helper::seekWidgetByName(root, "back")); - back_label->addTouchEventListener(this, toucheventselector(UIScene_Editor::toGUIEditorTestScene)); + back_label->addTouchEventListener(CC_CALLBACK_2(UIScene_Editor::toGUIEditorTestScene, this)); _sceneTitle = static_cast(Helper::seekWidgetByName(root, "UItest")); @@ -203,7 +203,7 @@ bool UILayoutTest_BackGroundImage_Editor::init() left_button->setPosition(Vector2(_layout->getSize().width / 2 - left_button->getSize().width, left_button->getSize().height * 0.625)); left_button->setTouchEnabled(true); - left_button->addTouchEventListener(this, toucheventselector(UIScene_Editor::previousCallback)); + left_button->addTouchEventListener(CC_CALLBACK_2(UIScene_Editor::previousCallback, this)); left_button->setLocalZOrder(_layout->getLocalZOrder() + 1); _layout->addChild(left_button); @@ -213,7 +213,7 @@ bool UILayoutTest_BackGroundImage_Editor::init() right_button->getSize().height * 0.625)); right_button->setTouchEnabled(true); right_button->setLocalZOrder(_layout->getLocalZOrder() + 1); - right_button->addTouchEventListener(this, toucheventselector(UIScene_Editor::nextCallback)); + right_button->addTouchEventListener(CC_CALLBACK_2(UIScene_Editor::nextCallback, this)); _layout->addChild(right_button); return true; @@ -249,7 +249,7 @@ bool UILayoutTest_BackGroundImage_Scale9_Editor::init() Layout* root = static_cast(_layout->getChildByName("root_Panel")); Text* back_label = static_cast(Helper::seekWidgetByName(root, "back")); - back_label->addTouchEventListener(this, toucheventselector(UIScene_Editor::toGUIEditorTestScene)); + back_label->addTouchEventListener(CC_CALLBACK_2(UIScene_Editor::toGUIEditorTestScene, this)); _sceneTitle = static_cast(Helper::seekWidgetByName(root, "UItest")); @@ -258,7 +258,7 @@ bool UILayoutTest_BackGroundImage_Scale9_Editor::init() left_button->setPosition(Vector2(_layout->getSize().width / 2 - left_button->getSize().width, left_button->getSize().height)); left_button->setTouchEnabled(true); - left_button->addTouchEventListener(this, toucheventselector(UIScene_Editor::previousCallback)); + left_button->addTouchEventListener(CC_CALLBACK_2(UIScene_Editor::previousCallback, this)); left_button->setLocalZOrder(_layout->getLocalZOrder() + 1); _layout->addChild(left_button); @@ -268,7 +268,7 @@ bool UILayoutTest_BackGroundImage_Scale9_Editor::init() right_button->getSize().height)); right_button->setTouchEnabled(true); right_button->setLocalZOrder(_layout->getLocalZOrder() + 1); - right_button->addTouchEventListener(this, toucheventselector(UIScene_Editor::nextCallback)); + right_button->addTouchEventListener(CC_CALLBACK_2(UIScene_Editor::nextCallback, this)); _layout->addChild(right_button); return true; @@ -304,7 +304,7 @@ bool UILayoutTest_Layout_Linear_Vertical_Editor::init() Layout* root = static_cast(_layout->getChildByName("root_Panel")); Text* back_label = static_cast(Helper::seekWidgetByName(root, "back")); - back_label->addTouchEventListener(this, toucheventselector(UIScene_Editor::toGUIEditorTestScene)); + back_label->addTouchEventListener(CC_CALLBACK_2(UIScene_Editor::toGUIEditorTestScene, this)); _sceneTitle = static_cast(Helper::seekWidgetByName(root, "UItest")); @@ -313,7 +313,7 @@ bool UILayoutTest_Layout_Linear_Vertical_Editor::init() left_button->setPosition(Vector2(_layout->getSize().width / 2 - left_button->getSize().width, left_button->getSize().height * 0.625)); left_button->setTouchEnabled(true); - left_button->addTouchEventListener(this, toucheventselector(UIScene_Editor::previousCallback)); + left_button->addTouchEventListener(CC_CALLBACK_2(UIScene_Editor::previousCallback, this)); left_button->setLocalZOrder(_layout->getLocalZOrder() + 1); _layout->addChild(left_button); @@ -323,7 +323,7 @@ bool UILayoutTest_Layout_Linear_Vertical_Editor::init() right_button->getSize().height * 0.625)); right_button->setTouchEnabled(true); right_button->setLocalZOrder(_layout->getLocalZOrder() + 1); - right_button->addTouchEventListener(this, toucheventselector(UIScene_Editor::nextCallback)); + right_button->addTouchEventListener(CC_CALLBACK_2(UIScene_Editor::nextCallback, this)); _layout->addChild(right_button); return true; @@ -359,7 +359,7 @@ bool UILayoutTest_Layout_Linear_Horizontal_Editor::init() Layout* root = static_cast(_layout->getChildByName("root_Panel")); Text* back_label = static_cast(Helper::seekWidgetByName(root, "back")); - back_label->addTouchEventListener(this, toucheventselector(UIScene_Editor::toGUIEditorTestScene)); + back_label->addTouchEventListener(CC_CALLBACK_2(UIScene_Editor::toGUIEditorTestScene, this)); _sceneTitle = static_cast(Helper::seekWidgetByName(root, "UItest")); @@ -368,7 +368,7 @@ bool UILayoutTest_Layout_Linear_Horizontal_Editor::init() left_button->setPosition(Vector2(_layout->getSize().width / 2 - left_button->getSize().width, left_button->getSize().height * 0.625)); left_button->setTouchEnabled(true); - left_button->addTouchEventListener(this, toucheventselector(UIScene_Editor::previousCallback)); + left_button->addTouchEventListener(CC_CALLBACK_2(UIScene_Editor::previousCallback, this)); left_button->setLocalZOrder(_layout->getLocalZOrder() + 1); _layout->addChild(left_button); @@ -378,7 +378,7 @@ bool UILayoutTest_Layout_Linear_Horizontal_Editor::init() right_button->getSize().height * 0.625)); right_button->setTouchEnabled(true); right_button->setLocalZOrder(_layout->getLocalZOrder() + 1); - right_button->addTouchEventListener(this, toucheventselector(UIScene_Editor::nextCallback)); + right_button->addTouchEventListener(CC_CALLBACK_2(UIScene_Editor::nextCallback, this)); _layout->addChild(right_button); @@ -415,7 +415,7 @@ bool UILayoutTest_Layout_Relative_Align_Parent_Editor::init() Layout* root = static_cast(_layout->getChildByName("root_Panel")); Text* back_label = static_cast(Helper::seekWidgetByName(root, "back")); - back_label->addTouchEventListener(this, toucheventselector(UIScene_Editor::toGUIEditorTestScene)); + back_label->addTouchEventListener(CC_CALLBACK_2(UIScene_Editor::toGUIEditorTestScene, this)); _sceneTitle = static_cast(Helper::seekWidgetByName(root, "UItest")); @@ -424,7 +424,7 @@ bool UILayoutTest_Layout_Relative_Align_Parent_Editor::init() left_button->setPosition(Vector2(_layout->getSize().width / 2 - left_button->getSize().width, left_button->getSize().height * 0.625)); left_button->setTouchEnabled(true); - left_button->addTouchEventListener(this, toucheventselector(UIScene_Editor::previousCallback)); + left_button->addTouchEventListener(CC_CALLBACK_2(UIScene_Editor::previousCallback, this)); left_button->setLocalZOrder(_layout->getLocalZOrder() + 1); _layout->addChild(left_button); @@ -434,7 +434,7 @@ bool UILayoutTest_Layout_Relative_Align_Parent_Editor::init() right_button->getSize().height * 0.625)); right_button->setTouchEnabled(true); right_button->setLocalZOrder(_layout->getLocalZOrder() + 1); - right_button->addTouchEventListener(this, toucheventselector(UIScene_Editor::nextCallback)); + right_button->addTouchEventListener(CC_CALLBACK_2(UIScene_Editor::nextCallback, this)); _layout->addChild(right_button); return true; @@ -470,7 +470,7 @@ bool UILayoutTest_Layout_Relative_Location_Editor::init() Layout* root = static_cast(_layout->getChildByName("root_Panel")); Text* back_label = static_cast(Helper::seekWidgetByName(root, "back")); - back_label->addTouchEventListener(this, toucheventselector(UIScene_Editor::toGUIEditorTestScene)); + back_label->addTouchEventListener(CC_CALLBACK_2(UIScene_Editor::toGUIEditorTestScene, this)); _sceneTitle = static_cast(Helper::seekWidgetByName(root, "UItest")); @@ -479,7 +479,7 @@ bool UILayoutTest_Layout_Relative_Location_Editor::init() left_button->setPosition(Vector2(_layout->getSize().width / 2 - left_button->getSize().width, left_button->getSize().height * 0.625)); left_button->setTouchEnabled(true); - left_button->addTouchEventListener(this, toucheventselector(UIScene_Editor::previousCallback)); + left_button->addTouchEventListener(CC_CALLBACK_2(UIScene_Editor::previousCallback, this)); left_button->setLocalZOrder(_layout->getLocalZOrder() + 1); _layout->addChild(left_button); @@ -489,7 +489,7 @@ bool UILayoutTest_Layout_Relative_Location_Editor::init() right_button->getSize().height * 0.625)); right_button->setTouchEnabled(true); right_button->setLocalZOrder(_layout->getLocalZOrder() + 1); - right_button->addTouchEventListener(this, toucheventselector(UIScene_Editor::nextCallback)); + right_button->addTouchEventListener(CC_CALLBACK_2(UIScene_Editor::nextCallback, this)); _layout->addChild(right_button); return true; diff --git a/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UIListViewTest/UIListViewTest_Editor.cpp b/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UIListViewTest/UIListViewTest_Editor.cpp index ae64e9ea1a..a1ac86f748 100644 --- a/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UIListViewTest/UIListViewTest_Editor.cpp +++ b/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UIListViewTest/UIListViewTest_Editor.cpp @@ -29,7 +29,7 @@ bool UIListViewTest_Vertical_Editor::init() Layout* root = static_cast(_layout->getChildByName("root_Panel")); Text* back_label = static_cast(Helper::seekWidgetByName(root, "back")); - back_label->addTouchEventListener(this, toucheventselector(UIScene_Editor::toGUIEditorTestScene)); + back_label->addTouchEventListener(CC_CALLBACK_2(UIScene_Editor::toGUIEditorTestScene,this)); _sceneTitle = static_cast(Helper::seekWidgetByName(root, "UItest")); @@ -41,7 +41,9 @@ bool UIListViewTest_Vertical_Editor::init() left_button->setPosition(Vector2(_layout->getSize().width / 2 - left_button->getSize().width, left_button->getSize().height * 0.625)); left_button->setTouchEnabled(true); - left_button->addTouchEventListener(this, toucheventselector(UIScene_Editor::previousCallback)); + left_button->addTouchEventListener(CC_CALLBACK_2(UIScene_Editor::previousCallback,this)); + + left_button->setLocalZOrder(_layout->getLocalZOrder() + 1); _layout->addChild(left_button); @@ -51,7 +53,7 @@ bool UIListViewTest_Vertical_Editor::init() right_button->getSize().height * 0.625)); right_button->setTouchEnabled(true); right_button->setLocalZOrder(_layout->getLocalZOrder() + 1); - right_button->addTouchEventListener(this, toucheventselector(UIScene_Editor::nextCallback)); + right_button->addTouchEventListener(CC_CALLBACK_2(UIScene_Editor::nextCallback,this)); _layout->addChild(right_button); return true; @@ -88,7 +90,7 @@ bool UIListViewTest_Horizontal_Editor::init() Layout* root = static_cast(_layout->getChildByName("root_Panel")); Text* back_label = static_cast(Helper::seekWidgetByName(root, "back")); - back_label->addTouchEventListener(this, toucheventselector(UIScene_Editor::toGUIEditorTestScene)); + back_label->addTouchEventListener(CC_CALLBACK_2(UIScene_Editor::toGUIEditorTestScene,this)); _sceneTitle = static_cast(Helper::seekWidgetByName(root, "UItest")); @@ -97,7 +99,7 @@ bool UIListViewTest_Horizontal_Editor::init() left_button->setPosition(Vector2(_layout->getSize().width / 2 - left_button->getSize().width, left_button->getSize().height * 0.625)); left_button->setTouchEnabled(true); - left_button->addTouchEventListener(this, toucheventselector(UIScene_Editor::previousCallback)); + left_button->addTouchEventListener(CC_CALLBACK_2(UIScene_Editor::previousCallback,this)); left_button->setLocalZOrder(_layout->getLocalZOrder() + 1); _layout->addChild(left_button); @@ -107,7 +109,7 @@ bool UIListViewTest_Horizontal_Editor::init() right_button->getSize().height * 0.625)); right_button->setTouchEnabled(true); right_button->setLocalZOrder(_layout->getLocalZOrder() + 1); - right_button->addTouchEventListener(this, toucheventselector(UIScene_Editor::nextCallback)); + right_button->addTouchEventListener(CC_CALLBACK_2(UIScene_Editor::nextCallback, this)); _layout->addChild(right_button); return true; } diff --git a/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UILoadingBarTest/UILoadingBarTest_Editor.cpp b/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UILoadingBarTest/UILoadingBarTest_Editor.cpp index e13deddca0..7e5b0e9d75 100644 --- a/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UILoadingBarTest/UILoadingBarTest_Editor.cpp +++ b/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UILoadingBarTest/UILoadingBarTest_Editor.cpp @@ -31,7 +31,8 @@ bool UILoadingBarTest_Editor::init() Layout* root = static_cast(_layout->getChildByName("root_Panel")); Text* back_label = static_cast(Helper::seekWidgetByName(root, "back")); - back_label->addTouchEventListener(this, toucheventselector(UIScene_Editor::toGUIEditorTestScene)); +// back_label->addTouchEventListener(this, toucheventselector(UIScene_Editor::toGUIEditorTestScene)); + back_label->addTouchEventListener(CC_CALLBACK_2(UIScene_Editor::toGUIEditorTestScene, this)); _sceneTitle = static_cast(Helper::seekWidgetByName(root, "UItest")); @@ -64,7 +65,7 @@ void UILoadingBarTest_Editor::update(float delta) loadingBar_right_to_left->setPercent(_count); } -void UILoadingBarTest_Editor::toCocosGUITestScene(Widget::TouchEventType event) +void UILoadingBarTest_Editor::toCocosGUITestScene(Ref* sender, Widget::TouchEventType event) { switch (event) { @@ -72,7 +73,7 @@ void UILoadingBarTest_Editor::toCocosGUITestScene(Widget::TouchEventType event) { unscheduleUpdate(); - UIScene_Editor::toGUIEditorTestScene(event); + UIScene_Editor::toGUIEditorTestScene(sender, event); } break; diff --git a/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UILoadingBarTest/UILoadingBarTest_Editor.h b/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UILoadingBarTest/UILoadingBarTest_Editor.h index 890caa38cf..1cb987c22d 100644 --- a/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UILoadingBarTest/UILoadingBarTest_Editor.h +++ b/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UILoadingBarTest/UILoadingBarTest_Editor.h @@ -12,7 +12,7 @@ public: ~UILoadingBarTest_Editor(); bool init(); void update(float delta); - void toCocosGUITestScene(Widget::TouchEventType event); + void toCocosGUITestScene(Ref* sender, Widget::TouchEventType event); protected: UI_SCENE_EDITOR_CREATE_FUNC(UILoadingBarTest_Editor) diff --git a/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UIPageViewTest/UIPageViewTest_Editor.cpp b/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UIPageViewTest/UIPageViewTest_Editor.cpp index 691e310394..2e672da0ed 100644 --- a/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UIPageViewTest/UIPageViewTest_Editor.cpp +++ b/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UIPageViewTest/UIPageViewTest_Editor.cpp @@ -30,7 +30,7 @@ bool UIPageViewTest_Editor::init() Layout* root = static_cast(_layout->getChildByName("root_Panel")); Text* back_label = static_cast(Helper::seekWidgetByName(root, "back")); - back_label->addTouchEventListener(this, toucheventselector(UIScene_Editor::toGUIEditorTestScene)); + back_label->addTouchEventListener(CC_CALLBACK_2(UIScene_Editor::toGUIEditorTestScene, this)); _sceneTitle = static_cast(Helper::seekWidgetByName(root, "UItest")); @@ -39,7 +39,7 @@ bool UIPageViewTest_Editor::init() left_button->setPosition(Vector2(_layout->getSize().width / 2 - left_button->getSize().width, left_button->getSize().height * 0.625)); left_button->setTouchEnabled(true); - left_button->addTouchEventListener(this, toucheventselector(UIScene_Editor::previousCallback)); + left_button->addTouchEventListener(CC_CALLBACK_2(UIScene_Editor::previousCallback, this)); left_button->setLocalZOrder(_layout->getLocalZOrder() + 1); _layout->addChild(left_button); @@ -49,7 +49,7 @@ bool UIPageViewTest_Editor::init() right_button->getSize().height * 0.625)); right_button->setTouchEnabled(true); right_button->setLocalZOrder(_layout->getLocalZOrder() + 1); - right_button->addTouchEventListener(this, toucheventselector(UIScene_Editor::nextCallback)); + right_button->addTouchEventListener(CC_CALLBACK_2(UIScene_Editor::nextCallback, this)); _layout->addChild(right_button); return true; diff --git a/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UIRichTextTest/UIRichTextTest.cpp b/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UIRichTextTest/UIRichTextTest.cpp index afa6b6ba80..c2de04c2ba 100644 --- a/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UIRichTextTest/UIRichTextTest.cpp +++ b/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UIRichTextTest/UIRichTextTest.cpp @@ -31,7 +31,8 @@ bool UIRichTextTest::init() button->setTouchEnabled(true); button->setTitleText("switch"); button->setPosition(Vector2(widgetSize.width / 2.0f, widgetSize.height / 2.0f + button->getSize().height * 2.5)); - button->addTouchEventListener(this, toucheventselector(UIRichTextTest::touchEvent)); +// button->addTouchEventListener(this, toucheventselector(UIRichTextTest::touchEvent)); + button->addTouchEventListener(CC_CALLBACK_2(UIRichTextTest::touchEvent, this)); button->setLocalZOrder(10); _widget->addChild(button); @@ -75,11 +76,11 @@ bool UIRichTextTest::init() return false; } -void UIRichTextTest::touchEvent(Ref *pSender, TouchEventType type) +void UIRichTextTest::touchEvent(Ref *pSender, Widget::TouchEventType type) { switch (type) { - case TOUCH_EVENT_ENDED: + case Widget::TouchEventType::ENDED: { if (_richText->isIgnoreContentAdaptWithSize()) { diff --git a/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UIRichTextTest/UIRichTextTest.h b/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UIRichTextTest/UIRichTextTest.h index 0fd2db97f4..0563fec64e 100644 --- a/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UIRichTextTest/UIRichTextTest.h +++ b/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UIRichTextTest/UIRichTextTest.h @@ -11,7 +11,7 @@ public: UIRichTextTest(); ~UIRichTextTest(); bool init(); - void touchEvent(Ref *pSender, TouchEventType type); + void touchEvent(Ref *pSender, Widget::TouchEventType type); protected: UI_SCENE_CREATE_FUNC(UIRichTextTest) diff --git a/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UIScene_Editor.cpp b/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UIScene_Editor.cpp index a7155df080..92976538e8 100644 --- a/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UIScene_Editor.cpp +++ b/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UIScene_Editor.cpp @@ -32,7 +32,7 @@ bool UIScene_Editor::init() return false; } -void UIScene_Editor::previousCallback(Widget::TouchEventType event) +void UIScene_Editor::previousCallback(Ref* sender, Widget::TouchEventType event) { switch (event) { @@ -45,7 +45,7 @@ void UIScene_Editor::previousCallback(Widget::TouchEventType event) } } -void UIScene_Editor::nextCallback(Widget::TouchEventType event) +void UIScene_Editor::nextCallback(Ref* sender, Widget::TouchEventType event) { switch (event) { @@ -58,7 +58,7 @@ void UIScene_Editor::nextCallback(Widget::TouchEventType event) } } -void UIScene_Editor::toGUIEditorTestScene(Widget::TouchEventType event) +void UIScene_Editor::toGUIEditorTestScene(Ref* sender, Widget::TouchEventType event) { switch (event) { diff --git a/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UIScene_Editor.h b/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UIScene_Editor.h index 5602b7beb1..b485871969 100644 --- a/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UIScene_Editor.h +++ b/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UIScene_Editor.h @@ -60,10 +60,10 @@ public: ~UIScene_Editor(); bool init(); - virtual void previousCallback(Widget::TouchEventType event); - virtual void nextCallback(Widget::TouchEventType event); + virtual void previousCallback(Ref* sender, Widget::TouchEventType event); + virtual void nextCallback(Ref* sender, Widget::TouchEventType event); - void toGUIEditorTestScene(Widget::TouchEventType event); + void toGUIEditorTestScene(Ref* sender, Widget::TouchEventType event); /** Title label of the scene.*/ CC_SYNTHESIZE_READONLY(Text*, _sceneTitle, SceneTitle) diff --git a/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UIScrollViewTest/UIScrollViewTest_Editor.cpp b/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UIScrollViewTest/UIScrollViewTest_Editor.cpp index 6eb3da1c6f..44b4a3f5d2 100644 --- a/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UIScrollViewTest/UIScrollViewTest_Editor.cpp +++ b/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UIScrollViewTest/UIScrollViewTest_Editor.cpp @@ -29,7 +29,7 @@ bool UIScrollViewTest_Vertical_Editor::init() Layout* root = static_cast(_layout->getChildByName("root_Panel")); Text* back_label = static_cast(Helper::seekWidgetByName(root, "back")); - back_label->addTouchEventListener(this, toucheventselector(UIScene_Editor::toGUIEditorTestScene)); + back_label->addTouchEventListener(CC_CALLBACK_2(UIScene_Editor::toGUIEditorTestScene, this)); _sceneTitle = static_cast(Helper::seekWidgetByName(root, "UItest")); @@ -38,7 +38,7 @@ bool UIScrollViewTest_Vertical_Editor::init() left_button->setPosition(Vector2(_layout->getSize().width / 2 - left_button->getSize().width, left_button->getSize().height * 0.625)); left_button->setTouchEnabled(true); - left_button->addTouchEventListener(this, toucheventselector(UIScene_Editor::previousCallback)); + left_button->addTouchEventListener(CC_CALLBACK_2(UIScene_Editor::previousCallback, this)); left_button->setLocalZOrder(_layout->getLocalZOrder() + 1); _layout->addChild(left_button); @@ -48,7 +48,7 @@ bool UIScrollViewTest_Vertical_Editor::init() right_button->getSize().height * 0.625)); right_button->setTouchEnabled(true); right_button->setLocalZOrder(_layout->getLocalZOrder() + 1); - right_button->addTouchEventListener(this, toucheventselector(UIScene_Editor::nextCallback)); + right_button->addTouchEventListener(CC_CALLBACK_2(UIScene_Editor::nextCallback, this)); _layout->addChild(right_button); return true; @@ -84,7 +84,7 @@ bool UIScrollViewTest_Horizontal_Editor::init() Layout* root = static_cast(_layout->getChildByName("root_Panel")); Text* back_label = static_cast(Helper::seekWidgetByName(root, "back")); - back_label->addTouchEventListener(this, toucheventselector(UIScene_Editor::toGUIEditorTestScene)); + back_label->addTouchEventListener(CC_CALLBACK_2(UIScene_Editor::toGUIEditorTestScene, this)); _sceneTitle = static_cast(Helper::seekWidgetByName(root, "UItest")); @@ -93,7 +93,7 @@ bool UIScrollViewTest_Horizontal_Editor::init() left_button->setPosition(Vector2(_layout->getSize().width / 2 - left_button->getSize().width, left_button->getSize().height * 0.625)); left_button->setTouchEnabled(true); - left_button->addTouchEventListener(this, toucheventselector(UIScene_Editor::previousCallback)); + left_button->addTouchEventListener(CC_CALLBACK_2(UIScene_Editor::previousCallback, this)); left_button->setLocalZOrder(_layout->getLocalZOrder() + 1); _layout->addChild(left_button); @@ -103,7 +103,7 @@ bool UIScrollViewTest_Horizontal_Editor::init() right_button->getSize().height * 0.625)); right_button->setTouchEnabled(true); right_button->setLocalZOrder(_layout->getLocalZOrder() + 1); - right_button->addTouchEventListener(this, toucheventselector(UIScene_Editor::nextCallback)); + right_button->addTouchEventListener(CC_CALLBACK_2(UIScene_Editor::nextCallback, this)); _layout->addChild(right_button); return true; @@ -139,7 +139,7 @@ bool UIScrollViewTest_Both_Editor::init() Layout* root = static_cast(_layout->getChildByName("root_Panel")); Text* back_label = static_cast(Helper::seekWidgetByName(root, "back")); - back_label->addTouchEventListener(this, toucheventselector(UIScene_Editor::toGUIEditorTestScene)); + back_label->addTouchEventListener(CC_CALLBACK_2(UIScene_Editor::toGUIEditorTestScene, this)); _sceneTitle = static_cast(Helper::seekWidgetByName(root, "UItest")); @@ -148,7 +148,7 @@ bool UIScrollViewTest_Both_Editor::init() left_button->setPosition(Vector2(_layout->getSize().width / 2 - left_button->getSize().width, left_button->getSize().height * 0.625)); left_button->setTouchEnabled(true); - left_button->addTouchEventListener(this, toucheventselector(UIScene_Editor::previousCallback)); + left_button->addTouchEventListener(CC_CALLBACK_2(UIScene_Editor::previousCallback, this)); left_button->setLocalZOrder(_layout->getLocalZOrder() + 1); _layout->addChild(left_button); @@ -158,7 +158,7 @@ bool UIScrollViewTest_Both_Editor::init() right_button->getSize().height * 0.625)); right_button->setTouchEnabled(true); right_button->setLocalZOrder(_layout->getLocalZOrder() + 1); - right_button->addTouchEventListener(this, toucheventselector(UIScene_Editor::nextCallback)); + right_button->addTouchEventListener(CC_CALLBACK_2(UIScene_Editor::nextCallback, this)); _layout->addChild(right_button); return true; @@ -194,18 +194,18 @@ bool UIScrollViewTest_ScrollToPercentBothDirection_Editor::init() Layout* root = static_cast(_layout->getChildByName("root_Panel")); Text* back_label = static_cast(Helper::seekWidgetByName(root, "back")); - back_label->addTouchEventListener(this, toucheventselector(UIScene_Editor::toGUIEditorTestScene)); + back_label->addTouchEventListener(CC_CALLBACK_2(UIScene_Editor::toGUIEditorTestScene, this)); _sceneTitle = static_cast(Helper::seekWidgetByName(root, "UItest")); Button* left_button = static_cast(Helper::seekWidgetByName(root, "left_Button")); - left_button->addTouchEventListener(this, toucheventselector(UIScene_Editor::previousCallback)); + left_button->addTouchEventListener(CC_CALLBACK_2(UIScene_Editor::previousCallback, this)); Button* middle_button = static_cast(Helper::seekWidgetByName(root, "middle_Button")); middle_button->setVisible(false); Button* right_button = static_cast(Helper::seekWidgetByName(root, "right_Button")); - right_button->addTouchEventListener(this, toucheventselector(UIScene_Editor::nextCallback)); + right_button->addTouchEventListener(CC_CALLBACK_2(UIScene_Editor::nextCallback, this)); return true; } @@ -240,18 +240,18 @@ bool UIScrollViewTest_ScrollToPercentBothDirection_Bounce_Editor::init() Layout* root = static_cast(_layout->getChildByName("root_Panel")); Text* back_label = static_cast(Helper::seekWidgetByName(root, "back")); - back_label->addTouchEventListener(this, toucheventselector(UIScene_Editor::toGUIEditorTestScene)); + back_label->addTouchEventListener(CC_CALLBACK_2(UIScene_Editor::toGUIEditorTestScene, this)); _sceneTitle = static_cast(Helper::seekWidgetByName(root, "UItest")); Button* left_button = static_cast(Helper::seekWidgetByName(root, "left_Button")); - left_button->addTouchEventListener(this, toucheventselector(UIScene_Editor::previousCallback)); + left_button->addTouchEventListener(CC_CALLBACK_2(UIScene_Editor::previousCallback, this)); Button* middle_button = static_cast(Helper::seekWidgetByName(root, "middle_Button")); middle_button->setVisible(false); Button* right_button = static_cast(Helper::seekWidgetByName(root, "right_Button")); - right_button->addTouchEventListener(this, toucheventselector(UIScene_Editor::nextCallback)); + right_button->addTouchEventListener(CC_CALLBACK_2(UIScene_Editor::nextCallback, this)); return true; } diff --git a/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UISliderTest/UISliderTest_Editor.cpp b/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UISliderTest/UISliderTest_Editor.cpp index 2325e9d3b6..a9179de983 100644 --- a/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UISliderTest/UISliderTest_Editor.cpp +++ b/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UISliderTest/UISliderTest_Editor.cpp @@ -30,7 +30,7 @@ bool UISliderTest_Editor::init() Layout* root = static_cast(_layout->getChildByName("root_Panel")); Text* back_label = static_cast(Helper::seekWidgetByName(root, "back")); - back_label->addTouchEventListener(this, toucheventselector(UIScene_Editor::toGUIEditorTestScene)); + back_label->addTouchEventListener(CC_CALLBACK_2(UIScene_Editor::toGUIEditorTestScene, this)); _sceneTitle = static_cast(Helper::seekWidgetByName(root, "UItest")); diff --git a/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UITextAtlasTest/UITextAtlasTest_Editor.cpp b/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UITextAtlasTest/UITextAtlasTest_Editor.cpp index 4f614d979b..6077d19e18 100644 --- a/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UITextAtlasTest/UITextAtlasTest_Editor.cpp +++ b/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UITextAtlasTest/UITextAtlasTest_Editor.cpp @@ -18,7 +18,7 @@ bool UITextAtlasTest_Editor::init() Layout* root = static_cast(_layout->getChildByName("root_Panel")); Text* back_label = static_cast(Helper::seekWidgetByName(root, "back")); - back_label->addTouchEventListener(this, toucheventselector(UIScene_Editor::toGUIEditorTestScene)); + back_label->addTouchEventListener(CC_CALLBACK_2(UIScene_Editor::toGUIEditorTestScene, this)); _sceneTitle = static_cast(Helper::seekWidgetByName(root, "UItest")); diff --git a/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UITextBMFontTest/UITextBMFontTest_Editor.cpp b/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UITextBMFontTest/UITextBMFontTest_Editor.cpp index 0ce7e6d7c7..b053f267b4 100644 --- a/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UITextBMFontTest/UITextBMFontTest_Editor.cpp +++ b/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UITextBMFontTest/UITextBMFontTest_Editor.cpp @@ -19,7 +19,7 @@ bool UITextBMFontTest_Editor::init() Layout* root = static_cast(_layout->getChildByName("root_Panel")); Text* back_label = static_cast(Helper::seekWidgetByName(root, "back")); - back_label->addTouchEventListener(this, toucheventselector(UIScene_Editor::toGUIEditorTestScene)); + back_label->addTouchEventListener(CC_CALLBACK_2(UIScene_Editor::toGUIEditorTestScene, this)); _sceneTitle = static_cast(Helper::seekWidgetByName(root, "UItest")); diff --git a/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UITextFieldTest/UITextFieldTest_Editor.cpp b/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UITextFieldTest/UITextFieldTest_Editor.cpp index 5704ba62b4..31e8e37213 100644 --- a/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UITextFieldTest/UITextFieldTest_Editor.cpp +++ b/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UITextFieldTest/UITextFieldTest_Editor.cpp @@ -30,7 +30,7 @@ bool UITextFieldTest_Editor::init() Layout* root = static_cast(_layout->getChildByName("root_Panel")); Text* back_label = static_cast(Helper::seekWidgetByName(root, "back")); - back_label->addTouchEventListener(this, toucheventselector(UIScene_Editor::toGUIEditorTestScene)); + back_label->addTouchEventListener(CC_CALLBACK_2(UIScene_Editor::toGUIEditorTestScene, this)); _sceneTitle = static_cast(Helper::seekWidgetByName(root, "UItest")); diff --git a/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UITextTest/UITextTest_Editor.cpp b/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UITextTest/UITextTest_Editor.cpp index 22918cafd8..effd3883e3 100644 --- a/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UITextTest/UITextTest_Editor.cpp +++ b/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UITextTest/UITextTest_Editor.cpp @@ -21,7 +21,7 @@ bool UITextTest_Editor::init() Layout* root = static_cast(_layout->getChildByName("root_Panel")); Text* back_label = static_cast(Helper::seekWidgetByName(root, "back")); - back_label->addTouchEventListener(this, toucheventselector(UIScene_Editor::toGUIEditorTestScene)); + back_label->addTouchEventListener(CC_CALLBACK_2(UIScene_Editor::toGUIEditorTestScene, this)); _sceneTitle = static_cast(Helper::seekWidgetByName(root, "UItest")); diff --git a/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UIWidgetAddNodeTest/UIWidgetAddNodeTest_Editor.cpp b/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UIWidgetAddNodeTest/UIWidgetAddNodeTest_Editor.cpp index f8b5d766ba..cb91a6dad4 100644 --- a/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UIWidgetAddNodeTest/UIWidgetAddNodeTest_Editor.cpp +++ b/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UIWidgetAddNodeTest/UIWidgetAddNodeTest_Editor.cpp @@ -29,7 +29,7 @@ bool UIWidgetAddNodeTest_Editor::init() Layout* root = static_cast(_layout->getChildByName("root_Panel")); Text* back_label = static_cast(Helper::seekWidgetByName(root, "back")); - back_label->addTouchEventListener(this, toucheventselector(UIScene_Editor::toGUIEditorTestScene)); + back_label->addTouchEventListener(CC_CALLBACK_2(UIScene_Editor::toGUIEditorTestScene, this)); _sceneTitle = static_cast(Helper::seekWidgetByName(root, "UItest"));