本文整理汇总了C++中HorizontalLayout::setSizeLimitedToParent方法的典型用法代码示例。如果您正苦于以下问题:C++ HorizontalLayout::setSizeLimitedToParent方法的具体用法?C++ HorizontalLayout::setSizeLimitedToParent怎么用?C++ HorizontalLayout::setSizeLimitedToParent使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类HorizontalLayout
的用法示例。
在下文中一共展示了HorizontalLayout::setSizeLimitedToParent方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: finish
void HallMainWidget::finish()
{
float hrate = getHorAdaptResourceScale();
CCSprite *bottomBg = CCSprite::createWithSpriteFrameName("hallbottom.png");
CCSize bgSize = bottomBg->getContentSize();
BasNodeDelegateWidget *bottomBar = new BasNodeDelegateWidget(bottomBg,CCSizeMake(bgSize.width * hrate,bgSize.height * hrate));
this->addChild(bottomBar);
bottomBar->setLeft("parent",uilib::Left);
bottomBar->setRight("parent",uilib::Right);
bottomBar->setBottom("parent",uilib::Bottom);
bottomBar->setHeight(bgSize.height * hrate);
BasWidget *pageWidget = new BasWidget;
this->addChild(pageWidget);
pageWidget->setLeft("parent",uilib::Left);
pageWidget->setRight("parent",uilib::Right);
pageWidget->setTop("parent",uilib::Top);
pageWidget->setBottom(bottomBar->getName(),uilib::Top);
BasWidget *buttonContainer = bottomBar;
if(m_pages.size() != 0){
HorizontalLayout *barlay = new HorizontalLayout;
barlay->setSpacing(5);
barlay->setAlignChildsSize(true);
barlay->setAveraged(true);
barlay->setSizeLimitedToParent();
BasButton *button;
if(m_buttonTheme.empty())
m_buttonTheme = "default";
BasNodeAction *pageMoveIn = UiNodeActionFactory::getInstance()->getMoveActionByName("movein");
pageMoveIn->setEaseType(uilib::EaseNone);
pageMoveIn->setMoveInType(uilib::HorizontalRightIn);
BasNodeAction *pageMoveOut = UiNodeActionFactory::getInstance()->getMoveActionByName("moveout");
pageMoveOut->setEaseType(uilib::EaseNone);
pageMoveOut->setMoveOutType(uilib::HorizontalRightOut);
for(unsigned int i = 0;i < m_pages.size();i++){
HallPageDef *page = m_pages[i];
button = new BasButton;
button->setTouchPriority(uilib::HighestPriority);
button->setButtonIndex(i);
button->setClickCB(this,callfuncND_selector(HallMainWidget::onPageButtonClicked));
button->setButtonInfo("",m_buttonTheme,
page->m_img,
CCSizeMake(0,0),
page->m_pressedImg
);
button->setWidthHeightRate(0.735);
barlay->addWidget(button);
page->m_page->setContainer(pageWidget);
page->m_page->setMoveinAction(pageMoveIn);
page->m_page->setMoveoutAction(pageMoveOut);
}
buttonContainer->setLayout(barlay);
m_currPage = 0;
}
}