void create() { for(unsigned n = 0; n < 544; n++) buffer[n] = n; hexEditFont.setFamily("Liberation Mono"); hexEditFont.setSize(8); hexEdit.setFont(hexEditFont); hexEdit.onRead = [this](unsigned addr) { return this->buffer[addr]; }; hexEdit.onWrite = [this](unsigned addr, uint8_t data) { this->buffer[addr] = data; }; hexEdit.setColumns(16); hexEdit.setRows(16); hexEdit.setOffset(0); hexEdit.setLength(544); layout.setMargin(5); layout.append(hexEdit, ~0, ~0); append(layout); onClose = []() { OS::quit(); }; setStatusText("Ready"); setStatusVisible(); setTitle("Hex Edit"); setGeometry({ 64, 64, 485, 220 }); setVisible(); }
static int lua_VerticalLayout_setSpacing(lua_State* state) { // Get the number of parameters. int paramCount = lua_gettop(state); // Attempt to match the parameters to a valid binding. switch (paramCount) { case 2: { if ((lua_type(state, 1) == LUA_TUSERDATA) && lua_type(state, 2) == LUA_TNUMBER) { // Get parameter 1 off the stack. int param1 = (int)luaL_checkint(state, 2); VerticalLayout* instance = getInstance(state); instance->setSpacing(param1); return 0; } lua_pushstring(state, "lua_VerticalLayout_setSpacing - Failed to match the given parameters to a valid function signature."); lua_error(state); break; } default: { lua_pushstring(state, "Invalid number of parameters (expected 2)."); lua_error(state); break; } } return 0; }
static int lua_VerticalLayout_setBottomToTop(lua_State* state) { // Get the number of parameters. int paramCount = lua_gettop(state); // Attempt to match the parameters to a valid binding. switch (paramCount) { case 2: { if ((lua_type(state, 1) == LUA_TUSERDATA) && lua_type(state, 2) == LUA_TBOOLEAN) { // Get parameter 1 off the stack. bool param1 = gameplay::ScriptUtil::luaCheckBool(state, 2); VerticalLayout* instance = getInstance(state); instance->setBottomToTop(param1); return 0; } lua_pushstring(state, "lua_VerticalLayout_setBottomToTop - Failed to match the given parameters to a valid function signature."); lua_error(state); break; } default: { lua_pushstring(state, "Invalid number of parameters (expected 2)."); lua_error(state); break; } } return 0; }
static int lua_VerticalLayout_getBottomToTop(lua_State* state) { // Get the number of parameters. int paramCount = lua_gettop(state); // Attempt to match the parameters to a valid binding. switch (paramCount) { case 1: { if ((lua_type(state, 1) == LUA_TUSERDATA)) { VerticalLayout* instance = getInstance(state); bool result = instance->getBottomToTop(); // Push the return value onto the stack. lua_pushboolean(state, result); return 1; } lua_pushstring(state, "lua_VerticalLayout_getBottomToTop - Failed to match the given parameters to a valid function signature."); lua_error(state); break; } default: { lua_pushstring(state, "Invalid number of parameters (expected 1)."); lua_error(state); break; } } return 0; }
MainWindow() { setFrameGeometry({64, 64, 640, 480}); layout.setMargin(5); listView.append("Item 1"); listView.append("Item 2"); listView.append("Item 3"); listView.setSelection(1); layout.append(listView, {~0, ~0}); append(layout); onClose = &Application::quit; listView.onActivate = [&] { if(modal() == false) { print("Base = ", listView.selection(), "\n"); setModal(true); } else { print("Slot = ", listView.selection(), "\n"); setModal(false); setVisible(false); } }; setVisible(); listView.setFocused(); }
static int lua_VerticalLayout_addRef(lua_State* state) { // Get the number of parameters. int paramCount = lua_gettop(state); // Attempt to match the parameters to a valid binding. switch (paramCount) { case 1: { if ((lua_type(state, 1) == LUA_TUSERDATA)) { VerticalLayout* instance = getInstance(state); instance->addRef(); return 0; } lua_pushstring(state, "lua_VerticalLayout_addRef - Failed to match the given parameters to a valid function signature."); lua_error(state); break; } default: { lua_pushstring(state, "Invalid number of parameters (expected 1)."); lua_error(state); break; } } return 0; }
/** * 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); }
void reflow() { unsigned i; for (i=0; i<N::OPN::Types::Total; ++i) lTogglesOPN.append(opnToggles[i], {~0,0}, 2); for (i=0; i<N::OPM::Types::Total; ++i) lTogglesOPM.append(opmToggles[i], {~0,0}, 2); append(lMain); lMain.append(tabMain, {~0,~0}); }
/** * 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); } }
void MainScreen::createSecondScreen() { mSecondScreen = new Screen(); mSecondScreen->setTitle("2nd screen"); VerticalLayout* layout = new VerticalLayout(); layout->setBackgroundColor(0x123456); mSecondScreen->setMainWidget(layout); }
/** * 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); }
/** * Creates an empty vertical layout. * @param width Layout width. * @param height Layout height. * @return A vertical layout widget. * The ownership of the result is passed to the caller! */ VerticalLayout* ScreenWebView::createSpacer(const int width, const int height) { VerticalLayout* layout = new VerticalLayout(); layout->setSize(width, height); // This shows how you set a property for which there is no // predefined method. layout->setChildHorizontalAlignment(MAW_ALIGNMENT_RIGHT); layout->setChildVerticalAlignment(MAW_ALIGNMENT_CENTER); return layout; }
/** * 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 ScreenColorList::openColorScreen(int listItemIndex) { // Create a screen that will show the color. Screen* screen = new Screen(); // The title of this screen is displayed on the // navigation bar on iPhone/iPad. screen->setTitle(sColors[listItemIndex].name); VerticalLayout* widget = new VerticalLayout(); widget->setBackgroundColor(sColors[listItemIndex].color); screen->setMainWidget(widget); this->push(screen); }
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); }
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; }
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); }
static VerticalLayout* VerticalLayoutFromDef(ParsedMui& parsed, TxtNode* structDef) { CrashIf(!structDef->IsStructWithName("VerticalLayout")); VerticalLayoutDef* def = DeserializeVerticalLayoutDef(structDef); VerticalLayout* l = new VerticalLayout(); l->SetName(def->name); Vec<DirectionalLayoutDataDef*>* children = def->children; DirectionalLayoutData ld; for (size_t i = 0; children && i < children->size(); i++) { SetDirectionalLayouData(ld, parsed, children->at(i)); l->Add(ld); } FreeVerticalLayoutDef(def); return l; }
VideoPanel() { setMargin(5); append(spacer, 120, ~0, 5); append(layout, ~0, ~0); label.setFont("Sans, 16, Bold"); label.setText("Video"); layout.append(label, ~0, 0, 5); }
AudioPanel() { setMargin(5); append(spacer, 120, ~0, 5); append(layout, ~0, ~0); label.setFont("Sans, 16, Bold"); label.setText("Audio"); list.setCheckable(); list.append("Item"); list.append("Item"); list.append("Item"); list.append("Item"); list.append("Item"); layout.append(label, ~0, 0, 5); layout.append(list, ~0, ~0); list.onTick = [&](unsigned n) { print("Row ", n, "\n"); }; }
/** * 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); }
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); }
LoadMenu::LoadMenu(std::shared_ptr<StateContext> sc) : GameState(StateType::LOAD_MENU, sc) { using namespace MenuSettings; using std::placeholders::_1; getCallbacks()->setKey(SDLK_ESCAPE, CommonCallback::popStateK); getCallbacks()->setDefaultKey(DefaultCallback::key); getCallbacks()->setMouse(DefaultCallback::mouse); getCallbacks()->setEvent(DefaultCallback::event); // setup widgets VerticalLayout* layout = new VerticalLayout; layout->setMargins(0, 0, 0, 0); layout->setWidgetAlignment(WidgetAlignmentHoriz::CENTER, WidgetAlignmentVert::TOP); TextListView* view = new TextListView; view->setSelectedCallback(std::bind(&self_type::selectedCallback, this, _1)); setup(*view); layout->add(view); wArea.setPosition(IntPair{viewPadding, viewPadding}); wArea.setSize(IntPair{Constants::windowWidth - (viewPadding * 2), Constants::windowHeight - (viewPadding * 2)}); wArea.setLayout(layout); }
/** * 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); }
/** * 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); }
/** proc **/ void init() { setWindowGeometry({128,128,400,256}); setTitle("Preferences"); lMain.setMargin(5); frTogglesOPN.setText("Output Formats"); ltOPN.setMargin(5); lTogglesOPN.setMargin(5); opnToggles[N::OPN::Types::VGI].setText("VGI"); opnToggles[N::OPN::Types::TFI].setText("TFI"); opnToggles[N::OPN::Types::TYI].setText("TYI"); opnToggles[N::OPN::Types::EIF].setText("EIF"); opnToggles[N::OPN::Types::DMP].setText("DMP"); opnToggles[N::OPN::Types::Y12].setText("Y12"); opnToggles[N::OPN::Types::GYB].setText("GYB"); frTogglesOPM.setText("Output Formats"); ltOPM.setMargin(5); lTogglesOPM.setMargin(5); opmToggles[N::OPM::Types::OPM].setText("OPM"); initProc(); }
static void CreateLayout(EbookControls *ctrls) { HorizontalLayout *topPart = new HorizontalLayout(); DirectionalLayoutData ld; ld.Set(ctrls->prev, SizeSelf, 1.f, GetElAlignCenter()); topPart->Add(ld); ld.Set(ctrls->page, 1.f, 1.f, GetElAlignTop()); topPart->Add(ld); ld.Set(ctrls->next, SizeSelf, 1.f, GetElAlignBottom()); topPart->Add(ld); VerticalLayout *l = new VerticalLayout(); ld.Set(topPart, 1.f, 1.f, GetElAlignTop()); l->Add(ld, true); ld.Set(ctrls->progress, SizeSelf, 1.f, GetElAlignCenter()); l->Add(ld); ld.Set(ctrls->status, SizeSelf, 1.f, GetElAlignCenter()); l->Add(ld); ctrls->mainWnd->layout = l; }
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 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 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); }
Application() { setGeometry({256, 256, 640, 400}); layout.setMargin(5); button.setText("Toggle"); itemA[0].setText("Item A0"); itemA[1].setText("Item A1"); itemA[2].setText("Item A2"); RadioBox::group(itemA[0], itemA[1], itemA[2]); itemB[0].setText("Item B0"); itemB[1].setText("Item B1"); itemB[2].setText("Item B2"); RadioBox::group(itemB[0], itemB[1], itemB[2]); itemC[0].setText("Item C0"); itemC[1].setText("Item C1"); itemC[2].setText("Item C2"); RadioBox::group(itemC[0], itemC[1], itemC[2]); append(layout); layout.append(button, {~0, 0}, 5); layout.append(groupA, {~0, 0}, 5); groupA.append(itemA[0], {~0, 0}, 5); groupA.append(itemA[1], {~0, 0}, 5); groupA.append(itemA[2], {~0, 0}); layout.append(groupB, {~0, 0}, 5); groupB.append(itemB[0], {~0, 0}, 5); groupB.append(itemB[1], {~0, 0}, 5); groupB.append(itemB[2], {~0, 0}); layout.append(groupC, {~0, 0}, 5); groupC.append(itemC[0], {~0, 0}, 5); groupC.append(itemC[1], {~0, 0}, 5); groupC.append(itemC[2], {~0, 0}); onClose = &OS::quit; itemC[0].onActivate = [] { print("C0\n"); }; itemC[1].onActivate = [] { print("C1\n"); }; itemC[2].onActivate = [] { print("C2\n"); }; button.onActivate = [&] { //print("Before: ", itemC[0].checked(), ",", itemC[1].checked(), ",", itemC[2].checked(), "\n"); static bool visible = true; if(visible) { layout.remove(groupC); } else { layout.append(groupC, {~0, 0}, 5); } visible = !visible; //print("After!: ", itemC[0].checked(), ",", itemC[1].checked(), ",", itemC[2].checked(), "\n"); }; setVisible(); }