Example #1
0
// create popup
void
Form2::CreatePopup(void) {

    __pPopup = new (std::nothrow) Popup();
	__pPopup->Construct(true, Dimension(600, 450));
	__pPopup->SetTitleText(L"Input to do");

	Rectangle rect;
	rect = __pPopup->GetClientAreaBounds();

	__pEditField = new (std::nothrow) Label();
	__pEditField->Construct(Rectangle(50, 50, 450, 100), L"Continue?");
	__pPopup->AddControl(*__pEditField);

	// create "ok" button
	Button *pButtonOK = new (std::nothrow) Button();
	pButtonOK->Construct(Rectangle(50, 230, 150, 74), L"OK");
	pButtonOK->SetActionId(ID_BUTTON_POPUP_OK);
	pButtonOK->AddActionEventListener(*this);
	__pPopup->AddControl(*pButtonOK);

	// create "cancel" button
	Button *pButtonClose = new (std::nothrow) Button();
	pButtonClose->Construct(Rectangle(350, 230, 150, 74), L"Cancel");
	pButtonClose->SetActionId(ID_BUTTON_POPUP_CANCEL);
	//if(pButtonClose)
	//{
	pButtonClose->AddActionEventListener(*this);
	//}
	__pPopup->AddControl(*pButtonClose);

}
Example #2
0
result UserForm::InitScene() {
	result r = E_SUCCESS;

	Panel * pImagePlaceholder = dynamic_cast<Panel *>(GetControl(IDC_PANEL_USER_AVATAR, true));

	String avatarPath;
	r = JsonParseUtils::GetString(*_pUserJson, L"photo_200", avatarPath);

	if (r != E_SUCCESS) {
		r = JsonParseUtils::GetString(*_pUserJson, L"photo_100", avatarPath);
	}

	int hasMobile;
	JsonParseUtils::GetInteger(*_pUserJson, L"has_mobile", hasMobile);

	WebImageView * pAvatar = new WebImageView();
	pAvatar->Construct(Rectangle(0, 0, 300, 300), avatarPath);
	pImagePlaceholder->AddControl(pAvatar);

	Button * pWriteButton = dynamic_cast<Button *>(GetControl(IDC_BUTTON_USER_WRITETO, true));
	pWriteButton->SetActionId(ACTION_ID_WRITE);
	pWriteButton->AddActionEventListener(*this);

	Button * pCallButton = dynamic_cast<Button *>(GetControl(IDC_BUTTON_USER_CALLTO, true));
	pCallButton->SetShowState(hasMobile == 1);

	pCallButton->AddActionEventListener(*this);

	String name, nextName;
	JsonParseUtils::GetString(*_pUserJson, L"first_name", name);
	name += L" ";
	JsonParseUtils::GetString(*_pUserJson, L"last_name", nextName);
	name += nextName;

	GetHeader()->SetTitleText(name);
	GetFooter()->SetItemEnabled(0, false);
	GetFooter()->AddActionEventListener(*this);
	GetFooter()->SetShowState(false);
	GetFooter()->Invalidate(true);

	if (hasMobile == 1) {
		String phone;
		JsonParseUtils::GetString(*_pUserJson, L"mobile_phone", phone);
		if (phone.GetLength() == 0) {
			pCallButton->SetShowState(false);
		} else {
			pCallButton->SetText(L"Call " + phone);
			pCallButton->SetActionId(ACTION_ID_CALL);
		}
	}

	pCallButton->Invalidate(true);

	CheckIsFriends();

	return r;
}
Example #3
0
result
LoginForm::OnInitializing(void)
{
	result r = E_SUCCESS;

	// TODO: Add your initialization code here

	// Setup back event listener
	SetFormBackEventListener(this);

	// Get a button via resource ID
	Button* pButtonLogin = static_cast< Button* >(GetControl(IDC_LOGIN_BUTTON_SIGN));
	if (pButtonLogin != null)
	{
		pButtonLogin->SetActionId(IDA_BUTTON_LOGIN);
		pButtonLogin->AddActionEventListener(*this);
	}
	Button* pButtonJoin = static_cast< Button* >(GetControl(IDC_LOGIN_BUTTON_JOIN));
	if (pButtonJoin != null)
	{
		pButtonJoin->SetActionId(IDA_BUTTON_JOIN);
		pButtonJoin->AddActionEventListener(*this);
	}

	pTextEmail = static_cast< EditField* >(GetControl(IDC_LOGIN_EDITTEXT_EMAIL));
	pTextPw = static_cast< EditField* >(GetControl(IDC_LOGIN_EDITTEXT_PW));

	// Get Player Info from AppRegistry ----------------------------
	String strEmail;
	String strPw;
	appReg.get(appReg.email, strEmail);
	appReg.get(appReg.pwd, strPw);

	if(strEmail != NULL && strPw != NULL)
	{
		AppLogDebug("AppRegistry Name value1 [%S]", strEmail.GetPointer());

		pTextEmail->SetText(strEmail);
		pTextPw->SetText(strPw);
//		doLogin();
	}
	//------------------------------------------------------

	return r;
}
result
VKUSearchPanel::OnInitializing(void)
{
	result r = E_SUCCESS;
	String syncText;
	Button *syncButton = dynamic_cast<Button *>(GetControl(IDC_BUTTON_SYNC, true));
	syncButton->SetActionId(ACTION_ID_SYNC);
	syncButton->AddActionEventListener(*this);
	VKUApp::GetInstance()->GetAppResource()->GetString(L"IDS_SYNC", syncText);
	syncButton->SetText(syncText);
	return r;
}
result Enrollment::OnInitializing(void) {
	result r = E_SUCCESS;
	CheckButton* pCheckBtn = null;

	SetFormBackEventListener(this);

	__pSaveBtn = static_cast<Button*>(GetControl(IDC_SAVE));
	__pDate = static_cast<Label*>(GetControl(IDC_DATE));

	String cBtnName[] = { IDC_CHECKBUTTON_WORK1, IDC_CHECKBUTTON_WORK2,
			IDC_CHECKBUTTON_WORK3, IDC_CHECKBUTTON_WORK4 };

	for (int i = 0; i < MAX_WORK_COUNT; i++) {
		__pWorkList[i] = static_cast<CheckButton*>(GetControl(cBtnName[i]));
	}

	for (int i = 0; i < MAX_WORK_COUNT; i++) {
		pCheckBtn = dynamic_cast<CheckButton*>(GetControl(cBtnName[i]));
		TryReturn(pCheckBtn != null, E_SYSTEM,
				"Unable to get control [%ls]", cBtnName[i].GetPointer());
		pCheckBtn->SetEnabled(false);
		pCheckBtn->SetActionId(ID_WORK_1 + i, ID_WORK_1 + 500 + i);

		pCheckBtn->AddActionEventListener(*this);

	}

//!!!!!!!!!!!!!!!!!!!!!!!!!!!

	String btnName[] = { IDC_PILL_1, IDC_PILL_2, IDC_PILL_3, IDC_MEET, IDC_SAVE,
			IDC_DEL };

	Button* pButton = null;

	for (int i = 0; i < MAX_BTN_COUNT; i++) {
		pButton = dynamic_cast<Button*>(GetControl(btnName[i]));
		TryReturn(pButton != null, E_SYSTEM,
				"Unable to get control [%ls]", btnName[i].GetPointer());

		pButton->SetActionId(IDC_BUTTON_PILL_1 + i);
		pButton->AddActionEventListener(*this);
	}

	//!!!!!!!!!!!!!!!!!!!!!!!!!!!!

	__pForm = this;
	EnableControl(false);

	return r;
}
Example #6
0
bool Information::ShowPopup(Form * parent)
{
	String titleid = L"IDS_FORM_";
	titleid.Append(__type);
	String title = Utils::GetString(titleid);
	//                IDS_INFORMATION_DICTIONARY
	String textid = L"IDS_INFORMATION_";
	textid.Append(__type);
	String text = Utils::GetString(textid);

	__pParentForm = parent;
	result result = Construct(L"IDP_INFORMATION");

	SetTitleText(title);

	__chkNoShowMore = static_cast<CheckButton *> (GetControl("IDC_NOSHOWMORE"));
	if (__chkNoShowMore)
	{
		bool checked = false;
		SetupCheckbox(checked);
		__chkNoShowMore->SetSelected(checked);
	}

	EditArea *peaText = static_cast<EditArea *> (GetControl("IDC_TEXT"));
	if (peaText)
	{
		peaText->SetText(text);
		peaText->SetEnabled(false);
		peaText->SetCursorPosition(0);
	}

	Button *pbtnCancel = static_cast<Button *> (GetControl("IDC_BTN_CANCEL"));
	if (pbtnCancel)
	{
		pbtnCancel->AddActionEventListener(*this);
		pbtnCancel->SetActionId(ID_BTN_CANCEL);
	}

	SetShowState(true);
	Show();
	return result;
}
result VKSettingsPanel::OnInitializing(void) {
	result r = E_SUCCESS;

	SectionTableView* pSettingsTable = static_cast<SectionTableView *>(GetControl(IDC_SECTIONTABLEVIEW_SETTINGS, true));
	pSettingsTable->SetItemProvider(pProvider);
	pSettingsTable->AddSectionTableViewItemEventListener(*pProvider);
	pAvatarPanel = static_cast<Panel *>(GetControl(IDC_PANEL_SETTINGS_AVATAR, true));
	pLabelName = static_cast<Label *>(GetControl(IDC_LABEL_SETTINGS_NAME, true));

	Button * signout = dynamic_cast<Button *>(GetControl(IDC_BUTTON_SETTINGS_SIGNOUT, true));
	signout->SetActionId(ACTION_ID_SIGNOUT);
	signout->AddActionEventListener(*this);

	String signoutText;
	VKUApp::GetInstance()->GetAppResource()->GetString(L"IDS_SIGN_OUT", signoutText);
	signout->SetText(signoutText);

	VKUApi::GetInstance().CreateRequest("users.get", this)->Put(L"fields", "photo_max")->Submit(REQUEST_GET_MYSELF);

	return r;
}
void
ProjectGiraffeTab4::showLoginButton(void)
{
	RemoveAllControls();

	Label* loginLabel = new Label();
	loginLabel->Construct(Rectangle(0, 0, 600, 80), "To view this tab, please log in first.");
	centerHorizontally(loginLabel, this);
	loginLabel->SetName("loginLabel");
	AddControl(*loginLabel);

	Button* loginButton = new Button();
	loginButton->Construct(Rectangle(0, 100, 300, 80), "Log In");
	centerHorizontally(loginButton, this);
	loginButton->SetName("loginButton");
	loginButton->SetActionId(ID_BUTTON_LOGIN);
	loginButton->AddActionEventListener(*this);
	AddControl(*loginButton);

	Draw();
}
result ForUsDocForm::InitializeActionControls(void) {

	AppLog(
			"*---------ForUsDocForm::InitializeActionControls started--------*\n");

	String btnName[] = { IDC_BTN_PRV_YEAR, IDC_BTN_PRV_MONTH,
			IDC_BTN_NEXT_MONTH, IDC_BTN_NEXT_YEAR };
	Button* pButton = null;

	for (int i = 0; i < ACTION_BUTTON_COUNT; i++) {
		pButton = dynamic_cast<Button*>(GetControl(btnName[i]));
		TryReturn(pButton != null, E_SYSTEM,
				"Unable to get control [%ls]", btnName[i].GetPointer());

		pButton->SetActionId(ID_BUTTON_PREV_YEAR_ID + i);
		pButton->AddActionEventListener(*this);
	}

	String lblStr[] = { IDC_EDIT_FIELD_YEAR, IDC_EDIT_FIELD_MONTH };

	String value[] = { L"", L"" };
	value[0].Append(__pSelectCalendar->GetTimeField(TIME_FIELD_YEAR));
	value[1].Append(__pSelectCalendar->GetTimeField(TIME_FIELD_MONTH));

	result r = E_SUCCESS;
	for (int i = 0; i < ACTION_LABEL_COUNT; i++) {
		__pEditFields[i] = dynamic_cast<EditField*>(GetControl(lblStr[i]));
		TryReturn(__pEditFields[i] != null, E_SYSTEM,
				"Unable to get control [%ls]", lblStr[i].GetPointer());

		r = __pEditFields[i]->SetText(value[i]);
		TryReturn(!IsFailed(r), r,
				"[%s] EditField::SetText() failed for [%ls]", GetErrorMessage(r), lblStr[i].GetPointer());

		__pEditFields[i]->AddTextEventListener(*this);
	}

	return E_SUCCESS;

}
Example #10
0
result
SelectCalendarPopup::Construct(const Form* pParentForm, RecordId calendarId)
{
	result r = E_SUCCESS;

	r = Popup::Construct(true, Dimension(650, 800));
	TryReturn(!IsFailed(r), r, "[%s] Failed to construct popup.", GetErrorMessage(r));

	SetTitleText(L"달력 선택");
	__pParentForm = const_cast< Form* >(pParentForm);
	if (__pParentForm == null)
	{
		return E_FAILURE;
	}

	__selectedCalendarId = calendarId;

	__pListView = new (std::nothrow) ListView();
	__pListView->Construct(Rectangle(20, 0, GetClientAreaBounds().width - 40, GetClientAreaBounds().height - 89));
	__pListView->SetItemProvider(*this);
	__pListView->AddListViewItemEventListener(*this);

	AddControl(__pListView);

	Button* pButtonCancel = new (std::nothrow) Button();
	pButtonCancel->Construct(Rectangle((GetClientAreaBounds().width - 180) / 2, GetClientAreaBounds().height - 89, 180, 74), L"Cancel");
	pButtonCancel->SetActionId(ID_BUTTON_CANCEL_POPUP);
	pButtonCancel->AddActionEventListener(*this);
	AddControl(pButtonCancel);

	r = GetCalendarlist();
	TryReturn(!IsFailed(r), r, "[%s] Failed to get the calendar list.", GetErrorMessage(r));

	SetPropagatedKeyEventListener(this);

	return r;
}
Example #11
0
result
OverlayKeypadForm::OnInitializing(void)
{
	BaseForm::OnInitializing();
	result r = E_SUCCESS;
	SetOrientation(ORIENTATION_AUTOMATIC);
    AddOrientationEventListener(*this);
    Tizen::Ui::OrientationStatus orientationStatus = GetOrientationStatus();
	if(orientationStatus == ORIENTATION_STATUS_LANDSCAPE|| orientationStatus == ORIENTATION_STATUS_LANDSCAPE_REVERSE)
	{
		SetActionBarsVisible(FORM_ACTION_BAR_HEADER,false);
	}

	__pScrollPanel = static_cast<ScrollPanel*>(GetControl(L"IDC_SCROLLPANEL", false));
	__pEditField = static_cast<EditField*>(GetControl(L"IDC_EDITFIELD", true));
	__pEditArea = static_cast<EditArea*>(GetControl(L"IDC_EDITAREA", true));

	__pEditField->AddTextEventListener(*this);
	__pEditField->SetOverlayKeypadCommandButtonVisible(false);
	__pEditField->AddKeypadEventListener(*this);
	
	__pEditArea->AddTextEventListener(*this);
	__pEditArea->SetOverlayKeypadCommandButtonVisible(false);
	__pEditArea->AddKeypadEventListener(*this);

	Button* pButtonClear = static_cast<Button*>(GetControl(L"IDC_BUTTON_EDITAREA_CLEAR", true));
	pButtonClear->SetActionId(ID_BUTTON_EDITAREA_CLEAR);
	pButtonClear->AddActionEventListener(*this);

	__pEditFieldText = new (std::nothrow) String();
	__pEditAreaText = new (std::nothrow) String();
	__pEditAreaPreText = new (std::nothrow) String();
	__pEditFieldPreText = new (std::nothrow) String();

	return r;
}
result
CaseValueChoicePopup::Construct(bool hasTitle, Osp::Graphics::Dimension dim)
{
	result r = E_SUCCESS;

	// Construct Popup
	r = Popup::Construct( hasTitle, dim);


	int POPUP_WIDTH = GetWidth();
	int POPUP_HEIGHT = GetHeight();

	int BUTTON_WIDTH  = POPUP_WIDTH/(_size + 1);
	int BUTTON_HEIGHT = POPUP_HEIGHT/ (_size + 2);



	for(int i=0; i<_valueMax; i++)
	{
		int value = i+1;

		int x = 0.5 * BUTTON_WIDTH + /*GetX() + */(i%_size) * BUTTON_WIDTH;

		int y = 0.5 * BUTTON_HEIGHT/*+  GetY()*/ + (i/_size) * BUTTON_HEIGHT;

		Button *choiceButton = new Button();
		choiceButton->Construct(__R(x, y, BUTTON_WIDTH, BUTTON_HEIGHT));
		Osp::Base::String label= "";
		label.Insert( value , 0);
		choiceButton->SetText(label);
		choiceButton->SetActionId(ID_FIRST_BUTTON + i);
		choiceButton->AddActionEventListener(*this);

		Case* currentCase = Game::getInstance()->getCase(_caseId);


		bool isEnable = currentCase->canAdd(value);

		choiceButton->SetEnabled(isEnable);


		AddControl(*choiceButton);
		_buttons.push_back(choiceButton);

		//AppLog("Popup: creation button %d, x = %d, y = %d", i, x, y);
	}


	//Creation of Button "OK"

	int butonWidth = POPUP_WIDTH / 3;

	int x = 0.5 * butonWidth;
	int y = 0.5 * BUTTON_HEIGHT + /* GetY()+  */_size * BUTTON_HEIGHT;




	Button *okButton = new Button();
	okButton->Construct(__R(x, y, butonWidth, BUTTON_HEIGHT));
	okButton->SetText(Osp::Base::String("OK"));
	okButton->SetActionId(ID_OK_BUTTON);
	okButton->AddActionEventListener(*this);
	AddControl(*okButton);
	_buttons.push_back(okButton);


	//Creation of Button "CLEAR"
	x = 0.5 * butonWidth + butonWidth;

	Button *clearButton = new Button();
	clearButton->Construct(__R(x, y, butonWidth, BUTTON_HEIGHT));
	clearButton->SetText(Osp::Base::String("CLEAR"));
	clearButton->SetActionId(ID_CLEAR_BUTTON);
	clearButton->AddActionEventListener(*this);
	AddControl(*clearButton);
	_buttons.push_back(clearButton);



	return r;
}
Example #13
0
void
UserProfileForm::OnTransactionReadyToRead(HttpSession& httpSession, HttpTransaction& httpTransaction, int availableBodyLen)
{

	AppLogDebug("OnTransactionReadyToRead,..availableBodyLen=%d",availableBodyLen);
	count++;

	HttpResponse* pHttpResponse = httpTransaction.GetResponse();

	if(pHttpResponse->GetHttpStatusCode() == HTTP_STATUS_OK)
	{
		__pBuffer = pHttpResponse->ReadBodyN();
	}
	if(__pProfileName==NULL)
	{
		ParseJsonData();
		Label *pLabel = new Label();
		String labelText(L"Welcome ");
		labelText.Append(*__pProfileName);
		AppLog("labelText is =%ls",labelText.GetPointer());
		pLabel->Construct(Rectangle(05, 50, 500, 100), labelText);
		AddControl(*pLabel);
		Draw();
		Show();

		__pSession->CloseTransaction(httpTransaction);
		delete __pSession;
		__pSession = null;
	}

	//Get Profile Picture

	String imageurl;
	imageurl.Append(L"https://graph.facebook.com/me");
	imageurl.Append(L"/picture?");
	imageurl.Append(L"access_token=");
	imageurl.Append(__accessToken);
	SendRequestGet(imageurl);

	__pProfileImage = new Image();
	__pProfileImage->Construct();

	Bitmap *pBitmap;
	pBitmap=__pProfileImage->DecodeN(*__pBuffer,IMG_FORMAT_JPG,BITMAP_PIXEL_FORMAT_ARGB8888,150,150);
	Label *pImageLabel = new Label();
	pImageLabel->Construct(Rectangle(150,150, 150, 150),"");
	pImageLabel->SetBackgroundBitmap(*pBitmap);
	AddControl(*pImageLabel);

	Button* pGetFriends = new Button();
	pGetFriends->Construct(Rectangle(30,330, 350, 70), L"Get Friends");
	pGetFriends->SetActionId(ID_BUTTON_FRIENDS_CLICKED);
	pGetFriends->AddActionEventListener(*this);
	AddControl(*pGetFriends);

	Button* pLogout = new Button();
	pLogout->Construct(Rectangle(30,430, 350, 70), L"Logout");
	pLogout->SetActionId(ID_BUTTON_LOGOUT_CLICKED);
	pLogout->AddActionEventListener(*this);
	AddControl(*pLogout);
	Draw();
	Show();

}
result
GameForm::OnInitializing(void)
{
	result r = E_SUCCESS;

	// Create an OptionKey
	//SetOptionkeyActionId(ID_OPTIONKEY);
	//AddOptionkeyActionListener(*this);

	Game* game = Game::getInstance();
	game->setProperties(_size, _casesCount, _rowSize, _valueMax);
	game->build();
	game->setGameForm(this);

	// Create a Button

	int APPLICATION_WIDTH = Application::GetInstance()->GetAppFrame()->GetFrame()->GetWidth();
	int APPLICATION_HEIGHT = Application::GetInstance()->GetAppFrame()->GetFrame()->GetHeight();

	int BUTTON_WIDTH = APPLICATION_WIDTH/ (_rowSize + 1);
	int BUTTON_HEIGHT = BUTTON_WIDTH * 1.2;//APPLICATION_HEIGHT/12;

	for(int i = 0; i < _casesCount; i++)
	{
		Button *pButton = new Button();

		int row =  i/ _rowSize;
		int column = i% _columnSize;

		int x = column * BUTTON_WIDTH;
		int y = BUTTON_HEIGHT / 2 + row * BUTTON_HEIGHT;

		//Add spaces betwin group of cases
		y += (row / _size) * BUTTON_HEIGHT / 2;

		//Add spaces betwin group of cases
		x += (column / _size) * BUTTON_WIDTH / 2;

		pButton->Construct(__R(x, y, BUTTON_WIDTH, BUTTON_HEIGHT));
		AddControl(*pButton);
		Osp::Base::String label= "";
		pButton->SetText(label);
		//pButton->SetText(L);
		pButton->SetActionId(ID_FIST_CASE + i);
		pButton->AddActionEventListener(*this);

		_buttons.push_back(pButton);
	}

	int controlButtonsWidth = APPLICATION_WIDTH * 0.8;
	int remainingHeight = APPLICATION_HEIGHT - ( BUTTON_HEIGHT * (_columnSize + 1));

	int resultButtonHeight = remainingHeight / 5;
	int controlButtonsY      = APPLICATION_HEIGHT - remainingHeight/2 - resultButtonHeight/2;//- (1.75 * resultButtonHeight);

	Button *resultButton = new Button();
	resultButton->Construct(__R(controlButtonsWidth * 0.1, controlButtonsY, controlButtonsWidth/2, resultButtonHeight));
	AddControl(*resultButton);
	resultButton->SetText(L"Solve Me!");
	resultButton->SetActionId(ID_RESULT_BUTTON);
	resultButton->AddActionEventListener(*this);

	Button *resetButton = new Button();
	resetButton->Construct(__R(controlButtonsWidth * 0.1 + controlButtonsWidth/2, controlButtonsY, controlButtonsWidth/2, resultButtonHeight));
	AddControl(*resetButton);
	resetButton->SetText(L"Reset");
	resetButton->SetActionId(ID_RESET_BUTTON);
	resetButton->AddActionEventListener(*this);

	return r;
}
Example #15
0
void
EditPanel::OnActionPerformed(const Tizen::Ui::Control& source, int actionId)
{
	SceneManager* pSceneManager = SceneManager::GetInstance();
	AppAssert(pSceneManager);

	switch(actionId)
	{
	case 1:
	{
		String	  *tmp_string;
		Boolean	  *tmp_highlight;
		int i;

		if(onHighlightStart == true)
		{
			for(i=0; i<arr_text_element_highlight.GetCount(); i++)
			{
				tmp_highlight = static_cast <Boolean *> (arr_text_element_highlight.GetAt(i));
				tmp_string = static_cast< String *> (arr_text_element.GetAt(i));
				if(tmp_highlight->ToBool() == true)
				{
					popup_edit_string.Append(*tmp_string);
					arr_text_element_highlight.SetAt(new Boolean(false), i);
					end_index = i;
				}


			}

			select_index_edit.x = start_index;
			select_index_edit.y = end_index;
		}

		else
		{
			for(i=select_index_edit.x; i<=select_index_edit.y - select_index_edit.y; i++)
			{
				tmp_string = static_cast< String *> (arr_text_element.GetAt(i));

				popup_edit_string.Append(*tmp_string);

			}
		}

		onHighlightStart = false;


		real_position_end = 0;
	    popup = new Popup;

	        popup->Construct(false, Dimension(600,800));

	        popup->SetPosition(60,30);

	        popup->SetColor(Color(246,246,246,255));



	        Label *label_ori, *label_edit, *label_explain;



	        label_ori = new Label;

	        label_ori->Construct(Rectangle(30,20,100,40), L"원문");

	        popup_ori_area = new EditArea();

	        popup_ori_area->Construct(Rectangle(50, 60, 500, 150),INPUT_STYLE_OVERLAY);

	        popup_ori_area->SetKeypadEnabled(false);

	        popup_ori_area->SetColor(EDIT_STATUS_NORMAL, Color(216,216,216,255));
	        popup_ori_area->SetColor(EDIT_STATUS_PRESSED, Color(216,216,216,255));
	        popup_ori_area->SetColor(EDIT_STATUS_HIGHLIGHTED, Color(216,216,216,255));

	        popup_ori_area->SetText(popup_edit_string);

	        popup->AddControl(popup_ori_area);

	        popup->AddControl(label_ori);



	        label_edit = new Label;

	        label_edit->Construct(Rectangle(30,220,280,40), L"글을 수정해주세요");

	        popup_edit_area = new EditArea();

	        popup_edit_area->Construct(Rectangle(50, 270, 500, 150),INPUT_STYLE_OVERLAY);
	        popup_edit_area->SetFocus();

	        popup_edit_area->SetText(popup_edit_string);
	        popup_edit_area->SetColor(EDIT_STATUS_NORMAL, Color(255,255,255,255));
	        popup_edit_area->SetColor(EDIT_STATUS_PRESSED , Color(255,255,255,255));
	        popup_edit_area->SetColor(EDIT_STATUS_HIGHLIGHTED, Color(255,255,255,255));
	        popup_edit_area->AddKeyEventListener(*this);

	        popup->AddControl(popup_edit_area);

	        popup->AddControl(label_edit);



	        label_explain = new Label;

	        label_explain->Construct(Rectangle(30,430,200,40), L"피드백 설명");

	        popup_explain = new EditArea();

	        popup_explain->Construct(Rectangle(50, 480, 500, 150),INPUT_STYLE_OVERLAY);
	        popup_explain->SetColor(EDIT_STATUS_HIGHLIGHTED, Color(255,255,255,255));
	        popup_explain->SetColor(EDIT_STATUS_PRESSED, Color(255,255,255,255));
	        popup_explain->SetColor(EDIT_STATUS_NORMAL, Color(255,255,255,255));



	        popup->AddControl(popup_explain);

	        popup->AddControl(label_explain);



	        Button* pCloseButton = new Button();

	        pCloseButton->Construct(Rectangle(20, 630, 250, 80), L"Close Popup");

	        pCloseButton->SetActionId(2);

	        pCloseButton->AddActionEventListener(*this);



	        // Adds the button to the popup

	        popup->AddControl(pCloseButton);



	        Button* CompletionButton = new Button();

	        CompletionButton->Construct(Rectangle(20, 630, 250, 80), L"Completion");

	        CompletionButton->SetActionId(3);

	        CompletionButton->AddActionEventListener(*this);

        // Adds the button to the popup
       // popup->AddControl(CompletionButton);





        // 원문의 단어와 첨삭본의 단어의 개수를 구한다.
		arr_ori_word.RemoveAll();
		arr_edit_word.RemoveAll();

        EditWord *tmp_word;
        int tmp_length = 0;
        for(i=start_index; i<=end_index; i++)
        {
			tmp_string = static_cast< String *> (arr_text_element.GetAt(i));
			tmp_word = new EditWord;
			tmp_word->word = *tmp_string;
			tmp_word->start_index = tmp_length;
			AppLog("tmp_word->start_index : %d", tmp_word->start_index);
			tmp_length += tmp_word->word.GetLength();
			tmp_word->end_index = tmp_length;
			arr_ori_word.Add(*tmp_word);
			//arr_text_element_editing_mark.Add(new Integer(NONE));
        }

        edit_area_length = popup_edit_string.GetLength();


        draw_timer.Cancel();
        ShowPopup();


        break;
	}
	case 2:
	{
		int i;
		Integer *tmp_int;
		String *tmp_str;
		Integer *tmp_check;
		Point	*tmp_point;



		Attached_decision();
		SyncText();
		TextCorrecting();


		if(popup_explain->GetTextLength() > 0){
			AppLog("cont %S", popup_explain->GetText().GetPointer());

			arr_memo.SetAt(new String(popup_explain->GetText()), start_index);
		}

		for(i=start_index; i<=end_index; i++)
		{
			//AppLog("cont %d", tmp_string2->GetLength());
			arr_binding_start_and_end.SetAt(new Point(start_index, end_index), i);
		}

		/*EditWord tmp_word;
		for(i = 0; i < arr_ori_word.GetCount(); i++)
		{
			tmp_int = arr_text_element_editing_mark.GetAt(i);
			if(tmp_int == 3)
				AppLog("attach : %S, index : %d", tmp_word.word.GetPointer(), tmp_word.start_index);
		}
		for(i = 0; i < arr_edit_word.GetCount(); i++)
		{
			tmp_int = arr_text_element_editing_mark.GetAt(i);
			if(tmp_int == 3)
				AppLog("attach : %S, index : %d", tmp_word.word.GetPointer(), tmp_word.start_index);
		}*/

		for(i = 0; i < arr_text_element.GetCount(); i++)
		{
			tmp_int = static_cast< Integer *> (arr_text_element_editing_mark.GetAt(i));
			tmp_str = static_cast< String *> (arr_text_element.GetAt(i));
			tmp_check = static_cast< Integer *> (arr_insert_check.GetAt(i));
			tmp_point = static_cast< Point *> (arr_binding_start_and_end.GetAt(i));

			if(tmp_int->value == 3)
				AppLog("attach : %S", tmp_str->GetPointer());
			else if(tmp_int->value == 2)
				AppLog("modify : %S", tmp_str->GetPointer());
			else if(tmp_int->value == 1)
				AppLog("delete : %S", tmp_str->GetPointer());
			/*else if(tmp_bool->GetTrue() == true)
			{
				tmp_str = static_cast< String *> (arr_text_insert.GetAt(i));
				AppLog("insert : %S", tmp_str->GetPointer());
			}*/
		}




		HidePopup();
		popup_edit_string.Clear();
		popup->Destroy();
		break;
	}
	case 10:
	{
	    popup = new Popup;

	    popup->Construct(false, Dimension(600,400));

	    popup->SetPosition(60,500);

	    Button *button = new Button;
	    button->Construct(Rectangle(20,200,260, 150), L"삭제합니다");
	    button->SetActionId(11);
	    button->AddActionEventListener(*this);

	    Button *button2 = new Button;
	    button2->Construct(Rectangle(300,200,260, 150), L"아니오");
	    button2->SetActionId(12);
	    button2->AddActionEventListener(*this);

	    popup->AddControl(button);
	    popup->AddControl(button2);
        ShowPopup();

	}
	break;
	case 11:
	{

		for(int i=select_index_edit.x; i<=select_index_edit.y; i++)
		{

			arr_insert_check.SetAt(new Integer(0), i);
			arr_text_insert.SetAt(new String(" "), i);
			arr_text_element_highlight.SetAt(new Boolean(false), i);
			arr_text_element_editing_mark.SetAt(new Integer(0), i);
			arr_binding_start_and_end.SetAt(new Point(1000,1000), i);
			arr_memo.SetAt(new String("0"), i);
		}
		HidePopup();
		popup->Destroy();
	}
	break;
	case 12:
	{
		HidePopup();
		popup->Destroy();
	}
	break;

	case 90:
	{
		Button *button = new Button;
	    popup = new Popup;
	    AppLog("goood!!!");
	    popup->Construct(true, Dimension(600,800));
	    draw_timer.Cancel();
	    popup->SetPosition(60,60);

	    popup->SetTitleText(L"Ellen Page님의 글");

	    button->Construct(Rectangle(550,200,50,50),"닫");
	    button->SetActionId(91);
	    button->AddActionEventListener(*this);

	    EditArea *eng = new EditArea;

	    eng->Construct(Rectangle(0, 0, 550, 800),INPUT_STYLE_OVERLAY);
	    eng->SetKeypadEnabled(false);
	    eng->SetText(Eng);
	    eng->SetColor(EDIT_STATUS_HIGHLIGHTED, Color(255,255,255,255));
	    eng->SetColor(EDIT_STATUS_PRESSED, Color(255,255,255,255));
	    eng->SetColor(EDIT_STATUS_NORMAL, Color(255,255,255,255));

	    popup->SetColor(Color(255,255,255,255));

	    popup->AddControl(button);
	    popup->AddControl(eng);

	    ShowPopup();
	    break;

	}
	case 91:
	{
		HidePopup();
		popup->Destroy();
		break;
	}
	}
}
Example #16
0
bool
GCubeApp::OnAppInitialized(void)
{
	// フレーム作成
	Frame *pFrame = new Frame();
	pFrame->Construct();
	pFrame->SetName(L"GCube");

	// フォーム作成
	Form *pForm = new Form();
	if (settings->showStatusBar) {
		pForm->Construct(FORM_STYLE_INDICATOR);
	} else {
		pForm->Construct(FORM_STYLE_NORMAL);
	}
	pForm->AddTouchEventListener(*this);
	pForm->AddOrientationEventListener(*this);

	pFrame->AddControl(pForm);
	pFrame->SetCurrentForm(pForm);

	// 画面の向き
	enum Orientation orientation = ORIENTATION_NONE;
	if (settings->orientationPortrait) {
		if (settings->orientationLandscapeLeft || settings->orientationLandscapeRight) {
			orientation = ORIENTATION_AUTOMATIC;
		} else {
			orientation = ORIENTATION_PORTRAIT;
		}
	} else {
		if (settings->orientationPortraitUpsideDown) {
			if (settings->orientationLandscapeLeft || settings->orientationLandscapeRight) {
				orientation = ORIENTATION_AUTOMATIC_FOUR_DIRECTION;
			} else {
				orientation = ORIENTATION_PORTRAIT_REVERSE;
			}
		} else {
			if (settings->orientationLandscapeLeft) {
				orientation = ORIENTATION_LANDSCAPE_REVERSE;
			} else {
				if (settings->orientationLandscapeRight) {
					orientation = ORIENTATION_LANDSCAPE;
				}
			}
		}
	}

	pFrame->SetOrientation(orientation);
	pForm->SetOrientation(orientation);
	pFrame->SetMultipointTouchEnabled(true);
	AddFrame(*pFrame);

	{
		__player = new Tizen::Graphics::Opengl::GlPlayer;
		__player->Construct(Tizen::Graphics::Opengl::EGL_CONTEXT_CLIENT_VERSION_2_X, pForm);
		__player->SetFps(settings->frameRate);
		__player->SetEglAttributePreset(Tizen::Graphics::Opengl::EGL_ATTRIBUTES_PRESET_ARGB8888);
		EGLint eglConfigList[] =
		{
		  EGL_RED_SIZE, 8,
		  EGL_GREEN_SIZE, 8,
		  EGL_BLUE_SIZE, 8,
		  EGL_ALPHA_SIZE, 8,
		  EGL_DEPTH_SIZE, 16,
		  EGL_SURFACE_TYPE, EGL_WINDOW_BIT,
		  EGL_RENDERABLE_TYPE, EGL_OPENGL_ES2_BIT,
		  EGL_NONE
		};
		__player->SetEglAttributeList(eglConfigList);
		__player->Start();
	}

	__renderer = new GlRendererTemplate();
	__player->SetIGlRenderer(__renderer);

	int w = __renderer->GetTargetControlWidth();
	int h = __renderer->GetTargetControlHeight();

	if (settings->debugButtonPos > 0) {
		// デバッグボタン作成
		// TODO: XMLで作成
		int dy = 0;
		if (settings->showStatusBar) {
			dy = 60;
		}
		Button* pDebugButton = new Button();
		if (settings->debugButtonPos == 1) {
			pDebugButton->Construct(Rectangle(w-80, h-80-dy, 70, 70), L"D");
		} else if (settings->debugButtonPos == 2) {
			pDebugButton->Construct(Rectangle(10, h-80-dy, 70, 70), L"D");
		} else if (settings->debugButtonPos == 3) {
			pDebugButton->Construct(Rectangle(w-80, 10, 70, 70), L"D");
		} else {
			pDebugButton->Construct(Rectangle(10, 10, 70, 70), L"D");
		}
		pDebugButton->SetActionId(ID_DEBUG_BUTTON);
		pDebugButton->AddActionEventListener(*this);
		pForm->AddControl(pDebugButton);

		// ポップアップ作成
		__pPopup = new Popup();
		__pPopup->Construct(true, Dimension(600, 800));
		__pPopup->SetTitleText(L"DebugConsole");

		// ポップアップを閉じるボタン作成
		Button* pCloseButton = new Button();
		pCloseButton->Construct(Rectangle(30, 600, 250, 80), L"Cancel");
		pCloseButton->SetActionId(ID_BUTTON_CLOSE_POPUP);
		pCloseButton->AddActionEventListener(*this);
		__pPopup->AddControl(pCloseButton);

		// OKボタン作成
		Button* pOKButton = new Button();
		pOKButton->Construct(Rectangle(320, 600, 250, 80), L"OK");
		pOKButton->SetActionId(ID_BUTTON_OK_POPUP);
		pOKButton->AddActionEventListener(*this);
		__pPopup->AddControl(pOKButton);

		// テキスト入力
		__pEditField = new EditField();
		__pEditField->Construct(Rectangle(30, 500, 540, 80));
		__pPopup->AddControl(__pEditField);

		// 説明テキスト
		std::vector<char> textBuff;
		GCGetResourceData("etc/debug.txt", textBuff);
		textBuff.push_back('\n');
		String text = String(&textBuff[0]);
		TextBox *pTextBox = new TextBox();
		pTextBox->Construct(Rectangle(30, 50, 540, 430));
		pTextBox->SetTextSize(18);
		pTextBox->SetText(text);
		__pPopup->AddControl(pTextBox);
	}

	// サイズを通知
	DeviceOrientation o = this->ConvertOrientState(pFrame->GetOrientationStatus());
	gcube->onSizeChanged(w, h, o);

	if (settings->useOrientationSensor) {
		__sensorManager.Construct();
		this->CreateSensor();
	}

	return true;
}
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();
}
Example #18
0
result
DateTimeForm::OnInitializing(void)
{
	BaseForm::OnInitializing();
	result r = E_SUCCESS;

	__pEditDateDisable = static_cast<EditDate*>(GetControl("IDC_EDITDATE_DISABLE", true));
	__pEditDateDisable->SetCurrentDate();
	__pEditDateDisable->SetEnabled(false);
	__pEditDateDisable->AddDateChangeEventListener(*this);

	__pEditDate = static_cast<EditDate*>(GetControl("IDC_EDITDATE", true));
	__pEditDate->SetCurrentDate();
	__pEditDate->AddDateChangeEventListener(*this);

	__pEditDateNotitle = static_cast<EditDate*>(GetControl("IDC_EDITDATE_NO_TITLE", true));
	__pEditDateNotitle->SetCurrentDate();
	__pEditDateNotitle->AddDateChangeEventListener(*this);

	__pEditTimeDisable = static_cast<EditTime*>(GetControl("IDC_EDITTIME_DISABLE", true));
	__pEditTimeDisable->SetCurrentTime();
	__pEditTimeDisable->SetEnabled(false);
	__pEditTimeDisable->AddTimeChangeEventListener(*this);

	__pEditTime = static_cast<EditTime*>(GetControl("IDC_EDITTIME", true));
	__pEditTime->SetCurrentTime();
	__pEditTime->AddTimeChangeEventListener(*this);

	__pEditTimeNotitle = static_cast<EditTime*>(GetControl("IDC_EDITTIME_NO_TITLE", true));
	__pEditTimeNotitle->SetCurrentTime();
	__pEditTimeNotitle->AddTimeChangeEventListener(*this);

	__pDateTimePicker = new (std::nothrow) DateTimePicker();
	__pDateTimePicker->Construct();
	__pDateTimePicker->AddDateTimeChangeEventListener(*this);

	__pDatePicker = new (std::nothrow) DatePicker();
	__pDatePicker->Construct();
	__pDatePicker->AddDateChangeEventListener(*this);

	__pTimePicker = new (std::nothrow) TimePicker();
	__pTimePicker->Construct();
	__pTimePicker->AddTimeChangeEventListener(*this);

	Button* pButtonDatePicker = static_cast<Button*>(GetControl("IDC_BUTTON_DATEPICKER", true));
	if(pButtonDatePicker)
	{
		pButtonDatePicker->SetActionId(ID_BUTTON_DATE_ON);
		pButtonDatePicker->AddActionEventListener(*this);
	}
	Button* pButtonTimePicker = static_cast<Button*>(GetControl("IDC_BUTTON_TIMEPICKER", true));
	if(pButtonTimePicker)
	{
		pButtonTimePicker->SetActionId(ID_BUTTON_TIME_ON);
		pButtonTimePicker->AddActionEventListener(*this);
	}
	Button* pButtonDateTimePicker = static_cast<Button*>(GetControl("IDC_BUTTON_DATETIMEPICKER", true));
	if(pButtonDateTimePicker)
	{
		pButtonDateTimePicker->SetActionId(ID_BUTTON_DATETIME_ON);
		pButtonDateTimePicker->AddActionEventListener(*this);
	}
	return r;
}