/** * Create ListView section properties layout */ void SettingsScreen::createListViewSectionPropertiesLayout() { VerticalLayout* listViewSectionPropertiesVerticalLayout = new VerticalLayout(); listViewSectionPropertiesVerticalLayout->wrapContentVertically(); mListViewSectionLabel = new Label(); mListViewSectionLabel->setText("No section in focus"); mListViewSectionLabel->setFontSize(TITLE_FONT_SIZE); mListViewSectionLabel->setFontColor(0xFF0000); listViewSectionPropertiesVerticalLayout->addChild(mListViewSectionLabel); // create the current section title layout HorizontalLayout* currentSectionTitleLayout = new HorizontalLayout(); currentSectionTitleLayout->wrapContentVertically(); mSetListViewSectionTitleButton = new Button(); mSetListViewSectionTitleButton->setText("Set title"); mSetListViewSectionTitleButton->fillSpaceHorizontally(); currentSectionTitleLayout->addChild(mSetListViewSectionTitleButton); mCurrentListViewSectionTitleEditBox = new EditBox(); mCurrentListViewSectionTitleEditBox->fillSpaceHorizontally(); currentSectionTitleLayout->addChild(mCurrentListViewSectionTitleEditBox); listViewSectionPropertiesVerticalLayout->addChild(currentSectionTitleLayout); // create the current section header text layout HorizontalLayout* currentSectionHeaderTextLayout = new HorizontalLayout(); currentSectionHeaderTextLayout->wrapContentVertically(); mSetListViewSectionHeaderButton = new Button(); mSetListViewSectionHeaderButton->setText("Set header"); mSetListViewSectionHeaderButton->fillSpaceHorizontally(); currentSectionHeaderTextLayout->addChild(mSetListViewSectionHeaderButton); mCurrentListViewSectionHeaderEditBox = new EditBox(); mCurrentListViewSectionHeaderEditBox->fillSpaceHorizontally(); currentSectionHeaderTextLayout->addChild(mCurrentListViewSectionHeaderEditBox); listViewSectionPropertiesVerticalLayout->addChild(currentSectionHeaderTextLayout); // create the current section footer text layout HorizontalLayout* currentSectionFooterTextLayout = new HorizontalLayout(); currentSectionFooterTextLayout->wrapContentVertically(); mSetListViewSectionFooterButton = new Button(); mSetListViewSectionFooterButton->setText("Set footer"); mSetListViewSectionFooterButton->fillSpaceHorizontally(); currentSectionFooterTextLayout->addChild(mSetListViewSectionFooterButton); mCurrentListViewSectionFooterEditBox = new EditBox(); mCurrentListViewSectionFooterEditBox->fillSpaceHorizontally(); currentSectionFooterTextLayout->addChild(mCurrentListViewSectionFooterEditBox); listViewSectionPropertiesVerticalLayout->addChild(currentSectionFooterTextLayout); if (isWindowsPhone() || isAndroid()) { listViewSectionPropertiesVerticalLayout->wrapContentVertically(); createListViewSectionHeaderPropertiesLayout(listViewSectionPropertiesVerticalLayout); createListViewSectionFooterPropertiesLayout(listViewSectionPropertiesVerticalLayout); } ListViewItem* mListSectionPropertiesItem = new ListViewItem(); mListSectionPropertiesItem->setSelectionStyle(LIST_VIEW_ITEM_SELECTION_STYLE_NONE); mListSectionPropertiesItem->addChild(listViewSectionPropertiesVerticalLayout); mPropertiesListView->addChild(mListSectionPropertiesItem); }
/** * Create ListView properties layout */ void SettingsScreen::createListViewPropertiesLayout() { VerticalLayout* listViewPropertiesVerticalLayout = new VerticalLayout(); listViewPropertiesVerticalLayout->wrapContentVertically(); Label* mListViewPropertiesLabel = new Label(); mListViewPropertiesLabel->setText("ListView properties"); mListViewPropertiesLabel->setFontSize(TITLE_FONT_SIZE); mListViewPropertiesLabel->setFontColor(0xFF0000); listViewPropertiesVerticalLayout->addChild(mListViewPropertiesLabel); // create the allow selection layout HorizontalLayout* allowSelectionLayout = new HorizontalLayout(); allowSelectionLayout->wrapContentVertically(); mListViewAllowSelectionCheckbox = new CheckBox(); mListViewAllowSelectionCheckbox->setState(true); Label* allowSelectionLabel = new Label(); allowSelectionLabel->setText("Allow selection"); allowSelectionLayout->addChild(mListViewAllowSelectionCheckbox); allowSelectionLayout->addChild(allowSelectionLabel); listViewPropertiesVerticalLayout->addChild(allowSelectionLayout); if (isIOS()) { listViewPropertiesVerticalLayout->wrapContentVertically(); // create the mode selection layout HorizontalLayout* modeSelectionLayout = new HorizontalLayout(); modeSelectionLayout->wrapContentVertically(); Label* setModeLabel = new Label(); setModeLabel->setText("Set mode: "); modeSelectionLayout->addChild(setModeLabel); mDisplayCheckBox = new CheckBox(); mDisplayCheckBox->setState(true); listViewPropertiesVerticalLayout->addChild(modeSelectionLayout); modeSelectionLayout = new HorizontalLayout(); Label* setDisplayLabel = new Label(); setDisplayLabel->setText("Display"); modeSelectionLayout->addChild(mDisplayCheckBox); modeSelectionLayout->addChild(setDisplayLabel); mEditCheckBox = new CheckBox(); mEditCheckBox->setState(false); Label* setEditLabel = new Label(); setEditLabel->setText("Edit"); modeSelectionLayout->addChild(mEditCheckBox); modeSelectionLayout->addChild(setEditLabel); listViewPropertiesVerticalLayout->addChild(modeSelectionLayout); createListViewItemSelectionStyleLayout(listViewPropertiesVerticalLayout); } ListViewItem* mListPropertiesItem = new ListViewItem(); mListPropertiesItem->setSelectionStyle(LIST_VIEW_ITEM_SELECTION_STYLE_NONE); mListPropertiesItem->addChild(listViewPropertiesVerticalLayout); mPropertiesListView->addChild(mListPropertiesItem); }
/** * 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; }
/** * 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 SettingsScreen::createListViewSectionFooterPropertiesLayout(VerticalLayout* listViewSectionPropertiesVerticalLayout) { // create the current section footer background color layout HorizontalLayout* currentSectionFooterBackgroundColorLayout = new HorizontalLayout(); currentSectionFooterBackgroundColorLayout->wrapContentVertically(); mSetSectionFooterBackgroundColor = new Button(); mSetSectionFooterBackgroundColor->setText("Footer bg"); mSetSectionFooterBackgroundColor->fillSpaceHorizontally(); currentSectionFooterBackgroundColorLayout->addChild(mSetSectionFooterBackgroundColor); mFooterBackgroundColorEditBox = new EditBox(); mFooterBackgroundColorEditBox->setPlaceholder("ex: 0xFF0000"); mFooterBackgroundColorEditBox->fillSpaceHorizontally(); currentSectionFooterBackgroundColorLayout->addChild(mFooterBackgroundColorEditBox); listViewSectionPropertiesVerticalLayout->addChild(currentSectionFooterBackgroundColorLayout); // create the current section footer font size layout HorizontalLayout* currentSectionFooterFontSizeLayout = new HorizontalLayout(); currentSectionFooterFontSizeLayout->wrapContentVertically(); mSetSectionFooterFontSize = new Button(); mSetSectionFooterFontSize->setText("Footer font sz"); mSetSectionFooterFontSize->fillSpaceHorizontally(); currentSectionFooterFontSizeLayout->addChild(mSetSectionFooterFontSize); mFooterFontSizeEditBox = new EditBox(); mFooterFontSizeEditBox->setInputMode(EDIT_BOX_INPUT_MODE_NUMERIC); mFooterFontSizeEditBox->fillSpaceHorizontally(); currentSectionFooterFontSizeLayout->addChild(mFooterFontSizeEditBox); listViewSectionPropertiesVerticalLayout->addChild(currentSectionFooterFontSizeLayout); // create the current section footer font color layout HorizontalLayout* currentSectionFooterFontColorLayout = new HorizontalLayout(); currentSectionFooterFontColorLayout->wrapContentVertically(); mSetSectionFooterFontColor = new Button(); mSetSectionFooterFontColor->setText("Footer font color"); mSetSectionFooterFontColor->fillSpaceHorizontally(); currentSectionFooterFontColorLayout->addChild(mSetSectionFooterFontColor); mFooterFontColorEditBox = new EditBox(); mFooterFontColorEditBox->setPlaceholder("ex: 0xFF0000"); mFooterFontColorEditBox->fillSpaceHorizontally(); currentSectionFooterFontColorLayout->addChild(mFooterFontColorEditBox); listViewSectionPropertiesVerticalLayout->addChild(currentSectionFooterFontColorLayout); }
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); }
/** * 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 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); }
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); }
/** * 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 addCheckboxWidget(Layout* aTargetLayout) { VerticalLayout* betaWrapper = new VerticalLayout(); betaWrapper->fillSpaceHorizontally(); betaWrapper->wrapContentVertically(); betaWrapper->setPaddingTop(int(mFontSize * 0.5)); VerticalLayout* betaContainer = new VerticalLayout(); betaContainer->fillSpaceHorizontally(); betaContainer->wrapContentVertically(); betaContainer->setBackgroundColor(AUX_COLOR); setRoundPadding(aTargetLayout); HorizontalLayout* subSettingsContainer = new HorizontalLayout(); subSettingsContainer->fillSpaceHorizontally(); subSettingsContainer->wrapContentVertically(); subSettingsContainer->setChildVerticalAlignment(MAW_ALIGNMENT_CENTER); subSettingsContainer->setChildHorizontalAlignment(MAW_ALIGNMENT_RIGHT); Label* betaText = new Label(); betaText->setText("This is a checkBox"); betaText->setFontColor(LABEL_FONT_COLOR); betaText->setFontSize(mFontSize); betaText->fillSpaceHorizontally(); betaText->wrapContentVertically(); betaText->setTextHorizontalAlignment(MAW_ALIGNMENT_LEFT); CheckBox* betaCB = new CheckBox(); betaCB->wrapContentHorizontally(); betaCB->wrapContentVertically(); betaCB->setState(true); subSettingsContainer->addChild(betaText); subSettingsContainer->addChild(betaCB); betaContainer->addChild(subSettingsContainer); betaWrapper->addChild(betaContainer); aTargetLayout->addChild(betaWrapper); }