update for cocos reader

This commit is contained in:
Liam 2014-12-25 15:02:22 +08:00
parent 807e63eae3
commit fa85faec68
6 changed files with 13 additions and 13 deletions

View File

@ -519,7 +519,7 @@ namespace cocostudio
auto layoutComponentTable = ((WidgetOptions*)nodeOptions)->layoutComponent(); auto layoutComponentTable = ((WidgetOptions*)nodeOptions)->layoutComponent();
if (!layoutComponentTable) return; if (!layoutComponentTable) return;
auto layoutComponent = ui::LayoutComponent::boundingLayoutComponent(node); auto layoutComponent = ui::LayoutComponent::bindLayoutComponent(node);
bool positionXPercentEnabled = layoutComponentTable->positionXPercentEnabled(); bool positionXPercentEnabled = layoutComponentTable->positionXPercentEnabled();
bool positionYPercentEnabled = layoutComponentTable->positionYPercentEnabled(); bool positionYPercentEnabled = layoutComponentTable->positionYPercentEnabled();

View File

@ -868,7 +868,7 @@ namespace cocostudio
auto layoutComponentTable = ((WidgetOptions*)nodeOptions)->layoutComponent(); auto layoutComponentTable = ((WidgetOptions*)nodeOptions)->layoutComponent();
if (!layoutComponentTable) return; if (!layoutComponentTable) return;
auto layoutComponent = ui::LayoutComponent::boundingLayoutComponent(node); auto layoutComponent = ui::LayoutComponent::bindLayoutComponent(node);
bool positionXPercentEnabled = layoutComponentTable->positionXPercentEnabled(); bool positionXPercentEnabled = layoutComponentTable->positionXPercentEnabled();
bool positionYPercentEnabled = layoutComponentTable->positionYPercentEnabled(); bool positionYPercentEnabled = layoutComponentTable->positionYPercentEnabled();

View File

@ -57,7 +57,7 @@ namespace ui {
} }
LayoutComponent* LayoutComponent::boundingLayoutComponent(Node* node) LayoutComponent* LayoutComponent::bindLayoutComponent(Node* node)
{ {
LayoutComponent * layout = (LayoutComponent*)node->getComponent(__LAYOUT_COMPONENT_NAME); LayoutComponent * layout = (LayoutComponent*)node->getComponent(__LAYOUT_COMPONENT_NAME);
if (layout != nullptr) if (layout != nullptr)

View File

@ -38,7 +38,7 @@ namespace ui {
virtual bool init()override; virtual bool init()override;
CREATE_FUNC(LayoutComponent); CREATE_FUNC(LayoutComponent);
static LayoutComponent* boundingLayoutComponent(Node* node); static LayoutComponent* bindLayoutComponent(Node* node);
enum class HorizontalEdge enum class HorizontalEdge
{ {

View File

@ -755,25 +755,25 @@ bool UILayoutComponent_Berth_Test::init()
if (UILayoutComponentTest::init()) if (UILayoutComponentTest::init())
{ {
Sprite* leftTopSprite = Sprite::create("cocosui/CloseSelected.png"); Sprite* leftTopSprite = Sprite::create("cocosui/CloseSelected.png");
LayoutComponent* leftTop = LayoutComponent::boundingLayoutComponent(leftTopSprite); LayoutComponent* leftTop = LayoutComponent::bindLayoutComponent(leftTopSprite);
leftTop->setHorizontalEdge(LayoutComponent::HorizontalEdge::Left); leftTop->setHorizontalEdge(LayoutComponent::HorizontalEdge::Left);
leftTop->setVerticalEdge(LayoutComponent::VerticalEdge::Top); leftTop->setVerticalEdge(LayoutComponent::VerticalEdge::Top);
_baseLayer->addChild(leftTopSprite); _baseLayer->addChild(leftTopSprite);
Sprite* leftBottomSprite = Sprite::create("cocosui/CloseSelected.png"); Sprite* leftBottomSprite = Sprite::create("cocosui/CloseSelected.png");
LayoutComponent* leftBottom = LayoutComponent::boundingLayoutComponent(leftBottomSprite); LayoutComponent* leftBottom = LayoutComponent::bindLayoutComponent(leftBottomSprite);
leftBottom->setHorizontalEdge(LayoutComponent::HorizontalEdge::Left); leftBottom->setHorizontalEdge(LayoutComponent::HorizontalEdge::Left);
leftBottom->setVerticalEdge(LayoutComponent::VerticalEdge::Bottom); leftBottom->setVerticalEdge(LayoutComponent::VerticalEdge::Bottom);
_baseLayer->addChild(leftBottomSprite); _baseLayer->addChild(leftBottomSprite);
Sprite* rightTopSprite = Sprite::create("cocosui/CloseSelected.png"); Sprite* rightTopSprite = Sprite::create("cocosui/CloseSelected.png");
LayoutComponent* rightTop = LayoutComponent::boundingLayoutComponent(rightTopSprite); LayoutComponent* rightTop = LayoutComponent::bindLayoutComponent(rightTopSprite);
rightTop->setHorizontalEdge(LayoutComponent::HorizontalEdge::Right); rightTop->setHorizontalEdge(LayoutComponent::HorizontalEdge::Right);
rightTop->setVerticalEdge(LayoutComponent::VerticalEdge::Top); rightTop->setVerticalEdge(LayoutComponent::VerticalEdge::Top);
_baseLayer->addChild(rightTopSprite); _baseLayer->addChild(rightTopSprite);
Sprite* rightBottomSprite = Sprite::create("cocosui/CloseSelected.png"); Sprite* rightBottomSprite = Sprite::create("cocosui/CloseSelected.png");
LayoutComponent* rightBottom = LayoutComponent::boundingLayoutComponent(rightBottomSprite); LayoutComponent* rightBottom = LayoutComponent::bindLayoutComponent(rightBottomSprite);
rightBottom->setHorizontalEdge(LayoutComponent::HorizontalEdge::Right); rightBottom->setHorizontalEdge(LayoutComponent::HorizontalEdge::Right);
rightBottom->setVerticalEdge(LayoutComponent::VerticalEdge::Bottom); rightBottom->setVerticalEdge(LayoutComponent::VerticalEdge::Bottom);
_baseLayer->addChild(rightBottomSprite); _baseLayer->addChild(rightBottomSprite);
@ -791,7 +791,7 @@ bool UILayoutComponent_Berth_Stretch_Test::init()
{ {
ImageView* leftTopSprite = ImageView::create("cocosui/CloseSelected.png"); ImageView* leftTopSprite = ImageView::create("cocosui/CloseSelected.png");
leftTopSprite->ignoreContentAdaptWithSize(false); leftTopSprite->ignoreContentAdaptWithSize(false);
LayoutComponent* leftTop = LayoutComponent::boundingLayoutComponent(leftTopSprite); LayoutComponent* leftTop = LayoutComponent::bindLayoutComponent(leftTopSprite);
leftTop->setHorizontalEdge(LayoutComponent::HorizontalEdge::Left); leftTop->setHorizontalEdge(LayoutComponent::HorizontalEdge::Left);
leftTop->setVerticalEdge(LayoutComponent::VerticalEdge::Top); leftTop->setVerticalEdge(LayoutComponent::VerticalEdge::Top);
leftTop->setStretchWidthEnabled(true); leftTop->setStretchWidthEnabled(true);
@ -803,7 +803,7 @@ bool UILayoutComponent_Berth_Stretch_Test::init()
ImageView* leftBottomSprite = ImageView::create("cocosui/CloseSelected.png"); ImageView* leftBottomSprite = ImageView::create("cocosui/CloseSelected.png");
leftBottomSprite->ignoreContentAdaptWithSize(false); leftBottomSprite->ignoreContentAdaptWithSize(false);
LayoutComponent* leftBottom = LayoutComponent::boundingLayoutComponent(leftBottomSprite); LayoutComponent* leftBottom = LayoutComponent::bindLayoutComponent(leftBottomSprite);
leftBottom->setHorizontalEdge(LayoutComponent::HorizontalEdge::Left); leftBottom->setHorizontalEdge(LayoutComponent::HorizontalEdge::Left);
leftBottom->setVerticalEdge(LayoutComponent::VerticalEdge::Bottom); leftBottom->setVerticalEdge(LayoutComponent::VerticalEdge::Bottom);
leftBottom->setStretchWidthEnabled(true); leftBottom->setStretchWidthEnabled(true);
@ -815,7 +815,7 @@ bool UILayoutComponent_Berth_Stretch_Test::init()
ImageView* rightTopSprite = ImageView::create("cocosui/CloseSelected.png"); ImageView* rightTopSprite = ImageView::create("cocosui/CloseSelected.png");
rightTopSprite->ignoreContentAdaptWithSize(false); rightTopSprite->ignoreContentAdaptWithSize(false);
LayoutComponent* rightTop = LayoutComponent::boundingLayoutComponent(rightTopSprite); LayoutComponent* rightTop = LayoutComponent::bindLayoutComponent(rightTopSprite);
rightTop->setHorizontalEdge(LayoutComponent::HorizontalEdge::Right); rightTop->setHorizontalEdge(LayoutComponent::HorizontalEdge::Right);
rightTop->setVerticalEdge(LayoutComponent::VerticalEdge::Top); rightTop->setVerticalEdge(LayoutComponent::VerticalEdge::Top);
rightTop->setStretchWidthEnabled(true); rightTop->setStretchWidthEnabled(true);
@ -827,7 +827,7 @@ bool UILayoutComponent_Berth_Stretch_Test::init()
ImageView* rightBottomSprite = ImageView::create("cocosui/CloseSelected.png"); ImageView* rightBottomSprite = ImageView::create("cocosui/CloseSelected.png");
rightBottomSprite->ignoreContentAdaptWithSize(false); rightBottomSprite->ignoreContentAdaptWithSize(false);
LayoutComponent* rightBottom = LayoutComponent::boundingLayoutComponent(rightBottomSprite); LayoutComponent* rightBottom = LayoutComponent::bindLayoutComponent(rightBottomSprite);
rightBottom->setHorizontalEdge(LayoutComponent::HorizontalEdge::Right); rightBottom->setHorizontalEdge(LayoutComponent::HorizontalEdge::Right);
rightBottom->setVerticalEdge(LayoutComponent::VerticalEdge::Bottom); rightBottom->setVerticalEdge(LayoutComponent::VerticalEdge::Bottom);
rightBottom->setStretchWidthEnabled(true); rightBottom->setStretchWidthEnabled(true);

View File

@ -1235,7 +1235,7 @@ void UILayoutComponentTest_Editor::configureGUIScene()
Text* back_label = Text::create("Back", "", 20); Text* back_label = Text::create("Back", "", 20);
back_label->setTouchEnabled(true); back_label->setTouchEnabled(true);
auto labelLayout = LayoutComponent::boundingLayoutComponent(back_label); auto labelLayout = LayoutComponent::bindLayoutComponent(back_label);
labelLayout->setHorizontalEdge(LayoutComponent::HorizontalEdge::Right); labelLayout->setHorizontalEdge(LayoutComponent::HorizontalEdge::Right);
labelLayout->setVerticalEdge(LayoutComponent::VerticalEdge::Bottom); labelLayout->setVerticalEdge(LayoutComponent::VerticalEdge::Bottom);
back_label->addTouchEventListener(CC_CALLBACK_2(UIScene_Editor::toGUIEditorTestScene, this)); back_label->addTouchEventListener(CC_CALLBACK_2(UIScene_Editor::toGUIEditorTestScene, this));