void create() { setTitle("Test Application"); setGeometry(Geometry(128, 128, 640, 480 )); layout.append(bProcess); layout.append(lvOutput); layout.append(baseN); layout.append(baseR); unsigned bn = integer(baseN.text()), br = integer(baseR.text()); if (br>=0 && br<=bn) { lstring hdr; for (unsigned i = 0; i < br; ++i) { hdr.append((string){i>0?",":"","B",i+1}); } lvOutput.setHeaderText(hdr); } bProcess.setText("Draw!"); bProcess.onActivate = [&]() { lvOutput.reset(); }; //Hook it all up append(layout); onClose = [&layout] { // layout.setSkipGeomUpdates(true); //Example of skipping pointless update calculations. OS::quit(); }; setVisible(); }
/** * 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); }
void reflowStatic() { tabMain.append("OPN"); tabMain.setLayout(0, ltOPN); frTogglesOPN.setLayout(lTogglesOPN); ltOPN.append(frTogglesOPN, {~0,~0}, 5); ltOPN.append(lOPN2, {~0,~0}); tabMain.append("OPM"); tabMain.setLayout(1, ltOPM); frTogglesOPM.setLayout(lTogglesOPM); ltOPM.append(frTogglesOPM, {~0,~0}, 5); ltOPM.append(lOPM2, {~0,~0}); }
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); }
void SettingsScreen::createListViewItemEditModeLayout(VerticalLayout* listViewItemPropertiesVerticalLayout) { HorizontalLayout* editModeLayout = new HorizontalLayout(); editModeLayout->wrapContentVertically(); mListViewItemEditModeCheckbox = new CheckBox(); mListViewItemEditModeCheckbox->setState(false); Label* editModeLabel = new Label(); editModeLabel->setText("Edit mode"); editModeLayout->addChild(mListViewItemEditModeCheckbox); editModeLayout->addChild(editModeLabel); listViewItemPropertiesVerticalLayout->addChild(editModeLayout); }
void SettingsScreen::createListViewItemDeleteButtonTextLayout(VerticalLayout* listViewItemPropertiesVerticalLayout) { HorizontalLayout* currentListViewItemDeleteButtonLayout = new HorizontalLayout(); currentListViewItemDeleteButtonLayout->wrapContentVertically(); mSetListViewItemDeleteTitleButton = new Button(); mSetListViewItemDeleteTitleButton->setText("Set delete"); mSetListViewItemDeleteTitleButton->fillSpaceHorizontally(); currentListViewItemDeleteButtonLayout->addChild(mSetListViewItemDeleteTitleButton); mSetListViewItemDeleteTitleEditBox = new EditBox(); mSetListViewItemDeleteTitleEditBox->fillSpaceHorizontally(); currentListViewItemDeleteButtonLayout->addChild(mSetListViewItemDeleteTitleEditBox); listViewItemPropertiesVerticalLayout->addChild(currentListViewItemDeleteButtonLayout); }
/** * 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); }
void SettingsScreen::createListViewItemFontColorLayout(VerticalLayout* listViewItemPropertiesVerticalLayout) { HorizontalLayout* currentListViewItemFontColorLayout = new HorizontalLayout(); currentListViewItemFontColorLayout->wrapContentVertically(); mSetListViewItemFontColorButton = new Button(); mSetListViewItemFontColorButton->setText("Set font color"); mSetListViewItemFontColorButton->fillSpaceHorizontally(); currentListViewItemFontColorLayout->addChild(mSetListViewItemFontColorButton); mSetListViewItemFontColorEditBox = new EditBox(); mSetListViewItemFontColorEditBox->fillSpaceHorizontally(); mSetListViewItemFontColorEditBox->setPlaceholder("ex: 0xFF0000"); currentListViewItemFontColorLayout->addChild(mSetListViewItemFontColorEditBox); listViewItemPropertiesVerticalLayout->addChild(currentListViewItemFontColorLayout); }
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); }
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); }
/** * 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); }
/** * 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); }
/** * Creates the get button text layout. */ void ButtonSettingsLayout::createGetButtonTextLayout() { HorizontalLayout* getTextHorizontalLayout = new HorizontalLayout(); getTextHorizontalLayout->setHeight(PROPERTY_LINE_HEIGHT); getTextButton = new Button(); getTextButton->setText("Get button text:"); getTextButton->fillSpaceHorizontally(); getTextHorizontalLayout->addChild(getTextButton); getTextLabel = new Label(); getTextLabel->setText("No text yet"); getTextLabel->fillSpaceHorizontally(); getTextHorizontalLayout->addChild(getTextLabel); this->addChild(getTextHorizontalLayout); }
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; }
/** * 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); }
/** * Creates the get button text layout. */ void EditBoxSettingsLayout::createGetEditBoxTextLayout() { HorizontalLayout* getTextHorizontalLayout = new HorizontalLayout(); getTextHorizontalLayout->setHeight(PROPERTY_LINE_HEIGHT); getTextButton = new Button(); getTextButton->setText("Get edit box text:"); getTextButton->fillSpaceHorizontally(); getTextHorizontalLayout->addChild(getTextButton); getTextLabel = new Label(); getTextLabel->setText("No text yet"); getTextLabel->fillSpaceHorizontally(); getTextHorizontalLayout->addChild(getTextLabel); mEditBoxListView->addChild(getTextHorizontalLayout); }
/** * 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); }
/** * 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; }
/** * 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); }
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; }
/** proc **/ void init() { setWindowGeometry({128,128,400,256}); setTitle("Preferences"); lMain.setMargin(5); frTogglesOPN.setText("Output Formats"); ltOPN.setMargin(5); lTogglesOPN.setMargin(5); opnToggles[N::OPN::Types::VGI].setText("VGI"); opnToggles[N::OPN::Types::TFI].setText("TFI"); opnToggles[N::OPN::Types::TYI].setText("TYI"); opnToggles[N::OPN::Types::EIF].setText("EIF"); opnToggles[N::OPN::Types::DMP].setText("DMP"); opnToggles[N::OPN::Types::Y12].setText("Y12"); opnToggles[N::OPN::Types::GYB].setText("GYB"); frTogglesOPM.setText("Output Formats"); ltOPM.setMargin(5); lTogglesOPM.setMargin(5); opmToggles[N::OPM::Types::OPM].setText("OPM"); initProc(); }
/** * 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); }
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; } }
/** * Helper function to create list view item with * specific label and edit/check box. */ ListViewItem* CreateNotificationScreen::createListViewItem(const MAUtil::String& labelText, Widget* widget)//EditBox* editBox) { ListViewItem* listItem; HorizontalLayout* hLayout; Widget* space; Label* label; hLayout = new HorizontalLayout(); label = new Label(); label->setText(labelText); hLayout->addChild(label); space = this->createSpacer(); hLayout->addChild(space); widget->fillSpaceHorizontally(); hLayout->addChild(widget); listItem = new ListViewItem(); listItem->addChild(hLayout); return listItem; }
/** * 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(MAIN_LAYOUT_COLOR); Screen::setMainWidget(mMainLayout); // Create the "BUY" section. VerticalLayout* buyLayout = new VerticalLayout(); buyLayout->wrapContentVertically(); mMainLayout->addChild(buyLayout); Label* info = new Label(); info->setText("Items for sale"); info->setFontColor(INFO_LABELS_COLOR); buyLayout->addChild(info); // Add the list of available items for sale along with check boxes. for (int i=0; i < mProductNamesList.size(); i++) { HorizontalLayout* itemLayout = new HorizontalLayout(); itemLayout->wrapContentVertically(); CheckBox* itemCheckBox = new CheckBox(); itemLayout->addChild(itemCheckBox); mItemsCheckBoxes.add(itemCheckBox); Label* itemId = new Label(); itemId->setText(mProductNamesList[i]); itemId->setFontColor(ITEMS_COLOR); itemLayout->addChild(itemId); buyLayout->addChild(itemLayout); } // Use buy button to purchase the checked product it from the "BUY" section. mBuyButton = new Button(); mBuyButton->setText("BUY"); mMainLayout->addChild(mBuyButton); // Add a small break line between the two sections. HorizontalLayout* lineLayout = new HorizontalLayout(); lineLayout->setHeight(BREAKLINE_HEIGHT); lineLayout->setBackgroundColor(BREAKLINE_COLOR); mMainLayout->addChild(lineLayout); // Create the "HISTORY" section. VerticalLayout* purchasedLayout = new VerticalLayout(); Label* purchasedLabel = new Label(); purchasedLabel->setText("Items you own"); purchasedLabel->setFontColor(INFO_LABELS_COLOR); purchasedLayout->addChild(purchasedLabel); mPurchasedItemsList = new ListView(); purchasedLayout->addChild(mPurchasedItemsList); mMainLayout->addChild(purchasedLayout); }
void create() { layout.setMargin(5); list.append("Video"); list.append("Audio"); list.append("Input"); list.setSelection(0); append(layout); append(videoPanel); append(audioPanel); append(inputPanel); layout.append(list, 120, ~0, 5); select(); setStatusText("???"); setStatusVisible(); setTitle("Layout List"); setFrameGeometry({ 64, 64, 640, 360 }); setVisible(); onClose = &OS::quit; list.onChange = { &Application::select, this }; }
void FirstScreen::createRemoveItemDialog() { mRemoveItemDialog = new Dialog(); VerticalLayout* removeDialogLayout = new VerticalLayout(); mRemoveItemDialog->addChild(removeDialogLayout); mItemsPicker = new CustomPicker(); for (int i=0; i<mMenuItems.size(); i++) { HorizontalLayout* itemLayout = new HorizontalLayout(); Label* info = new Label("Item on position" +MAUtil::integerToString(i)); itemLayout->addChild(info); mItemsPicker->addChild(itemLayout); } mRemoveItemDone = new Button(); mRemoveItemDone->setText("Remove selected item"); mRemoveAllItemsDone = new Button(); mRemoveAllItemsDone->setText("Remove ALL items"); removeDialogLayout->addChild(mItemsPicker); removeDialogLayout->addChild(mRemoveItemDone); removeDialogLayout->addChild(mRemoveAllItemsDone); }
/** * Creates and adds main layout to the screen. */ void EditBoxSettingsLayout::createMainLayout() { mEditBoxListView = new ListView(); this->addChild(mEditBoxListView); createSetEditBoxTextLayout(); createGetEditBoxTextLayout(); createSetPlaceholderLayout(); mGetTextLabel = new Label(); mEditBoxListView->addChild(mGetTextLabel); // create and add the show/hide keyboard button mKeyboardButton = new Button(); mKeyboardButton->setText("Show/hide keyboard"); mKeyboardButton->setHeight(PROPERTY_LINE_HEIGHT); mKeyboardButton->fillSpaceHorizontally(); mEditBoxListView->addChild(mKeyboardButton); // Create layout for widgets. createDecimalEditBoxView(mMaxTextLengthEditBox, mEditBoxListView, MAX_TEXT_LENGTH_LABEL_TEXT); createDecimalEditBoxView(mMaxLinesEditBox, mEditBoxListView, MAX_LINES_LABEL_TEXT); createDecimalEditBoxView(mMinLinesEditBox, mEditBoxListView, MIN_LINES_LABEL_TEXT); createDecimalEditBoxView(mLinesNumberEditBox, mEditBoxListView, LINES_NUMBER_LABEL_TEXT); createDecimalEditBoxView(mPlaceholderColorEditBox, mEditBoxListView, PLACEHOLDER_COLOR_LABEL_TEXT); createInputModeListView(mEditBoxListView); // create a black separator between the lists HorizontalLayout* separatorLayout = new HorizontalLayout(); separatorLayout->setBackgroundColor(0x000000); separatorLayout->setHeight(PROPERTY_LINE_HEIGHT); mEditBoxListView->addChild(separatorLayout); createInputFlagListView(mEditBoxListView); }
Application() { setGeometry({ 256, 256, 640, 400 }); listA.append("Item"); listA.append("Item"); listA.append("Item"); listA.append("Item"); listA.append("Item"); listB.append("Item"); listB.append("Item"); listB.append("Item"); listB.append("Item"); listB.append("Item"); append(layout); layout.setMargin(5); layout.append(listA, ~0, ~0, 5); layout.append(listB, ~0, ~0, 0); onClose = &OS::quit; setVisible(); }
Application() { setGeometry({256, 256, 640, 400}); layout.setMargin(5); button.setText("Toggle"); itemA[0].setText("Item A0"); itemA[1].setText("Item A1"); itemA[2].setText("Item A2"); RadioBox::group(itemA[0], itemA[1], itemA[2]); itemB[0].setText("Item B0"); itemB[1].setText("Item B1"); itemB[2].setText("Item B2"); RadioBox::group(itemB[0], itemB[1], itemB[2]); itemC[0].setText("Item C0"); itemC[1].setText("Item C1"); itemC[2].setText("Item C2"); RadioBox::group(itemC[0], itemC[1], itemC[2]); append(layout); layout.append(button, {~0, 0}, 5); layout.append(groupA, {~0, 0}, 5); groupA.append(itemA[0], {~0, 0}, 5); groupA.append(itemA[1], {~0, 0}, 5); groupA.append(itemA[2], {~0, 0}); layout.append(groupB, {~0, 0}, 5); groupB.append(itemB[0], {~0, 0}, 5); groupB.append(itemB[1], {~0, 0}, 5); groupB.append(itemB[2], {~0, 0}); layout.append(groupC, {~0, 0}, 5); groupC.append(itemC[0], {~0, 0}, 5); groupC.append(itemC[1], {~0, 0}, 5); groupC.append(itemC[2], {~0, 0}); onClose = &OS::quit; itemC[0].onActivate = [] { print("C0\n"); }; itemC[1].onActivate = [] { print("C1\n"); }; itemC[2].onActivate = [] { print("C2\n"); }; button.onActivate = [&] { //print("Before: ", itemC[0].checked(), ",", itemC[1].checked(), ",", itemC[2].checked(), "\n"); static bool visible = true; if(visible) { layout.remove(groupC); } else { layout.append(groupC, {~0, 0}, 5); } visible = !visible; //print("After!: ", itemC[0].checked(), ",", itemC[1].checked(), ",", itemC[2].checked(), "\n"); }; setVisible(); }