2 // Copyright (c) 2012 Samsung Electronics Co., Ltd.
\r
4 // Licensed under the Flora License, Version 1.1 (the License);
\r
5 // you may not use this file except in compliance with the License.
\r
6 // You may obtain a copy of the License at
\r
8 // http://floralicense.org/license/
\r
10 // Unless required by applicable law or agreed to in writing, software
\r
11 // distributed under the License is distributed on an AS IS BASIS,
\r
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
\r
13 // See the License for the specific language governing permissions and
\r
14 // limitations under the License.
\r
18 * @file: MfContentListViewItem.cpp
\r
19 * @brief: This file contains implementation of ContentListItem class, which is used to
\r
20 * customize and personalize the Listview elements.
\r
23 #include "MfContentListItem.h"
\r
24 #include "MfMyFilesApp.h"
\r
26 using namespace Tizen::App;
\r
27 using namespace Tizen::Base;
\r
28 using namespace Tizen::Base::Collection;
\r
29 using namespace Tizen::Base::Utility;
\r
30 using namespace Tizen::Graphics;
\r
31 using namespace Tizen::Media;
\r
32 using namespace Tizen::System;
\r
33 using namespace Tizen::Ui;
\r
34 using namespace Tizen::Ui::Controls;
\r
36 ContentListItem::ContentListItem(int nWidth, int nHeight, bool isSearchedtextPresent)
\r
38 AppLogDebug("Entry");
\r
39 COLOR_TITLE = Color::GetColor(COLOR_ID_BLACK);
\r
40 COLOR_DATE = Color(124, 124, 124);
\r
41 __contentTitle = L"";
\r
42 __creationDate = L"";
\r
43 __descriptionText = L"";
\r
45 __searchedText = L"";
\r
47 __itemWidth = nWidth;
\r
48 __itemHeight = nHeight;
\r
50 __pThumbnailBitmap = null;
\r
53 __titleRect.SetBounds(0, 0, 0, 0);
\r
54 __thumbnailRect.SetBounds(0, 0, 0, 0);
\r
56 __detailedListDateRect.SetBounds(0, 0, 0, 0);
\r
57 __detailedListDescriptionRect.SetBounds(0, 0, 0, 0);
\r
58 __detailedListThumbnailRect.SetBounds(0, 0, 0, 0);
\r
60 __detailedListTitleRect.SetBounds(0, 0, 0, 0);
\r
62 __pRenameBitmap = null;
\r
63 __pPlayBitmap = null;
\r
64 __pPauseBitmap = null;
\r
66 __editRenameRect.SetBounds(0, 0, 0, 0);
\r
67 __editDateRect.SetBounds(0, 0, 0, 0);
\r
68 __editPlayRect.SetBounds(0, 0, 0, 0);
\r
69 __editPauseRect.SetBounds(0, 0, 0, 0);
\r
71 __isSearchedTextPresent = isSearchedtextPresent;
\r
72 __searchedText = L"";
\r
74 __pFtDescriptionText = null;
\r
75 __pFtCreationDate = null;
\r
76 AppLogDebug("Exit %s", GetErrorMessage(GetLastResult()));
\r
80 ContentListItem::~ContentListItem(void)
\r
82 AppLogDebug("Entry");
\r
84 if (__pFtTitle != null)
\r
88 if (__pFtDescriptionText != null)
\r
90 delete __pFtDescriptionText;
\r
92 if (__pFtCreationDate != null)
\r
94 delete __pFtCreationDate;
\r
101 if (__pThumbnailBitmap != null)
\r
103 delete __pThumbnailBitmap;
\r
107 /*if (__pPlayBitmap != null)
\r
109 delete __pPlayBitmap;
\r
112 if (__pPauseBitmap != null)
\r
114 delete __pPauseBitmap;
\r
117 RemoveAllElements(); //Code to remove CustomItem elements.
\r
119 AppLogDebug("ContentListItem::~ContentListItem()");
\r
123 ContentListItem::operator =(const ContentListItem& contentListItem)
\r
128 ContentListItem::ContentListItem(const ContentListItem& contentListItem)
\r
134 ContentListItem::Refresh(void)
\r
136 AppLogDebug("Entry");
\r
137 int thumbnailX = X_LISTVIEW;
\r
138 int normalGap = X_LISTVIEW;
\r
139 int thumbnailWidth = W_LISTVIEW_ITEM_BITMAP;
\r
140 int nMultiTextWidth = __itemWidth - thumbnailX - thumbnailWidth - 2 * normalGap;
\r
142 if (__pThumbnailBitmap != null)
\r
144 AddElement(__thumbnailRect, CONTENT_LIST_ITEM_TYPE_THUMBNAIL, *__pThumbnailBitmap, __pThumbnailBitmap, __pThumbnailBitmap);
\r
148 __pFtTitle = new (std::nothrow) FormatedText(nMultiTextWidth);
\r
149 if (__pFtTitle == null)
\r
152 __pFtTitle->SetTextWrap(TEXT_WRAP_NONE);
\r
153 __pFtTitle->AddText(__contentTitle, FONT_MAIN, COLOR_TITLE);
\r
155 AddElement(__titleRect, CONTENT_LIST_ITEM_TYPE_TITLE, *__pFtTitle);
\r
156 AppLogDebug("Exit %s", GetErrorMessage(GetLastResult()));
\r
160 ContentListItem::GetItemSize(int& itemHeight, int& titleHeight)
\r
162 AppLogDebug("Entry");
\r
163 int y = X_LISTVIEW;
\r
165 titleHeight = GetTitleHeight(__contentTitle);
\r
167 //Calculate Y position of Description
\r
168 y += H_LISTVIEW_ITEM_BITMAP;
\r
169 y += 2 * X_LISTVIEW; //Gap of 20 between title and content
\r
171 itemHeight = H_ITEM_LISTVIEW;
\r
172 AppLogDebug("Exit %s", GetErrorMessage(GetLastResult()));
\r
175 ContentListItem::MakePlainTitleItem(void)
\r
177 //__itemHeight = 0;
\r
178 int titleHeight = 0;
\r
179 int w_Title = __itemWidth - ((W_LISTVIEW_ITEM_BITMAP * 4) + (4 * X_LISTVIEW));
\r
181 GetItemSize(__itemHeight, titleHeight);
\r
183 Construct(Dimension(__itemWidth, __itemHeight), LIST_ANNEX_STYLE_MARK);
\r
184 SetElementTextVerticalAlignment(CONTENT_LIST_ITEM_TYPE_TITLE, ALIGNMENT_MIDDLE);
\r
186 __titleRect.SetBounds(X_LISTVIEW, (__itemHeight - titleHeight) / 2, w_Title, 60);
\r
192 ContentListItem::Make(int indent)
\r
194 AppLogDebug("Entry");
\r
196 int titleHeight = 0;
\r
198 GetItemSize(__itemHeight, titleHeight);
\r
200 Construct(Dimension(__itemWidth, __itemHeight), LIST_ANNEX_STYLE_NORMAL);
\r
201 SetElementTextVerticalAlignment(CONTENT_LIST_ITEM_TYPE_TITLE, ALIGNMENT_MIDDLE);
\r
203 CreateFormatRectangle(__itemHeight, titleHeight, indent);
\r
205 AppLogDebug("Exit %s", GetErrorMessage(GetLastResult()));
\r
209 ContentListItem::MakeFileManageFormListItem(void)
\r
211 AppLogDebug("Entry");
\r
212 int titleHeight = 0;
\r
213 GetItemSize(__itemHeight, titleHeight);
\r
215 Construct(Dimension(__itemWidth, __itemHeight), LIST_ANNEX_STYLE_MARK);
\r
217 //SetBackgroundColor(LIST_ITEM_DRAWING_STATUS_PRESSED, Color::GetColor(COLOR_ID_WHITE));
\r
218 SetElementTextVerticalAlignment(CONTENT_LIST_ITEM_TYPE_THUMBNAIL, ALIGNMENT_MIDDLE);
\r
219 SetElementTextVerticalAlignment(CONTENT_LIST_ITEM_TYPE_DATE, ALIGNMENT_BOTTOM);
\r
220 SetElementTextVerticalAlignment(CONTENT_LIST_ITEM_TYPE_RENAME, ALIGNMENT_MIDDLE);
\r
222 CreateFormatRectangleForFileManageForm(__itemHeight, titleHeight);
\r
223 RefreshFileManageFormListItem();
\r
225 AppLogDebug("Exit %s", GetErrorMessage(GetLastResult()));
\r
229 ContentListItem::CreateFormatRectangle(int itemHeight, int textHeight, int indent)
\r
231 AppLogDebug("Entry");
\r
232 int thumbnailX = X_LISTVIEW * indent;
\r
233 int thumbnailY = X_LISTVIEW;
\r
235 int normalGap = X_LISTVIEW;
\r
236 int thumbnailWidth = W_LISTVIEW_ITEM_BITMAP;
\r
237 int thumbnailHeight = H_LISTVIEW_ITEM_BITMAP;
\r
239 int width = __itemWidth;
\r
240 int w_Title = width - (W_LISTVIEW_ITEM_BITMAP + 3 * X_LISTVIEW);
\r
242 __thumbnailRect.SetBounds(thumbnailX, thumbnailY, thumbnailWidth, thumbnailHeight); //right side width:20
\r
244 if (!__creationDate.IsEmpty())
\r
246 SetElementTextVerticalAlignment(CONTENT_LIST_ITEM_TYPE_TITLE, ALIGNMENT_MIDDLE);
\r
247 __titleRect.SetBounds(thumbnailX + thumbnailWidth + normalGap, thumbnailY, w_Title, H_LISTVIEW_ITEM_TITLE);
\r
251 SetElementTextVerticalAlignment(CONTENT_LIST_ITEM_TYPE_TITLE, ALIGNMENT_MIDDLE);
\r
252 __titleRect.SetBounds(thumbnailX + thumbnailWidth + normalGap, (itemHeight - textHeight) / 2, w_Title, H_LISTVIEW_ITEM_TITLE);
\r
257 ContentListItem::CreateFormatRectangleForFileManageForm(int itemHeight, int textHeight)
\r
259 AppLogDebug("Entry");
\r
260 int thumbnailX = X_LISTVIEW;
\r
261 int thumbnailY = X_LISTVIEW;
\r
263 int normalGap = X_LISTVIEW;
\r
264 int thumbnailWidth = W_LISTVIEW_ITEM_BITMAP;
\r
265 int thumbnailHeight = H_LISTVIEW_ITEM_BITMAP;
\r
267 int width = __itemWidth;
\r
268 int w_Rename = W_RENAME_ICON;
\r
269 int h_Rename = W_RENAME_ICON;
\r
271 int w_Title = width - (W_LISTVIEW_ITEM_BITMAP + (4 * X_LISTVIEW) + (2 * W_RENAME_ICON));
\r
272 int x_Rename = width - (w_Rename + W_RENAME_ICON + (2 * X_LISTVIEW));
\r
275 __thumbnailRect.SetBounds(thumbnailX, thumbnailY, thumbnailWidth, thumbnailHeight); //right side width:20
\r
277 if (!__creationDate.IsEmpty())
\r
279 SetElementTextVerticalAlignment(CONTENT_LIST_ITEM_TYPE_TITLE, ALIGNMENT_MIDDLE);
\r
280 __titleRect.SetBounds(thumbnailX + thumbnailWidth + normalGap, Y_LISTVIEW, w_Title, H_LISTVIEW_ITEM_TITLE);
\r
284 SetElementTextVerticalAlignment(CONTENT_LIST_ITEM_TYPE_TITLE, ALIGNMENT_MIDDLE);
\r
285 __titleRect.SetBounds(thumbnailX + thumbnailWidth + normalGap, (itemHeight - textHeight) / 2, w_Title, H_LISTVIEW_ITEM_TITLE);
\r
287 __editRenameRect.SetBounds(x_Rename, (itemHeight - W_RENAME_ICON) / 2, w_Rename, h_Rename);
\r
288 __editDateRect.SetBounds(thumbnailX + thumbnailWidth + normalGap, H_LISTVIEW_ITEM_TITLE + Y_LISTVIEW, w_Title, H_LISTVIEW_ITEM_DESCRIPTION);
\r
291 ContentListItem::SetThumbnail(const Bitmap* picture)
\r
293 AppLogDebug("Entry");
\r
294 if (__pThumbnailBitmap)
\r
296 delete __pThumbnailBitmap;
\r
297 __pThumbnailBitmap = null;
\r
299 __pThumbnailBitmap = (Bitmap*) picture;
\r
300 AppLogDebug("Exit ");
\r
304 ContentListItem::SetTitle(const String& title, const String& searchedText)
\r
306 AppLogDebug("Entry");
\r
307 __contentTitle = title;
\r
308 if (__isSearchedTextPresent == true)
\r
310 __searchedText = searchedText;
\r
312 AppLogDebug("Exit %s", GetErrorMessage(GetLastResult()));
\r
316 ContentListItem::SetDescription(const String& descriptionText)
\r
318 AppLogDebug("Entry");
\r
319 __descriptionText = descriptionText;
\r
320 AppLogDebug("Exit %s", GetErrorMessage(GetLastResult()));
\r
324 ContentListItem::SetDate(const String& date)
\r
326 AppLogDebug("Entry");
\r
327 __creationDate = date;
\r
328 AppLogDebug("Exit %s", GetErrorMessage(GetLastResult()));
\r
332 ContentListItem::GetTitleHeight(String& title)
\r
334 AppLogDebug("Entry");
\r
335 int thumbnailX = X_LISTVIEW;
\r
336 int normalGap = X_LISTVIEW;
\r
337 int thumbnailWidth = W_LISTVIEW_ITEM_BITMAP;
\r
338 int nMultiTextWidth = __itemWidth - thumbnailX - thumbnailWidth - 2 * normalGap;
\r
340 if (title.GetLength() <= 0)
\r
342 FormatedText ft(nMultiTextWidth);
\r
344 ft.AddText(title, FONT_MAIN, COLOR_TITLE);
\r
345 //ft.SetLineSpace(1);
\r
347 AppLogDebug("Exit %s", GetErrorMessage(GetLastResult()));
\r
348 return ft.GetHeight();
\r
352 ContentListItem::SetBackground(const Bitmap* pBg)
\r
354 AppLogDebug("Entry");
\r
355 __pBg = (Bitmap*) pBg;
\r
356 AppLogDebug("Exit %s", GetErrorMessage(GetLastResult()));
\r
360 ContentListItem::MakeDetailedListItem(void)
\r
362 AppLogDebug("Entry");
\r
363 int titleHeight = 0;
\r
365 Construct(Dimension(__itemWidth, __itemHeight), LIST_ANNEX_STYLE_NORMAL);
\r
366 SetElementTextVerticalAlignment(DETAILED_LIST_ELEMENTS_TITLE, ALIGNMENT_MIDDLE);
\r
367 SetElementTextVerticalAlignment(DETAILED_LIST_ELEMENTS_DESCRIPTION, ALIGNMENT_MIDDLE);
\r
368 SetElementTextVerticalAlignment(DETAILED_LIST_ELEMENTS_CREATION_DATE, ALIGNMENT_MIDDLE);
\r
369 SetElementTextVerticalAlignment(DETAILED_LIST_ELEMENTS_RENAME, ALIGNMENT_MIDDLE);
\r
371 CreateFormatRectangleForDetailedList(__itemHeight, titleHeight);
\r
372 RefreshDetailedListItem();
\r
374 AppLogDebug("Exit %s", GetErrorMessage(GetLastResult()));
\r
378 ContentListItem::MakeFileManageFormDetailedListItem(void)
\r
380 AppLogDebug("ENTRY::ContentListItem::MakeFileManageFormDetailedListItem()");
\r
381 int titleHeight = 0;
\r
383 Construct(Dimension(__itemWidth, __itemHeight), LIST_ANNEX_STYLE_MARK);
\r
384 SetElementTextVerticalAlignment(DETAILED_LIST_ELEMENTS_TITLE, ALIGNMENT_MIDDLE);
\r
385 SetElementTextVerticalAlignment(DETAILED_LIST_ELEMENTS_DESCRIPTION, ALIGNMENT_MIDDLE);
\r
386 SetElementTextVerticalAlignment(DETAILED_LIST_ELEMENTS_CREATION_DATE, ALIGNMENT_MIDDLE);
\r
387 SetElementTextVerticalAlignment(DETAILED_LIST_ELEMENTS_RENAME, ALIGNMENT_MIDDLE);
\r
389 CreateFormatRectangleForDetailedList(__itemHeight, titleHeight);
\r
390 RefreshDetailedListItem();
\r
391 AppLogDebug("EXIT::ContentListItem::MakeFileManageFormDetailedListItem()");
\r
395 ContentListItem::RefreshDetailedListItem(void)
\r
397 AppLogDebug("Entry");
\r
398 int nMultiTextWidth = (__itemWidth - (4 * X_LISTVIEW - W_LISTVIEW_ITEM_BITMAP)) / 2;
\r
401 if (__pThumbnailBitmap != null)
\r
403 AddElement(__thumbnailRect, DETAILED_LIST_ELEMENTS_THUMBNAIL, *__pThumbnailBitmap, __pThumbnailBitmap, __pThumbnailBitmap);
\r
407 __pFtTitle = new (std::nothrow) FormatedText(nMultiTextWidth);
\r
408 if (__pFtTitle == null)
\r
411 __pFtTitle->AddText(__contentTitle, FONT_MAIN, COLOR_TITLE);
\r
412 AddElement(__titleRect, DETAILED_LIST_ELEMENTS_TITLE, *__pFtTitle);
\r
414 // Description Text
\r
415 __pFtDescriptionText = new (std::nothrow) FormatedText(nMultiTextWidth);
\r
416 if (__pFtDescriptionText == null)
\r
419 __pFtDescriptionText->SetAlignment(TEXT_ALIGNMENT_LEFT, TEXT_ALIGNMENT_MIDDLE);
\r
421 if (!__descriptionText.IsEmpty())
\r
423 __pFtDescriptionText->SetTextWrap(TEXT_WRAP_NONE);
\r
424 __pFtDescriptionText->AddText(__descriptionText, FONT_SUB, COLOR_DATE);
\r
425 AddElement(__detailedListDescriptionRect, DETAILED_LIST_ELEMENTS_DESCRIPTION, *__pFtDescriptionText);
\r
429 __pFtCreationDate = new (std::nothrow) FormatedText(nMultiTextWidth);
\r
430 if (__pFtCreationDate == null)
\r
433 if (!__creationDate.IsEmpty())
\r
435 __pFtCreationDate->SetTextWrap(TEXT_WRAP_NONE);
\r
436 __pFtCreationDate->SetAlignment(TEXT_ALIGNMENT_RIGHT, TEXT_ALIGNMENT_MIDDLE);
\r
437 __pFtCreationDate->AddText(__creationDate, FONT_SUB, COLOR_DATE);
\r
438 AddElement(__detailedListDateRect, DETAILED_LIST_ELEMENTS_CREATION_DATE, *__pFtCreationDate);
\r
441 if (__pRenameBitmap != null)
\r
443 AddElement(__editRenameRect, DETAILED_LIST_ELEMENTS_RENAME, *__pRenameBitmap, __pRenameBitmap, __pRenameBitmap);
\r
449 ContentListItem::CreateFormatRectangleForDetailedList(int itemHeight, int textHeight)
\r
451 AppLogDebug("Entry");
\r
452 int width = __itemWidth;
\r
454 itemHeight = itemHeight - (2 * X_LISTVIEW);
\r
456 int thumbnailX = X_LISTVIEW;
\r
457 int thumbnailY = (H_DETAIL_LISTVIEW - H_LISTVIEW_ITEM_BITMAP) / 2;
\r
459 //int normalGap = DETAILEDLIST_COMMON_OFFSET;
\r
460 int thumbnailWidth = W_LISTVIEW_ITEM_BITMAP;
\r
461 int thumbnailHeight = H_LISTVIEW_ITEM_BITMAP;
\r
463 int bitmapElementWidth = thumbnailWidth + 2 * X_LISTVIEW;
\r
465 int x_Title = bitmapElementWidth;
\r
466 int y_Title = Y_LISTVIEW;
\r
467 int w_Title = width - (thumbnailWidth + 3 * X_LISTVIEW); //width - (W_LISTVIEW_ITEM_BITMAP + 3 * LISTVIEW_COMMON_OFFSET);;
\r
468 int h_Title = H_LISTVIEW_ITEM_TITLE;
\r
471 int x_Description = x_Title; //width - (W_DETAILED_LIST_DESCRIPTION_TEXT + X_LISTVIEW);
\r
472 int y_Description = h_Title + X_LISTVIEW; //X_DETAILEDLIST_COMMON_OFFSET;
\r
473 int w_Description = width / 2;
\r
474 int h_Description = H_LISTVIEW_ITEM_DESCRIPTION;
\r
477 int x_CreationDate = width / 2 - X_LISTVIEW; //(3 * X_DETAILEDLIST_COMMON_OFFSET) + thumbnailWidth + w_Description;//x_Title;
\r
478 int y_CreationDate = h_Title + X_LISTVIEW;
\r
479 int w_CreationDate = (width / 2) + 2;
\r
480 int h_CreationDate = H_LISTVIEW_ITEM_DESCRIPTION;
\r
483 int x_Rename = width - (W_RENAME_ICON + (2 * X_LISTVIEW));
\r
484 int y_Rename = (itemHeight - W_RENAME_ICON) / 2;
\r
485 int w_Rename = W_RENAME_ICON;
\r
486 int h_Rename = W_RENAME_ICON;
\r
488 __thumbnailRect.SetBounds(thumbnailX, thumbnailY, thumbnailWidth, thumbnailHeight); //right side width:20
\r
490 if (__pRenameBitmap != null)
\r
492 __titleRect.SetBounds(x_Title, y_Title, w_Title - W_RENAME_ICON - X_LISTVIEW, h_Title);
\r
496 __titleRect.SetBounds(x_Title, y_Title, w_Title, h_Title);
\r
498 __detailedListDescriptionRect.SetBounds(x_Description, y_Description, w_Description, h_Description);
\r
499 __detailedListDateRect.SetBounds(x_CreationDate, y_CreationDate, w_CreationDate, h_CreationDate);
\r
500 __editRenameRect.SetBounds(x_Rename, y_Rename, w_Rename, h_Rename);
\r
505 ContentListItem::SetRenameBitmap(const Bitmap* picture, const Bitmap* pressedPicture)
\r
507 AppLogDebug("Entry");
\r
508 __pRenameBitmap = (Bitmap*) picture;
\r
509 __pRenamePressed = (Bitmap*) pressedPicture;
\r
510 AppLogDebug("Exit %s", GetErrorMessage(GetLastResult()));
\r
515 ContentListItem::RefreshFileManageFormListItem(void)
\r
517 int thumbnailX = X_LISTVIEW;
\r
518 int normalGap = X_LISTVIEW;
\r
519 int thumbnailWidth = W_LISTVIEW_ITEM_BITMAP;
\r
520 int nMultiTextWidth = __itemWidth - thumbnailX - thumbnailWidth - 2 * normalGap;
\r
522 if (__pThumbnailBitmap != null)
\r
524 AddElement(__thumbnailRect, CONTENT_LIST_ITEM_TYPE_THUMBNAIL, *__pThumbnailBitmap, __pThumbnailBitmap, __pThumbnailBitmap);
\r
528 __pFtTitle = new (std::nothrow) FormatedText(nMultiTextWidth);
\r
529 if (__pFtTitle == null)
\r
532 __pFtTitle->AddText(__contentTitle, FONT_MAIN, COLOR_TITLE);
\r
533 AddElement(__titleRect, CONTENT_LIST_ITEM_TYPE_TITLE, *__pFtTitle);
\r
536 __pFtCreationDate = new (std::nothrow) FormatedText(nMultiTextWidth);
\r
537 if (__pFtCreationDate == null)
\r
540 __pFtCreationDate->SetTextWrap(TEXT_WRAP_NONE);
\r
541 __pFtCreationDate->AddText(__creationDate, FONT_SUB, COLOR_DATE);
\r
542 AddElement(__editDateRect, CONTENT_LIST_ITEM_TYPE_DATE, *__pFtCreationDate);
\r
545 if (__pRenameBitmap != null)
\r
547 AddElement(__editRenameRect, CONTENT_LIST_ITEM_TYPE_RENAME, *__pRenameBitmap, __pRenamePressed, __pRenameBitmap);
\r
553 ContentListItem::SetTitleColor(const Color& colorTitle)
\r
555 COLOR_TITLE = colorTitle;
\r
559 ContentListItem::SetDescColor(const Color& colorDesc)
\r
561 COLOR_TITLE = colorDesc;
\r
565 ContentListItem::SetTimeColor(const Color& colorTime)
\r
567 COLOR_DATE = colorTime;
\r
571 * SearchAllFoldersItem
\r
574 SearchAllFolders::SearchAllFolders(String text)
\r
576 __text = text; //FbkGetString(L"IDS_SHOWMORE");
\r
580 SearchAllFolders::~SearchAllFolders(void)
\r
582 //Empty Implementation
\r
586 SearchAllFolders::operator =(const SearchAllFolders& searchAllFolders)
\r
591 SearchAllFolders::SearchAllFolders(const SearchAllFolders& searchAllFolders)
\r
597 SearchAllFolders::OnDraw(Tizen::Graphics::Canvas& canvas, const Tizen::Graphics::Rectangle& rect, Tizen::Ui::Controls::ListItemDrawingStatus status)
\r
599 Canvas* pCanvas = const_cast< Canvas* >(&canvas);
\r
601 Dimension rectSearchAllFolders(10, 10);
\r
602 pCanvas->DrawRoundRectangle(rect, rectSearchAllFolders);
\r
603 if (status == LIST_ITEM_DRAWING_STATUS_NORMAL)
\r
605 pCanvas->FillRoundRectangle(Color(129, 141, 149), rect, rectSearchAllFolders);
\r
609 pCanvas->FillRoundRectangle(Color(58, 119, 153), rect, rectSearchAllFolders);
\r
614 Dimension dim(rect.width, rect.height);
\r
616 EnrichedText enrichedText;
\r
617 enrichedText.Construct(dim);
\r
619 enrichedText.SetHorizontalAlignment(TEXT_ALIGNMENT_CENTER);
\r
620 enrichedText.SetVerticalAlignment(TEXT_ALIGNMENT_MIDDLE);
\r
621 enrichedText.SetTextWrapStyle(TEXT_WRAP_WORD_WRAP);
\r
622 enrichedText.SetTextAbbreviationEnabled(false);
\r
623 //et.SetLineSpace(0);
\r
625 TextElement textElement;
\r
626 textElement.Construct(__text);
\r
627 textElement.SetFont(*FontManager::GetFont(FONT_MAIN));
\r
629 textElement.SetTextColor(Color(0, 0, 0));
\r
631 enrichedText.Add(textElement);
\r
632 enrichedText.Refresh();
\r
634 pCanvas->DrawText(Point(0, 0), enrichedText);
\r
640 SearchAllFoldersItem::SearchAllFoldersItem(int width, int height, String text = "")
\r
648 Construct(Dimension(width, height), LIST_ANNEX_STYLE_NORMAL);
\r
649 SetBackgroundColor(LIST_ITEM_DRAWING_STATUS_PRESSED, Color::GetColor(COLOR_ID_WHITE));
\r
650 CreateFormatRectangle();
\r
652 __pElement = new (std::nothrow) SearchAllFolders(text);
\r
655 AddElement(searchAllFoldersRect, H_SEARCH_ALL_FOLDERS, *__pElement);
\r
659 SearchAllFoldersItem::~SearchAllFoldersItem(void)
\r
666 SearchAllFoldersItem::CreateFormatRectangle(void)
\r
669 int height = H_SEARCH_ALL_FOLDERS;
\r
671 searchAllFoldersRect.SetBounds(X_SEARCH_ALL_FOLDERS, (__height - height) / 2, __width - (2 * X_SEARCH_ALL_FOLDERS), height);
\r
676 ContentListItem::SetAudioBitmap(const Bitmap* pBitmapplay, const Bitmap* pBitmapPause)
\r
678 AppLogDebug("Entry");
\r
680 if (pBitmapplay != null)
\r
682 __pPlayBitmap = (Bitmap*) pBitmapplay;
\r
685 if (pBitmapPause != null)
\r
687 __pPauseBitmap = (Bitmap*) pBitmapPause;
\r
689 AppLogDebug("Exit %s", GetErrorMessage(GetLastResult()));
\r
694 ContentListItem::MakeAppControlFormListItem(void)
\r
696 AppLogDebug("Entry");
\r
697 int titleHeight = 0;
\r
698 GetItemSize(__itemHeight, titleHeight);
\r
700 if (__currentListStyle == ANNEX_STYLE_NORMAL)
\r
702 Construct(Dimension(__itemWidth, __itemHeight), LIST_ANNEX_STYLE_NORMAL);
\r
704 else if (__currentListStyle == ANNEX_STYLE_RADIO)
\r
706 Construct(Dimension(__itemWidth, __itemHeight), LIST_ANNEX_STYLE_RADIO);
\r
708 else if (__currentListStyle == ANNEX_STYLE_MARK)
\r
710 Construct(Dimension(__itemWidth, __itemHeight), LIST_ANNEX_STYLE_MARK);
\r
713 SetElementTextVerticalAlignment(CONTENT_LIST_ITEM_TYPE_TITLE, ALIGNMENT_MIDDLE);
\r
715 CreateFormatRectangleForAppControl(__itemHeight, titleHeight);
\r
716 RefreshAppControlListItem();
\r
717 AppLogDebug("Exit %s", GetErrorMessage(GetLastResult()));
\r
721 ContentListItem::SetListAnnexStyle(AnnexStyle currentStyle)
\r
723 __currentListStyle = currentStyle;
\r
727 ContentListItem::RefreshAppControlListItem(void)
\r
729 AppLogDebug("Entry");
\r
730 int thumbnailX = X_LISTVIEW;
\r
731 int normalGap = X_LISTVIEW;
\r
732 int thumbnailWidth = W_LISTVIEW_ITEM_BITMAP;
\r
733 int nMultiTextWidth = __itemWidth - thumbnailX - thumbnailWidth - 2 * normalGap;
\r
735 if (__pThumbnailBitmap != null)
\r
737 AddElement(__thumbnailRect, CONTENT_LIST_ITEM_TYPE_THUMBNAIL, *__pThumbnailBitmap, __pThumbnailBitmap, __pThumbnailBitmap);
\r
741 __pFtTitle = new (std::nothrow) FormatedText(nMultiTextWidth);
\r
742 if (__pFtTitle == null)
\r
745 __pFtTitle->SetTextWrap(TEXT_WRAP_NONE);
\r
746 __pFtTitle->AddText(__contentTitle, FONT_MAIN, COLOR_TITLE);
\r
748 AddElement(__titleRect, CONTENT_LIST_ITEM_TYPE_TITLE, *__pFtTitle);
\r
750 if (__pPlayBitmap != null)
\r
752 AddElement(__editPlayRect, CONTENT_LIST_ITEM_TYPE_PLAY, *__pPlayBitmap, __pPlayBitmap, __pPlayBitmap);
\r
754 else if (__pPauseBitmap != null)
\r
756 AddElement(__editPauseRect, CONTENT_LIST_ITEM_TYPE_PAUSE, *__pPauseBitmap, __pPauseBitmap, __pPauseBitmap);
\r
759 AppLogDebug("Exit %s", GetErrorMessage(GetLastResult()));
\r
763 ContentListItem::CreateFormatRectangleForAppControl(int itemHeight, int textHeight)
\r
765 AppLogDebug("Entry");
\r
766 int thumbnailX = X_LISTVIEW;
\r
767 int thumbnailY = X_LISTVIEW;
\r
769 int normalGap = X_LISTVIEW;
\r
770 int thumbnailWidth = W_LISTVIEW_ITEM_BITMAP;
\r
771 int thumbnailHeight = H_LISTVIEW_ITEM_BITMAP;
\r
773 int width = __itemWidth;
\r
774 int w_AudioPlay = W_RENAME_ICON;
\r
775 int h_AudioPlay = W_RENAME_ICON;
\r
777 int w_Title = width - (W_LISTVIEW_ITEM_BITMAP + (4 * X_LISTVIEW) + (2 * w_AudioPlay));
\r
778 int x_Play = width - (w_AudioPlay + w_AudioPlay + (2 * X_LISTVIEW));
\r
779 AppControlView currentViewStyle;
\r
781 __thumbnailRect.SetBounds(thumbnailX, thumbnailY, thumbnailWidth, thumbnailHeight); //right side width:20
\r
784 currentViewStyle = ((MyFilesApp*) Application::GetInstance())->GetCurrentView();
\r
785 //currentViewStyle = APPCONTROL_VIEW_EXPORT;
\r
787 SetElementTextVerticalAlignment(CONTENT_LIST_ITEM_TYPE_TITLE, ALIGNMENT_MIDDLE);
\r
789 if (currentViewStyle == APPCONTROL_VIEW_IMPORT)
\r
791 w_Title = width - (W_LISTVIEW_ITEM_BITMAP + 3 * X_LISTVIEW) - w_AudioPlay;
\r
793 else if (currentViewStyle == APPCONTROL_VIEW_EXPORT)
\r
795 w_Title = width - (W_LISTVIEW_ITEM_BITMAP + 3 * X_LISTVIEW);
\r
798 __titleRect.SetBounds(thumbnailX + thumbnailWidth + normalGap, (itemHeight - textHeight) / 2, w_Title + w_AudioPlay, H_LISTVIEW_ITEM_TITLE);
\r
800 if (__pPlayBitmap != null)
\r
802 __editPlayRect.SetBounds(x_Play, (itemHeight - w_AudioPlay) / 2, w_AudioPlay, h_AudioPlay);
\r
803 __titleRect.SetBounds(thumbnailX + thumbnailWidth + normalGap, (itemHeight - textHeight) / 2, w_Title, H_LISTVIEW_ITEM_TITLE);
\r
806 else if (__pPauseBitmap != null)
\r
808 __editPauseRect.SetBounds(x_Play, (itemHeight - w_AudioPlay) / 2, w_AudioPlay, h_AudioPlay);
\r
809 __titleRect.SetBounds(thumbnailX + thumbnailWidth + normalGap, (itemHeight - textHeight) / 2, w_Title, H_LISTVIEW_ITEM_TITLE);
\r
813 ContentListItem::MakeSearchFormListItem(void)
\r
815 AppLogDebug("Entry");
\r
816 int titleHeight = 0;
\r
817 int thumbnailX = X_LISTVIEW;
\r
818 int thumbnailY = X_LISTVIEW;
\r
819 int normalGap = X_LISTVIEW;
\r
820 int thumbnailWidth = W_LISTVIEW_ITEM_BITMAP;
\r
821 int thumbnailHeight = H_LISTVIEW_ITEM_BITMAP;
\r
822 int detailIconWidth = W_LISTVIEW_ITEM_BITMAP;
\r
823 int width = __itemWidth;
\r
826 GetItemSize(__itemHeight, titleHeight);
\r
828 if (__currentListStyle == ANNEX_STYLE_DETAILED)
\r
830 w_Title = width - (W_LISTVIEW_ITEM_BITMAP + 4 * X_LISTVIEW) - detailIconWidth;
\r
831 Construct(Dimension(__itemWidth, __itemHeight), LIST_ANNEX_STYLE_DETAILED);
\r
835 w_Title = width - (W_LISTVIEW_ITEM_BITMAP + 3 * X_LISTVIEW);
\r
836 Construct(Dimension(__itemWidth, __itemHeight), LIST_ANNEX_STYLE_NORMAL);
\r
839 SetElementTextVerticalAlignment(CONTENT_LIST_ITEM_TYPE_THUMBNAIL, ALIGNMENT_MIDDLE);
\r
840 SetElementTextVerticalAlignment(CONTENT_LIST_ITEM_TYPE_FILEPATH, ALIGNMENT_BOTTOM);
\r
842 __thumbnailRect.SetBounds(thumbnailX, thumbnailY, thumbnailWidth, thumbnailHeight); //right side width:20
\r
843 __titleRect.SetBounds((2 * thumbnailX) + thumbnailWidth, Y_LISTVIEW, w_Title, H_LISTVIEW_ITEM_TITLE);
\r
844 __editDateRect.SetBounds(thumbnailX + thumbnailWidth + normalGap, H_LISTVIEW_ITEM_TITLE + Y_LISTVIEW, w_Title, H_LISTVIEW_ITEM_DESCRIPTION);
\r
846 RefreshSearchFormListItem();
\r
847 AppLogDebug("Exit %s", GetErrorMessage(GetLastResult()));
\r
850 ContentListItem::RefreshSearchFormListItem(void)
\r
852 int thumbnailX = X_LISTVIEW;
\r
853 int normalGap = X_LISTVIEW;
\r
854 int thumbnailWidth = W_LISTVIEW_ITEM_BITMAP;
\r
855 int nMultiTextWidth = __itemWidth - thumbnailX - thumbnailWidth - 2 * normalGap;
\r
856 if (__pThumbnailBitmap != null)
\r
858 AddElement(__thumbnailRect, CONTENT_LIST_ITEM_TYPE_THUMBNAIL, *__pThumbnailBitmap, __pThumbnailBitmap, __pThumbnailBitmap);
\r
860 __pFtTitle = new (std::nothrow) FormatedText(nMultiTextWidth);
\r
861 if (__pFtTitle == null)
\r
863 if (__searchedText.GetLength() > 0)
\r
865 String tempTitleString = __contentTitle;
\r
866 tempTitleString.ToLowerCase();
\r
867 bool found = false;
\r
868 __searchedText.ToLowerCase();
\r
869 String temp1 = L"", temp2 = L"", temp3 = L"";
\r
871 if (tempTitleString.StartsWith(__searchedText, 0))
\r
874 __contentTitle.SubString(0, __searchedText.GetLength(), temp1);
\r
875 __contentTitle.SubString(__searchedText.GetLength(), __contentTitle.GetLength() - __searchedText.GetLength(), temp2);
\r
877 Color titleColor = Color(42, 137, 194);
\r
878 __pFtTitle->AddText(temp1, FONT_MAIN, titleColor);
\r
879 __pFtTitle->AddText(temp2, FONT_MAIN, COLOR_TITLE);
\r
884 tempTitleString.IndexOf(__searchedText, 0, index);
\r
887 __contentTitle.SubString(0, index, temp1);
\r
888 __contentTitle.SubString(index, __searchedText.GetLength(), temp2);
\r
889 __contentTitle.SubString(index + __searchedText.GetLength(), tempTitleString.GetLength() - __searchedText.GetLength() - index, temp3);
\r
893 __contentTitle.SubString(0, tempTitleString.GetLength(), temp1);
\r
895 __pFtTitle->SetTextWrap(TEXT_WRAP_NONE);
\r
896 Color titleColor = Color(42, 137, 194);
\r
897 if (temp1.GetLength() > 0)
\r
898 __pFtTitle->AddText(temp1, FONT_MAIN, COLOR_TITLE);
\r
899 if (temp2.GetLength() > 0)
\r
900 __pFtTitle->AddText(temp2, FONT_MAIN, titleColor);
\r
901 if (temp3.GetLength() > 0)
\r
902 __pFtTitle->AddText(temp3, FONT_MAIN, COLOR_TITLE);
\r
907 __pFtTitle->AddText(__contentTitle, FONT_MAIN, COLOR_TITLE);
\r
909 AddElement(__titleRect, CONTENT_LIST_ITEM_TYPE_TITLE, *__pFtTitle);
\r
911 __pFtFilepath = new (std::nothrow) FormatedText(nMultiTextWidth);
\r
912 if (__pFtFilepath == null)
\r
914 __pFtFilepath->SetTextWrap(TEXT_WRAP_NONE);
\r
915 __pFtFilepath->AddText(__filepath, FONT_SUB, COLOR_DATE);
\r
916 AddElement(__editDateRect, CONTENT_LIST_ITEM_TYPE_FILEPATH, *__pFtFilepath);
\r
919 ContentListItem::SetFilepath(const Tizen::Base::String& filePath)
\r
921 __filepath = filePath;
\r