示例#1
0
	/**
	 * Create widgets and add them to screen.
	 */
	void MagneticFieldScreen::createUI()
	{
		mMainLayout = new NativeUI::VerticalLayout();
		this->setMainWidget(mMainLayout);

		// Create widgets for gyroscope data: x,y,z values.
		mValueXLabel = new NativeUI::Label();
		mValueYLabel = new NativeUI::Label();
		mValueZLabel = new NativeUI::Label();
		this->createHorizontalWidgetsRow(mValueXLabel, VALUE_X_LABEL_TEXT);
		this->createHorizontalWidgetsRow(mValueYLabel, VALUE_Y_LABEL_TEXT);
		this->createHorizontalWidgetsRow(mValueZLabel, VALUE_Z_LABEL_TEXT);

		// Add a spacer
		NativeUI::Label* spacer = new NativeUI::Label();
		spacer->setHeight(this->getHeight() / 6);
		mMainLayout->addChild(spacer);

		// Create button for start reading magnetic field sensor values.
		mStartSensorButton = new NativeUI::Button();
		mStartSensorButton->setText(START_BUTTON_TEXT);
		mStartSensorButton->fillSpaceHorizontally();
		mMainLayout->addChild(mStartSensorButton);

		// Create button for stop reading magnetic field sensor values.
		mStopSensorButton = new NativeUI::Button();
		mStopSensorButton->setText(STOP_BUTTON_TEXT);
		mStopSensorButton->fillSpaceHorizontally();
		mMainLayout->addChild(mStopSensorButton);
	}
示例#2
0
	/**
	 * Create widgets and add them to screen.
	 */
	void OrientationScreen::createUI()
	{
		mMainLayout = new NativeUI::VerticalLayout();
		this->setMainWidget(mMainLayout);

		// Create widgets for orientation data.
		mOrientationValueLabel = new NativeUI::Label();
		this->createHorizontalWidgetsRow(mOrientationValueLabel,
			VALUE_LABEL_TEXT);

		// Add a spacer
		NativeUI::Label* spacer = new NativeUI::Label();
		spacer->setHeight(this->getHeight() / 6);
		mMainLayout->addChild(spacer);

		// Create button for start reading orientation values.
		mStartOrientationButton = new NativeUI::Button();
		mStartOrientationButton->setText(START_BUTTON_TEXT);
		mStartOrientationButton->fillSpaceHorizontally();
		mMainLayout->addChild(mStartOrientationButton);

		// Create button for stop reading orientation values.
		mStopOrientationButton = new NativeUI::Button();
		mStopOrientationButton->setText(STOP_BUTTON_TEXT);
		mStopOrientationButton->fillSpaceHorizontally();
		mMainLayout->addChild(mStopOrientationButton);
	}
示例#3
0
	/**
	 * Create a horizontal layout that will contain a first label with a
	 * given text and a seconds label given as argument. Layout will be
	 * added to screen.
	 * @param dataLabel Second label that will be added to layout.
	 * Object's ownership is passed to this method.
	 * @param firstLabelText Text that will be set to the first label.
	 */
	void MagneticFieldScreen::createHorizontalWidgetsRow(
		NativeUI::Label* dataLabel,
		const MAUtil::String& firstLabelText)
	{
		NativeUI::HorizontalLayout* layout = new NativeUI::HorizontalLayout();
		layout->wrapContentVertically();
		mMainLayout->addChild(layout);

		// Add first label to layout.
		NativeUI::Label* firstLabel = new NativeUI::Label();
		firstLabel->setText(firstLabelText);
		layout->addChild(firstLabel);

		// Add second label to layout.
		layout->addChild(dataLabel);
	}
示例#4
0
	/**
	 * Create layout that contains:
	 * - a Label widget.
	 * - a EditBox widget that will be used to get a file path for the
	 * pressed image.
	 */
	void PressedImageScreen::createEditBoxLayout()
	{
		NativeUI::HorizontalLayout* layout = new NativeUI::HorizontalLayout();
		layout->fillSpaceHorizontally();
		layout->wrapContentVertically();
		mMainLayout->addChild(layout);

		NativeUI::Label* label = new NativeUI::Label();
		label->wrapContentHorizontally();
		label->wrapContentVertically();
		label->setText(SET_PATH_LABEL_TEXT);
		layout->addChild(label);

		mPathEditBox = new NativeUI::EditBox();
		mPathEditBox->wrapContentVertically();
		mPathEditBox->fillSpaceHorizontally();
		layout->addChild(mPathEditBox);
	}
示例#5
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();
	}
示例#6
0
	/**
	 * 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;
	}