void ScrollPanelBase::execSyncV(      FieldContainer    &oFrom,
                                        ConstFieldMaskArg  whichField,
                                        AspectOffsetStore &oOffsets,
                                        ConstFieldMaskArg  syncMode,
                                  const UInt32             uiSyncInfo)
{
    ScrollPanel *pThis = static_cast<ScrollPanel *>(this);

    pThis->execSync(static_cast<ScrollPanel *>(&oFrom),
                    whichField,
                    oOffsets,
                    syncMode,
                    uiSyncInfo);
}
void ScrollPanelBase::onCreate(const ScrollPanel *source)
{
    Inherited::onCreate(source);

    if(source != NULL)
    {
        ScrollPanel *pThis = static_cast<ScrollPanel *>(this);

        pThis->setView(source->getView());

        pThis->setInternalVerticalScrollBar(source->getInternalVerticalScrollBar());

        pThis->setInternalHorizontalScrollBar(source->getInternalHorizontalScrollBar());

        pThis->setVerticalRangeModel(source->getVerticalRangeModel());

        pThis->setHorizontalRangeModel(source->getHorizontalRangeModel());
    }
}
Exemplo n.º 3
0
void
EditEventForm::OnActionPerformed(const Tizen::Ui::Control& source, int actionId)
{
	result r = E_SUCCESS;

	SceneManager* pSceneManager = SceneManager::GetInstance();
	AppAssert(pSceneManager);

	ScrollPanel* pScrollPanel = static_cast< ScrollPanel* >(GetControl(0));
	AppAssert(pScrollPanel);

	static const int CONTEXT_POSITION = 200;

	switch (actionId)
	{
	case ID_BUTTON_REMINDER:
		__pReminderContextMenu->SetAnchorPosition(Point(__pReminderContextMenu->GetAnchorPosition().x, source.GetBounds().y + CONTEXT_POSITION - pScrollPanel->GetScrollPosition()));
		__pReminderContextMenu->SetFocusable(true);
		__pReminderContextMenu->SetShowState(true);
		__pReminderContextMenu->Show();
		break;

	case ID_CONTEXT_REMINDER_MINUTE:
		__selectedReminder = REMINDER_TIME_UNIT_MINUTE;
		__pReminderContextButton->SetText(L"Minute(s)");
		__pReminderContextButton->Invalidate(false);
		break;

	case ID_CONTEXT_REMINDER_HOUR:
		__selectedReminder = REMINDER_TIME_UNIT_HOUR;
		__pReminderContextButton->SetText(L"Hour(s)");
		__pReminderContextButton->Invalidate(false);
		break;

	case ID_CONTEXT_REMINDER_DAY:
		__selectedReminder = REMINDER_TIME_UNIT_DAY;
		__pReminderContextButton->SetText(L"Day(s)");
		__pReminderContextButton->Invalidate(false);
		break;

	case ID_CONTEXT_REMINDER_WEEK:
		__selectedReminder = REMINDER_TIME_UNIT_WEEK;
		__pReminderContextButton->SetText(L"Week(s)");
		__pReminderContextButton->Invalidate(false);
		break;

	case ID_BUTTON_RECURRENCE:
	{
		ArrayList* pList = new (std::nothrow) ArrayList();
		pList->Construct();

		DateTime startDate = __pStartEditDate->GetDate();
		DateTime endDate = __pEndEditDate->GetDate();

		pList->Add(*(new (std::nothrow) DateTime(startDate)));
		pList->Add(*(new (std::nothrow) DateTime(endDate)));

		if (__pRecurrence != null)
		{
			pList->Add(*(new (std::nothrow) Recurrence(*__pRecurrence)));
		}

		pSceneManager->GoForward(ForwardSceneTransition(SCENE_EVENT_SETRECURRENCE), pList);
	}
	break;

	case ID_BUTTON_PRIORITY:
		__pPriorityContextMenu->SetAnchorPosition(Point(__pPriorityContextMenu->GetAnchorPosition().x, source.GetBounds().y + CONTEXT_POSITION - pScrollPanel->GetScrollPosition()));
		__pPriorityContextMenu->SetFocusable(true);
		__pPriorityContextMenu->SetShowState(true);
		__pPriorityContextMenu->Show();
		break;

	case ID_CONTEXT_PRIORITY_HIGH:
		__selectedPriority = EVENT_PRIORITY_HIGH;
		__pPriorityContextButton->SetText(L"High");
		__pPriorityContextButton->Invalidate(false);
		break;

	case ID_CONTEXT_PRIORITY_NORMAL:
		__selectedPriority = EVENT_PRIORITY_NORMAL;
		__pPriorityContextButton->SetText(L"Normal");
		__pPriorityContextButton->Invalidate(false);
		break;

	case ID_CONTEXT_PRIORITY_LOW:
		__selectedPriority = EVENT_PRIORITY_LOW;
		__pPriorityContextButton->SetText(L"Low");
		__pPriorityContextButton->Invalidate(false);
		break;

	case ID_BUTTON_SENSITIVITY:
		__pSensitivityContextMenu->SetAnchorPosition(Point(__pSensitivityContextMenu->GetAnchorPosition().x, source.GetBounds().y + CONTEXT_POSITION - pScrollPanel->GetScrollPosition()));
		__pSensitivityContextMenu->SetFocusable(true);
		__pSensitivityContextMenu->SetShowState(true);
		__pSensitivityContextMenu->Show();
		break;

	case ID_CONTEXT_SENSITIVITY_PUBLIC:
		__selectedSensitivity = SENSITIVITY_PUBLIC;
		__pSensitivityContextButton->SetText(L"Public");
		__pSensitivityContextButton->Invalidate(false);
		break;

	case ID_CONTEXT_SENSITIVITY_PRIVATE:
		__selectedSensitivity = SENSITIVITY_PRIVATE;
		__pSensitivityContextButton->SetText(L"Private");
		__pSensitivityContextButton->Invalidate(false);
		break;

	case ID_CONTEXT_SENSITIVITY_CONFIDENTIAL:
		__selectedSensitivity = SENSITIVITY_CONFIDENTIAL;
		__pSensitivityContextButton->SetText(L"Confidential");
		__pSensitivityContextButton->Invalidate(false);
		break;

	case ID_BUTTON_STATUS:
		__pStatusContextMenu->SetAnchorPosition(Point(__pStatusContextMenu->GetAnchorPosition().x, source.GetBounds().y + CONTEXT_POSITION - pScrollPanel->GetScrollPosition()));
		__pStatusContextMenu->SetFocusable(true);
		__pStatusContextMenu->SetShowState(true);
		__pStatusContextMenu->Show();
		break;

	case ID_CONTEXT_STATUS_NONE:
		__selectedStatus = EVENT_STATUS_NONE;
		__pStatusContextButton->SetText(L"None");
		__pStatusContextButton->Invalidate(false);
		break;

	case ID_CONTEXT_STATUS_CONFIRMED:
		__selectedStatus = EVENT_STATUS_CONFIRMED;
		__pStatusContextButton->SetText(L"Confirmed");
		__pStatusContextButton->Invalidate(false);
		break;

	case ID_CONTEXT_STATUS_CANCELLED:
		__selectedStatus = EVENT_STATUS_CANCELLED;
		__pStatusContextButton->SetText(L"Cancelled");
		__pStatusContextButton->Invalidate(false);
		break;

	case ID_CONTEXT_STATUS_TENTATIVE:
		__selectedStatus = EVENT_STATUS_TENTATIVE;
		__pStatusContextButton->SetText(L"Tentative");
		__pStatusContextButton->Invalidate(false);
		break;

	case ID_CHKBUTTON_ISALLDAY_CHECKED:
	{
		if (__pStartEditTime != null)
		{
			__pStartEditTime->SetShowState(false);
		}

		if (__pEndEditTime != null)
		{
			__pEndEditTime->SetShowState(false);
		}
	}
	break;

	case ID_CHKBUTTON_ISALLDAY_UNCHECKED:
	{
		if (__pStartEditTime != null)
		{
			__pStartEditTime->SetShowState(true);
		}

		if (__pEndEditTime != null)
		{
			__pEndEditTime->SetShowState(true);
		}
	}
	break;

	case ID_FOOTER_SAVE:
		if (__pSubjectEditField->GetText().IsEmpty())
		{
			MessageBox messageBox;
			messageBox.Construct(L"Error", "Please enter the subject", MSGBOX_STYLE_OK, 0);
			int doModal;
			messageBox.ShowAndWait(doModal);
		}
		else
		{
			if (__pCalEvent != null)
			{
				r = UpdateEvent();
				TryReturnVoid(!IsFailed(r), "[%s] Failed to edit event.", GetErrorMessage(r));
			}
			else
			{
				MessageBox messageBox;
				messageBox.Construct(L"Error", "Failed to edit the event.", MSGBOX_STYLE_OK, 0);
				int doModal;
				messageBox.ShowAndWait(doModal);
			}

			pSceneManager->GoBackward(BackwardSceneTransition(SCENE_EVENT_LIST));
		}
		break;

	}

}
Exemplo n.º 4
0
result
EditEventForm::OnInitializing(void)
{
	result r = E_SUCCESS;

	Header* pHeader = GetHeader();
	AppAssert(pHeader);
	pHeader->SetStyle(HEADER_STYLE_TITLE);
	pHeader->SetTitleText(L"Edit event");

	Footer* pFooter = GetFooter();
	AppAssert(pFooter);
	pFooter->SetStyle(FOOTER_STYLE_BUTTON_TEXT);

	FooterItem footerSave;
	footerSave.Construct(ID_FOOTER_SAVE);
	footerSave.SetText(L"Save");
	pFooter->AddItem(footerSave);

	pFooter->AddActionEventListener(*this);
	SetFormBackEventListener(this);

	static const unsigned int COLOR_BACKGROUND_LABEL = 0xFFEFEDE5;
	static const unsigned int COLOR_TITLE_LABEL = 0xFF808080;
	static const unsigned int COLOR_TIMEZONE_DATA = 0xFF444444;

	static const int UI_X_POSITION_GAP = 20;
	static const int UI_WIDTH = GetClientAreaBounds().width - 40;
	static const int UI_X_POSITION_MIDDLE = UI_WIDTH / 4;
	static const int UI_HEIGHT = 112;
	static const int BUTTON_HEIGHT = 74;
	static const int UI_SPACE = 32;
	static const int FONT_SIZE = 36;

	int yPosition = 0;

	ScrollPanel* pScrollPanel = new (std::nothrow) ScrollPanel();
	pScrollPanel->Construct(Rectangle(0, 0, GetClientAreaBounds().width, GetClientAreaBounds().height));

	// Subject
	__pSubjectEditField = new (std::nothrow) EditField();
	__pSubjectEditField->Construct(Rectangle(UI_X_POSITION_GAP, yPosition, UI_WIDTH, UI_HEIGHT), EDIT_FIELD_STYLE_NORMAL, INPUT_STYLE_FULLSCREEN, EDIT_FIELD_TITLE_STYLE_TOP);
	__pSubjectEditField->SetTitleText(L"Subject");
	__pSubjectEditField->SetGuideText(L"Enter the subject");
	pScrollPanel->AddControl(__pSubjectEditField);


	int minYear = Calendarbook::GetMinDateTime().GetYear() + 1;
	int maxYear = Calendarbook::GetMaxDateTime().GetYear() - 1;

	// Start Date
	Label* pStartDateLabel = new (std::nothrow) Label();
	pStartDateLabel->Construct(Rectangle(UI_X_POSITION_GAP, yPosition += UI_HEIGHT + UI_SPACE, UI_WIDTH, UI_HEIGHT), L"Start");
	pStartDateLabel->SetTextVerticalAlignment(ALIGNMENT_TOP);
	pStartDateLabel->SetTextHorizontalAlignment(ALIGNMENT_LEFT);
	pStartDateLabel->SetTextColor(COLOR_TITLE_LABEL);
	pStartDateLabel->SetBackgroundColor(COLOR_BACKGROUND_LABEL);
	pScrollPanel->AddControl(pStartDateLabel);

	__pStartEditDate = new (std::nothrow) EditDate();
	__pStartEditDate->Construct(Point(UI_X_POSITION_GAP, yPosition + 10));
	__pStartEditDate->SetCurrentDate();
	__pStartEditDate->SetYearRange(minYear, maxYear);
	__pStartEditDate->AddDateChangeEventListener(*this);
	pScrollPanel->AddControl(__pStartEditDate);

	__pStartEditTime = new (std::nothrow) EditTime();
	__pStartEditTime->Construct(Point(UI_X_POSITION_MIDDLE * 2 + UI_SPACE, yPosition + 10));
	__pStartEditTime->SetCurrentTime();
	__pStartEditTime->AddTimeChangeEventListener(*this);
	pScrollPanel->AddControl(__pStartEditTime);

	// End Date
	Label* pEndDateLabel = new (std::nothrow) Label();
	pEndDateLabel->Construct(Rectangle(UI_X_POSITION_GAP, yPosition += UI_HEIGHT, UI_WIDTH, UI_HEIGHT), L"End");
	pEndDateLabel->SetTextVerticalAlignment(ALIGNMENT_TOP);
	pEndDateLabel->SetTextHorizontalAlignment(ALIGNMENT_LEFT);
	pEndDateLabel->SetTextColor(COLOR_TITLE_LABEL);
	pEndDateLabel->SetBackgroundColor(COLOR_BACKGROUND_LABEL);
	pScrollPanel->AddControl(pEndDateLabel);

	__pEndEditDate = new (std::nothrow) EditDate();
	__pEndEditDate->Construct(Point(UI_X_POSITION_GAP, yPosition + 10));
	__pEndEditDate->SetCurrentDate();
	__pEndEditDate->SetYearRange(minYear, maxYear);
	__pEndEditDate->AddDateChangeEventListener(*this);
	pScrollPanel->AddControl(__pEndEditDate);

	DateTime endTime;
	endTime = __pStartEditTime->GetTime();
	endTime.AddHours(1);

	__pEndEditTime = new (std::nothrow) EditTime();
	__pEndEditTime->Construct(Point(UI_X_POSITION_MIDDLE * 2 + UI_SPACE, yPosition + 10));
	__pEndEditTime->SetTime(endTime);
	__pEndEditTime->AddTimeChangeEventListener(*this);
	pScrollPanel->AddControl(__pEndEditTime);

	// TimeZone
	Label* pTimeZoneLabel = new (std::nothrow) Label();
	pTimeZoneLabel->Construct(Rectangle(UI_X_POSITION_GAP, yPosition += UI_HEIGHT, UI_WIDTH, UI_HEIGHT), L"TimeZone");
	pTimeZoneLabel->SetTextHorizontalAlignment(ALIGNMENT_LEFT);
	pTimeZoneLabel->SetTextColor(COLOR_TITLE_LABEL);
	pTimeZoneLabel->SetBackgroundColor(COLOR_BACKGROUND_LABEL);
	pScrollPanel->AddControl(pTimeZoneLabel);

	Label* pTimeZoneDataLabel = new (std::nothrow) Label();
	pTimeZoneDataLabel->Construct(Rectangle(UI_X_POSITION_GAP + UI_X_POSITION_MIDDLE, yPosition, UI_WIDTH * 3 / 4, UI_HEIGHT), L"");
	pTimeZoneDataLabel->SetTextHorizontalAlignment(ALIGNMENT_LEFT);
	pTimeZoneDataLabel->SetText(GetTimezoneString());
	pTimeZoneDataLabel->SetTextColor(COLOR_TIMEZONE_DATA);
	pTimeZoneDataLabel->SetTextConfig(FONT_SIZE, LABEL_TEXT_STYLE_NORMAL);
	pTimeZoneDataLabel->SetBackgroundColor(COLOR_BACKGROUND_LABEL);
	pScrollPanel->AddControl(pTimeZoneDataLabel);

	// All day Event
	__pIsAllDayButton = new (std::nothrow) CheckButton();
	__pIsAllDayButton->Construct(Rectangle(UI_X_POSITION_GAP, yPosition += UI_HEIGHT + UI_SPACE, UI_WIDTH, UI_HEIGHT), CHECK_BUTTON_STYLE_ONOFF_SLIDING, BACKGROUND_STYLE_DEFAULT, false, L"All day Event");
	__pIsAllDayButton->SetActionId(ID_CHKBUTTON_ISALLDAY_CHECKED, ID_CHKBUTTON_ISALLDAY_UNCHECKED);
	__pIsAllDayButton->SetTextColor(COLOR_TITLE_LABEL);
	__pIsAllDayButton->AddActionEventListener(*this);
	pScrollPanel->AddControl(__pIsAllDayButton);

	// Location
	__pLocationEditField = new (std::nothrow) EditField();
	__pLocationEditField->Construct(Rectangle(UI_X_POSITION_GAP, yPosition += UI_HEIGHT + UI_SPACE, UI_WIDTH, UI_HEIGHT), EDIT_FIELD_STYLE_NORMAL, INPUT_STYLE_FULLSCREEN, EDIT_FIELD_TITLE_STYLE_TOP);
	__pLocationEditField->SetTitleText(L"Location");
	__pLocationEditField->SetGuideText(L"Enter the location");
	pScrollPanel->AddControl(__pLocationEditField);

	// Description
	__pDescriptionEditField = new (std::nothrow) EditField();
	__pDescriptionEditField->Construct(Rectangle(UI_X_POSITION_GAP, yPosition += UI_HEIGHT, UI_WIDTH, UI_HEIGHT), EDIT_FIELD_STYLE_NORMAL, INPUT_STYLE_FULLSCREEN, EDIT_FIELD_TITLE_STYLE_TOP);
	__pDescriptionEditField->SetTitleText(L"Description");
	__pDescriptionEditField->SetGuideText(L"Enter the description");
	pScrollPanel->AddControl(__pDescriptionEditField);

	// Reminder
	Label* pReminderLabel = new (std::nothrow) Label();
	pReminderLabel->Construct(Rectangle(UI_X_POSITION_GAP, yPosition += UI_HEIGHT + UI_SPACE, UI_WIDTH, UI_HEIGHT), L"Reminder");
	pReminderLabel->SetTextColor(COLOR_TITLE_LABEL);
	pReminderLabel->SetBackgroundColor(Color(COLOR_BACKGROUND_LABEL));
	pReminderLabel->SetTextHorizontalAlignment(ALIGNMENT_LEFT);
	pScrollPanel->AddControl(pReminderLabel);

	__pReminderEditField = new (std::nothrow) EditField();
	__pReminderEditField->Construct(Rectangle(UI_X_POSITION_GAP + UI_X_POSITION_MIDDLE, yPosition, UI_WIDTH / 4, UI_HEIGHT), EDIT_FIELD_STYLE_NUMBER, INPUT_STYLE_FULLSCREEN, false, 5);
	__pReminderEditField->SetGuideText(L"0 ~ ");
	__pReminderEditField->SetName(L"Reminder");
	__pReminderEditField->SetTextAlignment(ALIGNMENT_CENTER);
	pScrollPanel->AddControl(__pReminderEditField);

	__pReminderContextButton = new (std::nothrow) Button();
	__pReminderContextButton->Construct(Rectangle(UI_X_POSITION_MIDDLE * 2 + UI_X_POSITION_GAP, yPosition + 19, UI_WIDTH / 2, BUTTON_HEIGHT), L"Minute(s)");
	__pReminderContextButton->SetActionId(ID_BUTTON_REMINDER);
	__pReminderContextButton->AddActionEventListener(*this);
	pScrollPanel->AddControl(__pReminderContextButton);

	__pReminderContextMenu = new (std::nothrow) ContextMenu();
	__pReminderContextMenu->Construct(Point(UI_X_POSITION_GAP + UI_WIDTH * 3 / 4, yPosition + UI_HEIGHT * 2), CONTEXT_MENU_STYLE_LIST, CONTEXT_MENU_ANCHOR_DIRECTION_UPWARD);
	__pReminderContextMenu->AddItem(L"Minute(s)", ID_CONTEXT_REMINDER_MINUTE);
	__pReminderContextMenu->AddItem(L"Hour(s)", ID_CONTEXT_REMINDER_HOUR);
	__pReminderContextMenu->AddItem(L"Day(s)", ID_CONTEXT_REMINDER_DAY);
	__pReminderContextMenu->AddItem(L"Week(s)", ID_CONTEXT_REMINDER_WEEK);
	__pReminderContextMenu->AddActionEventListener(*this);

	// Recurrence
	Label* pRecurrenceLabel = new (std::nothrow) Label();
	pRecurrenceLabel->Construct(Rectangle(UI_X_POSITION_GAP, yPosition += UI_HEIGHT, UI_WIDTH, UI_HEIGHT), L"Recurrence");
	pRecurrenceLabel->SetTextConfig(29, LABEL_TEXT_STYLE_NORMAL);
	pRecurrenceLabel->SetTextHorizontalAlignment(ALIGNMENT_LEFT);
	pRecurrenceLabel->SetTextColor(COLOR_TITLE_LABEL);
	pRecurrenceLabel->SetBackgroundColor(Color(COLOR_BACKGROUND_LABEL));
	pScrollPanel->AddControl(pRecurrenceLabel);

	__pSetRecurrenceButton = new (std::nothrow) Button();
	__pSetRecurrenceButton->Construct(Rectangle(UI_X_POSITION_MIDDLE + UI_X_POSITION_GAP, yPosition + 19, UI_WIDTH * 3 / 4, BUTTON_HEIGHT), L"None");
	__pSetRecurrenceButton->SetActionId(ID_BUTTON_RECURRENCE);
	__pSetRecurrenceButton->AddActionEventListener(*this);
	pScrollPanel->AddControl(__pSetRecurrenceButton);

	// Priority
	Label* pPriorityLabel = new (std::nothrow) Label();
	pPriorityLabel->Construct(Rectangle(UI_X_POSITION_GAP, yPosition += UI_HEIGHT + UI_SPACE, UI_WIDTH, UI_HEIGHT), L"Priority");
	pPriorityLabel->SetTextHorizontalAlignment(ALIGNMENT_LEFT);
	pPriorityLabel->SetTextColor(COLOR_TITLE_LABEL);
	pPriorityLabel->SetBackgroundColor(COLOR_BACKGROUND_LABEL);
	pScrollPanel->AddControl(pPriorityLabel);

	__pPriorityContextButton = new (std::nothrow) Button();
	__pPriorityContextButton->Construct(Rectangle(UI_X_POSITION_MIDDLE + UI_X_POSITION_GAP, yPosition + 19, UI_WIDTH * 3 / 4, BUTTON_HEIGHT), L"Low");
	__pPriorityContextButton->SetActionId(ID_BUTTON_PRIORITY);
	__pPriorityContextButton->AddActionEventListener(*this);
	pScrollPanel->AddControl(__pPriorityContextButton);

	__pPriorityContextMenu = new (std::nothrow) ContextMenu();
	__pPriorityContextMenu->Construct(Point(UI_X_POSITION_GAP + UI_WIDTH * 5 / 8, yPosition + UI_HEIGHT * 2), CONTEXT_MENU_STYLE_LIST, CONTEXT_MENU_ANCHOR_DIRECTION_UPWARD);
	__pPriorityContextMenu->AddItem(L"High", ID_CONTEXT_PRIORITY_HIGH);
	__pPriorityContextMenu->AddItem(L"Normal", ID_CONTEXT_PRIORITY_NORMAL);
	__pPriorityContextMenu->AddItem(L"Low", ID_CONTEXT_PRIORITY_LOW);
	__pPriorityContextMenu->AddActionEventListener(*this);

	// Sensitivity
	Label* pSensitivityLabel = new (std::nothrow) Label();
	pSensitivityLabel->Construct(Rectangle(UI_X_POSITION_GAP, yPosition += UI_HEIGHT, UI_WIDTH, UI_HEIGHT), L"Sensitivity");
	pSensitivityLabel->SetTextHorizontalAlignment(ALIGNMENT_LEFT);
	pSensitivityLabel->SetTextColor(COLOR_TITLE_LABEL);
	pSensitivityLabel->SetBackgroundColor(COLOR_BACKGROUND_LABEL);
	pScrollPanel->AddControl(pSensitivityLabel);

	__pSensitivityContextButton = new (std::nothrow) Button();
	__pSensitivityContextButton->Construct(Rectangle(UI_X_POSITION_MIDDLE + UI_X_POSITION_GAP, yPosition + 19, UI_WIDTH * 3 / 4, BUTTON_HEIGHT), L"Public");
	__pSensitivityContextButton->SetActionId(ID_BUTTON_SENSITIVITY);
	__pSensitivityContextButton->AddActionEventListener(*this);
	pScrollPanel->AddControl(__pSensitivityContextButton);

	__pSensitivityContextMenu = new (std::nothrow) ContextMenu();
	__pSensitivityContextMenu->Construct(Point(UI_X_POSITION_GAP + UI_WIDTH * 5 / 8, yPosition + UI_HEIGHT * 2), CONTEXT_MENU_STYLE_LIST, CONTEXT_MENU_ANCHOR_DIRECTION_UPWARD);
	__pSensitivityContextMenu->AddItem(L"Public", ID_CONTEXT_SENSITIVITY_PUBLIC);
	__pSensitivityContextMenu->AddItem(L"Private", ID_CONTEXT_SENSITIVITY_PRIVATE);
	__pSensitivityContextMenu->AddItem(L"Confidential", ID_CONTEXT_SENSITIVITY_CONFIDENTIAL);
	__pSensitivityContextMenu->AddActionEventListener(*this);

	// Status
	Label* pStatusLabel = new (std::nothrow) Label();
	pStatusLabel->Construct(Rectangle(UI_X_POSITION_GAP, yPosition += UI_HEIGHT, UI_WIDTH, UI_HEIGHT), L"Status");
	pStatusLabel->SetTextHorizontalAlignment(ALIGNMENT_LEFT);
	pStatusLabel->SetTextColor(COLOR_TITLE_LABEL);
	pStatusLabel->SetBackgroundColor(COLOR_BACKGROUND_LABEL);
	pScrollPanel->AddControl(pStatusLabel);

	__pStatusContextButton = new (std::nothrow) Button();
	__pStatusContextButton->Construct(Rectangle(UI_X_POSITION_MIDDLE + UI_X_POSITION_GAP, yPosition + 19, UI_WIDTH * 3 / 4, BUTTON_HEIGHT), L"None");
	__pStatusContextButton->SetActionId(ID_BUTTON_STATUS);
	__pStatusContextButton->AddActionEventListener(*this);
	pScrollPanel->AddControl(__pStatusContextButton);

	__pStatusContextMenu = new (std::nothrow) ContextMenu();
	__pStatusContextMenu->Construct(Point(UI_X_POSITION_GAP + UI_WIDTH * 5 / 8, yPosition + UI_HEIGHT * 2), CONTEXT_MENU_STYLE_LIST, CONTEXT_MENU_ANCHOR_DIRECTION_UPWARD);
	__pStatusContextMenu->AddItem(L"None", ID_CONTEXT_STATUS_NONE);
	__pStatusContextMenu->AddItem(L"Confirmed", ID_CONTEXT_STATUS_CONFIRMED);
	__pStatusContextMenu->AddItem(L"Cancelled", ID_CONTEXT_STATUS_CANCELLED);
	__pStatusContextMenu->AddItem(L"Tentative", ID_CONTEXT_STATUS_TENTATIVE);
	__pStatusContextMenu->AddActionEventListener(*this);

	AddControl(pScrollPanel);

	return r;
}
Exemplo n.º 5
0
//-----------------------------------------------------------------------------
// Purpose: Constructs a message panel
//-----------------------------------------------------------------------------
CMessageWindowPanel::CMessageWindowPanel( const char *szMOTD, const char *szTitle, int iShadeFullscreen, int iRemoveMe, int x, int y, int wide, int tall ) : CMenuPanel( iShadeFullscreen ? 100 : 255, iRemoveMe, x, y, wide, tall )
{
	// Get the scheme used for the Titles
	CSchemeManager *pSchemes = gViewPort->GetSchemeManager();

	// schemes
	SchemeHandle_t hTitleScheme = pSchemes->getSchemeHandle( "Title Font" );
	SchemeHandle_t hMOTDText = pSchemes->getSchemeHandle( "Briefing Text" );

	// color schemes
	int r, g, b, a;

	// Create the window
	m_pBackgroundPanel = new CTransparentPanel( iShadeFullscreen ? 255 : 100, MOTD_WINDOW_X, MOTD_WINDOW_Y, MOTD_WINDOW_SIZE_X, MOTD_WINDOW_SIZE_Y );
	m_pBackgroundPanel->setParent( this );
	m_pBackgroundPanel->setBorder( new LineBorder( Color(255 * 0.7,170 * 0.7,0,0)) );
	m_pBackgroundPanel->setVisible( true );

	int iXSize,iYSize,iXPos,iYPos;
	m_pBackgroundPanel->getPos( iXPos,iYPos );
	m_pBackgroundPanel->getSize( iXSize,iYSize );

	// Create the title
	Label *pLabel = new Label( "", iXPos + MOTD_TITLE_X, iYPos + MOTD_TITLE_Y );
	pLabel->setParent( this );
	pLabel->setFont( pSchemes->getFont(hTitleScheme) );
	pLabel->setFont( Scheme::sf_primary1 );

	pSchemes->getFgColor( hTitleScheme, r, g, b, a );
	pLabel->setFgColor( r, g, b, a );
	pLabel->setFgColor( Scheme::sc_primary1 );
	pSchemes->getBgColor( hTitleScheme, r, g, b, a );
	pLabel->setBgColor( r, g, b, a );
	pLabel->setContentAlignment( vgui::Label::a_west );
	pLabel->setText( "%s", szTitle);

	// Create the Scroll panel
	ScrollPanel *pScrollPanel = new CTFScrollPanel( iXPos + XRES(16), iYPos + MOTD_TITLE_Y*2 + YRES(16), iXSize - XRES(32), iYSize - (YRES(48) + BUTTON_SIZE_Y*2) );
	pScrollPanel->setParent(this);
	
	//force the scrollbars on so clientClip will take them in account after the validate
	pScrollPanel->setScrollBarAutoVisible(false, false);
	pScrollPanel->setScrollBarVisible(true, true);
	pScrollPanel->validate();

	// Create the text panel
	TextPanel *pText = new TextPanel( "", 0,0, 64,64);
	pText->setParent( pScrollPanel->getClient() );

	// get the font and colors from the scheme
	pText->setFont( pSchemes->getFont(hMOTDText) );
	pSchemes->getFgColor( hMOTDText, r, g, b, a );
	pText->setFgColor( r, g, b, a );
	pSchemes->getBgColor( hMOTDText, r, g, b, a );
	pText->setBgColor( r, g, b, a );
	pText->setText( szMOTD);

	// Get the total size of the MOTD text and resize the text panel
	int iScrollSizeX, iScrollSizeY;

	// First, set the size so that the client's wdith is correct at least because the
	//  width is critical for getting the "wrapped" size right.
	// You'll see a horizontal scroll bar if there is a single word that won't wrap in the
	//  specified width.
	pText->getTextImage()->setSize(pScrollPanel->getClientClip()->getWide(), pScrollPanel->getClientClip()->getTall());
	pText->getTextImage()->getTextSizeWrapped( iScrollSizeX, iScrollSizeY );
	
	// Now resize the textpanel to fit the scrolled size
	pText->setSize( iScrollSizeX , iScrollSizeY );

	//turn the scrollbars back into automode
	pScrollPanel->setScrollBarAutoVisible(true, true);
	pScrollPanel->setScrollBarVisible(false, false);

	pScrollPanel->validate();

	CommandButton *pButton = new CommandButton( CHudTextMessage::BufferedLocaliseTextString( "#Menu_OK" ), iXPos + XRES(16), iYPos + iYSize - YRES(16) - BUTTON_SIZE_Y, CMENU_SIZE_X, BUTTON_SIZE_Y);
	pButton->addActionSignal(new CMenuHandler_TextWindow(HIDE_TEXTWINDOW));
	pButton->setParent(this);

}
Exemplo n.º 6
0
void FCarAddEdit::OnOtherControlSelected(const Osp::Ui::Control& source) {
	ScrollPanel * vpScrollPanel = static_cast<ScrollPanel *> (GetControl(L"IDC_SCROLLPANEL1"));
	vpScrollPanel->CloseOverlayWindow();
}
Exemplo n.º 7
0
void
FCarAddEdit::OnActionPerformed(const Control& source, int actionId)
{
	Frame *pFrame = Application::GetInstance()->GetAppFrame()->GetFrame();
	if (actionId == ID_CANCEL){
		bool issaved = false;
		if (!this->detailmode) {
		if (CheckIfDataChanged()) {
			MessageBox msgbox;
			int modalResult = 0;
			msgbox.Construct("Confirm cancel", "Car data changed. Save data?", MSGBOX_STYLE_YESNO, 10000);
			msgbox.ShowAndWait(modalResult);
			if (modalResult == MSGBOX_RESULT_YES) {
				if (Save() == false) {
					return;
				} else {
					issaved = true;
				}
			}
		}
		}
		if (this->formtype == 2) {
			FormMgr *pFormMgr = static_cast<FormMgr *>(pFrame->GetControl("FormMgr"));
			if (issaved) {
				carconclass_->SetLastSelectedID(this->itemid);
				FormMgr *pFormMgr = static_cast<FormMgr *>(pFrame->GetControl("FormMgr"));
				pFormMgr->SendUserEvent(FormMgr::REQUEST_MAINFORM, null);
			} else {
				ArrayList * list = new ArrayList;
				list->Construct();
				list->Add(*(new Integer(2)));
				pFormMgr->SendUserEvent(FormMgr::REQUEST_SETTINGSFORM, list);
			}
		} else {
		if ((!this->detailform) || (this->detailmode)) {
			FormMgr *pFormMgr = static_cast<FormMgr *>(pFrame->GetControl("FormMgr"));
			ArrayList * list = new ArrayList;
			list->Construct();
			list->Add(*(new Integer(this->itemid)));
			pFormMgr->SendUserEvent(FormMgr::REQUEST_CARSELECTFORM, list);
		} else {
			OnActionPerformed(source, ID_DETAIL);
		}
		}
	} else if (actionId == ID_SAVE) {
		if (Save() == false) {
			return;
		}
		if (this->formtype == 2) {
		carconclass_->SetLastSelectedID(this->itemid);
		FormMgr *pFormMgr = static_cast<FormMgr *>(pFrame->GetControl("FormMgr"));
		pFormMgr->SendUserEvent(FormMgr::REQUEST_MAINFORM, null);
		} else {
		if (!this->detailform) {
			FormMgr *pFormMgr = static_cast<FormMgr *>(pFrame->GetControl("FormMgr"));
			ArrayList * list = new ArrayList;
			list->Construct();
			list->Add(*(new Integer(this->itemid)));
			pFormMgr->SendUserEvent(FormMgr::REQUEST_CARSELECTFORM, list);
		} else {
			OnActionPerformed(source, ID_DETAIL);
		}
		}
	} else if (actionId == ID_SELECTFUELTYPEPOPUPOK) {
		fueltypesselectedarray_.RemoveAll();
		int checkeditemindex;
		int fueltypeid;
		checkeditemindex = pListSelectFuelTypes_->GetFirstCheckedItemIndex();
		while (checkeditemindex > -1) {
			fueltypeid = pListSelectFuelTypes_->GetItemIdAt(checkeditemindex);
			fueltypesselectedarray_.Add(fueltypeid);
			checkeditemindex = pListSelectFuelTypes_->GetNextCheckedItemIndexAfter(checkeditemindex);
		}
		controlhandler_->SetValue(this,L"CB_4_fueltypestring", GetFuelTypesString());
		pPopup_->SetShowState(false);
		this->SetFocus();
		RequestRedraw(true);
	} else if (actionId == ID_ADDNEWFUELTYPEPOPUPCANCEL) {
		pAddnewfueltypepopup_->SetShowState(false);
		this->SetFocus();
		RequestRedraw(true);
	} else if (actionId == ID_ADDNEWFUELTYPEPOPUPSAVE) {
		Osp::Ui::Controls::EditField *pAddnewfueltypepopupEditField_ = static_cast<EditField *>(pAddnewfueltypepopup_->GetControl(L"IDC_EDITFIELD1"));
		String tmps = pAddnewfueltypepopupEditField_->GetText();
		tmps.Trim();
		if (tmps == "") {
			MessageBox msgbox;
			int modalResult = 0;
			msgbox.Construct("Empty value!", "Input fuel type caption!", MSGBOX_STYLE_OK, 10000);
			msgbox.ShowAndWait(modalResult);
		} else {
			FuelTypeData fueltypedata_;
			fueltypedata_.Caption = tmps;
			fueltypedata_.ID = 0;
			carconclass_->SaveFuelTypeData(fueltypedata_);
			pListSelectFuelTypes_->AddItem(&fueltypedata_.Caption, null, null, null, fueltypedata_.ID);
			int selecteditemindex = pListSelectFuelTypes_->GetItemIndexFromItemId(fueltypedata_.ID);
			if (selecteditemindex > -1) {
				pListSelectFuelTypes_->SetItemChecked(selecteditemindex, true);
			}
			pListSelectFuelTypes_->ScrollToBottom();
			pAddnewfueltypepopup_->SetShowState(false);
			RequestRedraw(true);
		}
	} else if (actionId == ID_SELECTFUELTYPEPOPUPADD) {
		Osp::Ui::Controls::EditField *pAddnewfueltypepopupEditField_ = static_cast<EditField *>(pAddnewfueltypepopup_->GetControl(L"IDC_EDITFIELD1"));
		pAddnewfueltypepopupEditField_->SetText(L"");
		pAddnewfueltypepopup_->SetShowState(true);
		pAddnewfueltypepopup_->Show();
	} else if (actionId == ID_BUTTON_EDITFIELD_DONE) {
		int actiondone = controlhandler_->ActionDone(this, source);
		if ((actiondone == ControlHandler::ACTIONDONERESULT_HIDEKEYPAD) || (actiondone == ControlHandler::ACTIONDONERESULT_OPENCOMBOBOX)) {
			ScrollPanel * vpScrollPanel = static_cast<ScrollPanel *> (GetControl(L"IDC_SCROLLPANEL1"));
			vpScrollPanel->CloseOverlayWindow();
		}
		if (actiondone == ControlHandler::ACTIONDONERESULT_OPENCOMBOBOX) {
			pPopup_->SetShowState(true);
			pPopup_->Show();
		}
	} else if (actionId == ID_BUTTON_EDITFIELD_CLOSE) {
		ScrollPanel * vpScrollPanel = static_cast<ScrollPanel *> (GetControl(L"IDC_SCROLLPANEL1"));
		vpScrollPanel->CloseOverlayWindow();
	} else if ((actionId == ID_EDIT) || (actionId == ID_DETAIL)) {
		this->SetFocus();
		if (actionId == ID_DETAIL) {
			ReloadSavedData();
		}
		this->detailmode = (actionId == ID_DETAIL);
		DetailEditMode();
		RequestRedraw(true);
	}
}
Exemplo n.º 8
0
result
ProfileDetailForm::OnInitializing(void)
{
	result r = E_SUCCESS;

	Header* pHeader = GetHeader();
	AppAssert(pHeader);
	pHeader->SetStyle(HEADER_STYLE_TITLE);
	String getDetails;
	Application::GetInstance()->GetAppResource()->GetString(IDS_DETAILS, getDetails);
	pHeader->SetTitleText(getDetails);

	Footer* pFooter = GetFooter();
	AppAssert(pFooter);
	pFooter->SetStyle(FOOTER_STYLE_BUTTON_TEXT);


	String getEdit;
	Application::GetInstance()->GetAppResource()->GetString(IDS_EDIT, getEdit);
	FooterItem footerEdit;
	footerEdit.Construct(ID_FOOTER_EDIT);
	footerEdit.SetText(getEdit);
	pFooter->AddItem(footerEdit);


	String getDelete;
	Application::GetInstance()->GetAppResource()->GetString(IDS_DELETE, getDelete);
	FooterItem footerDelete;
	footerDelete.Construct(ID_FOOTER_DELETE);
	footerDelete.SetText(getDelete);
	pFooter->AddItem(footerDelete);
	pFooter->AddActionEventListener(*this);

	SetFormBackEventListener(this);

	static const unsigned int COLOR_BACKGROUND_LABEL = 0xFFEFEDE5;
	static const unsigned int COLOR_TITLE_LABEL = 0xFF808080;

	static const int UI_X_POSITION_GAP = 20;
	static const int UI_WIDTH = GetClientAreaBounds().width - 40;
	static const int UI_X_POSITION_MIDDLE = UI_WIDTH / 4 + UI_X_POSITION_GAP;
	static const int UI_HEIGHT = 112;
	static const int UI_SPACE = 26;
	int yPosition = 0;

	ScrollPanel* pScrollPanel = new (std::nothrow) ScrollPanel();
	pScrollPanel->Construct(Rectangle(0, 0, GetClientAreaBounds().width, GetClientAreaBounds().height));

	String date;
	DateTime displayStartDate;
	DateTime displayDueDate;

	// Subject
	Label* pSubjectLabel = new (std::nothrow) Label();
	String getProfileName;
	Application::GetInstance()->GetAppResource()->GetString(IDS_PROFILE_NAME, getProfileName);
	pSubjectLabel->Construct(Rectangle(UI_X_POSITION_GAP, yPosition, UI_WIDTH, UI_HEIGHT), getProfileName);
	pSubjectLabel->SetTextHorizontalAlignment(ALIGNMENT_LEFT);
	pSubjectLabel->SetTextColor(COLOR_TITLE_LABEL);
	pSubjectLabel->SetBackgroundColor(Color(COLOR_BACKGROUND_LABEL));
	pScrollPanel->AddControl(pSubjectLabel);

	__pSubjectLabelData = new (std::nothrow) Label();
	__pSubjectLabelData->Construct(Rectangle(UI_X_POSITION_MIDDLE, yPosition, UI_WIDTH * 3 / 4, UI_HEIGHT), L"");
	__pSubjectLabelData->SetTextHorizontalAlignment(ALIGNMENT_LEFT);
	pScrollPanel->AddControl(__pSubjectLabelData);

	// Start Date
	Label* pStartDateLabel = new (std::nothrow) Label();
	String getStartDatetime;
	Application::GetInstance()->GetAppResource()->GetString(IDS_START_DATETIME, getStartDatetime);
	pStartDateLabel->Construct(Rectangle(UI_X_POSITION_GAP, yPosition += UI_HEIGHT + UI_SPACE, UI_WIDTH, UI_HEIGHT), getStartDatetime);
	pStartDateLabel->SetTextHorizontalAlignment(ALIGNMENT_LEFT);
	pStartDateLabel->SetTextColor(COLOR_TITLE_LABEL);
	pStartDateLabel->SetBackgroundColor(Color(COLOR_BACKGROUND_LABEL));
	pScrollPanel->AddControl(pStartDateLabel);

	__pStartDateLabelData = new (std::nothrow) Label();
	__pStartDateLabelData->Construct(Rectangle(UI_X_POSITION_MIDDLE, yPosition, UI_WIDTH * 3 / 4, UI_HEIGHT), L"");
	__pStartDateLabelData->SetTextHorizontalAlignment(ALIGNMENT_LEFT);
	pScrollPanel->AddControl(__pStartDateLabelData);

	// Due Date
	Label* pDueDateLabel = new (std::nothrow) Label();
	String getEndDatetime;
	Application::GetInstance()->GetAppResource()->GetString(IDS_END_DATETIME, getEndDatetime);
	pDueDateLabel->Construct(Rectangle(UI_X_POSITION_GAP, yPosition += UI_HEIGHT, UI_WIDTH, UI_HEIGHT), getEndDatetime);
	pDueDateLabel->SetTextHorizontalAlignment(ALIGNMENT_LEFT);
	pDueDateLabel->SetTextColor(COLOR_TITLE_LABEL);
	pDueDateLabel->SetBackgroundColor(Color(COLOR_BACKGROUND_LABEL));
	pScrollPanel->AddControl(pDueDateLabel);

	__pDueDateLabelData = new (std::nothrow) Label();
	__pDueDateLabelData->Construct(Rectangle(UI_X_POSITION_MIDDLE, yPosition, UI_WIDTH * 3 / 4, UI_HEIGHT), L"");
	__pDueDateLabelData->SetTextHorizontalAlignment(ALIGNMENT_LEFT);
	pScrollPanel->AddControl(__pDueDateLabelData);

	// Location
	Label* pLocationLabel = new (std::nothrow) Label();
	String getLocation;
	Application::GetInstance()->GetAppResource()->GetString(IDS_LOCATION, getLocation);
	pLocationLabel->Construct(Rectangle(UI_X_POSITION_GAP, yPosition += UI_HEIGHT + UI_SPACE, UI_WIDTH, UI_HEIGHT), getLocation);
	pLocationLabel->SetTextHorizontalAlignment(ALIGNMENT_LEFT);
	pLocationLabel->SetTextColor(COLOR_TITLE_LABEL);
	pLocationLabel->SetBackgroundColor(Color(COLOR_BACKGROUND_LABEL));
	pScrollPanel->AddControl(pLocationLabel);

	__pLocationLabelData = new (std::nothrow) Label();
	__pLocationLabelData->Construct(Rectangle(UI_X_POSITION_MIDDLE, yPosition, UI_WIDTH * 3 / 4, UI_HEIGHT), L"");
	__pLocationLabelData->SetTextHorizontalAlignment(ALIGNMENT_LEFT);
	pScrollPanel->AddControl(__pLocationLabelData);

	// Volume
	Label* pVolumeLabel = new (std::nothrow) Label();
	String getVolume;
	Application::GetInstance()->GetAppResource()->GetString(IDS_VOLUME, getVolume);
	pVolumeLabel->Construct(Rectangle(UI_X_POSITION_GAP, yPosition += UI_HEIGHT + UI_SPACE, UI_WIDTH, UI_HEIGHT), getVolume);
	pVolumeLabel->SetTextHorizontalAlignment(ALIGNMENT_LEFT);
	pVolumeLabel->SetTextColor(COLOR_TITLE_LABEL);
	pVolumeLabel->SetBackgroundColor(Color(COLOR_BACKGROUND_LABEL));
	pScrollPanel->AddControl(pVolumeLabel);

	__pVolumeLabelData = new (std::nothrow) Label();
	__pVolumeLabelData->Construct(Rectangle(UI_X_POSITION_MIDDLE, yPosition, UI_WIDTH * 3 / 4, UI_HEIGHT), L"");
	__pVolumeLabelData->SetTextHorizontalAlignment(ALIGNMENT_LEFT);
	pScrollPanel->AddControl(__pVolumeLabelData);

	// Wifi
	Label* pWifiLabel = new (std::nothrow) Label();
	String getWifi;
	Application::GetInstance()->GetAppResource()->GetString(IDS_WIFI, getWifi);
	pWifiLabel->Construct(Rectangle(UI_X_POSITION_GAP, yPosition += UI_HEIGHT, UI_WIDTH, UI_HEIGHT), getWifi);
	pWifiLabel->SetTextHorizontalAlignment(ALIGNMENT_LEFT);
	pWifiLabel->SetTextColor(COLOR_TITLE_LABEL);
	pWifiLabel->SetBackgroundColor(Color(COLOR_BACKGROUND_LABEL));
	pScrollPanel->AddControl(pWifiLabel);

	__pWifiLabelData = new (std::nothrow) Label();
	__pWifiLabelData->Construct(Rectangle(UI_X_POSITION_MIDDLE, yPosition, UI_WIDTH * 3 / 4, UI_HEIGHT), L"");
	__pWifiLabelData->SetTextHorizontalAlignment(ALIGNMENT_LEFT);
	pScrollPanel->AddControl(__pWifiLabelData);

	// Description
	Label* pDescriptionLabel = new (std::nothrow) Label();
	String getMemo;
	Application::GetInstance()->GetAppResource()->GetString(IDS_DESCRIPTION, getMemo);
	pDescriptionLabel->Construct(Rectangle(UI_X_POSITION_GAP, yPosition += UI_HEIGHT + UI_SPACE, UI_WIDTH, UI_HEIGHT), getMemo);
	pDescriptionLabel->SetTextHorizontalAlignment(ALIGNMENT_LEFT);
	pDescriptionLabel->SetTextColor(COLOR_TITLE_LABEL);
	pDescriptionLabel->SetBackgroundColor(Color(COLOR_BACKGROUND_LABEL));
	pScrollPanel->AddControl(pDescriptionLabel);

	__pDescriptionLabelData = new (std::nothrow) Label();
	__pDescriptionLabelData->Construct(Rectangle(UI_X_POSITION_MIDDLE, yPosition, UI_WIDTH * 3 / 4, UI_HEIGHT), L"");
	__pDescriptionLabelData->SetTextHorizontalAlignment(ALIGNMENT_LEFT);
	pScrollPanel->AddControl(__pDescriptionLabelData);

	AddControl(pScrollPanel);

	return r;
}
Exemplo n.º 9
0
void
ProjectGiraffeTab4::showProfile(void)
{
	RemoveAllControls();

	//add scroll panel
	ScrollPanel *scrollPanel = new ScrollPanel();
	scrollPanel->Construct(Rectangle(0, 160, GetBounds().width, GetBounds().height - 160));

	User *cUser = User::currentUser();

	// Avatar button? image?
	Button* avatarButton = new Button();
	avatarButton->Construct(Rectangle(10, 10, 250, 250), "");
	avatarButton->SetName("avatarButton");
	avatarButton->SetActionId(ID_BUTTON_AVATAR);
	avatarButton->AddActionEventListener(*this);
	AddControl(*avatarButton);

	if (_avatarContextMenu == null) {
		_avatarContextMenu = new ContextMenu();
		_avatarContextMenu->Construct(Point(135, 420), CONTEXT_MENU_STYLE_LIST, CONTEXT_MENU_ANCHOR_DIRECTION_DOWNWARD);
		_avatarContextMenu->AddItem("Choose from library", ID_CONTEXT_CHOOSE);
		_avatarContextMenu->AddItem("Take photo", ID_CONTEXT_TAKE);
		_avatarContextMenu->AddActionEventListener(*this);
		_avatarContextMenu->SetShowState(false);
		_avatarContextMenu->Invalidate(true);

	}

	Label* usernameLabel = new Label();
	usernameLabel->Construct(Rectangle(270, 10, GetBounds().width - 20, 60), cUser->username());
	usernameLabel->SetTextConfig(48, LABEL_TEXT_STYLE_BOLD);
	usernameLabel->SetTextHorizontalAlignment(ALIGNMENT_LEFT);
	usernameLabel->SetName("usernameLabel");
	AddControl(*usernameLabel);

	Label* postsLabel = new Label();
	postsLabel->Construct(Rectangle(270, 80, GetBounds().width/3, 40), "posts");
	postsLabel->SetTextConfig(32, LABEL_TEXT_STYLE_BOLD);
	postsLabel->SetTextHorizontalAlignment(ALIGNMENT_LEFT);
	postsLabel->SetName("postsLabel");
	AddControl(*postsLabel);

	/*
	// logout button
	Button* logoutButton = new Button();
	logoutButton->Construct(Rectangle(GetBounds().width/2 + 30, 10, 300, 80), "Logout");
//	centerHorizontally(updateButton1, this);
	logoutButton->SetName("logoutButton");
	logoutButton->SetActionId(ID_BUTTON_LOGOUT);
	logoutButton->AddActionEventListener(*this);
	scrollPanel->AddControl(*logoutButton);

	// Avatar button? image?
	Button* avatarButton = new Button();
	avatarButton->Construct(Rectangle(10, 10, 250, 250), "");
	avatarButton->SetName("avatarButton");
	avatarButton->SetActionId(ID_BUTTON_AVATAR);
	avatarButton->AddActionEventListener(*this);
	scrollPanel->AddControl(*avatarButton);

	if (_avatarContextMenu == null) {
		_avatarContextMenu = new ContextMenu();
		_avatarContextMenu->Construct(Point(135, 420), CONTEXT_MENU_STYLE_LIST, CONTEXT_MENU_ANCHOR_DIRECTION_DOWNWARD);
		_avatarContextMenu->AddItem("Choose from library", ID_CONTEXT_CHOOSE);
		_avatarContextMenu->AddItem("Take photo", ID_CONTEXT_TAKE);
		_avatarContextMenu->AddActionEventListener(*this);
		_avatarContextMenu->SetShowState(false);
		_avatarContextMenu->Invalidate(true);

	}
	*/


	// Create tableView
	_tableView = new TableView();
	_tableView->Construct(Rectangle(0,270,GetBounds().width, GetBounds().height-270), \
			true, TABLE_VIEW_SCROLL_BAR_STYLE_FADE_OUT);
	_tableView->SetItemProvider(this);
	_tableView->AddTableViewItemEventListener(*this);
	AddControl(*_tableView);


	_items = new (std::nothrow) ArrayList();

	updateItems();
	Draw();
}