// Implements an ITextEventListener
void StringOptionView::OnTextValueChanged(const Control& source)
{
    // Todo:
	AppLog("OnTextValueChanged");
	CustomListItem* pItem = new OptionListItem(this);
    pItem->Construct(100);
    pItem->SetItemFormat(*myTab->form()->__pStringViewListItemFormat);
    pItem->SetElement(ID_LIST_TEXT_TITLE,String((ZLOptionView::name()).c_str()));
	pItem->SetElement(ID_LIST_TEXT_SUBTITLE, __pKeypad->GetText());


	myTab->form()->__pCustomList->SetItemAt(groupIndex,itemIndex, *pItem, ID_LIST_ITEM);

	 ByteBuffer* bb = Tizen::Base::Utility::StringUtil:: StringToUtf8N(__pKeypad->GetText());
	 myValue = std::string((char *)bb->GetPointer());
	 AppLog( "pKeypad->GetText %s",myValue.c_str());


}
result FPlaylistForm::AddListItem(int itemid, String itemTextArtist, String itemTextTitle, Bitmap* pBitmapNormal) {
    CustomListItem* pItem = new CustomListItem();
    CustomListElement * custom_element = new CustomListElement();
    CustomListElement * custom_element2 = new CustomListElement();
    custom_element->text = itemTextArtist;
    custom_element2->text = itemTextTitle;

    pItem->Construct(80);
    pItem->SetItemFormat(*__pCustomListItemFormat);
    if (pBitmapNormal != null) {
    	pItem->SetElement(ID_LIST_TEXTARTIST, *(static_cast<ICustomListElement *>(custom_element)));
    	pItem->SetElement(ID_LIST_TEXTTITLE, *(static_cast<ICustomListElement *>(custom_element2)));
    	pItem->SetElement(ID_LIST_ICON, *pBitmapNormal, pBitmapNormal);
    } else {
    	pItem->SetElement(ID_LIST_TEXTARTIST, *(static_cast<ICustomListElement *>(custom_element)));
    	pItem->SetElement(ID_LIST_TEXTTITLE, *(static_cast<ICustomListElement *>(custom_element2)));
    }

    UList_->AddItem(*pItem, itemid);

    return E_SUCCESS;
}
Beispiel #3
0
void
FTrip::AddListItemSearch(Osp::Base::String col1, Osp::Base::String col2, Osp::Base::String col3, Osp::Base::String col4, int itemId, int searchposcol1, int searchposcol2)
{

 CustomListItem * newItem = new CustomListItem();
 CustomListElementTrip * custom_element = new CustomListElementTrip();

 newItem->Construct(150);
 newItem->SetItemFormat(*pCustomListItemSearchFormat);

 custom_element->col1 = col1;
 custom_element->col2 = col2;
 custom_element->col3 = col3;
 custom_element->col4 = col4;
 if (custom_element->col4.GetLength() > 0)
 custom_element->col4.Replace("\n"," ");
 if (searchposcol1 > -1) {
 if (searchposcol1 > 10) {
 custom_element->col1.SubString(searchposcol1-3,custom_element->col1);
 custom_element->col1.Insert("...",0);
 searchposcol1 = 6;
 }
 custom_element->col1.SubString(0,searchposcol1,custom_element->col1b);
 custom_element->col1.SubString(searchposcol1,this->searchq.GetLength(),custom_element->col1s);
 if (searchposcol1+searchq.GetLength() < custom_element->col1.GetLength())
 custom_element->col1.SubString(searchposcol1+searchq.GetLength(), custom_element->col1a);
 }
 if (searchposcol2 > -1) {
 if (searchposcol2 > 10) {
 custom_element->col4.SubString(searchposcol2-3,custom_element->col4);
 custom_element->col4.Insert("...",0);
 searchposcol2 = 6;
 }
 custom_element->col4.SubString(0,searchposcol2,custom_element->col4b);
 custom_element->col4.SubString(searchposcol2,this->searchq.GetLength(),custom_element->col4s);
 if (searchposcol2+searchq.GetLength() < custom_element->col4.GetLength())
 custom_element->col4.SubString(searchposcol2+searchq.GetLength(), custom_element->col4a);
 }
 Osp::Base::String lowercasedsearchq;
 this->searchq.ToLower(lowercasedsearchq);
 custom_element->searchq = lowercasedsearchq;
 newItem->SetElement(LEL_BG, *(static_cast<ICustomListElement *>(custom_element)));

 pExList->AddItem(*newItem, itemId);

}
Beispiel #4
0
void
FTrip::AddListItem(Osp::Base::String col1, Osp::Base::String col2, Osp::Base::String col3, int itemId)
{

 CustomListItem * newItem = new CustomListItem();
 CustomListElementTrip * custom_element = new CustomListElementTrip();

 newItem->Construct(100);
 newItem->SetItemFormat(*pCustomListItemFormat);
 custom_element->col1 = col1;
 custom_element->col2 = col2;
 custom_element->col3 = col3;
 newItem->SetElement(LEL_BG, *(static_cast<ICustomListElement *>(custom_element)));

 pExList->AddItem(*newItem, itemId);

}
Beispiel #5
0
result
InfoForm::OnInitializing(void)
{
	Rectangle rect = this->GetClientAreaBounds();

	result r = E_SUCCESS;
	TabsForm::OnInitializing();

	AppResource *pAppResource = Application::GetInstance()->GetAppResource();
	Bitmap* _bitmap;

	CategoryList = new CustomList();
	CategoryList->Construct(Rectangle(0, 0, this->GetWidth(), rect.height), CUSTOM_LIST_STYLE_NORMAL);
	CategoryList->SetBackgroundColor(Color(239,239,239));
	CategoryList->AddCustomItemEventListener(*this);

	// Category element format
	pCustomListItemFormat = new CustomListItemFormat();
	pCustomListItemFormat->Construct();
	pCustomListItemFormat->AddElement(LIST_ELEMENT_IMG, Rectangle(Retina::GetInt(5), Retina::GetInt(5), Retina::GetInt(65), Retina::GetInt(65)));
	pCustomListItemFormat->AddElement(LIST_ELEMENT_DESC, Rectangle(Retina::GetInt(75), Retina::GetInt(5), Retina::GetInt(180), Retina::GetInt(120)),
		Retina::GetInt(12), Color(151,151,151), Osp::Ui::Controls::SYSTEM_COLOR_LIST_ITEM_PRESSED_TEXT);

	CreateArray();

	int i=0;
	// Adds an item to the CustomList
	while(__pProducts[i][0]->GetLength() == 12)
	{
		CustomListItem * newItem = new CustomListItem();

		newItem->Construct(Retina::GetInt(75));
		newItem->SetItemFormat(*pCustomListItemFormat);
		int k=0;
		Integer::Parse(*__pProducts[i][1], k);

		switch (k)
		{
			case 451549:
			case 451431:
				newItem->SetElement(LIST_ELEMENT_DESC, Helper::GetTraslation("IDS_SPACESHUFFLE"));
				_bitmap = pAppResource->GetBitmapN(L"Ikonka_512.png");
				break;
			case 53471:
				newItem->SetElement(LIST_ELEMENT_DESC, Helper::GetTraslation("IDS_UCONVERTOR"));
				_bitmap = pAppResource->GetBitmapN(L"uc_icon2.png");
				break;
			case 287131:
			case 287177:
			case 232222:
			case 279563:
				newItem->SetElement(LIST_ELEMENT_DESC, Helper::GetTraslation("IDS_sCalc"));
				_bitmap = pAppResource->GetBitmapN(L"scalc_icon.png");
				break;
		}
		newItem->SetElement(LIST_ELEMENT_IMG, *_bitmap, _bitmap);
		CategoryList->AddItem(*newItem, i);
		i++;
	}

	this->AddControl(*CategoryList);

	return r;
}
Beispiel #6
0
void
MainForm::OnParsingCompleted(ArrayList &feedData) {
	AppResource *pAppResource = Application::GetInstance()->GetAppResource();
	if (feedData.GetCount() == 0) {
		// no service this day
		String emptyText;
		pAppResource->GetString("IDS_NOSERVICE", emptyText);
		__pListFood->SetTextOfEmptyList(emptyText);
	} else {
		IEnumerator *pEnum = feedData.GetEnumeratorN();
		HashMap *pItem = null;
		int mensaIndex = -1;
		String *currentMensa = null;
		String currencySymbol;
		pAppResource->GetString("IDS_CURRENCY", currencySymbol);
		String soldOut;
		pAppResource->GetString("IDS_SOLDOUT", soldOut);

		// iterate over items (meals) in feed
		while (pEnum->MoveNext() == E_SUCCESS) {
			pItem = (HashMap *)pEnum->GetCurrent();

			// check if mensa is already in the list (we assume the feed to be ordered)
			if (!currentMensa || !(static_cast<String *>(pItem->GetValue(*(new String("author")))))->Equals(*currentMensa, false)) {
				currentMensa = static_cast<String *>(pItem->GetValue(*(new String("author"))));
				mensaIndex++;
				// Create a main item of the ExpandableList
				CustomListItem* pMainItem = new CustomListItem();
				pMainItem->Construct(100);
				pMainItem->SetItemFormat(*__pMainItemFormat);
				pMainItem->SetElement(TEXT_ID, *(new String(*currentMensa)));
				// Add the item to the ExpandableList
				__pListFood->AddItem(*pMainItem, mensaIndex);
			}

			String *title = static_cast<String *>(pItem->GetValue(*(new String("title"))));
			title->Trim();
			String priceStudents;
			String priceStaff;
			int stringLength = title->GetLength();

			// Create a sub item of the ExpandableList
			CustomListItem *pSubItem = new CustomListItem();
			pSubItem->Construct(100);
			pSubItem->SetItemFormat(*__pSubItemFormat);

			// get prices
			if (title->EndsWith(L" EUR)")) {
				// parse price
				title->SubString(stringLength - 20, 5, priceStudents);
				priceStudents.Append(currencySymbol);
				title->SubString(stringLength - 9, 5, priceStaff);
				priceStaff.Append(currencySymbol);
				title->Remove(stringLength - 22, 22);

				pSubItem->SetElement(PRICESTUDENT_ID, priceStudents);
				pSubItem->SetElement(PRICESTAFF_ID, priceStaff);
			} else if (title->EndsWith(L"(ausverkauft)")) {
				// sold out
				title->Remove(stringLength - 14, 14);
				pSubItem->SetElement(REMARK_ID, soldOut);
			}

			pSubItem->SetElement(TEXT_ID, *title);

			// Add sub item to the ExpandableList
			__pListFood->AddSubItem(mensaIndex, *pSubItem);
		}

		// clean up
		delete pEnum;
	}

	__pListFood->RequestRedraw();
	__pListFood->ScrollToTop();

	StopLoadingAnimation();
}
void
FPlaylistForm::OnActionPerformed(const Control& source, int actionId)
{
	if (actionId == APLAY) {
		FMainForm *pMainForm = static_cast<FMainForm *>(Application::GetInstance()->GetAppFrame()->GetFrame()->GetControl("FMainForm"));
		int playlistitemscount = 0;
		if (pMainForm->isstreaming) {
			playlistitemscount = pMainForm->playliststream->GetCount();
		} else {
			playlistitemscount = publicfunc_->playlist->GetCount();
		}
		if ((curselitemid > 0) && (curselitemid <= playlistitemscount)) {
			if (publicfunc_->sendingcommand == false) {
				//if (curplayingitemid != curselitemid) {
					PlayListItem * playlistitem_;
					if (pMainForm->isstreaming) {
						playlistitem_ = static_cast<PlayListItem *> (pMainForm->playliststream->GetAt(curselitemid-1));
						pMainForm->StreamingPlayListPlayItem(curselitemid-1);
					} else {
						playlistitem_ = static_cast<PlayListItem *> (publicfunc_->playlist->GetAt(curselitemid-1));
						publicfunc_->SendCommand(L"pl_play&id=" + Osp::Base::Integer::ToString(playlistitem_->id));
					}
					int listitemindex = -1;
					if (curplayingitemid >= 0) {
						PlayListItem * playlistitemold_;
						if (pMainForm->isstreaming) {
							playlistitemold_ = static_cast<PlayListItem *> (pMainForm->playliststream->GetAt(curplayingitemid-1));
						} else {
							playlistitemold_ = static_cast<PlayListItem *> (publicfunc_->playlist->GetAt(curplayingitemid-1));
						}
						listitemindex = UList_->GetItemIndexFromItemId(curplayingitemid);
						if (listitemindex >= 0) {
							CustomListItem* pItem = const_cast <CustomListItem*>(UList_->GetItemAt(listitemindex));
							pItem->SetElement(ID_LIST_ICON, L"");
							UList_->RefreshItem(listitemindex);
						}
					}
					listitemindex = UList_->GetItemIndexFromItemId(curselitemid);
					if (listitemindex >= 0) {
						CustomListItem* pItem = const_cast <CustomListItem*>(UList_->GetItemAt(listitemindex));
						pItem->SetElement(ID_LIST_ICON, *currenticon, currenticon);
						UList_->RefreshItem(listitemindex);
					}
					this->RequestRedraw();
					curplayingitemid = curselitemid;
				//}
			}
		}
	} else if (actionId == AREMOVE) {
		FMainForm *pMainForm = static_cast<FMainForm *>(Application::GetInstance()->GetAppFrame()->GetFrame()->GetControl("FMainForm"));
		int playlistitemscount = 0;
		if (pMainForm->isstreaming) {
			playlistitemscount = pMainForm->playliststream->GetCount();
		} else {
			playlistitemscount = publicfunc_->playlist->GetCount();
		}
		if ((curselitemid > 0) && (curselitemid <= playlistitemscount)) {
			if (publicfunc_->sendingcommand == false) {
				if (curplayingitemid == curselitemid) {
					curplayingitemid = -1;
				}
				PlayListItem * playlistitem_;
				if (pMainForm->isstreaming) {
					playlistitem_ = static_cast<PlayListItem *> (pMainForm->playliststream->GetAt(curselitemid-1));
					pMainForm->StreamingPlayListRemoveItem(curselitemid-1);

					UList_->RemoveAllItems();
					FillListItems();
				} else {
					playlistitem_ = static_cast<PlayListItem *> (publicfunc_->playlist->GetAt(curselitemid-1));
					publicfunc_->SendCommand(L"pl_delete&id=" + Osp::Base::Integer::ToString(playlistitem_->id));
					publicfunc_->playlist->RemoveAt(curselitemid-1,true);

					UList_->RemoveAllItems();
					FillListItems();

				}
			}
		}
	} else if (actionId == ACLEAR) {
		MessageBox msgbox;
		int modalResult = 0;
		msgbox.Construct("Clear playlist?", "Do you want to clear playlist?", MSGBOX_STYLE_YESNO, 0);
		msgbox.ShowAndWait(modalResult);
		if (modalResult == MSGBOX_RESULT_YES) {
			FMainForm *pMainForm = static_cast<FMainForm *>(Application::GetInstance()->GetAppFrame()->GetFrame()->GetControl("FMainForm"));
			if (pMainForm->isstreaming) {
				pMainForm->StreamingPlayListClear();
			}
			UList_->RemoveAllItems();
			publicfunc_->ClearPlayList();
			FillListItems();
		}
	} else if (actionId == AADD) {
		Frame *pFrame = Application::GetInstance()->GetAppFrame()->GetFrame();
		FormMgr *pFormMgr = static_cast<FormMgr *>(pFrame->GetControl("FormMgr"));
		pFormMgr->SendUserEvent(FormMgr::REQUEST_BROWSEFORMADDTOPLAYLIST, null);
	} else if (actionId == ABACK) {
		Frame *pFrame = Application::GetInstance()->GetAppFrame()->GetFrame();
		FormMgr *pFormMgr = static_cast<FormMgr *>(pFrame->GetControl("FormMgr"));
		pFormMgr->SendUserEvent(FormMgr::REQUEST_MAINFORM, null);
	}
}