/** * 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); }
/** * 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); }
/** * Creates and adds main layout to the screen. */ void MainScreen::createMainLayout() { // create the first screen Screen* firstScreen = new Screen(); firstScreen->setTitle("Edit box"); // create the vertical layout that will contain all the // elements from the first screen VerticalLayout* firstScreenVerticalLayout = new VerticalLayout(); // edit box creation mEditBox = new EditBox(); mEditBox->setPlaceholder("Enter text..."); mEditBox->setHeight((mScreenHeight/12)*2); mEditBox->fillSpaceHorizontally(); firstScreenVerticalLayout->addChild(mEditBox); // create the horizontal layout that will contain the // set text button (resets the text to 'DEFAULT') and the // get text button HorizontalLayout* layout = new HorizontalLayout(); layout->setHeight(mScreenHeight/12); firstScreenVerticalLayout->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(); firstScreenVerticalLayout->addChild(mGetTextLabel); // create and add the show/hide keyboard button mKeyboardButton = new Button(); mKeyboardButton->setText("Show/hide keyboard"); mKeyboardButton->setHeight(mScreenHeight/12); mKeyboardButton->fillSpaceHorizontally(); firstScreenVerticalLayout->addChild(mKeyboardButton); // Create layout for widgets. this->createDecimalEditBoxView(mMaxTextLengthEditBox, firstScreenVerticalLayout, MAX_TEXT_LENGTH_LABEL_TEXT); this->createDecimalEditBoxView(mMaxLinesEditBox, firstScreenVerticalLayout, MAX_LINES_LABEL_TEXT); this->createDecimalEditBoxView(mMinLinesEditBox, firstScreenVerticalLayout, MIN_LINES_LABEL_TEXT); this->createDecimalEditBoxView(mLinesNumberEditBox, firstScreenVerticalLayout, LINES_NUMBER_LABEL_TEXT); this->createDecimalEditBoxView(mPlaceholderColorEditBox, firstScreenVerticalLayout, PLACEHOLDER_COLOR_LABEL_TEXT); // Create widgets for testing MAW_EDIT_BOX_MODE property on iOS. if (isIOS()) { firstScreenVerticalLayout->addChild(this->createModePropertyLayout()); } // set the main widget for the first screen and // then add it as a application tab firstScreen->setMainWidget(firstScreenVerticalLayout); this->addTab(firstScreen); // create the second screen and the horizontal // layout that will contain the input modes and flags lists Screen* secondScreen = new Screen(); secondScreen->setTitle("Modes/flags"); VerticalLayout* secondScreenVerticalLayout = new VerticalLayout(); this->createInputModeListView(secondScreenVerticalLayout); // create a black separator between the lists HorizontalLayout* separatorLayout = new HorizontalLayout(); separatorLayout->setBackgroundColor(0x000000); separatorLayout->setHeight(mScreenHeight/12); secondScreenVerticalLayout->addChild(separatorLayout); this->createInputFlagListView(secondScreenVerticalLayout); // set the main widget for the second screen and // then add it as a application tab secondScreen->setMainWidget(secondScreenVerticalLayout); this->addTab(secondScreen); maSetColor(0x8A2BE2); }
void MainScreen::renderAlarm(AlarmMsg alarm, float ratio) { String s; HorizontalLayout *mainItemLayout = new HorizontalLayout(); VerticalLayout *verticalTextLayout = new VerticalLayout(); Label *lbDaysTo = new Label(); Label *lbName = new Label(); Label *lbsplitter = new Label(); Label *lbMessage = new Label(); s = ""; String multi = ""; int val = alarm.DaysTo; if (val > 99) { val /= 30; multi = Lang::getString(GS_LETTERMONTH); if (val > 24) { val /= 12; multi = Lang::getString(GS_LETTERYEAR); } } if (val == 0) { s += Lang::getString(GS_NOW); } else if (val == -1) { s += Lang::getString(GS_YESTERDAY); } else { s += Convert::toString(val); s += multi; } mainItemLayout->setChildVerticalAlignment(MAW_ALIGNMENT_CENTER); mainItemLayout->setBackgroundColor(Styler::getClBgMessage()); mainItemLayout->fillSpaceHorizontally(); mainItemLayout->wrapContentHorizontally(); //DaysTo setup VerticalLayout* vlDaysTo = new VerticalLayout(); vlDaysTo->fillSpaceHorizontally(); vlDaysTo->wrapContentHorizontally(); vlDaysTo->setBackgroundColor(Styler::getClBgDaysLeft()); vlDaysTo->setChildVerticalAlignment(MAW_ALIGNMENT_CENTER); lbDaysTo->setText(s); int daysLeftFontSize = static_cast<int>(Styler::getSzFontDaysLeft() - ratio * (Styler::getSzFontDaysLeft() - Styler::getSzFontSize1())); if (val < 1) { daysLeftFontSize /= 2; } Styler::setLabelFont(lbDaysTo, Styler::fontnameDaysLeft, daysLeftFontSize); lbDaysTo->setFontSize(daysLeftFontSize); lbDaysTo->fillSpaceHorizontally(); lbDaysTo->fillSpaceVertically(); lbDaysTo->setWidth(Styler::getSzWidthDaysLeft()); lbDaysTo->setFontColor(Styler::getClFcDaysLeft()); lbDaysTo->setBackgroundColor(Styler::getClBgDaysLeft()); lbDaysTo->setTextVerticalAlignment(MAW_ALIGNMENT_CENTER); lbDaysTo->setTextHorizontalAlignment(MAW_ALIGNMENT_CENTER); vlDaysTo->addChild(lbDaysTo); //name and message setup Styler::setLabelFont(lbName, Styler::fontnameEventName); lbName->setText(alarm.Name); lbName->setFontSize(Styler::getSzFontSize1()); lbName->setFontColor(Styler::getClFcName()); lbName->setTextHorizontalAlignment(MAW_ALIGNMENT_LEFT); lbMessage->setText(alarm.Message); lbMessage->setFontSize(Styler::szFontLittleMessage()); lbMessage->setFontColor(Styler::getClFcMessage()); lbMessage->setTextHorizontalAlignment(MAW_ALIGNMENT_LEFT); Label* lbAir = new Label(); lbAir->setHeight(5); verticalTextLayout->addChild(lbName); verticalTextLayout->addChild(lbAir); verticalTextLayout->addChild(lbMessage); Styler::setLayoutPadding(verticalTextLayout, 3); verticalTextLayout->setPaddingLeft(Styler::getSzPadding() / 2); verticalTextLayout->setPaddingRight(Styler::getSzPadding() / 2); verticalTextLayout->wrapContentVertically(); verticalTextLayout->fillSpaceHorizontally(); mainItemLayout->addChild(vlDaysTo); mainItemLayout->addChild(lbsplitter); mainItemLayout->addChild(lbName); mainItemLayout->addChild(verticalTextLayout); mainItemLayout->wrapContentHorizontally(); lvAlarms->addChild(mainItemLayout); }