本文整理汇总了C++中HorizontalLayout::setWidth方法的典型用法代码示例。如果您正苦于以下问题:C++ HorizontalLayout::setWidth方法的具体用法?C++ HorizontalLayout::setWidth怎么用?C++ HorizontalLayout::setWidth使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类HorizontalLayout
的用法示例。
在下文中一共展示了HorizontalLayout::setWidth方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: createModePropertyLayout
/**
* Create an layout containing a label and a check box widget.
* The check box will be used to set the edit box #MAW_EDIT_BOX_MODE property.
* Platform: iOS.
*/
HorizontalLayout* MainScreen::createModePropertyLayout()
{
if (!isIOS())
{
return NULL;
}
HorizontalLayout* hLayout = new HorizontalLayout();
hLayout->wrapContentVertically();
Label* label = new Label();
label->setText("Single line");
hLayout->addChild(label);
mSingleLineCheckBox = new CheckBox();
mSingleLineCheckBox->setState(true);
HorizontalLayout* spacer = new HorizontalLayout();
int spacerWidth = this->getWidth() - label->getWidth() -
mSingleLineCheckBox->getWidth();
spacer->setWidth(spacerWidth);
hLayout->addChild(spacer);
hLayout->addChild(mSingleLineCheckBox);
return hLayout;
}
示例2: createRow
/**
* Create a new row for settings.
* It contains a check box/button and a label.
*/
HorizontalLayout* MainScreen::createRow(Widget* check, Label* label)
{
HorizontalLayout* hLayout = new HorizontalLayout();
if ( check != NULL )
{
hLayout->addChild(check);
HorizontalLayout* space = new HorizontalLayout();
space->setWidth(10);
hLayout->addChild(space);
}
hLayout->addChild(label);
return hLayout;
}
示例3: createRow
/**
* Create a new row for settings.
* It contains two widgets separated by a spacer.
*/
HorizontalLayout* SettingsScreen::createRow(
Widget* firstWidget,
Widget* secondWidget)
{
HorizontalLayout* hLayout = new HorizontalLayout();
if ( firstWidget != NULL )
{
hLayout->addChild(firstWidget);
HorizontalLayout* space = new HorizontalLayout();
space->setWidth(10);
hLayout->addChild(space);
}
hLayout->addChild(secondWidget);
return hLayout;
}
示例4: 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);
}
示例5: addVideoWidgets
/**
* Creates and adds widgets to exemplify video widget.
*/
void VideoScreen::addVideoWidgets()
{
// Add a label that is refreshed at media source events.
mSourceStatus = new Label();
mSourceStatus->setText(SOURCE_LOADING);
mSourceStatus->setFontColor(INTENSE_BLUE);
mSourceStatus->setFontSize(12);
mMainLayout->addChild(mSourceStatus);
// Add a spacer of 10px before the buttons.
mTopSpacerLayout = new VerticalLayout();
mTopSpacerLayout->setBackgroundColor(INTENSE_BLUE);
mTopSpacerLayout->setHeight(10);
mMainLayout->addChild(mTopSpacerLayout);
createPlaybackButtons();
// Add duration label.
mDuration = new Label();
mDuration->setFontColor(INTENSE_BLUE);
mDuration->setText("Video Duration");
mMainLayout->addChild(mDuration);
// Add the video widget.
/**
* A media controller is attached to this view, and acts differently
* depending on platform.
* On Android typically contains the buttons like "Play/Pause", "Rewind",
* Fast Forward" and a progress slider. It takes care of synchronizing the
* controls with the state of the MediaPlayer.
* The set of controls are in a floating window next to the video widget.
* The window will disappear if left idle for three seconds and reappear
* when the user touches the video view.
*/
mVideoView = new VideoView();
mVideoView->fillSpaceHorizontally();
mVideoView->setHeight(mScreenHeight/3);
mVideoView->setWidth(MAW_CONSTANT_FILL_AVAILABLE_SPACE);
mMainLayout->addChild(mVideoView);
// Add an edit box for another urls or local paths.
mEditBox = new EditBox();
// mEditBox->setPlaceholder("Set video uri or path");
mEditBox->fillSpaceHorizontally();
mMainLayout->addChild(mEditBox);
// Add layout for load path or uri buttons.
mLoadLayout = new HorizontalLayout();
mLoadLayout->wrapContentVertically();
mSetUrl = new Button();
mSetUrl->setFontColor(INTENSE_BLUE);
// Apply a gradient ( on Android, or blank color on iOS).
if ( mSetUrl->setBackgroundGradient(SEA_GREEN, DARK_SEA_GREEN) != MAW_RES_OK )
{
mSetUrl->setBackgroundColor(DARK_SEA_GREEN);
}
mSetUrl->setText("Load url");
mSetPath = new Button();
mSetPath->setFontColor(INTENSE_BLUE);
// Apply a gradient.
if ( mSetPath->setBackgroundGradient(SEA_GREEN, DARK_SEA_GREEN) != MAW_RES_OK )
{
mSetPath->setBackgroundColor(DARK_SEA_GREEN);
}
mSetPath->setText("Load path");
HorizontalLayout* urlLayout = new HorizontalLayout();
urlLayout->setWidth(mScreenWidth/2);
urlLayout->setChildHorizontalAlignment(MAW_ALIGNMENT_CENTER);
urlLayout->addChild(mSetUrl);
HorizontalLayout* pathLayout = new HorizontalLayout();
pathLayout->setWidth(mScreenWidth/2);
pathLayout->setChildHorizontalAlignment(MAW_ALIGNMENT_CENTER);
pathLayout->addChild(mSetPath);
mLoadLayout->addChild(urlLayout);
mLoadLayout->addChild(pathLayout);
mMainLayout->addChild(mLoadLayout);
}
示例6: createPlaybackButtons
/**
* Create the controls area with Play, Pause and Stop buttons.
*/
void VideoScreen::createPlaybackButtons()
{
/**
* Add 3 buttons in 1 row: Play, Pause and stop.
* All buttons are disabled by default, until source can be played.
*/
mButtonsLayout = new HorizontalLayout();
mButtonsLayout->wrapContentVertically();
mButtonsLayout->setChildHorizontalAlignment(MAW_ALIGNMENT_CENTER);
mPlay = new Button();
// Apply a gradient ( on Android, or blank color on iOS).
if ( mPlay->setBackgroundGradient(SEA_GREEN, DARK_SEA_GREEN) != MAW_RES_OK )
{
mPlay->setBackgroundColor(DARK_SEA_GREEN);
}
mPlay->setText("Play");
mPlay->setEnabled(false);
mPlay->setFontColor(INTENSE_BLUE);
mPause = new Button();
// Apply a gradient ( on Android, or blank color on iOS).
if ( mPause->setBackgroundGradient(SEA_GREEN, DARK_SEA_GREEN) != MAW_RES_OK )
{
mPause->setBackgroundColor(DARK_SEA_GREEN);
}
mPause->setFontColor(INTENSE_BLUE);
mPause->setEnabled(false);
mPause->setText("Pause");
mStop = new Button();
mStop->setEnabled(false);
// Apply a gradient ( on Android, or blank color on iOS).
if ( mStop->setBackgroundGradient(SEA_GREEN, DARK_SEA_GREEN) != MAW_RES_OK )
{
mStop->setBackgroundColor(DARK_SEA_GREEN);
}
mStop->setFontColor(INTENSE_BLUE);
mStop->setText("Stop");
HorizontalLayout* playLayout = new HorizontalLayout();
playLayout->setChildHorizontalAlignment(MAW_ALIGNMENT_CENTER);
playLayout->setWidth(mScreenWidth/3);
playLayout->addChild(mPlay);
HorizontalLayout* pauseLayout = new HorizontalLayout();
pauseLayout->setChildHorizontalAlignment(MAW_ALIGNMENT_CENTER);
pauseLayout->setWidth(mScreenWidth/3);
pauseLayout->addChild(mPause);
HorizontalLayout* stopLayout = new HorizontalLayout();
stopLayout->setChildHorizontalAlignment(MAW_ALIGNMENT_CENTER);
stopLayout->setWidth(mScreenWidth/3);
stopLayout->addChild(mStop);
mButtonsLayout->addChild(playLayout);
mButtonsLayout->addChild(pauseLayout);
mButtonsLayout->addChild(stopLayout);
mMainLayout->addChild(mButtonsLayout);
}
示例7: createSpacer
/**
* Creates an empty widget with a given width.
* The ownership of the result is passed to the caller.
* @return An empty widget.
*/
Widget* CreateNotificationScreen::createSpacer(const int width)
{
HorizontalLayout* spacer = new HorizontalLayout();
spacer->setWidth(width);
return spacer;
}
示例8: createSpacer
/**
* Creates an empty widget with a given width.
* The ownership of the result is passed to the caller.
* @return An empty widget.
*/
Widget* SettingsScreen::createSpacer(const int width)
{
HorizontalLayout* spacer = new HorizontalLayout();
spacer->setWidth(width);
return spacer;
}