/** * 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); }
/** * 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); }
/** * 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); }
tinia::model::gui::Element* RenderConfig::guiFactory() const { VerticalLayout* root = new VerticalLayout; // ------------------------------------------------------------------------- ElementGroup* render_options_group = new ElementGroup( render_options_label_key, true ); root->addChild( render_options_group ); VerticalLayout* render_options_layout = new VerticalLayout; render_options_group->setChild( render_options_layout ); //render_options_layout->addChild( new tinia::model::gui::CheckBox( light_theme_key ) ); render_options_layout->addChild( new tinia::model::gui::CheckBox( render_clipplane_key ) ); render_options_layout->addChild( new tinia::model::gui::CheckBox( render_grid_key ) ); //render_options_layout->addChild( new tinia::model::gui::CheckBox( render_wells_key ) ); render_options_layout->addChild( new tinia::model::gui::CheckBox( create_nonindexed_surfaces_key ) ); //// ------------------------------------------------------------------------- //ElementGroup* rendering_quality_group = new ElementGroup( render_quality_key, true ); //root->addChild( rendering_quality_group ); //Grid* alpha_quality_layout = new Grid(3,2); //rendering_quality_group->setChild( alpha_quality_layout ); //alpha_quality_layout->setChild( 0, 0, new Label( render_quality_string_key, true ) ); //alpha_quality_layout->setChild( 0, 1, new HorizontalSlider( render_quality_key, true ) ); //alpha_quality_layout->setChild( 1, 0, new Label( shading_model_key ) ); //alpha_quality_layout->setChild( 1, 1, new ComboBox( shading_model_key ) ); // ------------------------------------------------------------------------- ElementGroup* line_thickness_group = new ElementGroup( line_thickness_key, true ); root->addChild( line_thickness_group ); line_thickness_group->setChild( new HorizontalSlider( line_thickness_key, true ) ); ElementGroup* proxy_group = new ElementGroup( proxy_label_key ); root->addChild( proxy_group ); Grid* proxy_grid = new Grid( 1, 2 ); proxy_group->setChild( proxy_grid ); proxy_grid->setChild( 0, 0, new Label( proxy_resolution_key ) ); HorizontalLayout* res_wrap = new HorizontalLayout; proxy_grid->setChild( 0, 1, res_wrap ); res_wrap->setPadContents( false ); res_wrap->addChild( new HorizontalSpace ); res_wrap->addChild( new SpinBox( proxy_resolution_key ) ); res_wrap->addChild( new HorizontalExpandingSpace ); root->addChild( new VerticalExpandingSpace ); return root; }
/** * Create ListView item properties layout */ void SettingsScreen::createListViewItemPropertiesLayout() { VerticalLayout* listViewItemPropertiesVerticalLayout = new VerticalLayout(); listViewItemPropertiesVerticalLayout->wrapContentVertically(); mCurrentListViewItemLabel = new Label(); mCurrentListViewItemLabel->setText("No item selected"); mCurrentListViewItemLabel->setFontSize(TITLE_FONT_SIZE); mCurrentListViewItemLabel->setFontColor(0xFF0000); listViewItemPropertiesVerticalLayout->addChild(mCurrentListViewItemLabel); createListViewItemTextLayout(listViewItemPropertiesVerticalLayout); createListViewItemFontColorLayout(listViewItemPropertiesVerticalLayout); createListViewItemFontSizeLayout(listViewItemPropertiesVerticalLayout); if (isIOS()) { listViewItemPropertiesVerticalLayout->wrapContentVertically(); createListViewItemEditModeLayout(listViewItemPropertiesVerticalLayout); createListViewItemDeleteButtonTextLayout(listViewItemPropertiesVerticalLayout); createListViewItemSelectedAnimationLayout(listViewItemPropertiesVerticalLayout); createListViewItemUnselectedAnimationLayout(listViewItemPropertiesVerticalLayout); createListViewItemHighlightedAnimationLayout(listViewItemPropertiesVerticalLayout); createListViewItemUnhighlightedAnimationLayout(listViewItemPropertiesVerticalLayout); createListViewItemAccessoryTypeIntLayout(listViewItemPropertiesVerticalLayout); createListViewItemAccessoryTypeEditModeLayout(listViewItemPropertiesVerticalLayout); createListViewItemEditStyleLayout(listViewItemPropertiesVerticalLayout); } ListViewItem* mListItemProperties = new ListViewItem(); mListItemProperties->setSelectionStyle(LIST_VIEW_ITEM_SELECTION_STYLE_NONE); mListItemProperties->addChild(listViewItemPropertiesVerticalLayout); mPropertiesListView->addChild(mListItemProperties); }
/** * Creates and adds main layout to the screen. */ void SettingsScreen::createMainLayout() { VerticalLayout* mainLayout = new VerticalLayout(); Screen::setMainWidget(mainLayout); ListView* listView = new ListView(); listView->fillSpaceHorizontally(); listView->fillSpaceVertically(); mainLayout->addChild(listView); ListViewItem* listItem; // Add IP label and edit box mIPEditBox = new EditBox(); mIPEditBox->setInputMode(EDIT_BOX_INPUT_MODE_NUMERIC); listView->addChild(this->createListViewItem(IP_LABEL_TEXT, mIPEditBox)); // Add port label and edit box mPortEditBox = new EditBox(); mPortEditBox->setInputMode(EDIT_BOX_INPUT_MODE_NUMERIC); listView->addChild(this->createListViewItem(PORT_LABEL_TEXT, mPortEditBox)); if ( isAndroid() ) { mShowOnlyIfInBackground = new CheckBox(); mShowOnlyIfInBackground->setState(true); listView->addChild(createListViewItem(SHOW_ONLY_IF_NOT_RUNNING, mShowOnlyIfInBackground)); mTickerText = new EditBox(); mTickerText->setText(TICKER_DEFAULT); listView->addChild(createListViewItem(TICKER_LABEL, mTickerText)); mContentTitle = new EditBox(); mContentTitle->setText(TITLE_DEFAULT); listView->addChild(createListViewItem(TITLE_LABEL, mContentTitle)); } // Android: If the registrationID was already saved from previous launches, // do not connect again. MAHandle myStore = maOpenStore("MyStore", 0); if ( isAndroid() && myStore == STERR_NONEXISTENT || !isAndroid() ) { // Add connection status label. listItem = new ListViewItem; listView->addChild(listItem); mConnectionStatusLabel = new Label(); mConnectionStatusLabel->setText(CONNECTION_NOT_ESTABLISHED); listItem->addChild(mConnectionStatusLabel); listItem = new ListViewItem; listView->addChild(listItem); mConnectButton = new Button(); mConnectButton->setText(CONNECT_BUTTON_TEXT); listItem->addChild(mConnectButton); } }
/** * 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); }
/** * Creates and adds main layout to the screen. */ void SettingsScreen::createMainLayout() { // Create and add the main layout to the screen. VerticalLayout* mainLayout = new VerticalLayout(); Screen::setMainWidget(mainLayout); ListView* listView = new ListView(); mainLayout->addChild(listView); // Add set duration option row. this->addSetDurationRow(listView); // Add get duration option row. this->addGetDurationRow(listView); // Add options for setting and getting the video quality value. this->addVideoQualityRows(listView); if ( isIOS()) { // Add options for setting and getting the flash mode value. this->addFlashModeRows(listView); // Add option for setting the camera roll flag. this->addCameraRollFlagRow(listView); // Add option for setting the camera controls flag. this->addCameraControlsFlagRow(listView); } // Add take picture button. mTakePictureBtn = new Button(); mTakePictureBtn->setText(TAKE_PICTURE_BTN_TEXT); this->addButtonToListView(mTakePictureBtn, listView); if (isAndroid()) { mTakenPicturePath = new Label(); ListViewItem* listItem = new ListViewItem(); listItem->addChild(mTakenPicturePath); listView->addChild(listItem); } // Add record video button. mRecordVideoBtn = new Button(); mRecordVideoBtn->setText(RECORD_VIDEO_BTN_TEXT); this->addButtonToListView(mRecordVideoBtn, listView); // Add show image button. mShowImageScreen = new Button(); mShowImageScreen->setText(SHOW_IMAGE_SCREEN_TEXT); this->addButtonToListView(mShowImageScreen, listView); // Add show video screen button. mShowVideoScreen = new Button(); mShowVideoScreen->setText(SHOW_VIDEO_SCREEN_TEXT); this->addButtonToListView(mShowVideoScreen, listView); }
/** * This method is called when an item is clicked in the list widget. * @param listItemIndex The index of the list item that was clicked. */ void ThirdScreen::openNextScreen(int listItemIndex) { // Screen* screen = new Screen(); if ( listItemIndex == 0) { scr1 = new Screen(); VerticalLayout* widget = new VerticalLayout(); widget->setBackgroundColor(0x104E8B); Label* info = new Label(); info->setText("First screen in stack.Menu items have icons(delete and save)."); widget->addChild(info); mListView1 = new ListView(); mListView1->fillSpaceHorizontally(); mListView1->fillSpaceVertically(); widget->addChild(mListView1); scr1->setMainWidget(widget); this->push(scr1); scr1->addScreenListener(this); scr1->addOptionsMenuItem("Menu item 0", MAW_OPTIONS_MENU_ICON_CONSTANT_DELETE,false); scr1->addOptionsMenuItem("Menu item 1", MAW_OPTIONS_MENU_ICON_CONSTANT_SAVE,false); } else { scr2 = new Screen(); VerticalLayout* widget = new VerticalLayout(); widget->setBackgroundColor(0x104E8B); Label* info = new Label(); info->setText("Second screen in stack.Menu items have icons(edit and add)"); widget->addChild(info); mListView2 = new ListView(); mListView2->fillSpaceHorizontally(); mListView2->fillSpaceVertically(); widget->addChild(mListView2); scr2->setMainWidget(widget); this->push(scr2); scr2->addScreenListener(this); scr2->addOptionsMenuItem("Menu item 0", MAW_OPTIONS_MENU_ICON_CONSTANT_EDIT,false); scr2->addOptionsMenuItem("Menu item 1", MAW_OPTIONS_MENU_ICON_CONSTANT_ADD,false); } }
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); }
void MainScreen::createFirstScreen() { mFirstScreen = new Screen(); mFirstScreen->setTitle("1st screen"); VerticalLayout* layout = new VerticalLayout(); layout->setBackgroundColor(0xFF0000); mFirstScreen->setMainWidget(layout); mPushButton = new Button(); mPushButton->setText("Push screen"); mPushButton->addButtonListener(this); layout->addChild(mPushButton); }
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); }
void PopupMessage::createLayout() { dia_->setTitle(title_); VerticalLayout* vl = new VerticalLayout(); vl->setScrollable(true); vl->setChildHorizontalAlignment(MAW_ALIGNMENT_CENTER); Styler::setLayoutPadding(vl); lbMessage_->setText(message_); Styler::setLabelStyle(lbMessage_, LSPopupMessage); vl->addChild(lbMessage_); dia_->addChild(vl); }
void setMainScreen() { // Because of issue http://jira.mosync.com/browse/MOSYNC-2732 the hole layout must be created. VerticalLayout* subContent = new VerticalLayout(); setRoundPadding(subContent); Layout* warningContainer = NULL; (VERTICAL_LAYOUT == mContainerLayoutTypeCounter)? warningContainer = new VerticalLayout() : warningContainer = new HorizontalLayout(); setupMainContainer(warningContainer, mContainerSizePolicyCounter); addChildrenToMainContainer(warningContainer, mLabelSizePolicyCounter, mLabelPropertyCounter); addDescriptionWidget(subContent); subContent->addChild(warningContainer); //addCheckboxWidget(mMainLayout); mScreen->setMainWidget(subContent); }
/** * 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); }
bool TestJob::init() { m_model->addStateListener(this); tinia::model::Viewer viewer; viewer.height = 500; viewer.width = 500; m_model->addElement("viewer", viewer); m_model->addElement<std::string>( "boundingbox", "-1.1 -1.1 -1.1 1.1 1.1 1.1" ); m_model->addElement<int>( "renderlist", 0 ); m_model->addElement<bool>("myTab", false); m_model->addAnnotation("myTab", "My tab"); m_model->addElement<bool>("myBool", false); m_model->addElement<std::string>("myVal", "THIS WORKS!"); const char* restrictions[] = {"select1", "select2", "select3", "select4"}; m_model->addElementWithRestriction<std::string>("myVal2", "select3", &restrictions[0], &restrictions[4]); m_model->addAnnotation("myVal2", "My special value"); m_model->addConstrainedElement<int>("myIntBA", 5,0, 900); m_model->addConstrainedElement<double>("myDouble", 10., 0., 11.); m_model->addElement<bool>("myButton", false); m_model->addElement<bool>( "details", true, "Popup" ); m_model->addAnnotation("myButton", "My pushButton"); tinia::model::File file; m_model->addElement("SpecialFile", file); m_model->addAnnotation("SpecialFile", "Open file"); m_model->addElement("SpecialFileName", file.name()); using namespace tinia::model::gui; TabLayout* root = new TabLayout(); HorizontalLayout *superLayout = new HorizontalLayout(); Grid *mainGrid = new Grid(16, 1); //superLayout->addChild(mainGrid); Tab *mainTab = new Tab("myTab"); mainTab->setChild(superLayout); root->addChild(mainTab); TabLayout *subTablayout = new TabLayout(); Tab* subTab = new Tab("myBool"); subTablayout->addChild(subTab); subTab->setChild(mainGrid); superLayout->addChild(subTablayout); // Simple Label-input-layout Grid *input1Grid = new Grid(4,3); mainGrid->setChild(0,0, input1Grid); input1Grid->setChild(0, 0, new Label("myVal")); input1Grid->setChild(0, 1, (new TextInput("myVal"))->setEnabledKey( "myTab", true ) ); input1Grid->setChild(1,0, new Label("myVal2")); input1Grid->setChild(1,1, new ComboBox("myVal2")); input1Grid->setChild(2,0, new Label("myVal2")); input1Grid->setChild(2,1, new RadioButtons("myVal2")); PopupButton* popup = new PopupButton("details", false); input1Grid->setChild(2, 2, popup ); popup->setEnabledKey( "myTab" ); PopupButton* popup2 = new PopupButton( "myVal", true ); input1Grid->setChild(3, 2, popup2 ); popup2->setChild( new TextInput("myVal" ) ); ElementGroup* popup_group = new ElementGroup( "myTab", true ); popup->setChild( popup_group ); popup_group->setChild( new RadioButtons( "myVal2" ) ); mainGrid->setChild(1, 0, new SpinBox("myIntBA")); mainGrid->setChild(2, 0, new TextInput("myIntBA")); mainGrid->setChild(3, 0, new CheckBox("myTab")); mainGrid->setChild(4, 0, new CheckBox("myTab")); mainGrid->setChild(5, 0, new Button("myButton")); mainGrid->setChild(6, 0, new HorizontalSlider("myIntBA")); mainGrid->setChild(8,0, new DoubleSpinBox("myDouble")); mainGrid->setChild(9, 0, new CheckBox("myBool")); mainGrid->setChild(10, 0, new VerticalExpandingSpace()); mainGrid->setChild(11, 0, new Label("myDouble", true ) ); mainGrid->setChild(12, 0, new FileDialogButton("SpecialFile")); mainGrid->setChild(13, 0, new Label("SpecialFileName", true)); ElementGroup* elemGroup = new ElementGroup("myTab", false); elemGroup->setVisibilityKey( "myTab" ); elemGroup->setChild( new TextInput("myVal") ); mainGrid->setChild(7, 0, elemGroup); Grid* canvasGrid = new Grid(2,1); Canvas *canvas = new Canvas("viewer", "renderlist", "boundingbox" ); canvasGrid->setChild(0,0, canvas); VerticalLayout* verticalLayout = new VerticalLayout; verticalLayout->setVisibilityKey( "myBool" ); verticalLayout->addChild(elemGroup); verticalLayout->addChild(elemGroup); verticalLayout->addChild(elemGroup); canvasGrid->setChild(1,0, verticalLayout); superLayout->addChild(canvasGrid); m_model->setGUILayout(root, DESKTOP); // ---- Set up renderlist data // Geometry for a simple line segment cube float wire_cube_pos[12*2*3] = { 0.f, 0.f, 0.f, 1.f, 0.f, 0.f, 0.f, 1.f, 0.f, 1.f, 1.f, 0.f, 0.f, 0.f, 0.f, 0.f, 1.f, 0.f, 1.f, 0.f, 0.f, 1.f, 1.f, 0.f, 0.f, 0.f, 0.f, 0.f, 0.f, 1.f, 0.f, 1.f, 0.f, 0.f, 1.f, 1.f, 1.f, 0.f, 0.f, 1.f, 0.f, 1.f, 1.f, 1.f, 0.f, 1.f, 1.f, 1.f, 0.f, 0.f, 1.f, 1.f, 0.f, 1.f, 0.f, 1.f, 1.f, 1.f, 1.f, 1.f, 0.f, 0.f, 1.f, 0.f, 1.f, 1.f, 1.f, 0.f, 1.f, 1.f, 1.f, 1.f, }; m_renderlist_db.createBuffer( "wire_cube_pos" )->set( wire_cube_pos, 12*2*3 ); m_renderlist_db.createAction<tinia::renderlist::Draw>( "wire_cube_draw" ) ->setNonIndexed( tinia::renderlist::PRIMITIVE_LINES, 0, 12*2 ); // Solid color shader std::string solid_vs = "uniform mat4 MVP;\n" "attribute vec3 position;\n" "void\n" "main()\n" "{\n" " gl_Position = MVP * vec4( position, 1.0 );\n" "}\n"; std::string solid_fs = "#ifdef GL_ES\n" "precision highp float;\n" "#endif\n" "uniform vec3 color;\n" "void\n" "main()\n" "{\n" " gl_FragColor = vec4( color, 1.0 );\n" "}\n"; m_renderlist_db.createShader( "solid" ) ->setVertexStage( solid_vs ) ->setFragmentStage( solid_fs ); m_renderlist_db.createAction<tinia::renderlist::SetShader>( "solid_use" ) ->setShader( "solid" ); m_renderlist_db.createAction<tinia::renderlist::SetUniforms>( "solid_orient" ) ->setShader( "solid" ) ->setSemantic( "MVP", tinia::renderlist::SEMANTIC_MODELVIEW_PROJECTION_MATRIX ); m_renderlist_db.createAction<tinia::renderlist::SetUniforms>( "solid_white" ) ->setShader( "solid" ) ->setFloat3( "color", 1.f, 1.f, 1.f ); m_renderlist_db.createAction<tinia::renderlist::SetUniforms>( "solid_green" ) ->setShader( "solid" ) ->setFloat3( "color", 0.f, 1.f, 0.f ); // Combine the wire cube geometry with the solid shader m_renderlist_db.createAction<tinia::renderlist::SetInputs>( "solid_wire_cube_input" ) ->setShader( "solid" ) ->setInput( "position", "wire_cube_pos", 3 ); // Position and scale the two instances, encoded as a transform matric and its inverse float shape0_to_world[16] = { 2.f, 0.f, 0.f, -1.0f, 0.f, 2.f, 0.f, -1.0f, 0.f, 0.f, 2.f, -1.0f, 0.f, 0.f, 0.f, 1.f, }; float shape0_from_world[16] = { 0.5f, 0.f, 0.f, 1.0f, 0.f, 0.5f, 0.f, 1.0f, 0.f, 0.f, 0.5f, 1.0f, 0.f, 0.f, 0.f, 1.f, }; m_renderlist_db.createAction<tinia::renderlist::SetLocalCoordSys>( "shape0_pos" ) ->setOrientation( shape0_from_world, shape0_to_world ); float shape1_to_world[16] = { 1.f, 0.f, 0.f, -0.5f, 0.f, 1.f, 0.f, -0.5f, 0.f, 0.f, 1.f, -0.5f, 0.f, 0.f, 0.f, 1.f, }; float shape1_from_world[16] = { 1.f, 0.f, 0.f, 0.5f, 0.f, 1.f, 0.f, 0.5f, 0.f, 0.f, 1.f, 0.5f, 0.f, 0.f, 0.f, 1.f, }; m_renderlist_db.createAction<tinia::renderlist::SetLocalCoordSys>( "shape1_pos" ) ->setOrientation( shape1_from_world, shape1_to_world ); // Set up draw order m_renderlist_db.drawOrderClear() ->drawOrderAdd( "solid_use") ->drawOrderAdd( "solid_wire_cube_input" ) ->drawOrderAdd( "shape0_pos" ) // sets transform matrices ->drawOrderAdd( "solid_orient" ) // updates uniforms ->drawOrderAdd( "solid_white" ) // set color uniform ->drawOrderAdd( "wire_cube_draw" ) // invoke draw call ->drawOrderAdd( "shape1_pos" ) ->drawOrderAdd( "solid_orient" ) ->drawOrderAdd( "solid_green" ) ->drawOrderAdd( "wire_cube_draw" ); m_renderlist_db.process(); m_model->updateElement<int>( "renderlist", m_renderlist_db.latest() ); glewInit(); #ifndef __APPLE__ static const GLfloat quad[ 4*4 ] = { 1.f, -1.f, 0.f, 1.f, 1.f, 1.f, 0.f, 1.f, -1.f, -1.f, 0.f, 1.f, -1.f, 1.f, 0.f, 1.f }; glGenVertexArrays( 1, &m_gpgpu_quad_vertex_array ); glBindVertexArray( m_gpgpu_quad_vertex_array ); glGenBuffers( 1, &m_gpgpu_quad_buffer ); glBindBuffer( GL_ARRAY_BUFFER, m_gpgpu_quad_buffer ); glBufferData( GL_ARRAY_BUFFER, sizeof(quad), quad, GL_STATIC_DRAW ); glVertexPointer( 4, GL_FLOAT, 0, NULL ); glEnableClientState( GL_VERTEX_ARRAY ); glBindBuffer( GL_ARRAY_BUFFER, 0 ); glBindVertexArray( 0 ); CHECK_GL; glBindVertexArray( m_gpgpu_quad_vertex_array ); glDrawArrays( GL_TRIANGLE_STRIP, 0, 4 ); glBindVertexArray( 0 ); CHECK_GL; #endif CHECK_GL; return true; }
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); }
/** * Constructor. * @param Screen The widgets will be added on this screen. * Initialize the objects. */ ScreenWebView::ScreenWebView(): Screen(), mWebView(NULL), mNavBarWidget(NULL), mOpenLinkButtonWidget(NULL), mEditBoxWidget(NULL), mAddressBarLayout(NULL), mLineLayout(NULL), mScreenWidth(0), mScreenHeight(0) { setTitle(TAB_SCREEN_TITLE); // Create and add the main layout to the screen. VerticalLayout* mainLayout = new VerticalLayout(); setMainWidget(mainLayout); // Get the screen size. MAExtent screenSize = maGetScrSize(); mScreenWidth = EXTENT_X(screenSize); mScreenHeight = EXTENT_Y(screenSize); if (getPlatform() == ANDROID) { // Set the screen icon for Android. setIcon(RES_TAB_ICON_WEB_VIEW_ANDROID); } else if(getPlatform() == IOS) { // Set the screen icon for iOS. setIcon(RES_TAB_ICON_WEB_VIEW); // Get the screen size. mScreenHeight = getHeight(); mScreenWidth = getWidth(); // Create and add the navigation bar to the main layout. mNavBarWidget = new NavigationBar(); mNavBarWidget->setTitle(SCREEN_TITLE); mNavBarWidget->setBackButtonTitle(""); mNavBarWidget->fillSpaceHorizontally(); mainLayout->addChild(mNavBarWidget); } // Create and add the address bar to the main layout. createAddressBar(); mainLayout->addChild(mAddressBarLayout); // Create and add the line layout to the main layout. mLineLayout = new HorizontalLayout(); mLineLayout->setSize( MAW_CONSTANT_FILL_AVAILABLE_SPACE, LINE_LAYOUT_HEIGHT); mLineLayout->setBackgroundColor(LINE_LAYOUT_BG_COLOR); mainLayout->addChild(mLineLayout); // Create and add the web view widget to the main layout. mWebView = new WebView(); mWebView->fillSpaceHorizontally(); mWebView->fillSpaceVertically(); mWebView->openURL(DEFAULT_URL_ADDRESS); mainLayout->addChild(mWebView); }
/** * Creates and adds main layout to the screen. */ void CreateNotificationScreen::createMainLayout() { VerticalLayout* mainLayout = new VerticalLayout(); Screen::setMainWidget(mainLayout); ListView* listView = new ListView(); listView->fillSpaceHorizontally(); listView->fillSpaceVertically(); mainLayout->addChild(listView); ListViewItem* listItem; HorizontalLayout* hLayout; Widget* space; // ================ Content body ===================== mContentBody = new EditBox(); listView->addChild(createListViewItem(CONTENT_BODY_LABEL_TEXT,(Widget*) mContentBody)); if ( isAndroid() ) { // ================ Content title ===================== mContentTitle = new EditBox(); listView->addChild(createListViewItem(CONTENT_TITLE_LABEL_TEXT, mContentTitle)); // ================ Ticker text ===================== mTickerText = new EditBox(); listView->addChild(createListViewItem(TICKER_TEXT_LABEL_TEXT, mTickerText)); } else { // ================ Badge number ===================== mBadgeNumber = new EditBox(); mBadgeNumber->setWidth(NUMERIC_EDIT_BOX_WIDTH); mBadgeNumber->setInputMode(EDIT_BOX_INPUT_MODE_NUMERIC); mBadgeNumber->addEditBoxListener(this); listView->addChild(createListViewItem(BADGE_NUMBER_LABEL_TEXT, mBadgeNumber)); // ================ Alert action ===================== mAlertAction = new EditBox(); mAlertAction->addEditBoxListener(this); listView->addChild(createListViewItem(ALERT_ACTION_LABEL_TEXT, mAlertAction)); } // ================ Play sound ===================== mPlaySound = new CheckBox(); listView->addChild(createListViewItem(PLAY_SOUND_LABEL_TEXT, mPlaySound)); if ( isAndroid() ) { // ================ Sound path===================== mSoundPath = new EditBox(); listView->addChild(createListViewItem(SOUND_PATH_LABEL_TEXT, mSoundPath)); // ================ Vibrate ===================== mVibrate = new CheckBox(); listView->addChild(createListViewItem(VIBRATE_LABEL_TEXT, mVibrate)); mVibrateDuration = new EditBox(); mVibrateDuration->setInputMode(EDIT_BOX_INPUT_MODE_NUMERIC); listView->addChild(createListViewItem(VIBRATE_DURATION_LABEL_TEXT, mVibrateDuration)); // ================ Flashing LED ===================== mFlash = new CheckBox(); listView->addChild(createListViewItem(FLASH_LABEL_TEXT, mFlash)); // The pattern mFlashColor = new EditBox(); listView->addChild(createListViewItem(FLASH_COLOR_LABEL_TEXT, mFlashColor)); mFlashOnLength = new EditBox(); mFlashOnLength->setInputMode(EDIT_BOX_INPUT_MODE_NUMERIC); listView->addChild(createListViewItem(FLASH_ON_LABEL_TEXT, mFlashOnLength)); mFlashOffLength = new EditBox(); mFlashOffLength->setInputMode(EDIT_BOX_INPUT_MODE_NUMERIC); listView->addChild(createListViewItem(FLASH_OFF_LABEL_TEXT, mFlashOffLength)); } // ================ Fire time ===================== mTime = new EditBox(); mTime->setWidth(NUMERIC_EDIT_BOX_WIDTH); mTime->setInputMode(EDIT_BOX_INPUT_MODE_NUMERIC); listView->addChild(createListViewItem(FIRE_TIME_LABEL_TEXT, mTime)); // ================= Send image button ================ hLayout = new HorizontalLayout(); hLayout->fillSpaceHorizontally(); listItem = new ListViewItem(); listItem->addChild(hLayout); listView->addChild(listItem); mCreateNotificationButton = new ImageButton(); mCreateNotificationButton->setImage(RES_IMAGE); space = this->createSpacer(); hLayout->addChild(space); hLayout->addChild(mCreateNotificationButton); // Align the image button at the center of the layout. // Only after adding the image button widget to layout the widget's width // is available. int spacerWidth = hLayout->getWidth() / 2 - mCreateNotificationButton->getWidth() / 2; space->setWidth(spacerWidth); }
void MainScreen::createDialogMainLayout() { VerticalLayout* dialogLayout = new VerticalLayout(); dialogLayout->setPaddingLeft(10); dialogLayout->setPaddingRight(10); Label* info = new Label(); info->setText(" Please fill in all the fields "); info->fillSpaceHorizontally(); dialogLayout->addChild(info); VerticalLayout* genderLayout = new VerticalLayout(); // set to wrap content genderLayout->setPaddingTop(20); genderLayout->setPaddingBottom(20); genderLayout->setPaddingLeft(20); Label* infoGender = new Label(); infoGender->setText("Select gender"); infoGender->setFontColor(0xFF7F24); genderLayout->addChild(infoGender); HorizontalLayout* femaleL = new HorizontalLayout(); mGenderFemale = new CheckBox(); mGenderFemale->setState(false); femaleL->addChild(mGenderFemale); Label* female = new Label(); female->setText(" Female"); femaleL->addChild(female); genderLayout->addChild(femaleL); HorizontalLayout* maleL = new HorizontalLayout(); mGenderMale = new CheckBox(); mGenderMale->setState(false); maleL->addChild(mGenderMale); Label* male = new Label(); male->setText(" Male"); maleL->addChild(male); genderLayout->addChild(maleL); dialogLayout->addChild(genderLayout); VerticalLayout* birthLayout = new VerticalLayout(); birthLayout->setPaddingTop(20); birthLayout->setPaddingBottom(20); birthLayout->setPaddingLeft(20); Label* infoBirth = new Label(); infoBirth->setText("Select age"); infoBirth->setFontColor(0xFF7F24); birthLayout->addChild(infoBirth); mAge = new Slider(); mAge->fillSpaceHorizontally(); mAge->setValue(18); mAge->setMaximumValue(110); birthLayout->addChild(mAge); mAgeLabel = new Label(); mAgeLabel->setText("18"); birthLayout->addChild(mAgeLabel); dialogLayout->addChild(birthLayout); mDialogDismiss = new Button(); mDialogDismiss->setText("Ready"); dialogLayout->addChild(mDialogDismiss); mDialog = new Dialog(); mDialog->setTitle("My Form"); mDialog->canBeDismissed(false); mDialog->setMainWidget(dialogLayout); }
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); }
void LoadingScreen::initializeScreen(MAUtil::String &os) { MAExtent ex = maGetScrSize(); int screenWidth = EXTENT_X(ex); int screenHeight = EXTENT_Y(ex); mSplashScreen = new Screen(); mSplashScreen->setBackgroundColor(40,40,40); //Layout that holds the screen elements RelativeLayout* relativeLayout = new RelativeLayout(); relativeLayout->setSize(screenWidth, screenHeight); //The huge Reload "Circle" Image* logo = new Image(); logo->setImage(SPLASH_IMAGE); logo->setSize(screenWidth,screenWidth); logo->setScaleMode(IMAGE_SCALE_PRESERVE_ASPECT); //Indicator placed on top of the reload circle mIndicator = new ActivityIndicator(); mIndicator->show(); //Progress bar for the download mProgressBar = new ProgressBar(); mProgressBar->setWidth((int)(screenWidth * 0.75)); mProgressBar->setMaximumValue(100); //Padding between the progress bar and the cancel button HorizontalLayout *paddingLayout = new HorizontalLayout(); paddingLayout->setHeight(screenHeight / 36); //the cancel button stops the download and returns the user //to the login screen if(os == "Android") { mCancelDownloadButton = new Button(); ((Button*)mCancelDownloadButton)->addButtonListener(this); } else { mCancelDownloadButton = new ImageButton(); ((ImageButton*)mCancelDownloadButton)->addButtonListener(this); ((ImageButton*)mCancelDownloadButton)->setBackgroundImage(RELOAD_BG); mCancelDownloadButton->setFontColor(0x000000); } mCancelDownloadButton->setText("Cancel"); mCancelDownloadButton->setTextHorizontalAlignment(MAW_ALIGNMENT_CENTER); mCancelDownloadButton->setTextVerticalAlignment(MAW_ALIGNMENT_CENTER); mCancelDownloadButton->setWidth((int)(screenWidth * 0.75)); mCancelDownloadButton->setHeight((int)(screenHeight * 0.1)); //Spacing between the cancel button and the bottom of the screen HorizontalLayout *paddingLayout2 = new HorizontalLayout(); paddingLayout2->setHeight(screenHeight / 15); VerticalLayout* logolayout = new VerticalLayout(); logolayout->setSize(screenWidth, screenHeight); logolayout->setChildHorizontalAlignment(MAW_ALIGNMENT_CENTER); logolayout->setChildVerticalAlignment(MAW_ALIGNMENT_CENTER); logolayout->addChild(logo); VerticalLayout* activitylayout = new VerticalLayout(); activitylayout->setSize(screenWidth, screenHeight); activitylayout->setChildHorizontalAlignment(MAW_ALIGNMENT_CENTER); activitylayout->setChildVerticalAlignment(MAW_ALIGNMENT_CENTER); activitylayout->addChild(mIndicator); VerticalLayout* progresslayout = new VerticalLayout(); progresslayout->setSize(screenWidth, screenHeight); progresslayout->setChildHorizontalAlignment(MAW_ALIGNMENT_CENTER); progresslayout->setChildVerticalAlignment(MAW_ALIGNMENT_BOTTOM); progresslayout->addChild(mProgressBar); progresslayout->addChild(paddingLayout); progresslayout->addChild(mCancelDownloadButton); progresslayout->addChild(paddingLayout2); relativeLayout->addChild(logolayout); relativeLayout->addChild(activitylayout); relativeLayout->addChild(progresslayout); mSplashScreen->setMainWidget(relativeLayout); }
/** * 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); }
/** * Creates and adds main layout to the screen. */ void MainScreen::createMainLayout() { // Create and add the main layout to the screen. VerticalLayout* mainLayout = new VerticalLayout(); Screen::setMainWidget(mainLayout); int platformType = getPlatform(); if (platformType == ANDROID || platformType == IOS) { // ID required for the android platform (the IOS platform will ignore it) mBanner = new Banner("a14dbba084368db"); } else if (getPlatform() == WINDOWSPHONE7) { // we need to send the APP ID and the AD ID to the mosync banner constructor // for the windows phone 7 platform (we'll use APP ID = 'test_client' and // AD ID = 'Image480_80' to enable the test mode) mBanner = new Banner("test_client|Image480_80"); } mBanner->requestContent(true); mainLayout->addBanner(mBanner); Label* label; // Add banner status to list item mBannerMessage = new Label(); mBannerMessage->setText("before loading Ad"); mBannerMessage->setFontColor(0xFF0000); mainLayout->addChild(mBannerMessage); // Add "Enable/Disable banner" list item label = new Label(); label->setText("Enable click on banner"); mEnableCheckBox = new CheckBox(); mEnableCheckBox->setState(true); mainLayout->addChild(createRow(mEnableCheckBox, label)); // Add "Is banner enabled/disabled status" into a list item mRefreshEnableButton = new Button(); mRefreshEnableButton->setText("Is Enabled"); mRefreshEnableButton->wrapContentHorizontally(); mIsBannerEnabled = new Label(); mIsBannerEnabled->setText("Banner is enabled"); mainLayout->addChild(createRow(mRefreshEnableButton, mIsBannerEnabled)); // Add "Show/Hide banner" list item label = new Label(); label->setText("Show banner"); mShowBannerCheckBox = new CheckBox(); mShowBannerCheckBox->setState(true); mainLayout->addChild(createRow(mShowBannerCheckBox, label)); // Add "Is banner visible status" into a list item mRefreshVisibleButton = new Button(); mRefreshVisibleButton->setText("Is Visible"); mRefreshVisibleButton->wrapContentHorizontally(); mIsBannerVisible = new Label(); mIsBannerVisible->setText("Banner is visible"); mainLayout->addChild(createRow(mRefreshVisibleButton, mIsBannerVisible)); // Add "Get banner size" list item mGetSizeButton = new Button(); mGetSizeButton->setText("Get size"); mGetSizeButton->wrapContentHorizontally(); mSizeLabel = new Label(); mSizeLabel->setText("Banner size: 0 x 0 px"); mainLayout->addChild(createRow(mGetSizeButton, mSizeLabel)); }
void FirstScreen::createAddItemDialog() { mAddItemDialog = new Dialog(); VerticalLayout* dialogLayout = new VerticalLayout(); mAddItemDialog->setMainWidget(dialogLayout); HorizontalLayout* titleLayout = new HorizontalLayout(); Label* infoTitle = new Label("Title"); mAddItemTitle = new EditBox(); mAddItemTitle->fillSpaceHorizontally(); titleLayout->addChild(infoTitle); titleLayout->addChild(mAddItemTitle); mFlagPicker = new CustomPicker(); HorizontalLayout* flagIfRoomLayout = new HorizontalLayout(); Label* flagIfRoom = new Label("Show If Room"); flagIfRoomLayout->addChild(flagIfRoom); HorizontalLayout* flagAlwaysLayout = new HorizontalLayout(); Label* flagAlways = new Label("Show Always"); flagAlwaysLayout->addChild(flagAlways); HorizontalLayout* flagWithTextLayout = new HorizontalLayout(); Label* flagText = new Label("Show with text"); flagWithTextLayout->addChild(flagText); HorizontalLayout* flagCollapseLayout = new HorizontalLayout(); Label* flagCollapse = new Label("Show collapse action view"); flagCollapseLayout->addChild(flagCollapse); mFlagPicker->addChild(flagIfRoomLayout); mFlagPicker->addChild(flagAlwaysLayout); mFlagPicker->addChild(flagWithTextLayout); mFlagPicker->addChild(flagCollapseLayout); HorizontalLayout* predefinedLayout = new HorizontalLayout(); Label* predefinedIconLabel = new Label("Use predefined image"); mUsePredefinedIcon = new CustomPicker(); HorizontalLayout* addIconLayout = new HorizontalLayout(); Label* addIcon = new Label("Add"); addIconLayout->addChild(addIcon); HorizontalLayout* editIconLayout = new HorizontalLayout(); Label* editIcon = new Label("Edit"); editIconLayout->addChild(editIcon); HorizontalLayout* saveIconLayout = new HorizontalLayout(); Label* saveIcon = new Label("Save"); saveIconLayout->addChild(saveIcon); HorizontalLayout* searchIconLayout = new HorizontalLayout(); Label* searchIcon = new Label("Search"); searchIconLayout->addChild(searchIcon); mUsePredefinedIcon->addChild(addIconLayout); mUsePredefinedIcon->addChild(editIconLayout); mUsePredefinedIcon->addChild(saveIconLayout); mUsePredefinedIcon->addChild(searchIconLayout); predefinedLayout->addChild(predefinedIconLabel); predefinedLayout->addChild(mUsePredefinedIcon); mAddItemDone = new Button(); mAddItemDone->fillSpaceHorizontally(); mAddItemDone->setText("Done"); dialogLayout->addChild(titleLayout); dialogLayout->addChild(mFlagPicker); dialogLayout->addChild(predefinedLayout); dialogLayout->addChild(mAddItemDone); }