/** * 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 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); }
/** * Creates and adds widgets to exemplify video widget. */ void VideoScreen::addVideoWidgets() { // Add a label that is refreshed at media source events. mSourceStatus = new Label(); mSourceStatus->setText(SOURCE_LOADING); mSourceStatus->setFontColor(INTENSE_BLUE); mSourceStatus->setFontSize(12); mMainLayout->addChild(mSourceStatus); // Add a spacer of 10px before the buttons. mTopSpacerLayout = new VerticalLayout(); mTopSpacerLayout->setBackgroundColor(INTENSE_BLUE); mTopSpacerLayout->setHeight(10); mMainLayout->addChild(mTopSpacerLayout); createPlaybackButtons(); // Add duration label. mDuration = new Label(); mDuration->setFontColor(INTENSE_BLUE); mDuration->setText("Video Duration"); mMainLayout->addChild(mDuration); // Add the video widget. /** * A media controller is attached to this view, and acts differently * depending on platform. * On Android typically contains the buttons like "Play/Pause", "Rewind", * Fast Forward" and a progress slider. It takes care of synchronizing the * controls with the state of the MediaPlayer. * The set of controls are in a floating window next to the video widget. * The window will disappear if left idle for three seconds and reappear * when the user touches the video view. */ mVideoView = new VideoView(); mVideoView->fillSpaceHorizontally(); mVideoView->setHeight(mScreenHeight/3); mVideoView->setWidth(MAW_CONSTANT_FILL_AVAILABLE_SPACE); mMainLayout->addChild(mVideoView); // Add an edit box for another urls or local paths. mEditBox = new EditBox(); // mEditBox->setPlaceholder("Set video uri or path"); mEditBox->fillSpaceHorizontally(); mMainLayout->addChild(mEditBox); // Add layout for load path or uri buttons. mLoadLayout = new HorizontalLayout(); mLoadLayout->wrapContentVertically(); mSetUrl = new Button(); mSetUrl->setFontColor(INTENSE_BLUE); // Apply a gradient ( on Android, or blank color on iOS). if ( mSetUrl->setBackgroundGradient(SEA_GREEN, DARK_SEA_GREEN) != MAW_RES_OK ) { mSetUrl->setBackgroundColor(DARK_SEA_GREEN); } mSetUrl->setText("Load url"); mSetPath = new Button(); mSetPath->setFontColor(INTENSE_BLUE); // Apply a gradient. if ( mSetPath->setBackgroundGradient(SEA_GREEN, DARK_SEA_GREEN) != MAW_RES_OK ) { mSetPath->setBackgroundColor(DARK_SEA_GREEN); } mSetPath->setText("Load path"); HorizontalLayout* urlLayout = new HorizontalLayout(); urlLayout->setWidth(mScreenWidth/2); urlLayout->setChildHorizontalAlignment(MAW_ALIGNMENT_CENTER); urlLayout->addChild(mSetUrl); HorizontalLayout* pathLayout = new HorizontalLayout(); pathLayout->setWidth(mScreenWidth/2); pathLayout->setChildHorizontalAlignment(MAW_ALIGNMENT_CENTER); pathLayout->addChild(mSetPath); mLoadLayout->addChild(urlLayout); mLoadLayout->addChild(pathLayout); mMainLayout->addChild(mLoadLayout); }
/** * Create the controls area with Play, Pause and Stop buttons. */ void VideoScreen::createPlaybackButtons() { /** * Add 3 buttons in 1 row: Play, Pause and stop. * All buttons are disabled by default, until source can be played. */ mButtonsLayout = new HorizontalLayout(); mButtonsLayout->wrapContentVertically(); mButtonsLayout->setChildHorizontalAlignment(MAW_ALIGNMENT_CENTER); mPlay = new Button(); // Apply a gradient ( on Android, or blank color on iOS). if ( mPlay->setBackgroundGradient(SEA_GREEN, DARK_SEA_GREEN) != MAW_RES_OK ) { mPlay->setBackgroundColor(DARK_SEA_GREEN); } mPlay->setText("Play"); mPlay->setEnabled(false); mPlay->setFontColor(INTENSE_BLUE); mPause = new Button(); // Apply a gradient ( on Android, or blank color on iOS). if ( mPause->setBackgroundGradient(SEA_GREEN, DARK_SEA_GREEN) != MAW_RES_OK ) { mPause->setBackgroundColor(DARK_SEA_GREEN); } mPause->setFontColor(INTENSE_BLUE); mPause->setEnabled(false); mPause->setText("Pause"); mStop = new Button(); mStop->setEnabled(false); // Apply a gradient ( on Android, or blank color on iOS). if ( mStop->setBackgroundGradient(SEA_GREEN, DARK_SEA_GREEN) != MAW_RES_OK ) { mStop->setBackgroundColor(DARK_SEA_GREEN); } mStop->setFontColor(INTENSE_BLUE); mStop->setText("Stop"); HorizontalLayout* playLayout = new HorizontalLayout(); playLayout->setChildHorizontalAlignment(MAW_ALIGNMENT_CENTER); playLayout->setWidth(mScreenWidth/3); playLayout->addChild(mPlay); HorizontalLayout* pauseLayout = new HorizontalLayout(); pauseLayout->setChildHorizontalAlignment(MAW_ALIGNMENT_CENTER); pauseLayout->setWidth(mScreenWidth/3); pauseLayout->addChild(mPause); HorizontalLayout* stopLayout = new HorizontalLayout(); stopLayout->setChildHorizontalAlignment(MAW_ALIGNMENT_CENTER); stopLayout->setWidth(mScreenWidth/3); stopLayout->addChild(mStop); mButtonsLayout->addChild(playLayout); mButtonsLayout->addChild(pauseLayout); mButtonsLayout->addChild(stopLayout); mMainLayout->addChild(mButtonsLayout); }