2014-03-04 16:51:35 +08:00
|
|
|
#include "UIWidgetAddNodeTest_Editor.h"
|
|
|
|
|
2015-04-09 12:23:47 +08:00
|
|
|
USING_NS_CC;
|
|
|
|
using namespace cocos2d::ui;
|
|
|
|
|
2015-04-03 14:31:03 +08:00
|
|
|
UIWidgetAddNodeEditorTests::UIWidgetAddNodeEditorTests()
|
|
|
|
{
|
|
|
|
ADD_TEST_CASE(UIWidgetAddNodeTest_Editor);
|
|
|
|
}
|
2014-03-04 16:51:35 +08:00
|
|
|
|
|
|
|
// UIWidgetAddNodeTest_Editor
|
|
|
|
|
|
|
|
UIWidgetAddNodeTest_Editor::UIWidgetAddNodeTest_Editor()
|
|
|
|
{
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
UIWidgetAddNodeTest_Editor::~UIWidgetAddNodeTest_Editor()
|
|
|
|
{
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2014-07-01 15:47:40 +08:00
|
|
|
void UIWidgetAddNodeTest_Editor::configureGUIScene()
|
|
|
|
{
|
2015-04-03 14:31:03 +08:00
|
|
|
UIScene_Editor::configureGUIScene();
|
|
|
|
|
2014-07-01 15:47:40 +08:00
|
|
|
Size rootSize = _layout->getContentSize();
|
2015-04-03 14:31:03 +08:00
|
|
|
|
2014-07-01 15:47:40 +08:00
|
|
|
// Create the ui widget
|
|
|
|
Widget* widget = Widget::create();
|
|
|
|
widget->setPosition(Vec2(rootSize.width / 2.0f, rootSize.height / 2.0f));
|
|
|
|
widget->setLocalZOrder(_layout->getLocalZOrder() + 1);
|
|
|
|
_layout->addChild(widget);
|
|
|
|
|
|
|
|
Sprite* sprite = Sprite::create("cocosui/ccicon.png");
|
|
|
|
widget->addChild(sprite);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
bool UIWidgetAddNodeTest_Editor::init()
|
|
|
|
{
|
|
|
|
if (UIScene_Editor::init())
|
|
|
|
{
|
2015-05-14 18:08:37 +08:00
|
|
|
Node* node = CSLoader::createNode("cocosui/UIEditorTest/UIWidgetAddNode/res.csb");
|
2014-10-10 10:44:16 +08:00
|
|
|
Node* child = node->getChildByTag(5);
|
|
|
|
child->removeFromParent();
|
|
|
|
_layout = static_cast<Layout*>(child);
|
2014-07-01 15:47:40 +08:00
|
|
|
_touchGroup->addChild(_layout);
|
2014-10-10 10:44:16 +08:00
|
|
|
|
2014-07-01 15:47:40 +08:00
|
|
|
this->configureGUIScene();
|
2014-10-10 10:44:16 +08:00
|
|
|
|
2014-03-04 16:51:35 +08:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|