本文整理汇总了C++中HorizontalLayout::setHeight方法的典型用法代码示例。如果您正苦于以下问题:C++ HorizontalLayout::setHeight方法的具体用法?C++ HorizontalLayout::setHeight怎么用?C++ HorizontalLayout::setHeight使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类HorizontalLayout
的用法示例。
在下文中一共展示了HorizontalLayout::setHeight方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: createMainLayout
/**
* 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);
}
示例2: createGetButtonTextLayout
/**
* Creates the get button text layout.
*/
void ButtonSettingsLayout::createGetButtonTextLayout()
{
HorizontalLayout* getTextHorizontalLayout = new HorizontalLayout();
getTextHorizontalLayout->setHeight(PROPERTY_LINE_HEIGHT);
getTextButton = new Button();
getTextButton->setText("Get button text:");
getTextButton->fillSpaceHorizontally();
getTextHorizontalLayout->addChild(getTextButton);
getTextLabel = new Label();
getTextLabel->setText("No text yet");
getTextLabel->fillSpaceHorizontally();
getTextHorizontalLayout->addChild(getTextLabel);
this->addChild(getTextHorizontalLayout);
}
示例3: createSetButtonTextLayout
/**
* Creates the set button text layout.
*/
void ButtonSettingsLayout::createSetButtonTextLayout()
{
HorizontalLayout* setTextHorizontalLayout = new HorizontalLayout();
setTextHorizontalLayout->setHeight(PROPERTY_LINE_HEIGHT);
setTextButton = new Button();
setTextButton->setText("Set button text:");
setTextButton->fillSpaceHorizontally();
setTextHorizontalLayout->addChild(setTextButton);
setTextEditBox = new EditBox();
setTextEditBox->setPlaceholder("Button text");
setTextEditBox->fillSpaceHorizontally();
setTextHorizontalLayout->addChild(setTextEditBox);
this->addChild(setTextHorizontalLayout);
}
示例4: createSetPlaceholderLayout
/**
* Creates the set edit box placeholder text layout.
*/
void EditBoxSettingsLayout::createSetPlaceholderLayout()
{
HorizontalLayout* getPlaceholderHorizontalLayout = new HorizontalLayout();
getPlaceholderHorizontalLayout->setHeight(PROPERTY_LINE_HEIGHT);
setPlaceholderButton = new Button();
setPlaceholderButton->setText("Set placeholder text:");
setPlaceholderButton->fillSpaceHorizontally();
getPlaceholderHorizontalLayout->addChild(setPlaceholderButton);
setPlaceholderEditBox = new EditBox();
setPlaceholderEditBox->setPlaceholder("Edit box placeholder");
setPlaceholderEditBox->fillSpaceHorizontally();
getPlaceholderHorizontalLayout->addChild(setPlaceholderEditBox);
mEditBoxListView->addChild(getPlaceholderHorizontalLayout);
}
示例5: createGetEditBoxTextLayout
/**
* Creates the get button text layout.
*/
void EditBoxSettingsLayout::createGetEditBoxTextLayout()
{
HorizontalLayout* getTextHorizontalLayout = new HorizontalLayout();
getTextHorizontalLayout->setHeight(PROPERTY_LINE_HEIGHT);
getTextButton = new Button();
getTextButton->setText("Get edit box text:");
getTextButton->fillSpaceHorizontally();
getTextHorizontalLayout->addChild(getTextButton);
getTextLabel = new Label();
getTextLabel->setText("No text yet");
getTextLabel->fillSpaceHorizontally();
getTextHorizontalLayout->addChild(getTextLabel);
mEditBoxListView->addChild(getTextHorizontalLayout);
}
示例6: createMainLayout
/**
* Creates and adds main layout to the screen.
*/
void MainScreen::createMainLayout()
{
// Create and add the main layout to the screen.
mMainListView = new ListView();
Screen::setMainWidget(mMainListView);
Label* info1 = new Label();
info1->setText("First edit box with Capitalize all characters");
mMainListView->addChild(info1);
mEditBox = new EditBox();
mEditBox->setPlaceholder("Enter text...");
mEditBox->setHeight(100);
mEditBox->fillSpaceHorizontally();
mMainListView->addChild(mEditBox);
HorizontalLayout* layout = new HorizontalLayout();
layout->setHeight(75);
mMainListView->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();
mMainListView->addChild(mGetTextLabel);
mKeyboardButton = new Button();
mKeyboardButton->setText("Show/hide keyboard");
mKeyboardButton->fillSpaceHorizontally();
mMainListView->addChild(mKeyboardButton);
// Create layout for widgets.
this->createDecimalEditBoxView(mMaxTextLengthEditBox, mMainListView, MAX_TEXT_LENGTH_LABEL_TEXT);
this->createDecimalEditBoxView(mMaxLinesEditBox, mMainListView, MAX_LINES_LABEL_TEXT);
this->createDecimalEditBoxView(mMinLinesEditBox, mMainListView, MIN_LINES_LABEL_TEXT);
this->createDecimalEditBoxView(mLinesNumberEditBox, mMainListView, LINES_NUMBER_LABEL_TEXT);
this->createDecimalEditBoxView(mPlaceholderColorEditBox, mMainListView, PLACEHOLDER_COLOR_LABEL_TEXT);
this->createInputModeListView(mMainListView);
this->createInputFlagListView(mMainListView);
maSetColor(0x8A2BE2);
}
示例7: createDecimalEditBoxView
/**
* Creates a horizontal layout, adds it to the main layout, initializes the
* edit box and adds it to the horizontal layout.
* @param editBox The editbox to be created and added on the screen.
* @param mainLayout Widgets will be added to it.
*/
void MainScreen::createDecimalEditBoxView(EditBox* &editBox, ListView* mainListView, String text)
{
// Create layout for widgets.
HorizontalLayout* layout = new HorizontalLayout();
layout->setHeight(65);
mainListView->addChild(layout);
// Add label with info.
Label* label = new Label();
label->setText(text);
layout->addChild(label);
// Create the edit box.
editBox = new EditBox();
editBox->setInputMode(EDIT_BOX_INPUT_MODE_DECIMAL);
editBox->fillSpaceHorizontally();
layout->addChild(editBox);
}
示例8: createMainLayout
/**
* Creates and adds main layout to the screen.
*/
void EditBoxSettingsLayout::createMainLayout()
{
mEditBoxListView = new ListView();
this->addChild(mEditBoxListView);
createSetEditBoxTextLayout();
createGetEditBoxTextLayout();
createSetPlaceholderLayout();
mGetTextLabel = new Label();
mEditBoxListView->addChild(mGetTextLabel);
// create and add the show/hide keyboard button
mKeyboardButton = new Button();
mKeyboardButton->setText("Show/hide keyboard");
mKeyboardButton->setHeight(PROPERTY_LINE_HEIGHT);
mKeyboardButton->fillSpaceHorizontally();
mEditBoxListView->addChild(mKeyboardButton);
// Create layout for widgets.
createDecimalEditBoxView(mMaxTextLengthEditBox, mEditBoxListView, MAX_TEXT_LENGTH_LABEL_TEXT);
createDecimalEditBoxView(mMaxLinesEditBox, mEditBoxListView, MAX_LINES_LABEL_TEXT);
createDecimalEditBoxView(mMinLinesEditBox, mEditBoxListView, MIN_LINES_LABEL_TEXT);
createDecimalEditBoxView(mLinesNumberEditBox, mEditBoxListView, LINES_NUMBER_LABEL_TEXT);
createDecimalEditBoxView(mPlaceholderColorEditBox, mEditBoxListView, PLACEHOLDER_COLOR_LABEL_TEXT);
createInputModeListView(mEditBoxListView);
// create a black separator between the lists
HorizontalLayout* separatorLayout = new HorizontalLayout();
separatorLayout->setBackgroundColor(0x000000);
separatorLayout->setHeight(PROPERTY_LINE_HEIGHT);
mEditBoxListView->addChild(separatorLayout);
createInputFlagListView(mEditBoxListView);
}
示例9: createMainLayout
/**
* Creates and adds main layout to the screen.
*/
void WorkspaceLayout::createMainLayout() {
// Create the main layout.
HorizontalLayout *controlButtonsContainer = new HorizontalLayout();
controlButtonsContainer->fillSpaceHorizontally();
controlButtonsContainer->setHeight(mWidgetHeight);
if(mOS == "iPhone OS")
{
mRefreshButton = new ImageButton();
((ImageButton*)mRefreshButton)->addButtonListener(this);
((ImageButton*)mRefreshButton)->setBackgroundImage(RELOAD_BG);
mRefreshButton->setFontColor(0x000000);
mDisconnectButton = new ImageButton();
((ImageButton*)mDisconnectButton)->addButtonListener(this);
((ImageButton*)mDisconnectButton)->setBackgroundImage(RELOAD_BG);
mDisconnectButton->setFontColor(0x000000);
mSaveButton = new ImageButton();
((ImageButton*)mSaveButton)->addButtonListener(this);
((ImageButton*)mSaveButton)->setBackgroundImage(RELOAD_BG);
mSaveButton->setFontColor(0x000000);
mReloadButton = new ImageButton();
((ImageButton*)mReloadButton)->addButtonListener(this);
((ImageButton*)mReloadButton)->setBackgroundImage(CONNECT_BG);
mReloadButton->setFontColor(0x000000);
}
else
{
mRefreshButton = new Button();
((Button*)mRefreshButton)->addButtonListener(this);
mDisconnectButton = new Button();
((Button*)mDisconnectButton)->addButtonListener(this);
mSaveButton = new Button();
((Button*)mSaveButton)->addButtonListener(this);
mReloadButton = new Button();
((Button*)mReloadButton)->addButtonListener(this);
}
mRefreshButton->setText(REFRESH_LIST_BUTTON_TEXT);
mRefreshButton->setHeight(mWidgetHeight);
mRefreshButton->fillSpaceHorizontally();
mDisconnectButton->setText(DISCONNECT_BUTTON_TEXT);
mDisconnectButton->setHeight(mWidgetHeight);
mDisconnectButton->fillSpaceHorizontally();
controlButtonsContainer->addChild(mDisconnectButton);
controlButtonsContainer->addChild(mRefreshButton);
// Create Project Control Buttons SAVE and RELOAD
mSaveButton->setText(SAVE_BUTTON_TEXT);
mSaveButton->setWidth((int)(mScreenWidth * mSaveButtonWidthRatio));
mReloadButton->setText(RELOAD_BUTTON_TEXT);
mReloadButton->setWidth((int)(mScreenWidth * mReloadButtonWidthRatio));
mListView = new ListView();
mListView->allowSelection(true);
mListView->addListViewListener(this);
if(mOS.find("iPhone") >= 0)
{
this->setBackgroundColor(0x000000);
mListView->setProperty(MAW_WIDGET_BACKGROUND_COLOR,"00000000");
}
this->addChild(controlButtonsContainer);
this->addChild(mListView);
// Create the activity indicator widgets
mActivityIndicatorContainer = new RelativeLayout();
mActivityIndicatorContainer->fillSpaceHorizontally();
mActivityIndicatorContainer->fillSpaceVertically();
/**
* FIXME Removing listView and adding Activity indicator causes
* the list view not getting events until some point,
* when removing activity indicator to add the list again.
*/
//ActivityIndicator *loadingProjectsIndicator = new ActivityIndicator();
//loadingProjectsIndicator->setSize(80,80);
//loadingProjectsIndicator->setPosition((int)(mScreenWidth*0.5) - 40, (int)(mScreenHeight*0.5) - 80 );
//mActivityIndicatorContainer->addChild(loadingProjectsIndicator);
}
示例10: updateProjectList
/**
* If there is no list populates the List View Widget with the project data
* from mProjects vector. Else destroys and deallocates previous list items
* and creates new ones.
*/
void WorkspaceLayout::updateProjectList(MAUtil::Vector <reloadProject> * projects)
{
// Remove The ListView and add An Activity Indicator
lprintfln("Updating Project List");
mListView->setVisible(false);
/**
* FIXME Removing listView and adding Activity indicator causes
* the list view not getting events until some point,
* when removing activity indicator to add the list again.
*/
//this->removeChild(mListView);
//this->addChild(mActivityIndicatorContainer);
// If there was a project Selected before update remove the
// control buttons
if(mSelectedProject != -1)
{
Widget *h = mListView->getChild(mSelectedProject)->getChild(0);
h->removeChild(h->getChild(1));
h->removeChild(h->getChild(1));
}
// ReInitialize selected project
mSelectedProject = -1;
mSelectedProjectName = "";
// Delete all the widgets from the ListView
int prProjects = mListView->countChildWidgets();
if(prProjects != 0)
{
for(int i = 0; i < prProjects; i++)
{
Widget *listItemWidget = mListView->getChild(0); // list Item Widget
Widget *hLayout = listItemWidget->getChild(0); // horizontal layout widget
for( int j = 0; j < hLayout->countChildWidgets(); j++)
{
Widget * w = hLayout->getChild(0);
hLayout->removeChild(w);
delete w;
}
listItemWidget->removeChild(hLayout);
delete hLayout;
mListView->removeChild(listItemWidget);
delete listItemWidget;
}
}
// Re-populate the ListView with projects
for (MAUtil::Vector <reloadProject>::iterator i = projects->begin(); i != projects->end(); i++)
{
// New List Itemprojects
ListViewItem* item = new ListViewItem();
item->setHeight(mWidgetHeight);
item->fillSpaceHorizontally();
// New Horizontal Layout
HorizontalLayout *itemHorizontalLayout = new HorizontalLayout();
itemHorizontalLayout->fillSpaceHorizontally();
itemHorizontalLayout->setHeight(mWidgetHeight);
// New Label
Label* projectNameLabel = new Label();
projectNameLabel->setTextHorizontalAlignment(MAW_ALIGNMENT_LEFT);
projectNameLabel->setTextVerticalAlignment(MAW_ALIGNMENT_CENTER);
projectNameLabel->setText(i->name);
projectNameLabel->fillSpaceHorizontally();
projectNameLabel->fillSpaceVertically();
if (mOS.find("iPhone") >= 0)
{
itemHorizontalLayout->setWidth(item->getWidth());
projectNameLabel->setFontColor(0xffffff);
}
itemHorizontalLayout->addChild(projectNameLabel);
item->addChild(itemHorizontalLayout);
mListView->addChild(item);
}
mListView->setVisible(true);
// Remove Indicator and Add Project ListView
//this->addChild(mListView);
//this->removeChild(mActivityIndicatorContainer);
}
示例11: initializeScreen
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);
}
示例12: createMainLayout
/**
* 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);
}