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_ListViewImpl.h
20 * @brief This file defines the _ListViewImpl class.
23 * This file contains the declarations of _ListViewImpl class.
26 #ifndef _FUI_CTRL_INTERNAL_LIST_VIEW_IMPL_H_
27 #define _FUI_CTRL_INTERNAL_LIST_VIEW_IMPL_H_
29 #include <FUiCtrlListView.h>
30 #include "FUi_ControlImpl.h"
31 #include "FUi_ITouchLongPressGestureEventListener.h"
32 #include "FUi_TouchLongPressGestureDetector.h"
33 #include "FUiCtrl_IFastScrollListener.h"
34 #include "FUiCtrl_IScrollEventListener.h"
35 #include "FUiCtrl_IUiListViewItemEventListener.h"
36 #include "FUiCtrl_ListViewTouchEventHandler.h"
37 #include "FUiCtrl_TableView.h"
39 namespace Tizen { namespace Ui { namespace Controls
42 class _FastScrollEvent;
46 class _PublicLinkEvent;
51 , public _IScrollEventListener
52 , public _ITableViewItemEventListener
53 , public _ITouchLongPressGestureEventListener
54 , public _IUiFastScrollListener
55 , public _IUiListViewItemEventListener
56 , virtual public Tizen::Base::Runtime::IEventListener
59 virtual ~_ListViewImpl(void);
61 static _ListViewImpl* CreateListViewImplN(ListView* pControl, bool itemDivider, bool fastScroll);
63 static _ListViewImpl* CreateListViewImplN(ListView* pControl, bool itemDivider, ListScrollStyle scrollStyle);
65 virtual const char* GetPublicClassName(void) const;
67 virtual const ListView& GetPublic(void) const;
69 virtual ListView& GetPublic(void);
71 virtual const _TableView& GetCore(void) const;
73 virtual _TableView& GetCore(void);
75 result SetItemProvider(IListViewItemProvider& provider);
77 result SetItemProvider(IListViewItemProviderF& provider);
79 void AddListViewItemEventListener(IListViewItemEventListener& listener);
81 void RemoveListViewItemEventListener(IListViewItemEventListener& listener);
83 void AddFastScrollListener(IFastScrollListener& listener);
85 void RemoveFastScrollListener(IFastScrollListener& listener);
87 void AddScrollEventListener(IScrollEventListener& listener);
89 void AddScrollEventListener(IScrollEventListenerF& listener);
91 void RemoveScrollEventListener(IScrollEventListener& listener);
93 void RemoveScrollEventListener(IScrollEventListenerF& listener);
95 void AddUiLinkEventListener(const Tizen::Ui::IUiLinkEventListener& listener);
97 void RemoveUiLinkEventListener(const Tizen::Ui::IUiLinkEventListener& listener);
99 result SetSweepEnabled(bool enable);
101 result SetFastScrollIndex(const Tizen::Base::String& text, bool useSearchIcon);
103 int GetTopDrawnItemIndex(void) const;
105 int GetBottomDrawnItemIndex(void) const;
107 result ScrollToItem(int index, ListScrollItemAlignment itemAlignment);
109 result SetItemChecked(int index, bool check);
111 bool IsItemChecked(int index) const;
113 result SetItemEnabled(int index, bool enable);
115 bool IsItemEnabled(int index) const;
117 int GetItemCount(void) const;
119 result ShowItemDescriptionText(int index);
121 result HideItemDescriptionText(int index);
123 result RefreshList(int index, ListRefreshType type, bool needFlush = true);
125 result RefreshList(int index, int elementId);
127 result UpdateList(void);
129 int GetItemIndexFromPosition(const Tizen::Graphics::FloatPoint& position) const;
131 result GetItemIndexFromPosition(const Tizen::Graphics::FloatPoint& position, int& itemIndex, int& elementId) const;
133 result SetItemDividerColor(const Tizen::Graphics::Color& color);
135 Tizen::Graphics::Color GetItemDividerColor(void) const;
137 result SetBitmapOfEmptyList(const Tizen::Graphics::Bitmap* pBitmap);
139 result SetTextOfEmptyList(const Tizen::Base::String& text);
141 Tizen::Base::String GetTextOfEmptyList(void) const;
143 result SetTextColorOfEmptyList(const Tizen::Graphics::Color& color);
145 Tizen::Graphics::Color GetTextColorOfEmptyList(void) const;
147 result SetListBackgroundColor(const Tizen::Graphics::Color& color);
149 result SetBackgroundBitmap(const Tizen::Graphics::Bitmap* pBitmap);
151 result BeginReorderingMode(void);
153 result EndReorderingMode(void);
155 bool IsInReorderingMode(void) const;
157 void SetScrollInputMode(ScrollInputMode mode);
159 ScrollInputMode GetScrollInputMode(void) const;
161 result OpenContextItem(int itemIndex);
163 result CloseContextItem(int itemIndex);
165 bool IsContextItemOpened(int itemIndex) const;
167 virtual void OnListViewContextItemStateChanged(Tizen::Ui::_Control& source, int groupIndex, int itemIndex, int elementId,
168 Tizen::Ui::Controls::ListContextItemStatus status);
170 // _ITableViewItemEventListener
171 virtual void OnTableViewItemStateChanged(Tizen::Ui::Controls::_TableView& tableView, int itemIndex,
172 Tizen::Ui::Controls::_TableViewItem* pItem, Tizen::Ui::Controls::TableViewItemStatus status);
174 virtual void OnTableViewContextItemActivationStateChanged(Tizen::Ui::Controls::_TableView& tableView, int itemIndex,
175 Tizen::Ui::Controls::_TableViewItem* pContextItem, bool activated);
177 virtual void OnTableViewItemReordered(Tizen::Ui::Controls::_TableView& tableView, int itemIndexFrom, int itemIndexTo);
179 virtual void OnGroupedTableViewGroupItemStateChanged(Tizen::Ui::Controls::_TableView& tableView, int groupIndex,
180 Tizen::Ui::Controls::_TableViewItem* pItem, Tizen::Ui::Controls::TableViewItemStatus status) {};
182 virtual void OnGroupedTableViewItemStateChanged(Tizen::Ui::Controls::_TableView& tableView, int groupIndex, int itemIndex,
183 Tizen::Ui::Controls::_TableViewItem* pItem, Tizen::Ui::Controls::TableViewItemStatus status) {};
185 virtual void OnGroupedTableViewContextItemActivationStateChanged(Tizen::Ui::Controls::_TableView& tableView, int groupIndex,
186 int itemIndex, Tizen::Ui::Controls::_TableViewItem* pContextItem, bool activated) {};
188 virtual void OnGroupedTableViewItemReordered(Tizen::Ui::Controls::_TableView& tableView, int groupIndexFrom, int itemIndexFrom,
189 int groupIndexTo, int itemIndexTo) {};
191 virtual void OnSectionTableViewItemStateChanged(Tizen::Ui::Controls::_TableView& tableView, int sectionIndex, int itemIndex,
192 Tizen::Ui::Controls::_TableViewItem* pItem, Tizen::Ui::Controls::TableViewItemStatus status) {};
194 virtual void OnSectionTableViewContextItemActivationStateChanged(Tizen::Ui::Controls::_TableView& tableView, int sectionIndex,
195 int itemIndex, Tizen::Ui::Controls::_TableViewItem* pContextItem, bool activated) {};
197 virtual void OnTableViewItemSwept(Tizen::Ui::Controls::_TableView& tableView, int groupIndex, int itemIndex,
198 Tizen::Ui::Controls::TableViewSweepDirection direction);
200 // Event handler for _IScrollEventListener
201 virtual void OnScrollEndReached(Tizen::Ui::_Control& source, ScrollEndEvent type);
203 virtual void OnScrollPositionChanged(Tizen::Ui::_Control& source, float scrollPosition);
205 virtual void OnScrollStopped(Tizen::Ui::_Control& source);
207 // Event handler for _IUiFastScrollListener
208 virtual void OnUiFastScrollIndexSelected(Tizen::Ui::_Control& source, Tizen::Ui::Controls::_FastScrollIndex& index);
210 virtual void OnDraw(void);
212 virtual void OnChangeLayout(_ControlOrientation orientation);
214 virtual void OnBoundsChanged(void);
216 virtual void OnFontChanged(Tizen::Graphics::Font* pFont);
218 virtual void OnFontInfoRequested(unsigned long& style, int& size);
220 virtual void OnFontInfoRequested(unsigned long& style, float& size);
222 virtual bool OnTouchPressed(const _ControlImpl& source, const _TouchInfo& touchinfo);
224 virtual bool OnTouchReleased(const _ControlImpl& source, const _TouchInfo& touchinfo);
226 virtual bool OnTouchMoved(const _ControlImpl& source, const _TouchInfo& touchinfo);
228 virtual bool OnTouchCanceled(const _ControlImpl& source, const _TouchInfo& touchinfo);
230 virtual bool OnLongPressGestureDetected(_TouchLongPressGestureDetector& gesture);
232 virtual bool OnLongPressGestureCanceled(_TouchLongPressGestureDetector& gesture);
234 bool GetInputEventConsumeState(void);
237 static _ListViewImpl* GetInstance(ListView& listView);
239 static const _ListViewImpl* GetInstance(const ListView& listView);
242 _ListViewImpl(ListView* pList, _TableView* pCore);
244 _ListViewImpl(_ListViewImpl& rhs);
246 _ListViewImpl& operator =(_ListViewImpl& rhs);
248 result SetItemDescriptionTextShowState(int index, bool show);
250 void AdjustLayoutOfEmptyList(void);
252 void CheckEmptyListShowState(void);
254 Tizen::Graphics::FloatPoint GetCurrentTouchPosition(void);
256 virtual result OnTouchEventListenerAdded(void);
258 virtual result OnTouchEventListenerRemoved(void);
260 void SetItemNeedsLazyDeletion(void);
263 _ListItemEvent* __pListItemEvent;
264 _PublicLinkEvent* __pLinkEvent;
265 _ScrollEvent* __pScrollEvent;
266 _FastScrollEvent* __pFastScrollEvent;
268 _Label* __pEmptyBitmap;
269 _Label* __pEmptyText;
270 Tizen::Graphics::Color __emptyTextColor;
272 bool __redrawListView;
273 bool __isBoundsChanged;
274 _ListViewItem* __pItemNeedsLazyDeletion;
276 _ListViewTouchEventHandler* __pTouchEventHandler;
277 _TouchLongPressGestureDetector* __pLongPressedGesture;
280 }}} // Tizen::Ui::Controls
282 #endif // _FUI_CTRL_INTERNAL_LIST_VIEW_IMPL_H_