2 // Open Service Platform
3 // Copyright (c) 2012-2013 Samsung Electronics Co., Ltd.
5 // Licensed under the Apache License, Version 2.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://www.apache.org/licenses/LICENSE-2.0/
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 <FUiCtrlIIconListViewItemProvider.h>
25 #include <FGrp_BitmapImpl.h>
27 #include "FUi_AccessibilityContainer.h"
28 #include "FUi_CoordinateSystemUtils.h"
30 #include "FUi_ResourceManager.h"
31 #include "FUiAnim_VisualElement.h"
32 #include "FUiCtrl_IconListItem.h"
33 #include "FUiCtrl_IconListPresenter.h"
34 #include "FUiCtrl_IconListView.h"
35 #include "FUiCtrl_IconListViewItemEventArg.h"
36 #include "FUiCtrl_IIconListItemEventListener.h"
37 #include "FUiCtrl_IScrollEventListener.h"
38 #include "FUiCtrl_UiIconListItemEvent.h"
39 #include "FUiCtrl_UiScrollEvent.h"
40 #include "FUiCtrl_UiScrollEventArg.h"
42 using namespace Tizen::Base;
43 using namespace Tizen::Graphics;
44 using namespace Tizen::Ui;
45 using namespace Tizen::Ui::Animations;
47 namespace Tizen { namespace Ui { namespace Controls
50 IMPLEMENT_PROPERTY(_IconListView);
52 _IconListView::_IconListView(void)
54 , __pIconListPresenter(null)
56 , __pIconListItemEvent(null)
57 , __pScrollEvent(null)
58 , __pGestureFlick(null)
59 , __pGestureLongPress(null)
60 , __style(ICON_LIST_VIEW_STYLE_NORMAL)
61 , __scrollStyle(ICON_LIST_SCROLL_STYLE_FADE_OUT)
62 , __pBackgroundBitmap(null)
63 , __textOfEmptyList(L"")
64 , __textColorOfEmptyList(0)
65 , __textSizeOfEmptyList(0)
66 , __pBitmapOfEmptyList(null)
67 , __reorderEnabled(false)
68 , __pScrollingAnimation(null)
69 , __scrollInputMode(SCROLL_INPUT_MODE_ALLOW_ANY_DIRECTION)
71 SetControlDelegate(*this);
72 AddPropertyChangeEventListener(*this);
74 _AccessibilityContainer* pContainer = GetAccessibilityContainer();
75 if (pContainer != null)
77 pContainer->Activate(true);
81 _IconListView::~_IconListView(void)
87 _IconListView::Dispose(void)
89 AnimationTransaction::SetTransactionEventListener(null);
91 if (__pScrollingAnimation != null)
93 __pScrollingAnimation->SetVisualElementAnimationTickEventListener(null);
94 __pScrollingAnimation->SetVisualElementAnimationStatusEventListener(null);
96 GetVisualElement()->RemoveAllAnimations();
98 delete __pScrollingAnimation;
99 __pScrollingAnimation = null;
102 delete __pIconListPresenter;
103 __pIconListPresenter = null;
105 delete __pBackgroundBitmap;
106 __pBackgroundBitmap = null;
108 delete __pBitmapOfEmptyList;
109 __pBitmapOfEmptyList = null;
111 delete __pIconListItemEvent;
112 __pIconListItemEvent = null;
114 delete __pScrollEvent;
115 __pScrollEvent = null;
117 if (__pScroll != null)
119 DetachSystemChild(*__pScroll);
124 if (__pGestureFlick != null)
126 _ITouchFlickGestureEventListener* pListener = dynamic_cast<_ITouchFlickGestureEventListener*>(this);
127 __pGestureFlick->RemoveGestureListener(*pListener);
128 RemoveGestureDetector(*__pGestureFlick);
129 delete __pGestureFlick;
130 __pGestureFlick = null;
133 if (__pGestureLongPress != null)
135 _ITouchLongPressGestureEventListener* pListener = dynamic_cast<_ITouchLongPressGestureEventListener*>(this);
136 __pGestureLongPress->RemoveGestureListener(*pListener);
137 RemoveGestureDetector(*__pGestureLongPress);
138 delete __pGestureLongPress;
139 __pGestureLongPress = null;
146 _IconListView::CreateIconListViewN(IconListViewStyle style)
148 result r = E_SUCCESS;
149 _IconListView* pCore = null;
150 _IconListPresenter* pIconListPresenter = null;
154 // Create _IconListView
155 pCore = new (std::nothrow) _IconListView;
156 SysTryReturn(NID_UI_CTRL, (pCore != null), null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.");
158 pCore->AcquireHandle();
160 // Create _IconListPresenter
161 pIconListPresenter = _IconListPresenter::CreateInstanceN(*pCore);
162 SysTryCatch(NID_UI_CTRL, (pIconListPresenter != null), , GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
164 r = pCore->Initialize(*pIconListPresenter);
165 SysTryCatch(NID_UI_CTRL, (r == E_SUCCESS), , r, "[%s] Propagating.", GetErrorMessage(r));
167 r = pCore->SetStyle(style);
168 SysTryCatch(NID_UI_CTRL, (r == E_SUCCESS), , r, "[%s] Propagating.", GetErrorMessage(r));
170 pCore->__pGestureFlick = new (std::nothrow) _TouchFlickGestureDetector();
172 pCore->AddGestureDetector(*(pCore->__pGestureFlick));
173 SysTryCatch(NID_UI_CTRL, (GetLastResult() == E_SUCCESS), , r = E_SYSTEM, "[E_SYSTEM] A system error has been occurred. AddGestureDetector failed.");
175 r = pCore->__pGestureFlick->AddGestureListener(*pCore);
176 SysTryCatch(NID_UI_CTRL, (r == E_SUCCESS), , r = E_SYSTEM, "[E_SYSTEM] A system error has been occurred. AddGestureListener failed.");
178 pCore->__pGestureLongPress = new (std::nothrow) _TouchLongPressGestureDetector();
179 pCore->AddGestureDetector(*(pCore->__pGestureLongPress));
180 SysTryCatch(NID_UI_CTRL, (GetLastResult() == E_SUCCESS), , r = E_SYSTEM, "[E_SYSTEM] A system error has been occurred. AddGestureDetector failed.");
182 r = pCore->__pGestureLongPress->AddGestureListener(*pCore);
183 SysTryCatch(NID_UI_CTRL, (r == E_SUCCESS), , r = E_SYSTEM, "[E_SYSTEM] A system error has been occurred. AddGestureListener failed.");
194 _IconListView::Initialize(_IconListPresenter& presenter)
196 result r = E_SUCCESS;
198 float textSize = 0.0f;
200 // Set _IconListPresenter
201 __pIconListPresenter = &presenter;
203 // Check _VisualElement
204 SysTryCatch(NID_UI_CTRL, (GetVisualElement() != null), r = E_SYSTEM, E_SYSTEM, "[E_SYSTEM] A system error has been occurred. Unable to initialize IconList.");
206 // Create _UiIconListItemEvent
207 __pIconListItemEvent = new (std::nothrow) _UiIconListItemEvent;
208 SysTryCatch(NID_UI_CTRL, (__pIconListItemEvent != null), r = E_OUT_OF_MEMORY, E_OUT_OF_MEMORY,
209 "[E_OUT_OF_MEMORY] Memory allocation failed.");
211 r = __pIconListItemEvent->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 Event.");
214 // Create _UiScrollEvent
215 __pScrollEvent = new (std::nothrow) _UiScrollEvent;
216 SysTryCatch(NID_UI_CTRL, (__pScrollEvent != null), r = E_OUT_OF_MEMORY, E_OUT_OF_MEMORY,
217 "[E_OUT_OF_MEMORY] Memory allocation failed.");
219 r = __pScrollEvent->Construct(*this);
220 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.");
222 SetBackgroundColor(Color(0, 0, 0, 0));
224 // Load emtpy content properties
225 GET_SHAPE_CONFIG(ICONLIST::EMPTY_FONT_SIZE, GetOrientation(), textSize);
226 SetTextSizeOfEmptyList(textSize);
228 GET_COLOR_CONFIG(ICONLIST::EMPTY_TEXT_NORMAL, color);
229 SetTextColorOfEmptyList(color);
231 // Set Touch move allowance config
232 SetTouchPressThreshold(0.08);
234 AnimationTransaction::SetTransactionEventListener(this);
236 __pScrollingAnimation = new (std::nothrow) VisualElementValueAnimation;
237 SysTryCatch(NID_UI_CTRL, (__pScrollEvent != null), r = E_OUT_OF_MEMORY, E_OUT_OF_MEMORY,
238 "[E_OUT_OF_MEMORY] Memory allocation failed.");
240 __pScrollingAnimation->SetRepeatCount(SCROLL_ANIMATION_DEFAULT_REPEAT_COUNT);
241 __pScrollingAnimation->SetTimingFunction(VisualElementAnimation::GetTimingFunctionByName("EaseOut"));
243 SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
245 __pScrollingAnimation->SetVisualElementAnimationTickEventListener(this);
247 SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
249 __pScrollingAnimation->SetVisualElementAnimationStatusEventListener(this);
251 SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
261 _IconListView::SetItemProvider(const IIconListViewItemProvider& provider)
263 return __pIconListPresenter->SetItemProvider(provider);
267 _IconListView::RegisterItemProviderAdaptor(_IListItemProviderAdaptor* pItemProviderAdaptor)
269 return __pIconListPresenter->RegisterItemProviderAdaptor(pItemProviderAdaptor);
273 _IconListView::AddIconListItemEventListener(const _IIconListItemEventListener& listener)
275 result r = __pIconListItemEvent->AddListener(listener);
276 if (r == E_OBJ_ALREADY_EXIST)
278 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.");
284 _IconListView::RemoveIconListItemEventListener(const _IIconListItemEventListener& listener)
286 return __pIconListItemEvent->RemoveListener(listener);
290 _IconListView::AddScrollEventListener(const _IScrollEventListener& listener)
292 result r = __pScrollEvent->AddListener(listener);
293 if (r == E_OBJ_ALREADY_EXIST)
295 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.");
301 _IconListView::RemoveScrollEventListener(const _IScrollEventListener& listener)
303 return __pScrollEvent->RemoveListener(listener);
307 _IconListView::SetStyle(IconListViewStyle style)
309 SysTryReturn(NID_UI_CTRL, (style >= ICON_LIST_VIEW_STYLE_NORMAL && style <= ICON_LIST_VIEW_STYLE_MARK), E_INVALID_ARG,
310 E_INVALID_ARG, "[E_INVALID_ARG] Invalid style is used.");
313 __pIconListPresenter->SetUseCheckedStyle(__style == ICON_LIST_VIEW_STYLE_NORMAL ? false : true);
319 _IconListView::GetStyle(void) const
325 _IconListView::SetScrollDirection(IconListViewScrollDirection scrollDirection)
327 return __pIconListPresenter->SetScrollDirection(scrollDirection);
331 _IconListView::SetScrollStyle(IconListViewScrollStyle scrollStyle)
333 SysTryReturn(NID_UI_CTRL, scrollStyle >= ICON_LIST_SCROLL_STYLE_FADE_OUT && scrollStyle <= ICON_LIST_SCROLL_STYLE_THUMB,
334 E_INVALID_ARG, E_INVALID_ARG, "[E_INVALID_ARG] Invalid scrollStyle is used.");
336 __scrollStyle = scrollStyle;
341 _IconListView::SetBackgroundBitmap(const Bitmap* pBitmap)
343 result r = E_SUCCESS;
345 Bitmap* pCopiedBitmap = null;
348 pCopiedBitmap = _BitmapImpl::CloneN(*pBitmap);
354 delete __pBackgroundBitmap;
355 __pBackgroundBitmap = pCopiedBitmap;
359 delete pCopiedBitmap;
362 __pIconListPresenter->ClearVisualElement();
368 _IconListView::GetBackgroundBitmap(void) const
370 return __pBackgroundBitmap;
374 _IconListView::SetMargin(MarginType type, float value)
376 return __pIconListPresenter->SetMargin(type, value);
380 _IconListView::GetMargin(MarginType type) const
382 return __pIconListPresenter->GetMargin(type);
386 _IconListView::SetItemSpacing(float horizontalSpacing, float verticalSpacing)
388 return __pIconListPresenter->SetItemSpacing(horizontalSpacing, verticalSpacing);
392 _IconListView::GetItemHorizontalSpacing(void) const
394 return __pIconListPresenter->GetItemHorizontalSpacing();
398 _IconListView::GetItemVerticalSpacing(void) const
400 return __pIconListPresenter->GetItemVerticalSpacing();
404 _IconListView::SetItemChecked(int index, bool check)
406 SysTryReturn(NID_UI_CTRL, (__style == ICON_LIST_VIEW_STYLE_RADIO || __style == ICON_LIST_VIEW_STYLE_MARK), E_SYSTEM, E_SYSTEM,
407 "[E_SYSTEM] A system error has been occurred. The style of IconListView is not available to check.");
409 return __pIconListPresenter->SetItemChecked(index, check);
413 _IconListView::IsItemChecked(int index) const
415 SysTryReturn(NID_UI_CTRL, (__style == ICON_LIST_VIEW_STYLE_RADIO || __style == ICON_LIST_VIEW_STYLE_MARK), false, E_SYSTEM,
416 "[E_SYSTEM] A system error has been occurred. The style of IconListView is not available to check.");
418 return __pIconListPresenter->IsItemChecked(index);
422 _IconListView::GetItemIndexFromPosition(float x, float y) const
424 return __pIconListPresenter->GetItemIndexFromPosition(x, y);
428 _IconListView::GetItemIndexFromPosition(const Point& position) const
430 return GetItemIndexFromPosition(_CoordinateSystemUtils::ConvertToFloat(position));
434 _IconListView::GetItemIndexFromPosition(const FloatPoint& position) const
436 return __pIconListPresenter->GetItemIndexFromPosition(position);
440 _IconListView::SetPropertyTextHorizontalAlignment(const Variant& alignment)
442 return __pIconListPresenter->SetTextHorizontalAlignment(static_cast<HorizontalAlignment>(alignment.ToInt()));
446 _IconListView::SetTextHorizontalAlignment(HorizontalAlignment alignment)
448 return SetProperty("textHorizontalAlignment", Variant(static_cast<int>(alignment)));
452 _IconListView::SetPropertyTextVerticalAlignment(const Variant& alignment)
454 return __pIconListPresenter->SetTextVerticalAlignment(static_cast<IconListViewItemTextVerticalAlignment>(alignment.ToInt()));
458 _IconListView::SetTextVerticalAlignment(IconListViewItemTextVerticalAlignment alignment)
460 return SetProperty("textVerticalAlignment", Variant(static_cast<int>(alignment)));
464 _IconListView::GetPropertyTextHorizontalAlignment(void) const
466 return Variant(static_cast<int>(__pIconListPresenter->GetTextHorizontalAlignment()));
470 _IconListView::GetTextHorizontalAlignment(void) const
472 Variant alignment = GetProperty("textHorizontalAlignment");
473 return static_cast<HorizontalAlignment> (alignment.ToInt());
477 _IconListView::GetPropertyTextVerticalAlignment(void) const
479 return Variant(static_cast<int>(__pIconListPresenter->GetTextVerticalAlignment()));
482 IconListViewItemTextVerticalAlignment
483 _IconListView::GetTextVerticalAlignment(void) const
485 Variant alignment = GetProperty("textVerticalAlignment");
486 return static_cast<IconListViewItemTextVerticalAlignment> (alignment.ToInt());
490 _IconListView::SetPropertyTextOfEmptyList(const Variant& text)
492 __textOfEmptyList = text.ToString();
494 __pIconListPresenter->ClearVisualElement();
500 _IconListView::SetTextOfEmptyList(const String& text)
502 return SetProperty("textOfEmptyList", Variant(text));
506 _IconListView::GetPropertyTextOfEmptyList(void) const
508 return Variant(__textOfEmptyList);
512 _IconListView::GetTextOfEmptyList(void) const
514 Variant text = GetProperty("textOfEmptyList");
515 return text.ToString();
519 _IconListView::SetPropertyTextColorOfEmptyList(const Variant& color)
521 __textColorOfEmptyList = color.ToColor();
522 __pIconListPresenter->ClearVisualElement();
527 _IconListView::SetTextColorOfEmptyList(const Color& color)
529 return SetProperty("textColorOfEmptyList", Variant(color));
533 _IconListView::GetPropertyTextColorOfEmptyList(void) const
535 return Variant(__textColorOfEmptyList);
539 _IconListView::GetTextColorOfEmptyList(void) const
541 Variant color = GetProperty("textColorOfEmptyList");
542 return color.ToColor();
546 _IconListView::SetTextSizeOfEmptyList(float size)
548 float minSize = 0.0f;
549 GET_FIXED_VALUE_CONFIG(ICONLIST::MINIMUM_FONT_SIZE, GetOrientation(), minSize);
550 SysTryReturn(NID_UI_CTRL, _FloatCompareGE(size, minSize), E_INVALID_ARG, E_INVALID_ARG,
551 "[E_INVALID_ARG] Invalid argument is used. Font size should be greater than or equal to the minimum size.");
553 __textSizeOfEmptyList = size;
559 _IconListView::GetTextSizeOfEmptyList(void) const
561 return __textSizeOfEmptyList;
565 _IconListView::SetItemTextColor(IconListViewItemDrawingStatus status, const Color& color)
567 return __pIconListPresenter->SetItemTextColor(status, color);
571 _IconListView::GetItemTextColor(IconListViewItemDrawingStatus status) const
573 return __pIconListPresenter->GetItemTextColor(status);
577 _IconListView::SetPropertyItemTextSize(const Variant& size)
579 return __pIconListPresenter->SetItemTextSize(size.ToFloat());
583 _IconListView::SetItemTextSize(float size)
585 return SetProperty("itemTextSize", Variant((size)));
589 _IconListView::GetPropertyItemTextSize(void) const
591 return Variant(__pIconListPresenter->GetItemTextSize());
595 _IconListView::GetItemTextSize(void) const
597 Variant size = GetProperty("itemTextSize");
598 return size.ToFloat();
602 _IconListView::SetPropertyCheckBoxPosition(const Variant& position)
604 SysTryReturn(NID_UI_CTRL, (__style == ICON_LIST_VIEW_STYLE_RADIO || __style == ICON_LIST_VIEW_STYLE_MARK), E_INVALID_OPERATION,
605 E_INVALID_OPERATION, "[E_INVALID_OPERATION] The current style of IconListView is not available to check. So can not set position of check box.");
607 return __pIconListPresenter->SetCheckBoxPosition(static_cast<IconListViewCheckBoxPosition>(position.ToInt()));
611 _IconListView::SetCheckBoxPosition(IconListViewCheckBoxPosition position)
613 return SetProperty("checkBoxPosition", Variant(static_cast<int>(position)));
617 _IconListView::GetPropertyCheckBoxPosition(void) const
619 SysTryReturn(NID_UI_CTRL, (__style == ICON_LIST_VIEW_STYLE_RADIO || __style == ICON_LIST_VIEW_STYLE_MARK),
620 Variant(static_cast<int>(ICON_LIST_VIEW_CHECK_BOX_POSITION_TOP_LEFT)), E_INVALID_OPERATION,
621 "[E_INVALID_OPERATION] The current style of IconListView is not available to check. So can not get position of check box.");
623 return Variant(static_cast<int>(__pIconListPresenter->GetCheckBoxPosition()));
626 IconListViewCheckBoxPosition
627 _IconListView::GetCheckBoxPosition(void) const
629 Variant position = GetProperty("checkBoxPosition");
630 return static_cast<IconListViewCheckBoxPosition>(position.ToInt());
634 _IconListView::SetPropertyTouchAnimationEnabled(const Variant& enabled)
636 return __pIconListPresenter->SetTouchAnimationEnabled(enabled.ToBool());
640 _IconListView::SetTouchAnimationEnabled(bool enable)
642 return SetProperty("touchAnimationEnabled", Variant(enable));
646 _IconListView::GetPropertyTouchAnimationEnabled(void) const
648 return Variant(__pIconListPresenter->IsTouchAnimationEnabled());
652 _IconListView::IsTouchAnimationEnabled(void) const
654 Variant enabled = GetProperty("touchAnimationEnabled");
655 return enabled.ToBool();
659 _IconListView::ScrollToItem(int index)
661 return __pIconListPresenter->ScrollToItem(index);
665 _IconListView::ScrollByPixel(float pixel)
667 return __pIconListPresenter->ScrollByPixel(pixel);
671 _IconListView::RefreshList(int index, ListRefreshType type)
673 return __pIconListPresenter->RefreshList(index, type);
677 _IconListView::UpdateList(void)
679 return __pIconListPresenter->UpdateList();
683 _IconListView::SetItemBitmapBounds(const Rectangle& bounds)
685 return SetItemBitmapBounds(_CoordinateSystemUtils::ConvertToFloat(bounds));
689 _IconListView::SetItemBitmapBounds(const FloatRectangle& bounds)
691 return __pIconListPresenter->SetItemBitmapBounds(bounds);
695 _IconListView::GetItemBitmapBounds(void) const
697 return __pIconListPresenter->GetItemBitmapBounds();
701 _IconListView::GetItemBitmapSize(float& width, float& height) const
703 return __pIconListPresenter->GetItemBitmapSize(width, height);
707 _IconListView::GetItemBitmapSize(void) const
709 return __pIconListPresenter->GetItemBitmapSize();
713 _IconListView::SetItemSize(const FloatDimension& size)
715 return __pIconListPresenter->SetItemSize(size);
719 _IconListView::GetItemSize(float& width, float& height) const
721 return __pIconListPresenter->GetItemSize(width, height);
725 _IconListView::GetItemSize(void) const
727 return __pIconListPresenter->GetItemSize();
731 _IconListView::SetPropertyMagneticScrollSize(const Variant& size)
733 return __pIconListPresenter->SetMagneticScrollSize(size.ToInt());
737 _IconListView::SetMagneticScrollSize(int scrollSize)
739 return SetProperty("magneticScrollSize", Variant(scrollSize));
743 _IconListView::GetPropertyMagneticScrollSize(void) const
745 return Variant(__pIconListPresenter->GetMagneticScrollSize());
749 _IconListView::GetMagneticScrollSize(void) const
751 Variant size = GetProperty("magneticScrollSize");
756 _IconListView::GetItemCountPerAxis(void) const
758 return __pIconListPresenter->GetItemCountPerAxis();
762 _IconListView::SetPropertyItemLayoutHorizontalAlignment(const Variant& alignment)
764 return __pIconListPresenter->SetItemLayoutHorizontalAlignment(static_cast<HorizontalAlignment>(alignment.ToInt()));
768 _IconListView::SetItemLayoutHorizontalAlignment(HorizontalAlignment alignment)
770 return SetProperty("itemLayoutHorizontalAlignment", Variant(static_cast<int>(alignment)));
774 _IconListView::SetPropertyItemLayoutVerticalAlignment(const Variant& alignment)
776 return __pIconListPresenter->SetItemLayoutVerticalAlignment(static_cast<VerticalAlignment>(alignment.ToInt()));
780 _IconListView::SetItemLayoutVerticalAlignment(VerticalAlignment alignment)
782 return SetProperty("itemLayoutVerticalAlignment", Variant(static_cast<int>(alignment)));
786 _IconListView::GetPropertyItemLayoutHorizontalAlignment(void) const
788 return Variant(static_cast<int>(__pIconListPresenter->GetItemLayoutHorizontalAlignment()));
792 _IconListView::GetItemLayoutHorizontalAlignment(void) const
794 Variant alignment = GetProperty("itemLayoutHorizontalAlignment");
795 return static_cast<HorizontalAlignment>(alignment.ToInt());
799 _IconListView::GetPropertyItemLayoutVerticalAlignment(void) const
801 return Variant(static_cast<int>(__pIconListPresenter->GetItemLayoutVerticalAlignment()));
805 _IconListView::GetItemLayoutVerticalAlignment(void) const
807 Variant alignment = GetProperty("itemLayoutVerticalAlignment");
808 return static_cast<VerticalAlignment>(alignment.ToInt());
812 _IconListView::SetPropertyItemBorderStyle(const Variant& style)
814 return __pIconListPresenter->SetItemBorderStyle(static_cast<IconListViewItemBorderStyle>(style.ToInt()));
818 _IconListView::SetItemBorderStyle(IconListViewItemBorderStyle borderStyle)
820 return SetProperty("itemBorderStyle", Variant(static_cast<int>(borderStyle)));
824 _IconListView::GetPropertyItemBorderStyle(void) const
826 return Variant(static_cast<int>(__pIconListPresenter->GetItemBorderStyle()));
829 IconListViewItemBorderStyle
830 _IconListView::GetItemBorderStyle(void) const
832 Variant style = GetProperty("itemBorderStyle");
833 return static_cast<IconListViewItemBorderStyle>(style.ToInt());
837 _IconListView::SetBitmapOfEmptyList(const Bitmap* pBitmap)
839 result r = E_SUCCESS;
840 Bitmap* pCopiedBitmap = null;
843 pCopiedBitmap = _BitmapImpl::CloneN(*pBitmap);
849 delete __pBitmapOfEmptyList;
850 __pBitmapOfEmptyList = pCopiedBitmap;
854 delete pCopiedBitmap;
857 __pIconListPresenter->ClearVisualElement();
863 _IconListView::GetBitmapOfEmptyList(void) const
865 return __pBitmapOfEmptyList;
869 _IconListView::SetNonSlidableList(void)
871 return __pIconListPresenter->SetNonSlidableList();
875 _IconListView::AddItem(_IconListItem* pItem)
877 return __pIconListPresenter->AddItem(pItem);
881 _IconListView::InsertItemAt(int index, _IconListItem* pItem)
883 return __pIconListPresenter->InsertItemAt(index, pItem);
887 _IconListView::SetItemAt(int index, _IconListItem* pItem)
889 return __pIconListPresenter->SetItemAt(index, pItem);
893 _IconListView::RemoveItemAt(int index)
895 return __pIconListPresenter->RemoveItemAt(index);
899 _IconListView::RemoveAllItems(void)
901 return __pIconListPresenter->RemoveAllItems();
905 _IconListView::SetScroll(const FloatRectangle& bounds, _ScrollDirection scrollDirection)
907 if (__pScroll == null)
909 __pScroll = _Scroll::CreateScrollN(*this, scrollDirection,
910 (((__scrollStyle == ICON_LIST_SCROLL_STYLE_FIXED) || (__scrollStyle == ICON_LIST_SCROLL_STYLE_THUMB)) ? false : true),
911 ((__scrollStyle == ICON_LIST_SCROLL_STYLE_JUMP_TO_TOP) ? true : false),
912 ((__scrollStyle == ICON_LIST_SCROLL_STYLE_THUMB) ? true : false),
913 (((__scrollStyle == ICON_LIST_SCROLL_STYLE_FIXED) || (__scrollStyle == ICON_LIST_SCROLL_STYLE_THUMB)) ? true : false), 1, 1, 0);
915 SysTryReturn(NID_UI_CTRL, __pScroll != null, E_OUT_OF_MEMORY, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.");
917 __pScroll->EnableScrollingEffect(true);
918 __pScroll->SetParentUsingViewport(false);
919 __pScroll->AddScrollEventListener(*__pIconListPresenter);
921 AttachSystemChild(*__pScroll);
928 _IconListView::GetScroll(void) const
934 _IconListView::SetItemBitmapAsAspectRatio(bool isAspect)
936 __pIconListPresenter->SetItemBitmapAsAspectRatio(isAspect);
940 _IconListView::IsItemBitmapAsAspectRatio(void) const
942 return __pIconListPresenter->IsItemBitmapAsAspectRatio();
945 _UiIconListItemEvent*
946 _IconListView::GetIconListItemEvent(void) const
948 return __pIconListItemEvent;
952 _IconListView::GetScrollEvent(void) const
954 return __pScrollEvent;
957 _TouchLongPressGestureDetector*
958 _IconListView::GetLongPressGesture(void) const
960 return __pGestureLongPress;
964 _IconListView::SetLongPressGesture(_TouchLongPressGestureDetector* pLongPress)
966 __pGestureLongPress = pLongPress;
970 _TouchFlickGestureDetector*
971 _IconListView::GetFlickGesture(void) const
973 return __pGestureFlick;
977 _IconListView::SetFlickGesture(_TouchFlickGestureDetector* pFlick)
979 __pGestureFlick = pFlick;
984 _IconListView::SetReorderModeEnabled(bool enable)
986 if (__reorderEnabled != enable)
988 __reorderEnabled = enable;
989 return __pIconListPresenter->SetReorderModeEnabled(enable);
995 _IconListView::IsInReorderingMode(void) const
997 return __reorderEnabled;
1001 _IconListView::SetScrollInputMode(ScrollInputMode mode)
1003 __scrollInputMode = mode;
1007 _IconListView::GetScrollInputMode(void) const
1009 return __scrollInputMode;
1013 _IconListView::OnBoundsChanged(void)
1015 __pIconListPresenter->OnBoundsChanged();
1019 _IconListView::OnDraw(void)
1021 __pIconListPresenter->Draw();
1025 _IconListView::OnAncestorVisibleStateChanged(const _Control& control)
1027 _Control::OnAncestorVisibleStateChanged(control);
1029 OnVisibleStateChanged();
1033 _IconListView::OnAncestorEnableStateChanged(const _Control& control)
1035 _Control::OnAncestorEnableStateChanged(control);
1037 OnVisibleStateChanged();
1041 _IconListView::OnAncestorInputEnableStateChanged(const _Control& control)
1043 __pIconListPresenter->OnInputEnableStateChanged();
1047 _IconListView::OnChangeLayout(_ControlOrientation orientation)
1049 _Control::OnChangeLayout(orientation);
1051 __pIconListPresenter->ClearVisualElement();
1055 _IconListView::OnFontInfoRequested(unsigned long& style, int& size)
1057 float floatSize = 0.0f;
1058 __pIconListPresenter->OnFontInfoRequested(style, floatSize);
1059 size = _CoordinateSystemUtils::ConvertToInteger(floatSize);
1063 _IconListView::OnFontInfoRequested(unsigned long& style, float& size)
1065 __pIconListPresenter->OnFontInfoRequested(style, size);
1069 _IconListView::OnFontChanged(Font* pFont)
1071 __pIconListPresenter->OnFontChanged(pFont);
1075 _IconListView::OnFocusModeStateChanged(void)
1077 __pIconListPresenter->OnFocusModeStateChanged();
1081 _IconListView::OnDrawFocus(void)
1083 __pIconListPresenter->OnDrawFocus();
1087 _IconListView::OnCanvasRequestedN(const FloatRectangle& bounds)
1089 return __pIconListPresenter->OnCanvasRequestedN(bounds);
1093 // Tizen::Ui::_IPreviewKeyEventListener
1095 _IconListView::OnPreviewKeyPressed(const _Control& source, const _KeyInfo& keyInfo)
1097 return __pIconListPresenter->OnPreviewKeyPressed(source, keyInfo);
1101 _IconListView::OnPreviewKeyReleased(const _Control& source, const _KeyInfo& keyInfo)
1103 return __pIconListPresenter->OnPreviewKeyReleased(source, keyInfo);
1106 // Tizen::Ui::_IKeyEventListener
1108 _IconListView::OnKeyPressed(const _Control& source, const _KeyInfo& keyInfo)
1110 return __pIconListPresenter->OnKeyPressed(source, keyInfo);
1114 _IconListView::OnKeyReleased(const _Control& source, const _KeyInfo& keyInfo)
1116 return __pIconListPresenter->OnKeyReleased(source, keyInfo);
1119 // Tizen::Ui::_IPreviewNotificationEventListener
1121 _IconListView::OnPreviewNotifiedN(const _Control& source, Collection::IList* pArgs)
1123 return __pIconListPresenter->OnPreviewNotifiedN(source, pArgs);
1126 // Tizen::Ui::_INotificationEventListener
1128 _IconListView::OnNotifiedN(const _Control& source, Collection::IList* pArgs)
1130 return __pIconListPresenter->OnNotifiedN(source, pArgs);
1133 // Tizen::Ui::_ITouchEventPreviewer
1134 _UiTouchEventDelivery
1135 _IconListView::OnPreviewTouchReleased(const _Control& source, const _TouchInfo& touchinfo)
1137 return __pIconListPresenter->OnPreviewTouchReleased(source, touchinfo);
1140 // Tizen::Ui::_ITouchEventListener
1142 _IconListView::OnTouchPressed(const _Control& source, const _TouchInfo& touchinfo)
1144 return __pIconListPresenter->OnTouchPressed(source, touchinfo);
1148 _IconListView::OnTouchReleased(const _Control& source, const _TouchInfo& touchinfo)
1150 return __pIconListPresenter->OnTouchReleased(source, touchinfo);
1154 _IconListView::OnTouchMoved(const _Control& source, const _TouchInfo& touchinfo)
1156 return __pIconListPresenter->OnTouchMoved(source, touchinfo);
1160 _IconListView::OnTouchCanceled(const _Control& source, const _TouchInfo& touchinfo)
1162 return __pIconListPresenter->OnTouchCanceled(source, touchinfo);
1166 _IconListView::OnFlickGestureDetected(_TouchFlickGestureDetector& gesture)
1170 gesture.GetDistance(xDistance, yDistance);
1171 Point flickPoint(xDistance, yDistance);
1173 return __pIconListPresenter->OnFlickGestureDetected(true, flickPoint, gesture.GetDuration());
1177 _IconListView::OnFlickGestureCanceled(_TouchFlickGestureDetector& gesture)
1183 _IconListView::OnLongPressGestureDetected(_TouchLongPressGestureDetector& gesture)
1185 return __pIconListPresenter->OnLongPressGestureDetected();
1189 _IconListView::OnLongPressGestureCanceled(_TouchLongPressGestureDetector& gesture)
1195 _IconListView::OnPropertyChanging(_PropertyBase& source, const String& name, const Variant& oldValue, const Variant& newValue)
1200 _IconListView::OnPropertyChanged(_PropertyBase& source, const String& name, const Variant& oldValue, const Variant& newValue)
1205 _IconListView::OnVisibleStateChanged(void)
1207 if (__pScroll != null)
1209 bool enableFadeEffect = __pScroll->IsEnabledFadeEffect();
1210 if (GetVisibleState() == false)
1212 if (enableFadeEffect)
1214 __pScroll->SetScrollVisibility(false);
1217 else if (enableFadeEffect)
1219 float scrollViewRange = 0.0f;
1220 float scrollRange = 0.0f;
1221 __pScroll->GetScrollRange(&scrollViewRange, &scrollRange);
1223 if (!_FloatCompareGE(scrollViewRange, scrollRange))
1225 __pIconListPresenter->ScrollFadeOut();
1230 __pIconListPresenter->OnVisibleStateChanged();
1233 // Tizen::Ui::_IScrollEventListener
1235 _IconListView::OnScrollEndReached(_Control& source, ScrollEndEvent type)
1237 __pIconListPresenter->OnScrollEndReached(source, type);
1241 _IconListView::OnScrollPositionChanged(_Control& source, float scrollPosition)
1243 __pIconListPresenter->OnScrollPositionChanged(source, scrollPosition);
1247 _IconListView::OnScrollStopped(_Control& source)
1249 __pIconListPresenter->OnScrollStopped(source);
1252 // Tizen::Ui::Animations::IAnimationTransactionEventListener
1254 _IconListView::OnAnimationTransactionStarted(int transactionId)
1259 _IconListView::OnAnimationTransactionStopped(int transactionId)
1261 __pIconListPresenter->OnAnimationTransactionStopped(transactionId);
1265 _IconListView::OnAnimationTransactionFinished(int transactionId)
1267 __pIconListPresenter->OnAnimationTransactionFinished(transactionId);
1270 // Tizen::Ui::Animations::IVisualElementAnimationTickEventListener
1272 _IconListView::OnTickOccurred(const VisualElementAnimation& animation, const String& keyName, VisualElement& target, const Variant& currentValue)
1274 __pIconListPresenter->OnTickOccurred(animation, keyName, target, currentValue);
1277 // Tizen::Ui::Animations::IVisualElementAnimationStatusEventListener
1279 _IconListView::OnVisualElementAnimationStarted(const VisualElementAnimation& animation, const String& keyName, VisualElement& target)
1281 __pIconListPresenter->OnVisualElementAnimationStarted(animation, keyName, target);
1285 _IconListView::OnVisualElementAnimationRepeated(const VisualElementAnimation& animation, const String& keyName, VisualElement& target, long currentRepeatCount)
1287 __pIconListPresenter->OnVisualElementAnimationRepeated(animation, keyName, target, currentRepeatCount);
1291 _IconListView::OnVisualElementAnimationFinished(const VisualElementAnimation& animation, const String& keyName, VisualElement& target, bool completedNormally)
1293 __pIconListPresenter->OnVisualElementAnimationFinished(animation, keyName, target, completedNormally);
1296 VisualElementValueAnimation*
1297 _IconListView::GetScrollingAnimation(void) const
1299 return __pScrollingAnimation;
1302 }}} // Tizen::Ui::Controls