本文整理汇总了C++中ListViewItem::addChild方法的典型用法代码示例。如果您正苦于以下问题:C++ ListViewItem::addChild方法的具体用法?C++ ListViewItem::addChild怎么用?C++ ListViewItem::addChild使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ListViewItem
的用法示例。
在下文中一共展示了ListViewItem::addChild方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: createMainLayout
/**
* 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);
}
}
示例2: createListViewItemPropertiesLayout
/**
* 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);
}
示例3: createListViewSectionPropertiesLayout
/**
* 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);
}
示例4: createMainLayout
/**
* 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);
}
示例5: addFlashModeRows
/**
* Adds two list rows for setting and getting the flash mode value.
*/
void SettingsScreen::addFlashModeRows(ListView* listView)
{
// Add set option for flash mode value.
ListViewItem* listItem = new ListViewItem();
listView->addChild(listItem);
mSetFlashModeBtn = new Button();
mSetFlashModeBtn->setText(SET_FLASH_MODE_BTN_TEXT);
listItem->addChild(mSetFlashModeBtn);
// Add get option for flash mode value.
listItem = new ListViewItem();
listView->addChild(listItem);
mGetFlashModeBtn = new Button();
mGetFlashModeBtn->setText(GET_FLASH_MODE_BTN_TEXT);
mFlashModeLabel = new Label();
mFlashModeLabel->fillSpaceHorizontally();
listItem->addChild(this->createRow(mGetFlashModeBtn, mFlashModeLabel));
}
示例6: createListViewPropertiesLayout
/**
* 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);
}
示例7: addVideoQualityRows
/**
* Adds two list rows for setting and getting the video quality value.
*/
void SettingsScreen::addVideoQualityRows(ListView* listView)
{
ListViewItem* listItem;
// Add set option for video quality value.
listItem = new ListViewItem();
listView->addChild(listItem);
mSetVideoQualityBtn = new Button();
mSetVideoQualityBtn->setText(SET_VIDEO_QUALITY_BTN_TEXT);
listItem->addChild(mSetVideoQualityBtn);
// Add get option for video quality value.
listItem = new ListViewItem();
listView->addChild(listItem);
mGetVideoQualityBtn = new Button();
mGetVideoQualityBtn->setText(GET_VIDEO_QUALITY_BTN_TEXT);
mVideoQualityLabel = new Label();
mVideoQualityLabel->setText(VIDEO_QUALITY_LABEL_TEXT);
mVideoQualityLabel->fillSpaceHorizontally();
listItem->addChild(this->createRow(mGetVideoQualityBtn, mVideoQualityLabel));
}
示例8: addGetDurationRow
/**
* Adds a list row that contains widgets for getting the current
* maximum video duration.
*/
void SettingsScreen::addGetDurationRow(ListView* listView)
{
ListViewItem* listItem = new ListViewItem();
listView->addChild(listItem);
mMaxDurationLabel = new Label();
mMaxDurationLabel->setText(MAX_DURATION_LABEL_TEXT);
// mMaxDurationLabel->setFontColor(0x123456);
mMaxDurationLabel->fillSpaceHorizontally();
mGetMaxDurationBtn = new Button();
mGetMaxDurationBtn->setText(MAX_DURATION_BTN_TEXT);
listItem->addChild(this->createRow(mGetMaxDurationBtn, mMaxDurationLabel));
}
示例9: addSetDurationRow
/**
* Adds a list row that contains widgets for setting the current
* maximum video duration.
*/
void SettingsScreen::addSetDurationRow(ListView* listView)
{
ListViewItem* listItem;
Label* label;
listItem = new ListViewItem();
listView->addChild(listItem);
mMaxDurationEditBox = new EditBox();
mMaxDurationEditBox->setInputMode(EDIT_BOX_INPUT_MODE_NUMERIC);
mMaxDurationEditBox->fillSpaceHorizontally();
label = new Label();
label->setText(VIDEO_MAX_DURATION_TEXT);
listItem->addChild(this->createRow(label, mMaxDurationEditBox));
}
示例10: addCameraControlsFlagRow
/**
* Adds a list row for setting the camera controls flag.
*/
void SettingsScreen::addCameraControlsFlagRow(ListView* listView)
{
ListViewItem* listItem;
Label* label;
listItem = new ListViewItem();
listView->addChild(listItem);
label = new Label();
label->setText(CAMERA_CONTROLS_LABEL_TEXT);
mCameraControlsCheckBox = new CheckBox();
mCameraControlsCheckBox->setState(true);
listItem->addChild(this->createRow(label, mCameraControlsCheckBox));
listView->addChild(label);
}
示例11: addButtonToListView
/**
* Add a button to a list view.
* @param button The button that will be added.
* @param listView The list view that will contain the button.
*/
void SettingsScreen::addButtonToListView(Button* button, ListView* listView)
{
ListViewItem* listItem = new ListViewItem();
listItem->addChild(button);
listView->addChild(listItem);
}
示例12: 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);
}