Tizen::Ui::Controls::ListItemBase* SelectCalendarPopup::CreateItem(int index, int itemWidth) { CustomItem* pItem = new (std::nothrow) CustomItem(); Calendar* pCalendar = null; String calendarName; pCalendar = static_cast< Calendar* >(__pCalendarList->GetAt(index)); TryReturn(pCalendar != null, null, "Failed to get a calendar"); calendarName = pCalendar->GetName(); if (calendarName.IsEmpty() == true) { calendarName = L"(Calendar ID: "; calendarName.Append(pCalendar->GetRecordId()); calendarName.Append(L")"); } pItem->Construct(Dimension(itemWidth, 100), LIST_ANNEX_STYLE_NORMAL); pItem->AddElement(Rectangle(32, 0, GetClientAreaBounds().width - 64, 112), 1, calendarName, true); if (__selectedCalendarId == pCalendar->GetRecordId()) { __pListView->SetItemChecked(index, true); } return pItem; }
CustomItem *Dictionary::CreateCustomWordItem(int itemWidth) { ListAnnexStyle style = LIST_ANNEX_STYLE_NORMAL; CustomItem *pItem = new CustomItem(); pItem->Construct(Osp::Graphics::Dimension(itemWidth, ITEM_HEIGHT), style); pItem->SetBackgroundColor(LIST_ITEM_DRAWING_STATUS_NORMAL, LangSetting::CUSTOM_WORD); String examples = L""; ArrayList *words = __WCtrl->GetWordsN(WordCtrl::CUSTOM_WORD_LESSON_ID); if (words && words->GetCount() > 0) { int cnt = words->GetCount(); for (int i = 0; i != cnt; i++) { Word * w = static_cast<Word*> (words->GetAt(i)); if (i > 0) examples.Append(","); examples.Append(w->__lern); } words->RemoveAll(true); delete words; } else examples = Utils::GetString("IDS_EMPTY_CUSTOM_LIST"); String name = Utils::GetString("IDS_CUSTOM_WORD_ITEM"); AddItemTitle(pItem, name, itemWidth); AddItemExamples(pItem, itemWidth, examples); return pItem; }
Tizen::Ui::Controls::ListItemBase* Lanking::CreateItem(int index, int itemWidth) { String* pItemText = null; pItemText = static_cast<String *>(__pRankingTextList->GetAt(index)); CustomItem* pItem = new (std::nothrow) CustomItem(); pItem->Construct(Tizen::Graphics::Dimension(itemWidth,74), LIST_ANNEX_STYLE_NORMAL); pItem->AddElement(Rectangle(10, 10, 460, 74), 300, *pItemText, true); return pItem; }
ListItemBase* PartnerListForm::CreateItem(int groupIndex, int itemIndex, float itemWidth) { ListAnnexStyle style = LIST_ANNEX_STYLE_NORMAL; CustomItem* pItem = new (std::nothrow) CustomItem(); pItem->Construct(Tizen::Graphics::FloatDimension(itemWidth, 210.0f), style); PartnerItem *p; p= new PartnerItem; ArrPartnerItem.GetAt(ITEM_CREATE_CNT++, *p); pItem->AddElement(Rectangle(0, 0, itemWidth, 210.0f), 0, *(static_cast<ICustomElement *>(p))); return pItem; }
Controls::ListItemBase * EnrichedTextForm::CreateItem(int index, int itemWidth) { // TODO: Add your implementation codes here ListAnnexStyle style = LIST_ANNEX_STYLE_NORMAL; CustomItem* pItem = new (std::nothrow) CustomItem(); pItem->Construct(Tizen::Graphics::Dimension(itemWidth, 112), style); Rectangle mainListItemRect(26, 32, GetClientAreaBounds().width, 50); switch(index) { case 0: pItem->AddElement(mainListItemRect, TEXT_WRAP_NONE_INDEX, L"Text Wrap None", true); break; case 1: pItem->AddElement(mainListItemRect, TEXT_WRAP_WORD_WRAP_INDEX, L"Text Wrap Word", true); break; case 2: pItem->AddElement(mainListItemRect, TEXT_WRAP_CHARACTER_WRAP_INDEX, L"Text Wrap Character Wrap", true); break; case 3: pItem->AddElement(mainListItemRect, TEXT_ALIGNMENT_LEFT_INDEX, L"Text Alignment Left", true); break; case 4: pItem->AddElement(mainListItemRect, TEXT_ALIGNMENT_CENTER_INDEX, L"Text Alignment Center", true); break; case 5: pItem->AddElement(mainListItemRect, TEXT_ALIGNMENT_RIGHT_INDEX, L"Text Alignment Right", true); break; case 6: pItem->AddElement(mainListItemRect, TEXT_ALIGNMENT_TOP_INDEX, L"Text Alignment Top", true); break; case 7: pItem->AddElement(mainListItemRect, TEXT_ALIGNMENT_MIDDLE_INDEX, L"Text Alignment Middle", true); break; case 8: pItem->AddElement(mainListItemRect, TEXT_ALIGNMENT_BOTTOM_INDEX, L"Text Alignment Bottom", true); break; case 9: pItem->AddElement(mainListItemRect, ABBREVIATION_ENABLED_TRUE, L"Abbreviation Enabled", true); break; case 10: pItem->AddElement(mainListItemRect, ABBREVIATION_ENABLED_FALSE, L"Abbreviation Disabled", true); break; default: break; } return pItem; }
CustomItem *Dictionary::CreateLessonItem(int itemWidth, int lesson) { ListAnnexStyle style = LIST_ANNEX_STYLE_MARK; CustomItem *pItem = new CustomItem(); pItem->Construct(Osp::Graphics::Dimension(itemWidth, ITEM_HEIGHT), style); pItem->SetBackgroundColor(LIST_ITEM_DRAWING_STATUS_NORMAL, LangSetting::LESSON_COLORS[lesson - 1]); String name = LangSetting::GetNameOfLesson(lesson); if (__progressState[lesson - 1]) AddItemPreparing(pItem, itemWidth); AddItemTitle(pItem, name, itemWidth); int count; wchar_t ** words = LangSetting::GetInitDataN(CommonSetting::GetInstance().lern, lesson, count); String examples = L""; count = count > EXAMPLES_MAX ? EXAMPLES_MAX : count; bool first = true; for (int i = 0; i != count; i++) { int indexOfComa; String word = words[i]; //word.IndexOf(",", 0, indexOfComa); if (word.IndexOf(",", 0, indexOfComa) == E_SUCCESS) { String neww; word.SubString(0, indexOfComa, neww); word = neww; } if (!first) examples.Append(L", "); examples.Append(word); first = false; } AddItemExamples(pItem, itemWidth, examples); SetupInitSetting(); return pItem; }
Tizen::Ui::Controls::ListItemBase * ShoppingListTab1::CreateItem(int index, int itemWidth) { String* pvalueText; DbRow* pRow = theTableLists.GetRow(index); if (pRow) { pRow->GetText(1, pvalueText); } String strName = *pvalueText; int textWidth = GetWidth() - INDENT*2; EnrichedText enrichedText; enrichedText.Construct(FloatDimension(textWidth, 112)); enrichedText.SetVerticalAlignment(TEXT_ALIGNMENT_MIDDLE); enrichedText.SetHorizontalAlignment(TEXT_ALIGNMENT_LEFT); enrichedText.SetTextWrapStyle(TEXT_WRAP_WORD_WRAP); Font pFont; pFont.Construct(FONT_STYLE_BOLD, 44.0f); TextElement* pTextElement = new (std::nothrow) TextElement(); pTextElement->Construct(strName + "\n"); pTextElement->SetFont(pFont); enrichedText.Add(*pTextElement); int textHeight = enrichedText.GetTotalLineHeight(); CustomItem* pItem = new CustomItem(); pItem->Construct(Dimension(GetWidth(), textHeight + INDENT*2), LIST_ANNEX_STYLE_NORMAL); pItem->AddElement(Rectangle(INDENT, INDENT, textWidth, textHeight), 0, enrichedText); AppAssert(pItemContext); pItem->SetContextItem(pItemContext); return pItem; }
ListItemBase* SettingForm::CreateItem(int index, float itemWidth) { ListAnnexStyle style = LIST_ANNEX_STYLE_NORMAL; CustomItem* pItem = new (std::nothrow) CustomItem; pItem->Construct(CoordinateSystem::AlignToDevice(Tizen::Graphics::FloatDimension(itemWidth, 112.0f)), style); FloatRectangle mainListItemRect(26.0f, 32.0f, GetClientAreaBoundsF().width, 60.0f); switch(index) { case 0: pItem->AddElement(mainListItemRect, ID_FORMAT_STRING, L"Chatting1", true); break; case 1: pItem->AddElement(mainListItemRect, ID_FORMAT_STRING, L"Chatting2", true); break; case 2: pItem->AddElement(mainListItemRect, ID_FORMAT_STRING, L"Chatting3", true); break; default: break; } return pItem; }
ListItemBase * BMCategoriesForm::CreateItem (int index, float itemWidth) { CustomItem * pItem = new CustomItem(); BookMarkManager & mngr = GetBMManager(); pItem->Construct(FloatDimension(itemWidth, lstItmHght), LIST_ANNEX_STYLE_NORMAL); int addWdth = 0; bool bShowDelete = index == m_categoryToDelete; if (m_bEditState) { FloatRectangle imgRect(btwWdth, topHght, imgWdth, imgHght); pItem->AddElement(imgRect, ID_DELETE, *GetBitmap(bShowDelete ? IDB_BOOKMARK_DELETE_CUR : IDB_BOOKMARK_DELETE), null, null); addWdth = btwWdth + imgWdth; } FloatRectangle imgRect(addWdth + btwWdth, topHght, imgWdth, imgHght); pItem->AddElement(imgRect, ID_EYE, *GetBitmap(mngr.IsCategoryVisible(index) ? IDB_EYE : IDB_EMPTY), null, null); int beg = addWdth + btwWdth + imgWdth + btwWdth; int end = 2 * btwWdth + (bShowDelete ? deleteWidth : imgWdth); String itemText = mngr.GetCategoryName(index); pItem->AddElement(FloatRectangle(beg, topHght, itemWidth - beg - end, imgHght), ID_NAME, itemText, mainFontSz, gray, gray, gray); if (bShowDelete) { pItem->AddElement(FloatRectangle(itemWidth - end + btwWdth, topHght, deleteWidth, imgHght), ID_DELETE_TXT, "Delete", mainFontSz, red, red, red); } else { int count = mngr.GetCategorySize(index); String sz; sz.Append(count); pItem->AddElement(FloatRectangle(itemWidth - btwWdth - imgWdth, topHght, imgWdth, imgHght), ID_SIZE, sz, mainFontSz, gray, gray, gray); } return pItem; }
ListItemBase* DeviceInfoForm::CreateItem(int groupIndex, int itemIndex, int itemWidth) { static const int LIST_ITEM_HEIGHT = 60; static const int ID_LIST_VALUE = 101; static const int LIST_DATA_HEIGHT = 50; static const int DEFAULT_MARGIN = 20; static const int ELEMENT_X = 26; static const int ELEMENT_Y = 0; int clientAreaWidth = GetClientAreaBounds().width; const IListT<WifiWpsConfigurationMode>* pWifiWpsConfigurationModes = null; CustomItem* pItem = new CustomItem(); // skip IP addrss and SSID if ((groupIndex >= DeviceInfoType::IP_ADDRESS) && (__pLocalDeviceInfo->GetGroupMemberType() == WIFI_DIRECT_GROUP_MEMBER_TYPE_NONE)) { groupIndex += 2; } if (groupIndex == DeviceInfoType::WPS_MODE) { pWifiWpsConfigurationModes = static_cast<const IListT<WifiWpsConfigurationMode>*>(__pLocalDeviceInfo->GetSupportedWpsConfigurationModeList()); int wpsModeCount = pWifiWpsConfigurationModes->GetCount(); if (wpsModeCount == 0) { // set default value to display "Unknown" wpsModeCount = 1; } if (pWifiWpsConfigurationModes != null) { pItem->Construct(Dimension(clientAreaWidth, ELEMENT_Y + (LIST_DATA_HEIGHT * wpsModeCount)), LIST_ANNEX_STYLE_NORMAL); for (int i = 0; i < wpsModeCount; i++) { WifiWpsConfigurationMode wpsConfigurationMode = WIFI_WPS_CONFIG_MODE_NONE; pWifiWpsConfigurationModes->GetAt(i, wpsConfigurationMode); pItem->AddElement(Rectangle(ELEMENT_X, ELEMENT_Y + (LIST_DATA_HEIGHT * i), clientAreaWidth - DEFAULT_MARGIN, LIST_DATA_HEIGHT), ID_LIST_VALUE + i, GetDeviceWpsConfigurationMode(wpsConfigurationMode)); } } } else { pItem->Construct(Tizen::Graphics::Dimension(GetClientAreaBounds().width, LIST_ITEM_HEIGHT), LIST_ANNEX_STYLE_NORMAL); switch (groupIndex) { case DeviceInfoType::DEVICE_NAME: pItem->AddElement(Rectangle(ELEMENT_X, ELEMENT_Y, clientAreaWidth - DEFAULT_MARGIN, LIST_DATA_HEIGHT), ID_LIST_VALUE, __pLocalDeviceInfo->GetDeviceName()); break; case DeviceInfoType::MAC_ADDRESS: { String macAddress = __pLocalDeviceInfo->GetMacAddress(); if (macAddress.GetLength() == 0) { macAddress = L"xx-xx-xx-xx-xx-xx"; } pItem->AddElement(Rectangle(ELEMENT_X, ELEMENT_Y, clientAreaWidth - DEFAULT_MARGIN, LIST_DATA_HEIGHT), ID_LIST_VALUE, macAddress); } break; case DeviceInfoType::IP_ADDRESS: if (__pLocalDeviceInfo->GetIpAddress() != null) { pItem->AddElement(Rectangle(ELEMENT_X, ELEMENT_Y, clientAreaWidth - DEFAULT_MARGIN, LIST_DATA_HEIGHT), ID_LIST_VALUE, __pLocalDeviceInfo->GetIpAddress()->ToString()); } break; case DeviceInfoType::SSID: pItem->AddElement(Rectangle(ELEMENT_X, ELEMENT_Y, clientAreaWidth - DEFAULT_MARGIN, LIST_DATA_HEIGHT), ID_LIST_VALUE, __pLocalDeviceInfo->GetSsid()); break; case DeviceInfoType::DEVICE_STATUS: pItem->AddElement(Rectangle(ELEMENT_X, ELEMENT_Y, clientAreaWidth - DEFAULT_MARGIN, LIST_DATA_HEIGHT), ID_LIST_VALUE, GetDeviceStatus()); break; case DeviceInfoType::MEMBER_TYPE: pItem->AddElement(Rectangle(ELEMENT_X, ELEMENT_Y, clientAreaWidth - DEFAULT_MARGIN, LIST_DATA_HEIGHT), ID_LIST_VALUE, GetGroupMemberType()); break; case DeviceInfoType::DEVICE_TYPE: pItem->AddElement(Rectangle(ELEMENT_X, ELEMENT_Y, clientAreaWidth - DEFAULT_MARGIN, LIST_DATA_HEIGHT), ID_LIST_VALUE, GetDeviceTypeCategory()); break; default: break; } } return pItem; }
Tizen::Ui::Controls::ListItemBase* TreeViewForm::CreateItem (int index, int itemWidth){ AppLog("CreateItem %d",index); CustomItem* pItem = null; ZLTreeNode* node = myTreeDialog->myCurrentNode->children().at(index); if (const ZLTreeTitledNode *TitledNode = zlobject_cast<const ZLTreeTitledNode*>(node)) { AppLog("ZLTreeTitledNode.titile %s",TitledNode->title().c_str()); //AppLog("ZLTreeTitledNode.imageUrl = %s",TitledNode->imageUrl().c_str()); String strName = String(TitledNode->title().c_str()); String strSub = String(TitledNode->subtitle().c_str()); pItem = new (std::nothrow) CustomItem(); Dimension itemDimension(itemWidth,100); pItem->Construct(itemDimension, LIST_ANNEX_STYLE_NORMAL); Bitmap *pBmp = null; Color blk = Color::GetColor(COLOR_ID_BLACK); if (showIcons) { //if (false) { shared_ptr<ZLImage> cover; if (TitledNode->imageIsUploaded()) cover = TitledNode->image(); else cover = TitledNode->extractCoverImage(); if (!cover.isNull()) { shared_ptr<ZLImageData> coverData = ZLImageManager::Instance().imageData(*cover); if (!coverData.isNull()) { ZLImageData &image = *coverData; Bitmap *tmpBmp = ((ZLbadaImageData&)image).pBitmap; pBmp = makeIcon(tmpBmp); } else { cover = TitledNode->extractCoverImage(); shared_ptr<ZLImageData> coverData = ZLImageManager::Instance().imageData(*cover); ZLImageData &image = *coverData; Bitmap *tmpBmp = ((ZLbadaImageData&)image).pBitmap; pBmp = makeIcon(tmpBmp); } } pItem->AddElement(iconRect, ID_FORMAT_BITMAP, *pBmp, null, null); pItem->AddElement(Rectangle(85, 12, formArea.width - 85, 40), ID_FORMAT_TITLE, strName,30, blk,blk,blk, true); pItem->AddElement(Rectangle(85, 37, formArea.width - 85, 80), ID_FORMAT_SUBTITLE, strSub,22, blk,blk,blk, true); } else { pItem->AddElement(Rectangle(15, 12, formArea.width - 15, 40), ID_FORMAT_TITLE, strName,30, blk,blk,blk, true); pItem->AddElement(Rectangle(15, 37, formArea.width - 15, 80), ID_FORMAT_SUBTITLE, strSub,22, blk,blk,blk, true); } if (pBmp != null) delete pBmp; } return pItem; }