Beispiel #1
0
/**
 * Creates and adds main layout to the screen.
 */
void MainScreen::createMainLayout() {
	// Create and add the main layout to the screen.
	VerticalLayout* mainLayout = new VerticalLayout();
	Screen::setMainWidget(mainLayout);

	int platformType = getPlatform();
	if (platformType == ANDROID || platformType == IOS)
	{
		// ID required for the android platform (the IOS platform will ignore it)
		mBanner = new Banner("a14dbba084368db");
	}
	else if (getPlatform() == WINDOWSPHONE7)
	{
		// we need to send the APP ID and the AD ID to the mosync banner constructor
		// for the windows phone 7 platform (we'll use APP ID = 'test_client' and
		// AD ID = 'Image480_80' to enable the test mode)
		mBanner = new Banner("test_client|Image480_80");
	}

	mBanner->requestContent(true);
	mainLayout->addBanner(mBanner);

	Label* label;

	// Add banner status to list item
	mBannerMessage = new Label();
	mBannerMessage->setText("before loading Ad");
	mBannerMessage->setFontColor(0xFF0000);
	mainLayout->addChild(mBannerMessage);

	// Add "Enable/Disable banner" list item
	label = new Label();
	label->setText("Enable click on banner");
	mEnableCheckBox = new CheckBox();
	mEnableCheckBox->setState(true);
	mainLayout->addChild(createRow(mEnableCheckBox, label));

	// Add "Is banner enabled/disabled status" into a list item
	mRefreshEnableButton = new Button();
	mRefreshEnableButton->setText("Is Enabled");
	mRefreshEnableButton->wrapContentHorizontally();
	mIsBannerEnabled = new Label();
	mIsBannerEnabled->setText("Banner is enabled");
	mainLayout->addChild(createRow(mRefreshEnableButton, mIsBannerEnabled));

	// Add "Show/Hide banner" list item
	label = new Label();
	label->setText("Show banner");
	mShowBannerCheckBox = new CheckBox();
	mShowBannerCheckBox->setState(true);
	mainLayout->addChild(createRow(mShowBannerCheckBox, label));

	// Add "Is banner visible status" into a list item
	mRefreshVisibleButton = new Button();
	mRefreshVisibleButton->setText("Is Visible");
	mRefreshVisibleButton->wrapContentHorizontally();
	mIsBannerVisible = new Label();
	mIsBannerVisible->setText("Banner is visible");
	mainLayout->addChild(createRow(mRefreshVisibleButton, mIsBannerVisible));

	// Add "Get banner size" list item
	mGetSizeButton = new Button();
	mGetSizeButton->setText("Get size");
	mGetSizeButton->wrapContentHorizontally();
	mSizeLabel = new Label();
	mSizeLabel->setText("Banner size: 0 x 0 px");
	mainLayout->addChild(createRow(mGetSizeButton, mSizeLabel));
}