2 // Open Service Platform
3 // Copyright (c) 2012-2013 Samsung Electronics Co., Ltd.
5 // Licensed under the Flora License, Version 1.0 (the License);
6 // you may not use this file except in compliance with the License.
7 // You may obtain a copy of the License at
9 // http://floralicense.org/license/
11 // Unless required by applicable law or agreed to in writing, software
12 // distributed under the License is distributed on an AS IS BASIS,
13 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 // See the License for the specific language governing permissions and
15 // limitations under the License.
19 * @file FUiCtrl_IconListView.cpp
20 * @brief This is the implementation file for the _IconListView class.
24 #include <FBaseSysLog.h>
25 #include <FUiCtrlIIconListViewItemProvider.h>
26 #include <FGrp_BitmapImpl.h>
28 #include "FUi_AccessibilityContainer.h"
29 #include "FUi_ResourceManager.h"
30 #include "FUiAnim_VisualElement.h"
31 #include "FUiCtrl_IconListItem.h"
32 #include "FUiCtrl_IconListPresenter.h"
33 #include "FUiCtrl_IconListView.h"
34 #include "FUiCtrl_IconListViewItemEventArg.h"
35 #include "FUiCtrl_IIconListItemEventListener.h"
36 #include "FUiCtrl_IScrollEventListener.h"
37 #include "FUiCtrl_UiIconListItemEvent.h"
38 #include "FUiCtrl_UiScrollEvent.h"
39 #include "FUiCtrl_UiScrollEventArg.h"
41 using namespace Tizen::Base;
42 using namespace Tizen::Graphics;
43 using namespace Tizen::Ui;
44 using namespace Tizen::Ui::Animations;
46 namespace Tizen { namespace Ui { namespace Controls
49 IMPLEMENT_PROPERTY(_IconListView);
51 _IconListView::_IconListView(void)
53 , __pIconListPresenter(null)
55 , __pIconListItemEvent(null)
56 , __pScrollEvent(null)
57 , __pGestureFlick(null)
58 , __pGestureLongPress(null)
59 , __style(ICON_LIST_VIEW_STYLE_NORMAL)
60 , __scrollStyle(ICON_LIST_SCROLL_STYLE_FADE_OUT)
61 , __pBackgroundBitmap(null)
62 , __textOfEmptyList(L"")
63 , __textColorOfEmptyList(0)
64 , __textSizeOfEmptyList(0)
65 , __pBitmapOfEmptyList(null)
66 , __reorderEnabled(false)
68 SetControlDelegate(*this);
69 AddPropertyChangeEventListener(*this);
71 _AccessibilityContainer* pContainer = GetAccessibilityContainer();
72 if (pContainer != null)
74 pContainer->Activate(true);
78 _IconListView::~_IconListView(void)
84 _IconListView::Dispose(void)
86 AnimationTransaction::SetTransactionEventListener(null);
88 delete __pIconListPresenter;
89 __pIconListPresenter = null;
91 delete __pBackgroundBitmap;
92 __pBackgroundBitmap = null;
94 delete __pBitmapOfEmptyList;
95 __pBitmapOfEmptyList = null;
97 if (__pIconListItemEvent != null)
99 delete __pIconListItemEvent;
100 __pIconListItemEvent = null;
103 if (__pScrollEvent != null)
105 delete __pScrollEvent;
106 __pScrollEvent = null;
109 if (__pScroll != null)
111 DetachSystemChild(*__pScroll);
116 if (__pGestureFlick != null)
118 _ITouchFlickGestureEventListener* pListener = dynamic_cast<_ITouchFlickGestureEventListener*>(this);
119 __pGestureFlick->RemoveGestureListener(*pListener);
120 RemoveGestureDetector(*__pGestureFlick);
121 delete __pGestureFlick;
122 __pGestureFlick = null;
125 if (__pGestureLongPress != null)
127 _ITouchLongPressGestureEventListener* pListener = dynamic_cast<_ITouchLongPressGestureEventListener*>(this);
128 __pGestureLongPress->RemoveGestureListener(*pListener);
129 RemoveGestureDetector(*__pGestureLongPress);
130 delete __pGestureLongPress;
131 __pGestureLongPress = null;
138 _IconListView::CreateIconListViewN(IconListViewStyle style)
140 result r = E_SUCCESS;
141 _IconListView* pCore = null;
142 _IconListPresenter* pIconListPresenter = null;
146 // Create _IconListView
147 pCore = new (std::nothrow) _IconListView;
148 SysTryReturn(NID_UI_CTRL, (pCore != null), null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.");
150 pCore->AcquireHandle();
152 // Create _IconListPresenter
153 pIconListPresenter = _IconListPresenter::CreateInstanceN(*pCore);
154 SysTryCatch(NID_UI_CTRL, (pIconListPresenter != null), , GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
156 r = pCore->Initialize(*pIconListPresenter);
157 SysTryCatch(NID_UI_CTRL, (r == E_SUCCESS), , r, "[%s] Propagating.", GetErrorMessage(r));
159 r = pCore->SetStyle(style);
160 SysTryCatch(NID_UI_CTRL, (r == E_SUCCESS), , r, "[%s] Propagating.", GetErrorMessage(r));
162 pCore->__pGestureFlick = new (std::nothrow) _TouchFlickGestureDetector();
164 pCore->AddGestureDetector(*(pCore->__pGestureFlick));
165 SysTryCatch(NID_UI_CTRL, (GetLastResult() == E_SUCCESS), , r = E_SYSTEM, "[E_SYSTEM] A system error has been occurred. AddGestureDetector failed.");
167 r = pCore->__pGestureFlick->AddGestureListener(*pCore);
168 SysTryCatch(NID_UI_CTRL, (r == E_SUCCESS), , r = E_SYSTEM, "[E_SYSTEM] A system error has been occurred. AddGestureListener failed.");
170 pCore->__pGestureLongPress = new (std::nothrow) _TouchLongPressGestureDetector();
171 pCore->AddGestureDetector(*(pCore->__pGestureLongPress));
172 SysTryCatch(NID_UI_CTRL, (GetLastResult() == E_SUCCESS), , r = E_SYSTEM, "[E_SYSTEM] A system error has been occurred. AddGestureDetector failed.");
174 r = pCore->__pGestureLongPress->AddGestureListener(*pCore);
175 SysTryCatch(NID_UI_CTRL, (r == E_SUCCESS), , r = E_SYSTEM, "[E_SYSTEM] A system error has been occurred. AddGestureListener failed.");
186 _IconListView::Initialize(_IconListPresenter& presenter)
188 result r = E_SUCCESS;
192 // Set _IconListPresenter
193 __pIconListPresenter = &presenter;
195 // Check _VisualElement
196 SysTryCatch(NID_UI_CTRL, (GetVisualElement() != null), r = E_SYSTEM, E_SYSTEM, "[E_SYSTEM] A system error has been occurred. Unable to initialize IconList.");
198 // Create _UiIconListItemEvent
199 __pIconListItemEvent = new (std::nothrow) _UiIconListItemEvent;
200 SysTryCatch(NID_UI_CTRL, (__pIconListItemEvent != null), r = E_OUT_OF_MEMORY, E_OUT_OF_MEMORY,
201 "[E_OUT_OF_MEMORY] Memory allocation failed.");
203 r = __pIconListItemEvent->Construct(*this);
204 SysTryCatch(NID_UI_CTRL, (r == E_SUCCESS), r = E_SYSTEM, E_SYSTEM, "[E_SYSTEM] A system error has been occurred. Unable to construct Event.");
206 // Create _UiScrollEvent
207 __pScrollEvent = new (std::nothrow) _UiScrollEvent;
208 SysTryCatch(NID_UI_CTRL, (__pScrollEvent != null), r = E_OUT_OF_MEMORY, E_OUT_OF_MEMORY,
209 "[E_OUT_OF_MEMORY] Memory allocation failed.");
211 r = __pScrollEvent->Construct(*this);
212 SysTryCatch(NID_UI_CTRL, (r == E_SUCCESS), r = E_SYSTEM, E_SYSTEM, "[E_SYSTEM] A system error has been occurred. Unable to construct Scroll Event.");
214 SetBackgroundColor(Color(0, 0, 0, 0));
216 // Load emtpy content properties
217 GET_SHAPE_CONFIG(ICONLIST::EMPTY_FONT_SIZE, GetOrientation(), textSize);
218 SetTextSizeOfEmptyList(textSize);
220 GET_COLOR_CONFIG(ICONLIST::EMPTY_TEXT_NORMAL, color);
221 SetTextColorOfEmptyList(color);
223 SetTextOfEmptyList(L"Empty List");
225 // Set Touch move allowance config
226 SetTouchMoveAllowance(TOUCH_MOVE_ALLOWANCE_NORMAL);
228 AnimationTransaction::SetTransactionEventListener(this);
238 _IconListView::SetItemProvider(const IIconListViewItemProvider& provider)
240 return __pIconListPresenter->SetItemProvider(provider);
244 _IconListView::RegisterItemProviderAdaptor(_IListItemProviderAdaptor* pItemProviderAdaptor)
246 return __pIconListPresenter->RegisterItemProviderAdaptor(pItemProviderAdaptor);
250 _IconListView::AddIconListItemEventListener(const _IIconListItemEventListener& listener)
252 result r = __pIconListItemEvent->AddListener(listener);
253 if (r == E_OBJ_ALREADY_EXIST)
255 SysLogException(NID_UI_CTRL, (r = E_SYSTEM), "[E_SYSTEM] A system error has been occurred. The same instance already exists in the event listener list.");
261 _IconListView::RemoveIconListItemEventListener(const _IIconListItemEventListener& listener)
263 return __pIconListItemEvent->RemoveListener(listener);
267 _IconListView::AddScrollEventListener(const _IScrollEventListener& listener)
269 result r = __pScrollEvent->AddListener(listener);
270 if (r == E_OBJ_ALREADY_EXIST)
272 SysLogException(NID_UI_CTRL, (r = E_SYSTEM), "[E_SYSTEM] A system error has been occurred. The same instance already exists in the event listener list.");
278 _IconListView::RemoveScrollEventListener(const _IScrollEventListener& listener)
280 return __pScrollEvent->RemoveListener(listener);
284 _IconListView::SetStyle(IconListViewStyle style)
286 SysTryReturn(NID_UI_CTRL, (style >= ICON_LIST_VIEW_STYLE_NORMAL && style <= ICON_LIST_VIEW_STYLE_MARK), E_INVALID_ARG,
287 E_INVALID_ARG, "[E_INVALID_ARG] Invalid style is used.");
290 __pIconListPresenter->SetUseCheckedStyle(__style == ICON_LIST_VIEW_STYLE_NORMAL ? false : true);
296 _IconListView::GetStyle(void) const
302 _IconListView::SetScrollDirection(IconListViewScrollDirection scrollDirection)
304 return __pIconListPresenter->SetScrollDirection(scrollDirection);
308 _IconListView::SetScrollStyle(IconListViewScrollStyle scrollStyle)
310 SysTryReturn(NID_UI_CTRL, scrollStyle >= ICON_LIST_SCROLL_STYLE_FADE_OUT && scrollStyle <= ICON_LIST_SCROLL_STYLE_THUMB,
311 E_INVALID_ARG, E_INVALID_ARG, "[E_INVALID_ARG] Invalid scrollStyle is used.");
313 __scrollStyle = scrollStyle;
318 _IconListView::SetBackgroundBitmap(const Bitmap* pBitmap)
320 result r = E_SUCCESS;
322 Bitmap* pCopiedBitmap = null;
325 pCopiedBitmap = _BitmapImpl::CloneN(*pBitmap);
331 delete __pBackgroundBitmap;
332 __pBackgroundBitmap = pCopiedBitmap;
336 delete pCopiedBitmap;
339 __pIconListPresenter->ClearVisualElement();
345 _IconListView::GetBackgroundBitmap(void) const
347 return __pBackgroundBitmap;
351 _IconListView::SetMargin(MarginType type, int value)
355 case MARGIN_TYPE_TOP:
356 return __pIconListPresenter->SetTopMargin(value);
358 case MARGIN_TYPE_BOTTOM:
359 return __pIconListPresenter->SetBottomMargin(value);
361 case MARGIN_TYPE_LEFT:
362 return __pIconListPresenter->SetLeftMargin(value);
364 case MARGIN_TYPE_RIGHT:
365 return __pIconListPresenter->SetRightMargin(value);
368 SysLogException(NID_UI_CTRL, E_INVALID_ARG, "[E_INVALID_ARG] Invalid type is used.");
369 return E_INVALID_ARG;
373 _IconListView::GetMargin(MarginType type) const
377 case MARGIN_TYPE_TOP:
378 return __pIconListPresenter->GetTopMargin();
380 case MARGIN_TYPE_BOTTOM:
381 return __pIconListPresenter->GetBottomMargin();
383 case MARGIN_TYPE_LEFT:
384 return __pIconListPresenter->GetLeftMargin();
386 case MARGIN_TYPE_RIGHT:
387 return __pIconListPresenter->GetRightMargin();
390 SysLogException(NID_UI_CTRL, E_INVALID_ARG, "[E_INVALID_ARG] Invalid argument is used.");
395 _IconListView::SetItemSpacing(int horizontalSpacing, int verticalSpacing)
397 return __pIconListPresenter->SetItemSpacing(horizontalSpacing, verticalSpacing);
401 _IconListView::GetItemHorizontalSpacing(void) const
403 return __pIconListPresenter->GetItemHorizontalSpacing();
407 _IconListView::GetItemVerticalSpacing(void) const
409 return __pIconListPresenter->GetItemVerticalSpacing();
413 _IconListView::SetItemChecked(int index, bool check)
415 SysTryReturn(NID_UI_CTRL, (__style == ICON_LIST_VIEW_STYLE_RADIO || __style == ICON_LIST_VIEW_STYLE_MARK), E_SYSTEM, E_SYSTEM,
416 "[E_SYSTEM] A system error has been occurred. The style of IconListView is not available to check.");
418 return __pIconListPresenter->SetItemChecked(index, check);
422 _IconListView::IsItemChecked(int index) const
424 SysTryReturn(NID_UI_CTRL, (__style == ICON_LIST_VIEW_STYLE_RADIO || __style == ICON_LIST_VIEW_STYLE_MARK), false, E_SYSTEM,
425 "[E_SYSTEM] A system error has been occurred. The style of IconListView is not available to check.");
427 return __pIconListPresenter->IsItemChecked(index);
431 _IconListView::GetItemIndexFromPosition(int x, int y) const
433 return __pIconListPresenter->GetItemIndexFromPosition(x, y);
437 _IconListView::GetItemIndexFromPosition(const Point& position) const
439 return __pIconListPresenter->GetItemIndexFromPosition(position);
443 _IconListView::SetPropertyTextHorizontalAlignment(const Variant& alignment)
445 return __pIconListPresenter->SetTextHorizontalAlignment(static_cast<HorizontalAlignment>(alignment.ToInt()));
449 _IconListView::SetTextHorizontalAlignment(HorizontalAlignment alignment)
451 return SetProperty("textHorizontalAlignment", Variant(static_cast<int>(alignment)));
455 _IconListView::SetPropertyTextVerticalAlignment(const Variant& alignment)
457 return __pIconListPresenter->SetTextVerticalAlignment(static_cast<IconListViewItemTextVerticalAlignment>(alignment.ToInt()));
461 _IconListView::SetTextVerticalAlignment(IconListViewItemTextVerticalAlignment alignment)
463 return SetProperty("textVerticalAlignment", Variant(static_cast<int>(alignment)));
467 _IconListView::GetPropertyTextHorizontalAlignment(void) const
469 return Variant(static_cast<int>(__pIconListPresenter->GetTextHorizontalAlignment()));
473 _IconListView::GetTextHorizontalAlignment(void) const
475 Variant alignment = GetProperty("textHorizontalAlignment");
476 return static_cast<HorizontalAlignment> (alignment.ToInt());
480 _IconListView::GetPropertyTextVerticalAlignment(void) const
482 return Variant(static_cast<int>(__pIconListPresenter->GetTextVerticalAlignment()));
485 IconListViewItemTextVerticalAlignment
486 _IconListView::GetTextVerticalAlignment(void) const
488 Variant alignment = GetProperty("textVerticalAlignment");
489 return static_cast<IconListViewItemTextVerticalAlignment> (alignment.ToInt());
493 _IconListView::SetPropertyTextOfEmptyList(const Variant& text)
495 __textOfEmptyList = text.ToString();
497 if (__pIconListPresenter != null)
499 __pIconListPresenter->ClearVisualElement();
506 _IconListView::SetTextOfEmptyList(const String& text)
508 return SetProperty("textOfEmptyList", Variant(text));
512 _IconListView::GetPropertyTextOfEmptyList(void) const
515 return Variant(__textOfEmptyList);
519 _IconListView::GetTextOfEmptyList(void) const
521 Variant text = GetProperty("textOfEmptyList");
522 return text.ToString();
526 _IconListView::SetPropertyTextColorOfEmptyList(const Variant& color)
528 __textColorOfEmptyList = color.ToColor();
529 __pIconListPresenter->ClearVisualElement();
534 _IconListView::SetTextColorOfEmptyList(const Color& color)
536 return SetProperty("textColorOfEmptyList", Variant(color));
540 _IconListView::GetPropertyTextColorOfEmptyList(void) const
543 return Variant(__textColorOfEmptyList);
547 _IconListView::GetTextColorOfEmptyList(void) const
549 Variant color = GetProperty("textColorOfEmptyList");
550 return color.ToColor();
554 _IconListView::SetTextSizeOfEmptyList(int size)
557 GET_FIXED_VALUE_CONFIG(ICONLIST::MINIMUM_FONT_SIZE, GetOrientation(), minSize);
558 SysTryReturn(NID_UI_CTRL, (size >= minSize), E_INVALID_ARG, E_INVALID_ARG,
559 "[E_INVALID_ARG] Invalid argument is used. Font size should be greater than or equal to the minimum size.");
561 __textSizeOfEmptyList = size;
567 _IconListView::GetTextSizeOfEmptyList(void) const
569 return __textSizeOfEmptyList;
573 _IconListView::SetItemTextColor(IconListViewItemDrawingStatus status, const Color& color)
575 return __pIconListPresenter->SetItemTextColor(status, color);
579 _IconListView::GetItemTextColor(IconListViewItemDrawingStatus status) const
581 return __pIconListPresenter->GetItemTextColor(status);
585 _IconListView::SetPropertyItemTextSize(const Variant& size)
587 return __pIconListPresenter->SetItemTextSize(size.ToInt());
591 _IconListView::SetItemTextSize(int size)
593 return SetProperty("itemTextSize", Variant(size));
597 _IconListView::GetPropertyItemTextSize(void) const
599 return Variant(__pIconListPresenter->GetItemTextSize());
603 _IconListView::GetItemTextSize(void) const
605 Variant size = GetProperty("itemTextSize");
610 _IconListView::SetPropertyCheckBoxPosition(const Variant& position)
612 SysTryReturn(NID_UI_CTRL, (__style == ICON_LIST_VIEW_STYLE_RADIO || __style == ICON_LIST_VIEW_STYLE_MARK), E_INVALID_OPERATION,
613 E_INVALID_OPERATION, "[E_INVALID_OPERATION] The current style of IconListView is not available to check. So can not set position of checkbox.");
615 return __pIconListPresenter->SetCheckBoxPosition(static_cast<IconListViewCheckBoxPosition>(position.ToInt()));
619 _IconListView::SetCheckBoxPosition(IconListViewCheckBoxPosition position)
621 return SetProperty("checkBoxPosition", Variant(static_cast<int>(position)));
625 _IconListView::GetPropertyCheckBoxPosition(void) const
627 SysTryReturn(NID_UI_CTRL, (__style == ICON_LIST_VIEW_STYLE_RADIO || __style == ICON_LIST_VIEW_STYLE_MARK),
628 Variant(static_cast<int>(ICON_LIST_VIEW_CHECK_BOX_POSITION_TOP_LEFT)), E_INVALID_OPERATION,
629 "[E_INVALID_OPERATION] The current style of IconListView is not available to check. So can not get position of checkBox.");
631 return Variant(static_cast<int>(__pIconListPresenter->GetCheckBoxPosition()));
634 IconListViewCheckBoxPosition
635 _IconListView::GetCheckBoxPosition(void) const
637 Variant position = GetProperty("checkBoxPosition");
638 return static_cast<IconListViewCheckBoxPosition>(position.ToInt());
642 _IconListView::SetPropertyTouchAnimationEnabled(const Variant& enabled)
644 return __pIconListPresenter->SetTouchAnimationEnabled(enabled.ToBool());
648 _IconListView::SetTouchAnimationEnabled(bool enable)
650 return SetProperty("touchAnimationEnabled", Variant(enable));
654 _IconListView::GetPropertyTouchAnimationEnabled(void) const
656 return Variant(__pIconListPresenter->IsTouchAnimationEnabled());
660 _IconListView::IsTouchAnimationEnabled(void) const
662 Variant enabled = GetProperty("touchAnimationEnabled");
663 return enabled.ToBool();
667 _IconListView::ScrollToItem(int index)
669 return __pIconListPresenter->ScrollToItem(index);
673 _IconListView::ScrollByPixel(int pixel)
675 return __pIconListPresenter->ScrollByPixel(pixel);
679 _IconListView::RefreshList(int index, ListRefreshType type)
681 return __pIconListPresenter->RefreshList(index, type);
685 _IconListView::UpdateList(void)
687 return __pIconListPresenter->UpdateList();
691 _IconListView::SetItemBitmapBounds(const Rectangle& bounds)
693 return __pIconListPresenter->SetItemBitmapBounds(bounds);
697 _IconListView::GetItemBitmapBounds(void) const
699 return __pIconListPresenter->GetItemBitmapBounds();
703 _IconListView::GetItemBitmapSize(int& width, int& height) const
705 return __pIconListPresenter->GetItemBitmapSize(width, height);
709 _IconListView::GetItemBitmapSize(void) const
711 return __pIconListPresenter->GetItemBitmapSize();
715 _IconListView::SetItemSize(const Dimension& size)
717 return __pIconListPresenter->SetItemSize(size);
721 _IconListView::GetItemSize(int& width, int& height) const
723 return __pIconListPresenter->GetItemSize(width, height);
727 _IconListView::GetItemSize(void) const
729 return __pIconListPresenter->GetItemSize();
733 _IconListView::SetPropertyMagneticScrollSize(const Variant& size)
735 return __pIconListPresenter->SetMagneticScrollSize(size.ToInt());
739 _IconListView::SetMagneticScrollSize(int scrollSize)
741 return SetProperty("magneticScrollSize", Variant(scrollSize));
745 _IconListView::GetPropertyMagneticScrollSize(void) const
747 return Variant(__pIconListPresenter->GetMagneticScrollSize());
751 _IconListView::GetMagneticScrollSize(void) const
753 Variant size = GetProperty("magneticScrollSize");
758 _IconListView::GetItemCountPerAxis(void) const
760 return __pIconListPresenter->GetItemCountPerAxis();
764 _IconListView::SetPropertyItemLayoutHorizontalAlignment(const Variant& alignment)
766 return __pIconListPresenter->SetItemLayoutHorizontalAlignment(static_cast<HorizontalAlignment>(alignment.ToInt()));
770 _IconListView::SetItemLayoutHorizontalAlignment(HorizontalAlignment alignment)
772 return SetProperty("itemLayoutHorizontalAlignment", Variant(static_cast<int>(alignment)));
776 _IconListView::SetPropertyItemLayoutVerticalAlignment(const Variant& alignment)
778 return __pIconListPresenter->SetItemLayoutVerticalAlignment(static_cast<VerticalAlignment>(alignment.ToInt()));
782 _IconListView::SetItemLayoutVerticalAlignment(VerticalAlignment alignment)
784 return SetProperty("itemLayoutVerticalAlignment", Variant(static_cast<int>(alignment)));
788 _IconListView::GetPropertyItemLayoutHorizontalAlignment(void) const
790 return Variant(static_cast<int>(__pIconListPresenter->GetItemLayoutHorizontalAlignment()));
794 _IconListView::GetItemLayoutHorizontalAlignment(void) const
796 Variant alignment = GetProperty("itemLayoutHorizontalAlignment");
797 return static_cast<HorizontalAlignment>(alignment.ToInt());
801 _IconListView::GetPropertyItemLayoutVerticalAlignment(void) const
803 return Variant(static_cast<int>(__pIconListPresenter->GetItemLayoutVerticalAlignment()));
807 _IconListView::GetItemLayoutVerticalAlignment(void) const
809 Variant alignment = GetProperty("itemLayoutVerticalAlignment");
810 return static_cast<VerticalAlignment>(alignment.ToInt());
814 _IconListView::SetPropertyItemBorderStyle(const Variant& style)
816 return __pIconListPresenter->SetItemBorderStyle(static_cast<IconListViewItemBorderStyle>(style.ToInt()));
820 _IconListView::SetItemBorderStyle(IconListViewItemBorderStyle borderStyle)
822 return SetProperty("itemBorderStyle", Variant(static_cast<int>(borderStyle)));
826 _IconListView::GetPropertyItemBorderStyle(void) const
828 return Variant(static_cast<int>(__pIconListPresenter->GetItemBorderStyle()));
831 IconListViewItemBorderStyle
832 _IconListView::GetItemBorderStyle(void) const
834 Variant style = GetProperty("itemBorderStyle");
835 return static_cast<IconListViewItemBorderStyle>(style.ToInt());
839 _IconListView::SetBitmapOfEmptyList(const Bitmap* pBitmap)
841 result r = E_SUCCESS;
842 Bitmap* pCopiedBitmap = null;
845 pCopiedBitmap = _BitmapImpl::CloneN(*pBitmap);
851 delete __pBitmapOfEmptyList;
852 __pBitmapOfEmptyList = pCopiedBitmap;
856 delete pCopiedBitmap;
859 __pIconListPresenter->ClearVisualElement();
865 _IconListView::GetBitmapOfEmptyList(void) const
867 return __pBitmapOfEmptyList;
871 _IconListView::SetNonSlidableList(void)
873 return __pIconListPresenter->SetNonSlidableList();
877 _IconListView::AddItem(_IconListItem* pItem)
879 return __pIconListPresenter->AddItem(pItem);
883 _IconListView::InsertItemAt(int index, _IconListItem* pItem)
885 return __pIconListPresenter->InsertItemAt(index, pItem);
889 _IconListView::SetItemAt(int index, _IconListItem* pItem)
891 return __pIconListPresenter->SetItemAt(index, pItem);
895 _IconListView::RemoveItemAt(int index)
897 return __pIconListPresenter->RemoveItemAt(index);
901 _IconListView::RemoveAllItems(void)
903 return __pIconListPresenter->RemoveAllItems();
907 _IconListView::SetScroll(const Rectangle& bounds, _ScrollDirection scrollDirection)
909 if (__pScroll == null)
911 __pScroll = _Scroll::CreateScrollN(*this, scrollDirection,
912 (((__scrollStyle == ICON_LIST_SCROLL_STYLE_FIXED) || (__scrollStyle == ICON_LIST_SCROLL_STYLE_THUMB)) ? false : true),
913 ((__scrollStyle == ICON_LIST_SCROLL_STYLE_JUMP_TO_TOP) ? true : false),
914 ((__scrollStyle == ICON_LIST_SCROLL_STYLE_THUMB) ? true : false),
915 (((__scrollStyle == ICON_LIST_SCROLL_STYLE_FIXED) || (__scrollStyle == ICON_LIST_SCROLL_STYLE_THUMB)) ? true : false), 1, 1, 0);
917 SysTryReturn(NID_UI_CTRL, __pScroll != null, E_OUT_OF_MEMORY, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.");
919 __pScroll->EnableScrollingEffect(true);
920 __pScroll->SetParentUsingViewport(false);
921 __pScroll->AddScrollEventListener(*__pIconListPresenter);
923 AttachSystemChild(*__pScroll);
930 _IconListView::GetScroll(void) const
936 _IconListView::SetItemBitmapAsAspectRatio(bool isAspect)
938 __pIconListPresenter->SetItemBitmapAsAspectRatio(isAspect);
942 _IconListView::IsItemBitmapAsAspectRatio(void) const
944 return __pIconListPresenter->IsItemBitmapAsAspectRatio();
947 _UiIconListItemEvent*
948 _IconListView::GetIconListItemEvent(void) const
950 return __pIconListItemEvent;
954 _IconListView::GetScrollEvent(void) const
956 return __pScrollEvent;
959 _TouchLongPressGestureDetector*
960 _IconListView::GetLongPressGesture(void) const
962 return __pGestureLongPress;
966 _IconListView::SetLongPressGesture(_TouchLongPressGestureDetector* pLongPress)
968 __pGestureLongPress = pLongPress;
972 _TouchFlickGestureDetector*
973 _IconListView::GetFlickGesture(void) const
975 return __pGestureFlick;
979 _IconListView::SetFlickGesture(_TouchFlickGestureDetector* pFlick)
981 __pGestureFlick = pFlick;
986 _IconListView::SetReorderModeEnabled(bool enable)
988 if (__reorderEnabled != enable)
990 __reorderEnabled = enable;
991 return __pIconListPresenter->SetReorderModeEnabled(enable);
997 _IconListView::IsInReorderingMode(void) const
1000 return __reorderEnabled;
1004 _IconListView::OnBoundsChanged(void)
1006 __pIconListPresenter->OnBoundsChanged();
1010 _IconListView::OnDraw(void)
1012 __pIconListPresenter->Draw();
1016 _IconListView::OnAncestorVisibleStateChanged(const _Control& control)
1018 _Control::OnAncestorVisibleStateChanged(control);
1020 OnVisibleStateChanged();
1024 _IconListView::OnAncestorEnableStateChanged(const _Control& control)
1026 _Control::OnAncestorEnableStateChanged(control);
1028 OnVisibleStateChanged();
1032 _IconListView::OnChangeLayout(_ControlOrientation orientation)
1034 _Control::OnChangeLayout(orientation);
1036 __pIconListPresenter->ClearVisualElement();
1040 _IconListView::OnFontInfoRequested(unsigned long& style, int& size)
1042 __pIconListPresenter->OnFontInfoRequested(style, size);
1046 _IconListView::OnFontChanged(Font* pFont)
1048 __pIconListPresenter->OnFontChanged(pFont);
1051 // Tizen::Ui::_IPreviewKeyEventListener
1053 _IconListView::OnPreviewKeyPressed(const _Control& source, const _KeyInfo& keyInfo)
1055 return __pIconListPresenter->OnPreviewKeyPressed(source, keyInfo);
1059 _IconListView::OnPreviewKeyReleased(const _Control& source, const _KeyInfo& keyInfo)
1061 return __pIconListPresenter->OnPreviewKeyReleased(source, keyInfo);
1064 // Tizen::Ui::_IKeyEventListener
1066 _IconListView::OnKeyPressed(const _Control& source, const _KeyInfo& keyInfo)
1068 return __pIconListPresenter->OnKeyPressed(source, keyInfo);
1072 _IconListView::OnKeyReleased(const _Control& source, const _KeyInfo& keyInfo)
1074 return __pIconListPresenter->OnKeyReleased(source, keyInfo);
1077 // Tizen::Ui::_IPreviewNotificationEventListener
1079 _IconListView::OnPreviewNotifiedN(const _Control& source, Collection::IList* pArgs)
1081 return __pIconListPresenter->OnPreviewNotifiedN(source, pArgs);
1084 // Tizen::Ui::_INotificationEventListener
1086 _IconListView::OnNotifiedN(const _Control& source, Collection::IList* pArgs)
1088 return __pIconListPresenter->OnNotifiedN(source, pArgs);
1091 // Tizen::Ui::_ITouchEventPreviewer
1092 _UiTouchEventDelivery
1093 _IconListView::OnPreviewTouchReleased(const _Control& source, const _TouchInfo& touchinfo)
1095 return __pIconListPresenter->OnPreviewTouchReleased(source, touchinfo);
1098 // Tizen::Ui::_ITouchEventListener
1100 _IconListView::OnTouchPressed(const _Control& source, const _TouchInfo& touchinfo)
1102 return __pIconListPresenter->OnTouchPressed(source, touchinfo);
1106 _IconListView::OnTouchReleased(const _Control& source, const _TouchInfo& touchinfo)
1108 return __pIconListPresenter->OnTouchReleased(source, touchinfo);
1112 _IconListView::OnTouchMoved(const _Control& source, const _TouchInfo& touchinfo)
1114 return __pIconListPresenter->OnTouchMoved(source, touchinfo);
1118 _IconListView::OnTouchCanceled(const _Control& source, const _TouchInfo& touchinfo)
1120 return __pIconListPresenter->OnTouchCanceled(source, touchinfo);
1124 _IconListView::OnFlickGestureDetected(_TouchFlickGestureDetector& gesture)
1128 gesture.GetDistance(xDistance, yDistance);
1129 Point flickPoint(xDistance, yDistance);
1131 return __pIconListPresenter->OnFlickGestureDetected(true, flickPoint, gesture.GetDuration());
1135 _IconListView::OnFlickGestureCanceled(_TouchFlickGestureDetector& gesture)
1141 _IconListView::OnLongPressGestureDetected(_TouchLongPressGestureDetector& gesture)
1143 return __pIconListPresenter->OnLongPressGestureDetected();
1147 _IconListView::OnLongPressGestureCanceled(_TouchLongPressGestureDetector& gesture)
1153 _IconListView::OnPropertyChanging(_PropertyBase& source, const String& name, const Variant& oldValue, const Variant& newValue)
1159 _IconListView::OnPropertyChanged(_PropertyBase& source, const String& name, const Variant& oldValue, const Variant& newValue)
1165 _IconListView::OnVisibleStateChanged(void)
1167 if (__pScroll != null)
1169 bool enableFadeEffect = __pScroll->IsEnabledFadeEffect();
1170 if (GetVisibleState() == false)
1172 if (enableFadeEffect)
1174 __pScroll->SetScrollVisibility(false);
1177 else if (enableFadeEffect)
1179 int scrollViewRange = 0;
1180 int scrollRange = 0;
1181 __pScroll->GetScrollRange(&scrollViewRange, &scrollRange);
1183 if (scrollViewRange < scrollRange)
1185 __pIconListPresenter->ScrollFadeOut();
1190 __pIconListPresenter->OnVisibleStateChanged();
1193 // Tizen::Ui::_IScrollEventListener
1195 _IconListView::OnScrollEndReached(_Control& source, ScrollEndEvent type)
1197 __pIconListPresenter->OnScrollEndReached(source, type);
1201 _IconListView::OnScrollPositionChanged(_Control& source, int scrollPos)
1203 __pIconListPresenter->OnScrollPositionChanged(source, scrollPos);
1207 _IconListView::OnScrollStopped(_Control& source)
1209 __pIconListPresenter->OnScrollStopped(source);
1212 // Tizen::Ui::Animations::IAnimationTransactionEventListener
1214 _IconListView::OnAnimationTransactionStarted(int transactionId)
1219 _IconListView::OnAnimationTransactionStopped(int transactionId)
1221 if (__pIconListPresenter != null)
1223 __pIconListPresenter->OnAnimationTransactionStopped(transactionId);
1228 _IconListView::OnAnimationTransactionFinished(int transactionId)
1230 if (__pIconListPresenter != null)
1232 __pIconListPresenter->OnAnimationTransactionFinished(transactionId);
1236 }}} // Tizen::Ui::Controls