예제 #1
0
파일: ViewUtils.cpp 프로젝트: Ginox/MoSync
	/**
	 * Create an NativeUI Label object with given values.
	 * @param text Text to set.
	 * @param fontColor Text font color.
	 * @param width Label's width in pixels or size constant.
	 * @param height Label's height in pixels or size constant.
	 * @return The created label object. Its ownership is passed to the caller.
	 */
	NativeUI::Label* createLabel(
		const MAUtil::String& text,
		const int fontColor,
		const int width,
		const int height)
	{
		NativeUI::Label* label = new NativeUI::Label();
		label->setTextHorizontalAlignment(MAW_ALIGNMENT_LEFT);
		label->setText(text);
		label->setWidth(width);
		label->setHeight(height);
		label->setFontColor(fontColor);
		label->setMaxNumberOfLines(LABEL_MAX_LINES);
		return label;
	}
예제 #2
0
	/**
	 * Create screen's UI.
	 */
	void LoadingScreen::createUI()
	{
		// Create and add main layout to the screen.
		mMainLayout = new NativeUI::VerticalLayout();
		this->setMainWidget(mMainLayout);

		// Add spacer.
		mMainLayout->addChild(new NativeUI::VerticalLayout);

		// Add ActivityIndicatior.
		NativeUI::ActivityIndicator* activityIndicator =
			new NativeUI::ActivityIndicator();
		mMainLayout->addChild(activityIndicator);

		if (isWindowsPhone())
		{
			// For WP7 platform add an Label widget.
			NativeUI::Label* loading = new NativeUI::Label(LOADING_LABEL_TEXT);
			loading->setTextHorizontalAlignment(MAW_ALIGNMENT_CENTER);
			loading->fillSpaceHorizontally();
			mMainLayout->addChild(loading);

			mMainLayout->addChild(createSpacer(SPACER_HEIGHT));
			activityIndicator->fillSpaceHorizontally();
		}
		else
		{
			mMainLayout->setChildHorizontalAlignment(MAW_ALIGNMENT_CENTER);
		}

		// Add spacer.
		mMainLayout->addChild(new NativeUI::VerticalLayout);

		// Show the ActivityIndicator.
		activityIndicator->show();
	}