Ejemplo n.º 1
0
/**
 * Creates and adds main layout to the screen.
 */
void MainScreen::createMainLayout()
{
	// Create and add the main layout to the screen.
	mMainLayout = new VerticalLayout();
	mMainLayout->setBackgroundColor(MAIN_LAYOUT_COLOR);
	Screen::setMainWidget(mMainLayout);

	// Create the "BUY" section.
	VerticalLayout* buyLayout = new VerticalLayout();
	buyLayout->wrapContentVertically();
	mMainLayout->addChild(buyLayout);
	Label* info = new Label();
	info->setText("Items for sale");
	info->setFontColor(INFO_LABELS_COLOR);
	buyLayout->addChild(info);

	// Add the list of available items for sale along with check boxes.
	for (int i=0; i < mProductNamesList.size(); i++)
	{
		HorizontalLayout* itemLayout = new HorizontalLayout();
		itemLayout->wrapContentVertically();
		CheckBox* itemCheckBox = new CheckBox();
		itemLayout->addChild(itemCheckBox);
		mItemsCheckBoxes.add(itemCheckBox);
		Label* itemId = new Label();
		itemId->setText(mProductNamesList[i]);
		itemId->setFontColor(ITEMS_COLOR);
		itemLayout->addChild(itemId);
		buyLayout->addChild(itemLayout);
	}

	// Use buy button to purchase the checked product it from the "BUY" section.
	mBuyButton = new Button();
	mBuyButton->setText("BUY");
	mMainLayout->addChild(mBuyButton);

	// Add a small break line between the two sections.
	HorizontalLayout* lineLayout = new HorizontalLayout();
	lineLayout->setHeight(BREAKLINE_HEIGHT);
	lineLayout->setBackgroundColor(BREAKLINE_COLOR);
	mMainLayout->addChild(lineLayout);

	// Create the "HISTORY" section.
	VerticalLayout* purchasedLayout = new VerticalLayout();
	Label* purchasedLabel = new Label();
	purchasedLabel->setText("Items you own");
	purchasedLabel->setFontColor(INFO_LABELS_COLOR);
	purchasedLayout->addChild(purchasedLabel);
	mPurchasedItemsList = new ListView();
	purchasedLayout->addChild(mPurchasedItemsList);
	mMainLayout->addChild(purchasedLayout);

}
/**
 * Creates the get button text layout.
 */
void ButtonSettingsLayout::createGetButtonTextLayout()
{
	HorizontalLayout* getTextHorizontalLayout = new HorizontalLayout();
	getTextHorizontalLayout->setHeight(PROPERTY_LINE_HEIGHT);
	getTextButton = new Button();
	getTextButton->setText("Get button text:");
	getTextButton->fillSpaceHorizontally();
	getTextHorizontalLayout->addChild(getTextButton);

	getTextLabel = new Label();
	getTextLabel->setText("No text yet");
	getTextLabel->fillSpaceHorizontally();
	getTextHorizontalLayout->addChild(getTextLabel);

	this->addChild(getTextHorizontalLayout);
}
/**
 * Creates the set button text layout.
 */
void ButtonSettingsLayout::createSetButtonTextLayout()
{
	HorizontalLayout* setTextHorizontalLayout = new HorizontalLayout();
	setTextHorizontalLayout->setHeight(PROPERTY_LINE_HEIGHT);
	setTextButton = new Button();
	setTextButton->setText("Set button text:");
	setTextButton->fillSpaceHorizontally();
	setTextHorizontalLayout->addChild(setTextButton);

	setTextEditBox = new EditBox();
	setTextEditBox->setPlaceholder("Button text");
	setTextEditBox->fillSpaceHorizontally();
	setTextHorizontalLayout->addChild(setTextEditBox);

	this->addChild(setTextHorizontalLayout);
}
/**
 * Creates the set edit box placeholder text layout.
 */
void EditBoxSettingsLayout::createSetPlaceholderLayout()
{
	HorizontalLayout* getPlaceholderHorizontalLayout = new HorizontalLayout();
	getPlaceholderHorizontalLayout->setHeight(PROPERTY_LINE_HEIGHT);
	setPlaceholderButton = new Button();
	setPlaceholderButton->setText("Set placeholder text:");
	setPlaceholderButton->fillSpaceHorizontally();
	getPlaceholderHorizontalLayout->addChild(setPlaceholderButton);

	setPlaceholderEditBox = new EditBox();
	setPlaceholderEditBox->setPlaceholder("Edit box placeholder");
	setPlaceholderEditBox->fillSpaceHorizontally();
	getPlaceholderHorizontalLayout->addChild(setPlaceholderEditBox);

	mEditBoxListView->addChild(getPlaceholderHorizontalLayout);
}
/**
 * Creates the get button text layout.
 */
void EditBoxSettingsLayout::createGetEditBoxTextLayout()
{
	HorizontalLayout* getTextHorizontalLayout = new HorizontalLayout();
	getTextHorizontalLayout->setHeight(PROPERTY_LINE_HEIGHT);
	getTextButton = new Button();
	getTextButton->setText("Get edit box text:");
	getTextButton->fillSpaceHorizontally();
	getTextHorizontalLayout->addChild(getTextButton);

	getTextLabel = new Label();
	getTextLabel->setText("No text yet");
	getTextLabel->fillSpaceHorizontally();
	getTextHorizontalLayout->addChild(getTextLabel);

	mEditBoxListView->addChild(getTextHorizontalLayout);
}
Ejemplo n.º 6
0
/**
 * Creates and adds main layout to the screen.
 */
void MainScreen::createMainLayout()
{
	// Create and add the main layout to the screen.
	mMainListView = new ListView();
	Screen::setMainWidget(mMainListView);

	Label* info1 = new Label();
	info1->setText("First edit box with Capitalize all characters");
	mMainListView->addChild(info1);

	mEditBox = new EditBox();
	mEditBox->setPlaceholder("Enter text...");
	mEditBox->setHeight(100);
	mEditBox->fillSpaceHorizontally();
	mMainListView->addChild(mEditBox);

	HorizontalLayout* layout = new HorizontalLayout();
	layout->setHeight(75);
	mMainListView->addChild(layout);

	mSetTextButton = new Button();
	mSetTextButton->setText("Reset text to DEFAULT ");
	layout->addChild(mSetTextButton);

	mGetTextButton = new Button();
	mGetTextButton->setText("Get text");
	layout->addChild(mGetTextButton);

	mGetTextLabel = new Label();
	mMainListView->addChild(mGetTextLabel);

	mKeyboardButton = new Button();
	mKeyboardButton->setText("Show/hide keyboard");
	mKeyboardButton->fillSpaceHorizontally();
	mMainListView->addChild(mKeyboardButton);

	// Create layout for widgets.
	this->createDecimalEditBoxView(mMaxTextLengthEditBox, mMainListView, MAX_TEXT_LENGTH_LABEL_TEXT);
	this->createDecimalEditBoxView(mMaxLinesEditBox, mMainListView, MAX_LINES_LABEL_TEXT);
	this->createDecimalEditBoxView(mMinLinesEditBox, mMainListView, MIN_LINES_LABEL_TEXT);
	this->createDecimalEditBoxView(mLinesNumberEditBox, mMainListView, LINES_NUMBER_LABEL_TEXT);
	this->createDecimalEditBoxView(mPlaceholderColorEditBox, mMainListView, PLACEHOLDER_COLOR_LABEL_TEXT);
	this->createInputModeListView(mMainListView);
	this->createInputFlagListView(mMainListView);

	maSetColor(0x8A2BE2);
}
Ejemplo n.º 7
0
/**
 * Creates a horizontal layout, adds it to the main layout, initializes the
 * edit box and adds it to the horizontal layout.
 * @param editBox The editbox to be created and added on the screen.
 * @param mainLayout Widgets will be added to it.
 */
void MainScreen::createDecimalEditBoxView(EditBox* &editBox, ListView* mainListView, String text)
{
	// Create layout for widgets.
	HorizontalLayout* layout = new HorizontalLayout();
	layout->setHeight(65);

	mainListView->addChild(layout);

	// Add label with info.
	Label* label = new Label();
	label->setText(text);
	layout->addChild(label);

	// Create the edit box.
	editBox = new EditBox();
	editBox->setInputMode(EDIT_BOX_INPUT_MODE_DECIMAL);
	editBox->fillSpaceHorizontally();
	layout->addChild(editBox);
}
/**
 * Creates and adds main layout to the screen.
 */
void EditBoxSettingsLayout::createMainLayout()
{
	mEditBoxListView = new ListView();
	this->addChild(mEditBoxListView);

	createSetEditBoxTextLayout();
	createGetEditBoxTextLayout();
	createSetPlaceholderLayout();

	mGetTextLabel = new Label();
	mEditBoxListView->addChild(mGetTextLabel);

	// create and add the show/hide keyboard button
	mKeyboardButton = new Button();
	mKeyboardButton->setText("Show/hide keyboard");
	mKeyboardButton->setHeight(PROPERTY_LINE_HEIGHT);
	mKeyboardButton->fillSpaceHorizontally();
	mEditBoxListView->addChild(mKeyboardButton);

	// Create layout for widgets.
	createDecimalEditBoxView(mMaxTextLengthEditBox, mEditBoxListView, MAX_TEXT_LENGTH_LABEL_TEXT);
	createDecimalEditBoxView(mMaxLinesEditBox, mEditBoxListView, MAX_LINES_LABEL_TEXT);
	createDecimalEditBoxView(mMinLinesEditBox, mEditBoxListView, MIN_LINES_LABEL_TEXT);
	createDecimalEditBoxView(mLinesNumberEditBox, mEditBoxListView, LINES_NUMBER_LABEL_TEXT);
	createDecimalEditBoxView(mPlaceholderColorEditBox, mEditBoxListView, PLACEHOLDER_COLOR_LABEL_TEXT);

	createInputModeListView(mEditBoxListView);

	// create a black separator between the lists
	HorizontalLayout* separatorLayout = new HorizontalLayout();
	separatorLayout->setBackgroundColor(0x000000);
	separatorLayout->setHeight(PROPERTY_LINE_HEIGHT);
	mEditBoxListView->addChild(separatorLayout);

	createInputFlagListView(mEditBoxListView);
}
Ejemplo n.º 9
0
/**
 * Creates and adds main layout to the screen.
 */
void WorkspaceLayout::createMainLayout() {

	// Create the main layout.
	HorizontalLayout *controlButtonsContainer = new HorizontalLayout();
	controlButtonsContainer->fillSpaceHorizontally();
	controlButtonsContainer->setHeight(mWidgetHeight);

	if(mOS == "iPhone OS")
	{

		mRefreshButton = new ImageButton();
		((ImageButton*)mRefreshButton)->addButtonListener(this);
		((ImageButton*)mRefreshButton)->setBackgroundImage(RELOAD_BG);
		mRefreshButton->setFontColor(0x000000);

		mDisconnectButton = new ImageButton();
		((ImageButton*)mDisconnectButton)->addButtonListener(this);
		((ImageButton*)mDisconnectButton)->setBackgroundImage(RELOAD_BG);
		mDisconnectButton->setFontColor(0x000000);

		mSaveButton = new ImageButton();
		((ImageButton*)mSaveButton)->addButtonListener(this);
		((ImageButton*)mSaveButton)->setBackgroundImage(RELOAD_BG);
		mSaveButton->setFontColor(0x000000);

		mReloadButton = new ImageButton();
		((ImageButton*)mReloadButton)->addButtonListener(this);
		((ImageButton*)mReloadButton)->setBackgroundImage(CONNECT_BG);
		mReloadButton->setFontColor(0x000000);
	}
	else
	{
		mRefreshButton = new Button();
		((Button*)mRefreshButton)->addButtonListener(this);

		mDisconnectButton = new Button();
		((Button*)mDisconnectButton)->addButtonListener(this);

		mSaveButton = new Button();
		((Button*)mSaveButton)->addButtonListener(this);

		mReloadButton = new Button();
		((Button*)mReloadButton)->addButtonListener(this);
	}

	mRefreshButton->setText(REFRESH_LIST_BUTTON_TEXT);
	mRefreshButton->setHeight(mWidgetHeight);
	mRefreshButton->fillSpaceHorizontally();

	mDisconnectButton->setText(DISCONNECT_BUTTON_TEXT);
	mDisconnectButton->setHeight(mWidgetHeight);
	mDisconnectButton->fillSpaceHorizontally();

	controlButtonsContainer->addChild(mDisconnectButton);
	controlButtonsContainer->addChild(mRefreshButton);

	// Create Project Control Buttons SAVE and RELOAD
	mSaveButton->setText(SAVE_BUTTON_TEXT);
	mSaveButton->setWidth((int)(mScreenWidth * mSaveButtonWidthRatio));

	mReloadButton->setText(RELOAD_BUTTON_TEXT);
	mReloadButton->setWidth((int)(mScreenWidth * mReloadButtonWidthRatio));

	mListView = new ListView();
	mListView->allowSelection(true);
	mListView->addListViewListener(this);
	if(mOS.find("iPhone") >= 0)
	{
		this->setBackgroundColor(0x000000);
		mListView->setProperty(MAW_WIDGET_BACKGROUND_COLOR,"00000000");
	}

	this->addChild(controlButtonsContainer);
	this->addChild(mListView);

	// Create the activity indicator widgets
	mActivityIndicatorContainer = new RelativeLayout();
	mActivityIndicatorContainer->fillSpaceHorizontally();
	mActivityIndicatorContainer->fillSpaceVertically();

	/**
	 * FIXME Removing listView and adding Activity indicator causes
	 * the list view not getting events until some point,
	 * when removing activity indicator to add the list again.
	 */
	//ActivityIndicator *loadingProjectsIndicator = new ActivityIndicator();
	//loadingProjectsIndicator->setSize(80,80);
	//loadingProjectsIndicator->setPosition((int)(mScreenWidth*0.5) - 40, (int)(mScreenHeight*0.5) - 80 );
	//mActivityIndicatorContainer->addChild(loadingProjectsIndicator);


}
Ejemplo n.º 10
0
/**
 * If there is no list populates the List View Widget with the project data
 * from mProjects vector. Else destroys and deallocates previous list items
 * and creates new ones.
 */
void WorkspaceLayout::updateProjectList(MAUtil::Vector <reloadProject> * projects)
{
	// Remove The ListView and add An Activity Indicator
	lprintfln("Updating Project List");
	mListView->setVisible(false);

	/**
	 * FIXME Removing listView and adding Activity indicator causes
	 * the list view not getting events until some point,
	 * when removing activity indicator to add the list again.
	 */
	//this->removeChild(mListView);
	//this->addChild(mActivityIndicatorContainer);

	// If there was a project Selected before update remove the
	// control buttons
	if(mSelectedProject != -1)
	{
		Widget *h = mListView->getChild(mSelectedProject)->getChild(0);
		h->removeChild(h->getChild(1));
		h->removeChild(h->getChild(1));
	}

	// ReInitialize selected project
	mSelectedProject = -1;
	mSelectedProjectName = "";

	// Delete all the widgets from the ListView
	int prProjects = mListView->countChildWidgets();
	if(prProjects != 0)
	{
		for(int i = 0; i < prProjects; i++)
		{
			Widget *listItemWidget = mListView->getChild(0); // list Item Widget

			Widget *hLayout = listItemWidget->getChild(0); // horizontal layout widget
			for( int j = 0; j < hLayout->countChildWidgets(); j++)
			{
				Widget * w = hLayout->getChild(0);
				hLayout->removeChild(w);
				delete w;
			}

			listItemWidget->removeChild(hLayout);

			delete hLayout;

			mListView->removeChild(listItemWidget);
			delete listItemWidget;
		}
	}

	// Re-populate the ListView with projects
	for (MAUtil::Vector <reloadProject>::iterator i = projects->begin(); i != projects->end(); i++)
	{
		// New List Itemprojects
		ListViewItem* item = new ListViewItem();
		item->setHeight(mWidgetHeight);
		item->fillSpaceHorizontally();

		// New Horizontal Layout
		HorizontalLayout *itemHorizontalLayout = new HorizontalLayout();
		itemHorizontalLayout->fillSpaceHorizontally();
		itemHorizontalLayout->setHeight(mWidgetHeight);

		// New Label
		Label* projectNameLabel = new Label();
		projectNameLabel->setTextHorizontalAlignment(MAW_ALIGNMENT_LEFT);
		projectNameLabel->setTextVerticalAlignment(MAW_ALIGNMENT_CENTER);
		projectNameLabel->setText(i->name);
		projectNameLabel->fillSpaceHorizontally();
		projectNameLabel->fillSpaceVertically();

		if (mOS.find("iPhone") >= 0)
		{
			itemHorizontalLayout->setWidth(item->getWidth());
			projectNameLabel->setFontColor(0xffffff);
		}

		itemHorizontalLayout->addChild(projectNameLabel);

		item->addChild(itemHorizontalLayout);

		mListView->addChild(item);
	}
	mListView->setVisible(true);

	// Remove Indicator and Add Project ListView
	//this->addChild(mListView);
	//this->removeChild(mActivityIndicatorContainer);

}
Ejemplo n.º 11
0
void LoadingScreen::initializeScreen(MAUtil::String &os)
{
			MAExtent ex = maGetScrSize();
			int screenWidth = EXTENT_X(ex);
			int screenHeight = EXTENT_Y(ex);

			mSplashScreen = new Screen();
			mSplashScreen->setBackgroundColor(40,40,40);

			//Layout that holds the screen elements
			RelativeLayout* relativeLayout = new RelativeLayout();
			relativeLayout->setSize(screenWidth, screenHeight);

			//The huge Reload "Circle"
			Image* logo = new Image();
			logo->setImage(SPLASH_IMAGE);
			logo->setSize(screenWidth,screenWidth);
			logo->setScaleMode(IMAGE_SCALE_PRESERVE_ASPECT);

			//Indicator placed on top of the reload circle
			mIndicator = new ActivityIndicator();
			mIndicator->show();

			//Progress bar for the download
			mProgressBar = new ProgressBar();
			mProgressBar->setWidth((int)(screenWidth * 0.75));
			mProgressBar->setMaximumValue(100);

			//Padding between the progress bar and the cancel button
			HorizontalLayout *paddingLayout = new HorizontalLayout();
			paddingLayout->setHeight(screenHeight / 36);

			//the cancel button stops the download and returns the user
			//to the login screen
			if(os == "Android")
			{
				mCancelDownloadButton = new Button();
				((Button*)mCancelDownloadButton)->addButtonListener(this);
			}
			else
			{
				mCancelDownloadButton = new ImageButton();
				((ImageButton*)mCancelDownloadButton)->addButtonListener(this);
				((ImageButton*)mCancelDownloadButton)->setBackgroundImage(RELOAD_BG);
				mCancelDownloadButton->setFontColor(0x000000);
			}

			mCancelDownloadButton->setText("Cancel");
			mCancelDownloadButton->setTextHorizontalAlignment(MAW_ALIGNMENT_CENTER);
			mCancelDownloadButton->setTextVerticalAlignment(MAW_ALIGNMENT_CENTER);
			mCancelDownloadButton->setWidth((int)(screenWidth * 0.75));
			mCancelDownloadButton->setHeight((int)(screenHeight * 0.1));

			//Spacing between the cancel button and the bottom of the screen
			HorizontalLayout *paddingLayout2 = new HorizontalLayout();
			paddingLayout2->setHeight(screenHeight / 15);

			VerticalLayout* logolayout = new VerticalLayout();
			logolayout->setSize(screenWidth, screenHeight);
			logolayout->setChildHorizontalAlignment(MAW_ALIGNMENT_CENTER);
			logolayout->setChildVerticalAlignment(MAW_ALIGNMENT_CENTER);
			logolayout->addChild(logo);

			VerticalLayout* activitylayout = new VerticalLayout();
			activitylayout->setSize(screenWidth, screenHeight);
			activitylayout->setChildHorizontalAlignment(MAW_ALIGNMENT_CENTER);
			activitylayout->setChildVerticalAlignment(MAW_ALIGNMENT_CENTER);
			activitylayout->addChild(mIndicator);

			VerticalLayout* progresslayout = new VerticalLayout();
			progresslayout->setSize(screenWidth, screenHeight);
			progresslayout->setChildHorizontalAlignment(MAW_ALIGNMENT_CENTER);
			progresslayout->setChildVerticalAlignment(MAW_ALIGNMENT_BOTTOM);
			progresslayout->addChild(mProgressBar);
			progresslayout->addChild(paddingLayout);
			progresslayout->addChild(mCancelDownloadButton);
			progresslayout->addChild(paddingLayout2);

			relativeLayout->addChild(logolayout);
			relativeLayout->addChild(activitylayout);
			relativeLayout->addChild(progresslayout);
			mSplashScreen->setMainWidget(relativeLayout);
}
Ejemplo n.º 12
0
/**
 * Creates and adds main layout to the screen.
 */
void MainScreen::createMainLayout()
{
	// create the first screen
	Screen* firstScreen = new Screen();
    firstScreen->setTitle("Edit box");

    // create the vertical layout that will contain all the
    // elements from the first screen
    VerticalLayout* firstScreenVerticalLayout = new VerticalLayout();

    // edit box creation
	mEditBox = new EditBox();
	mEditBox->setPlaceholder("Enter text...");
	mEditBox->setHeight((mScreenHeight/12)*2);
	mEditBox->fillSpaceHorizontally();
	firstScreenVerticalLayout->addChild(mEditBox);

	// create the horizontal layout that will contain the
	// set text button (resets the text to 'DEFAULT') and the
	// get text button
	HorizontalLayout* layout = new HorizontalLayout();
	layout->setHeight(mScreenHeight/12);
	firstScreenVerticalLayout->addChild(layout);

	mSetTextButton = new Button();
	mSetTextButton->setText("Reset text to DEFAULT ");
	layout->addChild(mSetTextButton);

	mGetTextButton = new Button();
	mGetTextButton->setText("Get text");
	layout->addChild(mGetTextButton);

	mGetTextLabel = new Label();
	firstScreenVerticalLayout->addChild(mGetTextLabel);

	// create and add the show/hide keyboard button
	mKeyboardButton = new Button();
	mKeyboardButton->setText("Show/hide keyboard");
	mKeyboardButton->setHeight(mScreenHeight/12);
	mKeyboardButton->fillSpaceHorizontally();
	firstScreenVerticalLayout->addChild(mKeyboardButton);

	// Create layout for widgets.
	this->createDecimalEditBoxView(mMaxTextLengthEditBox, firstScreenVerticalLayout, MAX_TEXT_LENGTH_LABEL_TEXT);
	this->createDecimalEditBoxView(mMaxLinesEditBox, firstScreenVerticalLayout, MAX_LINES_LABEL_TEXT);
	this->createDecimalEditBoxView(mMinLinesEditBox, firstScreenVerticalLayout, MIN_LINES_LABEL_TEXT);
	this->createDecimalEditBoxView(mLinesNumberEditBox, firstScreenVerticalLayout, LINES_NUMBER_LABEL_TEXT);
	this->createDecimalEditBoxView(mPlaceholderColorEditBox, firstScreenVerticalLayout, PLACEHOLDER_COLOR_LABEL_TEXT);

	// Create widgets for testing MAW_EDIT_BOX_MODE property on iOS.
	if (isIOS())
	{
		firstScreenVerticalLayout->addChild(this->createModePropertyLayout());
	}

	// set the main widget for the first screen and
	// then add it as a application tab
	firstScreen->setMainWidget(firstScreenVerticalLayout);
	this->addTab(firstScreen);

	// create the second screen and the horizontal
	// layout that will contain the input modes and flags lists
	Screen* secondScreen = new Screen();
	secondScreen->setTitle("Modes/flags");
	VerticalLayout* secondScreenVerticalLayout = new VerticalLayout();

	this->createInputModeListView(secondScreenVerticalLayout);

	// create a black separator between the lists
	HorizontalLayout* separatorLayout = new HorizontalLayout();
	separatorLayout->setBackgroundColor(0x000000);
	separatorLayout->setHeight(mScreenHeight/12);
	secondScreenVerticalLayout->addChild(separatorLayout);

	this->createInputFlagListView(secondScreenVerticalLayout);

	// set the main widget for the second screen and
	// then add it as a application tab
	secondScreen->setMainWidget(secondScreenVerticalLayout);
	this->addTab(secondScreen);

	maSetColor(0x8A2BE2);
}