本文整理汇总了C++中HorizontalLayout类的典型用法代码示例。如果您正苦于以下问题:C++ HorizontalLayout类的具体用法?C++ HorizontalLayout怎么用?C++ HorizontalLayout使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了HorizontalLayout类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Dialog
/**
* Create the dialog that will display receipt fields, on rows.
*/
void MainScreen::createReceiptDialog()
{
mReceiptDialog = new Dialog();
VerticalLayout* dialogLayout = new VerticalLayout();
mReceiptDialog->setMainWidget(dialogLayout);
HorizontalLayout* titleLayout = new HorizontalLayout();
titleLayout->wrapContentVertically();
titleLayout->setChildHorizontalAlignment(MAW_ALIGNMENT_CENTER);
Label* title = new Label("Product Receipt");
title->setFontColor(RECEIPT_FIELD_COLOR);
titleLayout->addChild(title);
dialogLayout->addChild(titleLayout);
Label* receiptProductIdInfo = new Label("Product ID");
receiptProductIdInfo->setFontColor(RECEIPT_FIELD_COLOR);
mReceiptProductId = new Label();
Label* receiptAppId = new Label("App ID");
receiptAppId->setFontColor(RECEIPT_FIELD_COLOR);
mReceiptAppId = new Label();
Label* receiptTransactionDate = new Label("Transaction date");
receiptTransactionDate->setFontColor(RECEIPT_FIELD_COLOR);
mReceiptTransactionDate = new Label();
dialogLayout->addChild(receiptProductIdInfo);
dialogLayout->addChild(mReceiptProductId);
dialogLayout->addChild(receiptAppId);
dialogLayout->addChild(mReceiptAppId);
dialogLayout->addChild(receiptTransactionDate);
dialogLayout->addChild(mReceiptTransactionDate);
if ( getPlatform() == IOS )
{
Label* receiptTransactionId = new Label("Transaction ID");
receiptTransactionId->setFontColor(RECEIPT_FIELD_COLOR);
mReceiptTransactionId = new Label();
Label* receiptVersionExternalId = new Label("Version external ID");
receiptVersionExternalId->setFontColor(RECEIPT_FIELD_COLOR);
mReceiptVersionExternalId = new Label();
Label* receiptBid = new Label("BID");
receiptBid->setFontColor(RECEIPT_FIELD_COLOR);
mReceiptBid = new Label();
dialogLayout->addChild(receiptTransactionId);
dialogLayout->addChild(mReceiptTransactionId);
dialogLayout->addChild(receiptVersionExternalId);
dialogLayout->addChild(mReceiptVersionExternalId);
dialogLayout->addChild(receiptBid);
dialogLayout->addChild(mReceiptBid);
}
mReceiptOkButton = new Button();
mReceiptOkButton->setText("Ok");
dialogLayout->addChild(mReceiptOkButton);
}
示例2: HorizontalLayout
void SettingsScreen::createListViewItemUnhighlightedAnimationLayout(VerticalLayout* listViewItemPropertiesVerticalLayout)
{
HorizontalLayout* unhighlightedAnimationLayout = new HorizontalLayout();
unhighlightedAnimationLayout->wrapContentVertically();
mListViewItemUnhighlightedCheckbox = new CheckBox();
mListViewItemUnhighlightedCheckbox->setState(false);
Label* unhighlightedAnimationLabel = new Label();
unhighlightedAnimationLabel->setText("Unhighlighted animation");
unhighlightedAnimationLayout->addChild(mListViewItemUnhighlightedCheckbox);
unhighlightedAnimationLayout->addChild(unhighlightedAnimationLabel);
listViewItemPropertiesVerticalLayout->addChild(unhighlightedAnimationLayout);
}
示例3: HorizontalLayout
/**
* Creates and adds main layout to the screen.
*/
void ImageScreen::createMainLayout()
{
HorizontalLayout* mainLayout = new HorizontalLayout();
Screen::setMainWidget(mainLayout);
mImage = new Image();
// mImage->setHeight(this->getHeight());
// mImage->setWidth(this->getWidth());
mImage->fillSpaceHorizontally();
mImage->fillSpaceVertically();
mImage->setScaleMode(IMAGE_SCALE_XY);
mainLayout->addChild(mImage);
}
示例4: HorizontalLayout
void SettingsScreen::createListViewItemFontSizeLayout(VerticalLayout* listViewItemPropertiesVerticalLayout)
{
HorizontalLayout* currentListViewItemFontSizeLayout = new HorizontalLayout();
currentListViewItemFontSizeLayout->wrapContentVertically();
mSetListViewItemFontSizeButton = new Button();
mSetListViewItemFontSizeButton->setText("Set font size");
mSetListViewItemFontSizeButton->fillSpaceHorizontally();
currentListViewItemFontSizeLayout->addChild(mSetListViewItemFontSizeButton);
mSetListViewItemFontSizeEditBox = new EditBox();
mSetListViewItemFontSizeEditBox->fillSpaceHorizontally();
mSetListViewItemFontSizeEditBox->setInputMode(EDIT_BOX_INPUT_MODE_NUMERIC);
currentListViewItemFontSizeLayout->addChild(mSetListViewItemFontSizeEditBox);
listViewItemPropertiesVerticalLayout->addChild(currentListViewItemFontSizeLayout);
}
示例5: assert
Dialog::Dialog(std::shared_ptr<DialogData> p) {
using namespace DialogSettings;
sizePolicy = WidgetSizePolicy::PREFER;
layout._setPos(IntPair{borderSz, borderSz});
layout.setMargins(0, 0, 0, 0);
layout.setWidgetAlignment(WidgetAlignmentHoriz::LEFT, WidgetAlignmentVert::TOP);
layout.setSpacing(widgetSpacing);
// process data
assert(p);
data = p;
assert(!data->title.empty());
assert(!data->message.empty());
assert(!data->buttonText.empty());
TextRenderer* tr = GameData::instance().resources->getDefaultTR();
WidgetText* textTitle = new WidgetText;
textTitle->enableBackground(colTitleBg);
textTitle->setRenderer(tr);
textTitle->setTextColor(colText);
textTitle->setText(data->title);
WidgetText* textMessage = new WidgetText;
textMessage->setRenderer(tr);
textMessage->setTextColor(colText);
textMessage->setText(data->message);
// add buttons
HorizontalLayout* hLayout = new HorizontalLayout;
hLayout->setWidgetAlignment(WidgetAlignmentHoriz::LEFT, WidgetAlignmentVert::TOP);
hLayout->setSpacing(btnSpacing);
std::shared_ptr<TextButton::Style> buttonStyle = std::make_shared<TextButton::Style>();
buttonStyle->tr = tr;
buttonStyle->outlineSz = 0;
buttonStyle->colText = colBtnText;
buttonStyle->colBgOut = colBtnBgOut;
buttonStyle->colBgOver = colBtnBgOver;
buttonStyle->colBgDown = colBtnBgDown;
TextButton* button;
for (std::size_t i = 0; i < data->buttonText.size(); ++i) {
button = new TextButton;
button->setStyle(buttonStyle);
button->setText(data->buttonText[i]);
button->setCallback(std::bind(&self_type::buttonCallback, this, i));
hLayout->add(button);
}
// add to layout
layout.add(textTitle);
layout.add(textMessage);
layout.add(hLayout);
// finalize
layout._setParent(this);
_resize(getPrefSize(), WidgetResizeFlag::SELF);
}
示例6: VerticalLayout
/**
* Creates and adds main layout to the screen.
*/
void MainScreen::createMainLayout()
{
// Create and add the main layout to the screen.
mMainLayout = new VerticalLayout();
mMainLayout->setBackgroundColor(0x220099);
Screen::setMainWidget(mMainLayout);
mGenderRadioGroup = new RadioGroup();
mMainLayout->addChild(mGenderRadioGroup);
mFemaleButton = new RadioButton();
mFemaleButton->setTextColor(0xFF0000);
mFemaleButton->setText("Female");
mMaleButton = new RadioButton();
mMaleButton->setText("Male");
mMaleButton->setTextColor(0x0000FF);
mUnknownButton = new RadioButton();
mUnknownButton->setText("Alien");
mUnknownButton->setTextColor(0x00FF00);
mGenderRadioGroup->addView(mFemaleButton);
mGenderRadioGroup->addView(mMaleButton);
mGenderRadioGroup->addView(mUnknownButton);
mClearGenderSelection = new Button();
mClearGenderSelection->setText("Clear gender selection");
mMainLayout->addChild(mClearGenderSelection);
HorizontalLayout* getGenderLayout = new HorizontalLayout();
getGenderLayout->setChildVerticalAlignment(MAW_ALIGNMENT_CENTER);
mMainLayout->addChild(getGenderLayout);
mGetGenderSelection = new Button();
mGetGenderSelection->setText("Get the gender selection");
getGenderLayout->addChild(mGetGenderSelection);
mGenderSelectionLabel = new Label();
mGenderSelectionLabel->fillSpaceHorizontally();
getGenderLayout->addChild(mGenderSelectionLabel);
HorizontalLayout* getCheckedLayout = new HorizontalLayout();
getCheckedLayout->setChildVerticalAlignment(MAW_ALIGNMENT_CENTER);
mMainLayout->addChild(getCheckedLayout);
mGetGenderChecked = new Button();
mGetGenderChecked->setText("Get male checked state");
getCheckedLayout->addChild(mGetGenderChecked);
mGenderCheckedLabel = new Label();
mGenderCheckedLabel->fillSpaceHorizontally();
getCheckedLayout->addChild(mGenderCheckedLabel);
mToggleMaleButton = new Button();
mToggleMaleButton->setText("Toggle(check) Male button");
mMainLayout->addChild(mToggleMaleButton);
mGenderSelectionEvent = new Label();
mGenderSelectionEvent->setText("Radio Group event");
mMainLayout->addChild(mGenderSelectionEvent);
mRadioButtonSelectEvent = new Label();
mRadioButtonSelectEvent->setText("Radio Button select event");
mMainLayout->addChild(mRadioButtonSelectEvent);
mradioButtonUnselectEvent = new Label();
mradioButtonUnselectEvent->setText("Radio Button unselect event");
mMainLayout->addChild(mradioButtonUnselectEvent);
}
示例7: HorizontalLayout
/**
* Creates the set button text layout.
*/
void ButtonSettingsLayout::createSetButtonTextLayout()
{
HorizontalLayout* setTextHorizontalLayout = new HorizontalLayout();
setTextHorizontalLayout->setHeight(PROPERTY_LINE_HEIGHT);
setTextButton = new Button();
setTextButton->setText("Set button text:");
setTextButton->fillSpaceHorizontally();
setTextHorizontalLayout->addChild(setTextButton);
setTextEditBox = new EditBox();
setTextEditBox->setPlaceholder("Button text");
setTextEditBox->fillSpaceHorizontally();
setTextHorizontalLayout->addChild(setTextEditBox);
this->addChild(setTextHorizontalLayout);
}
示例8: HorizontalLayoutFromDef
static HorizontalLayout* HorizontalLayoutFromDef(ParsedMui& parsed, TxtNode* structDef) {
CrashIf(!structDef->IsStructWithName("HorizontalLayout"));
HorizontalLayoutDef* def = DeserializeHorizontalLayoutDef(structDef);
HorizontalLayout* l = new HorizontalLayout();
l->SetName(def->name);
Vec<DirectionalLayoutDataDef*>* children = def->children;
DirectionalLayoutData ld;
for (size_t i = 0; children && i < children->size(); i++) {
SetDirectionalLayouData(ld, parsed, children->at(i));
l->Add(ld);
}
FreeHorizontalLayoutDef(def);
return l;
}
示例9: HorizontalLayout
/**
* Creates the set edit box placeholder text layout.
*/
void EditBoxSettingsLayout::createSetPlaceholderLayout()
{
HorizontalLayout* getPlaceholderHorizontalLayout = new HorizontalLayout();
getPlaceholderHorizontalLayout->setHeight(PROPERTY_LINE_HEIGHT);
setPlaceholderButton = new Button();
setPlaceholderButton->setText("Set placeholder text:");
setPlaceholderButton->fillSpaceHorizontally();
getPlaceholderHorizontalLayout->addChild(setPlaceholderButton);
setPlaceholderEditBox = new EditBox();
setPlaceholderEditBox->setPlaceholder("Edit box placeholder");
setPlaceholderEditBox->fillSpaceHorizontally();
getPlaceholderHorizontalLayout->addChild(setPlaceholderEditBox);
mEditBoxListView->addChild(getPlaceholderHorizontalLayout);
}
示例10: ListView
/**
* Creates and adds main layout to the screen.
*/
void MainScreen::createMainLayout()
{
// Create and add the main layout to the screen.
mMainListView = new ListView();
Screen::setMainWidget(mMainListView);
Label* info1 = new Label();
info1->setText("First edit box with Capitalize all characters");
mMainListView->addChild(info1);
mEditBox = new EditBox();
mEditBox->setPlaceholder("Enter text...");
mEditBox->setHeight(100);
mEditBox->fillSpaceHorizontally();
mMainListView->addChild(mEditBox);
HorizontalLayout* layout = new HorizontalLayout();
layout->setHeight(75);
mMainListView->addChild(layout);
mSetTextButton = new Button();
mSetTextButton->setText("Reset text to DEFAULT ");
layout->addChild(mSetTextButton);
mGetTextButton = new Button();
mGetTextButton->setText("Get text");
layout->addChild(mGetTextButton);
mGetTextLabel = new Label();
mMainListView->addChild(mGetTextLabel);
mKeyboardButton = new Button();
mKeyboardButton->setText("Show/hide keyboard");
mKeyboardButton->fillSpaceHorizontally();
mMainListView->addChild(mKeyboardButton);
// Create layout for widgets.
this->createDecimalEditBoxView(mMaxTextLengthEditBox, mMainListView, MAX_TEXT_LENGTH_LABEL_TEXT);
this->createDecimalEditBoxView(mMaxLinesEditBox, mMainListView, MAX_LINES_LABEL_TEXT);
this->createDecimalEditBoxView(mMinLinesEditBox, mMainListView, MIN_LINES_LABEL_TEXT);
this->createDecimalEditBoxView(mLinesNumberEditBox, mMainListView, LINES_NUMBER_LABEL_TEXT);
this->createDecimalEditBoxView(mPlaceholderColorEditBox, mMainListView, PLACEHOLDER_COLOR_LABEL_TEXT);
this->createInputModeListView(mMainListView);
this->createInputFlagListView(mMainListView);
maSetColor(0x8A2BE2);
}
示例11: HorizontalLayout
/**
* Create an layout containing a label and a check box widget.
* The check box will be used to set the edit box #MAW_EDIT_BOX_MODE property.
* Platform: iOS.
*/
HorizontalLayout* MainScreen::createModePropertyLayout()
{
if (!isIOS())
{
return NULL;
}
HorizontalLayout* hLayout = new HorizontalLayout();
hLayout->wrapContentVertically();
Label* label = new Label();
label->setText("Single line");
hLayout->addChild(label);
mSingleLineCheckBox = new CheckBox();
mSingleLineCheckBox->setState(true);
HorizontalLayout* spacer = new HorizontalLayout();
int spacerWidth = this->getWidth() - label->getWidth() -
mSingleLineCheckBox->getWidth();
spacer->setWidth(spacerWidth);
hLayout->addChild(spacer);
hLayout->addChild(mSingleLineCheckBox);
return hLayout;
}
示例12: HorizontalLayout
/**
* Creates a horizontal layout, adds it to the main layout, initializes the
* edit box and adds it to the horizontal layout.
* @param editBox The editbox to be created and added on the screen.
* @param mainLayout Widgets will be added to it.
*/
void MainScreen::createDecimalEditBoxView(EditBox* &editBox, ListView* mainListView, String text)
{
// Create layout for widgets.
HorizontalLayout* layout = new HorizontalLayout();
layout->setHeight(65);
mainListView->addChild(layout);
// Add label with info.
Label* label = new Label();
label->setText(text);
layout->addChild(label);
// Create the edit box.
editBox = new EditBox();
editBox->setInputMode(EDIT_BOX_INPUT_MODE_DECIMAL);
editBox->fillSpaceHorizontally();
layout->addChild(editBox);
}
示例13: CreateLayout
static void CreateLayout(EbookControls *ctrls)
{
HorizontalLayout *topPart = new HorizontalLayout();
DirectionalLayoutData ld;
ld.Set(ctrls->prev, SizeSelf, 1.f, GetElAlignCenter());
topPart->Add(ld);
ld.Set(ctrls->page, 1.f, 1.f, GetElAlignTop());
topPart->Add(ld);
ld.Set(ctrls->next, SizeSelf, 1.f, GetElAlignBottom());
topPart->Add(ld);
VerticalLayout *l = new VerticalLayout();
ld.Set(topPart, 1.f, 1.f, GetElAlignTop());
l->Add(ld, true);
ld.Set(ctrls->progress, SizeSelf, 1.f, GetElAlignCenter());
l->Add(ld);
ld.Set(ctrls->status, SizeSelf, 1.f, GetElAlignCenter());
l->Add(ld);
ctrls->mainWnd->layout = l;
}
示例14: Button
/**
* Creates the list manipulation UI (remove section, add/remove item).
*/
void ListScreen::createListManipulationLayout()
{
mRemoveFirstSection = new Button();
mRemoveFirstSection->setText("Remove first secction");
mRemoveFirstSection->fillSpaceHorizontally();
mMainLayout->addChild(mRemoveFirstSection);
HorizontalLayout* itemManipulationLayout = new HorizontalLayout();
itemManipulationLayout->wrapContentVertically();
mAddItem = new Button();
mAddItem->setText("Add item");
mAddItem->fillSpaceHorizontally();
itemManipulationLayout->addChild(mAddItem);
mRemoveItem = new Button();
mRemoveItem->setText("Remove item");
mRemoveItem->fillSpaceHorizontally();
itemManipulationLayout->addChild(mRemoveItem);
mMainLayout->addChild(itemManipulationLayout);
}
示例15: getHorAdaptResourceScale
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;
}
}