/** * Create the UI for the color list screen. */ void SettingsScreen::createUI() { setTitle("Settings"); // Create the screen's main layout widget. VerticalLayout* mMainLayout = new VerticalLayout(); // Make the layout fill the entire screen. mMainLayout->fillSpaceHorizontally(); mMainLayout->fillSpaceVertically(); // Add the layout as the root of the screen's widget tree. Screen::setMainWidget(mMainLayout); Label* mTitle = new Label(); // Make the label fill the width of the parent layout and // adjust its height to "shrink wrap" the size of the text. mTitle->fillSpaceHorizontally(); mTitle->wrapContentVertically(); // Set the label text. mTitle->setText("application settings"); mTitle->setTextHorizontalAlignment("center"); // Add the label to the main layout. mMainLayout->addChild(mTitle); mAppCodeBox = new EditBox(); mAppCodeBox->fillSpaceHorizontally(); mAppCodeBox->wrapContentVertically(); mAppCodeBox->setPlaceholder("application code"); //mAppCodeBox->setInputFlag(EDIT_BOX_INPUT_FLAG_PASSWORD); mMainLayout->addChild(mAppCodeBox); mAppUniqBox = new EditBox(); mAppUniqBox->fillSpaceHorizontally(); mAppUniqBox->wrapContentVertically(); mAppUniqBox->setPlaceholder("application unique"); mMainLayout->addChild(mAppUniqBox); mAppPwdBox = new EditBox(); mAppPwdBox->fillSpaceHorizontally(); mAppPwdBox->wrapContentVertically(); mAppPwdBox->setInputFlag(EDIT_BOX_INPUT_FLAG_PASSWORD); mAppPwdBox->setPlaceholder("application password"); mMainLayout->addChild(mAppPwdBox); mSubmitButton = new Button(); mSubmitButton->fillSpaceHorizontally(); mSubmitButton->wrapContentVertically(); mSubmitButton->setTextHorizontalAlignment(MAW_ALIGNMENT_CENTER); mSubmitButton->setTextVerticalAlignment(MAW_ALIGNMENT_CENTER); mSubmitButton->setText("Save"); mMainLayout->addChild(mSubmitButton); mSubmitButton->addButtonListener(this); }
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); }
/** * Create the UI for the color list screen. */ void LogScreen::createUI() { setTitle("Log"); // Create the screen's main layout widget. VerticalLayout* mMainLayout = new VerticalLayout(); // Make the layout fill the entire screen. mMainLayout->fillSpaceHorizontally(); mMainLayout->fillSpaceVertically(); // Add the layout as the root of the screen's widget tree. Screen::setMainWidget(mMainLayout); Label* mTitle = new Label(); // Make the label fill the width of the parent layout and // adjust its height to "shrink wrap" the size of the text. mTitle->fillSpaceHorizontally(); mTitle->wrapContentVertically(); // Set the label text. mTitle->setText("log APIs"); mTitle->setTextHorizontalAlignment("center"); // Add the label to the main layout. mMainLayout->addChild(mTitle); mLogLineBox = new EditBox(); mLogLineBox->fillSpaceHorizontally(); mLogLineBox->wrapContentVertically(); mLogLineBox->setPlaceholder("Log line"); mMainLayout->addChild(mLogLineBox); mLogCategoryBox = new EditBox(); mLogCategoryBox->fillSpaceHorizontally(); mLogCategoryBox->wrapContentVertically(); mLogCategoryBox->setPlaceholder("Category"); mLogCategoryBox->setText("DEFAULT"); mMainLayout->addChild(mLogCategoryBox); mSubmitButton = new Button(); mSubmitButton->fillSpaceHorizontally(); mSubmitButton->wrapContentVertically(); mSubmitButton->setTextHorizontalAlignment(MAW_ALIGNMENT_CENTER); mSubmitButton->setTextVerticalAlignment(MAW_ALIGNMENT_CENTER); mSubmitButton->setText("Log"); mMainLayout->addChild(mSubmitButton); mSubmitButton->addButtonListener(this); }
void addDescriptionWidget(Layout* aTargetLayout) { VerticalLayout* paddingLayout = new VerticalLayout(); paddingLayout->fillSpaceHorizontally(); paddingLayout->wrapContentVertically(); paddingLayout->setPaddingBottom(int(mFontSize * 0.5)); VerticalLayout* descLayout = new VerticalLayout(); descLayout->fillSpaceHorizontally(); descLayout->wrapContentVertically(); descLayout->setBackgroundColor(AUX_COLOR); setRoundPadding(descLayout); Label* layoutCounterLbl = new Label(); char buf[64]; sprintf(buf, "Layout nr: %d", mLayoutsCounter); layoutCounterLbl->setText(buf); Label* containerTypeLbl = new Label(); containerTypeLbl->setBackgroundColor(CONTAINER_BGK_COLOR); sprintf(buf, "Container layout type: %s", mNamesMap[mContainerLayoutTypeCounter]); containerTypeLbl->setText(buf); Label* containerPolicyLbl = new Label(); containerPolicyLbl->setBackgroundColor(CONTAINER_BGK_COLOR); sprintf(buf, "Container size policy: %s", mNamesMap[mContainerSizePolicyCounter]); containerPolicyLbl->setText(buf); Label* labelPolicyLbl = new Label(); labelPolicyLbl->setBackgroundColor(LABEL_BGK_COLOR); sprintf(buf, "Label size policy: %s", mNamesMap[mLabelSizePolicyCounter]); labelPolicyLbl->setText(buf); Label* labelTypeLbl = new Label(); labelTypeLbl->setBackgroundColor(LABEL_BGK_COLOR); sprintf(buf, "Label type: %s", mNamesMap[mLabelPropertyCounter]); labelTypeLbl->setText(buf); Label* helpLbl = new Label(); sprintf(buf, "Tap to play/pause layouts. Update: %d ms", UPDATE_INTERVAL); helpLbl->setText(buf); helpLbl->setFontSize(DESCRIPTION_FONT); layoutCounterLbl->setFontSize(DESCRIPTION_FONT); containerTypeLbl->setFontSize(DESCRIPTION_FONT); containerPolicyLbl->setFontSize(DESCRIPTION_FONT); labelPolicyLbl->setFontSize(DESCRIPTION_FONT); labelTypeLbl->setFontSize(DESCRIPTION_FONT); descLayout->addChild(helpLbl); TestUtils::addVerticalSpacerToLayout(descLayout); descLayout->addChild(layoutCounterLbl); TestUtils::addVerticalSpacerToLayout(descLayout); descLayout->addChild(containerTypeLbl); descLayout->addChild(containerPolicyLbl); TestUtils::addVerticalSpacerToLayout(descLayout); descLayout->addChild(labelPolicyLbl); descLayout->addChild(labelTypeLbl); paddingLayout->addChild(descLayout); aTargetLayout->addChild(paddingLayout); }
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); }