当前位置: 首页>>代码示例>>C++>>正文


C++ HorizontalLayout::getWidth方法代码示例

本文整理汇总了C++中HorizontalLayout::getWidth方法的典型用法代码示例。如果您正苦于以下问题:C++ HorizontalLayout::getWidth方法的具体用法?C++ HorizontalLayout::getWidth怎么用?C++ HorizontalLayout::getWidth使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在HorizontalLayout的用法示例。


在下文中一共展示了HorizontalLayout::getWidth方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: 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);
}
开发者ID:,项目名称:,代码行数:101,代码来源:


注:本文中的HorizontalLayout::getWidth方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。