Пример #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 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;
	}