Update TableView classes doxygen
[platform/framework/native/uifw.git] / inc / FUiCtrlTableView.h
1 //
2 // Open Service Platform
3 // Copyright (c) 2012-2013 Samsung Electronics Co., Ltd.
4 //
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
8 //
9 //     http://floralicense.org/license/
10 //
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.
16 //
17
18 /**
19 * @file FUiCtrlTableView.h
20 * @brief This is the header file for the %TableView class.
21 *
22 * This header file contains the declarations of the %TableView class and its helper classes.
23 */
24
25 #ifndef _FUI_CTRL_TABLE_VIEW_H_
26 #define _FUI_CTRL_TABLE_VIEW_H_
27
28 #include <FGrpRectangle.h>
29 #include <FGrpColor.h>
30 #include <FUiContainer.h>
31 #include <FUiCtrlTableViewTypes.h>
32 #include <FUiCtrlScrollPanelTypes.h>
33
34 namespace Tizen { namespace Ui { namespace Controls
35 {
36 class ITableViewItemProvider;
37 class ITableViewItemProviderF;
38 class ITableViewItemEventListener;
39 class IFastScrollListener;
40 class IScrollEventListener;
41 class IScrollEventListenerF;
42
43 /**
44  * @class TableView
45  * @brief   This class defines common behavior for a %TableView control.
46  *
47  * @since 2.0
48  *
49  * The %TableView class defines common behavior for a %TableView control.
50  * @code
51 //Sample code for TableViewSample.h
52 #include <FUi.h>
53
54 class TableViewSample
55         : public Tizen::Ui::Controls::Form
56         , public Tizen::Ui::Controls::ITableViewItemProvider
57         , public Tizen::Ui::Controls::ITableViewItemEventListener
58 {
59 public:
60         TableViewSample(void)
61         : __pTableView(null)
62         , __pContextItem(null){}
63
64         bool Initialize(void);
65         virtual result OnInitializing(void);
66         virtual result OnTerminating(void);
67
68         // ITableViewItemEventListener
69         virtual void OnTableViewItemStateChanged(Tizen::Ui::Controls::TableView& tableView, int itemIndex, Tizen::Ui::Controls::TableViewItem* pItem, Tizen::Ui::Controls::TableViewItemStatus status);
70         virtual void OnTableViewContextItemActivationStateChanged(Tizen::Ui::Controls::TableView& tableView, int itemIndex, Tizen::Ui::Controls::TableViewContextItem* pContextItem, bool activated);
71         virtual void OnTableViewItemReordered(Tizen::Ui::Controls::TableView& tableView, int itemIndexFrom, int itemIndexTo);
72
73         // ITableViewItemProvider
74         virtual int GetItemCount(void);
75         virtual Tizen::Ui::Controls::TableViewItem* CreateItem(int itemIndex, int itemWidth);
76         virtual bool DeleteItem(int itemIndex, Tizen::Ui::Controls::TableViewItem* pItem);
77         virtual void UpdateItem(int itemIndex, Tizen::Ui::Controls::TableViewItem* pItem);
78         virtual int GetDefaultItemHeight(void);
79
80 private:
81         Tizen::Ui::Controls::TableView* __pTableView;
82         Tizen::Ui::Controls::TableViewContextItem* __pContextItem;
83 };
84  *      @endcode
85  *
86  *      @code
87 //Sample code for TableViewSample.cpp
88 #include <FApp.h>
89 #include <FGraphics.h>
90
91 #include "TableViewSample.h"
92
93 using namespace Tizen::App;
94 using namespace Tizen::Base;
95 using namespace Tizen::Graphics;
96 using namespace Tizen::Media;
97 using namespace Tizen::Ui::Controls;
98
99 bool
100 TableViewSample::Initialize(void)
101 {
102         Construct(FORM_STYLE_NORMAL);
103         return true;
104 }
105
106 result
107 TableViewSample::OnInitializing(void)
108 {
109         result r = E_SUCCESS;
110
111         // Creates an instance of TableView
112         __pTableView = new TableView();
113         __pTableView->Construct(Rectangle(0, 0, GetClientAreaBounds().width, GetClientAreaBounds().height), true, TABLE_VIEW_SCROLL_BAR_STYLE_FADE_OUT);
114         __pTableView->SetItemProvider(*this);
115         __pTableView->AddTableViewItemEventListener(*this);
116
117         // Adds the TableView to the form
118         AddControl(*__pTableView);
119
120         // Creates an instance of TableViewContextItem
121         __pContextItem = new TableViewContextItem();
122         __pContextItem->Construct(Dimension(720, 100));
123
124         Button* pButton = new Button();
125         pButton->Construct(Rectangle(10, 10, 200, 80), L"Context1");
126
127         Button* pButton2 = new Button();
128         pButton2->Construct(Rectangle(250, 10, 200, 80), L"Context2");
129
130         __pContextItem->AddControl(*pButton);
131         __pContextItem->AddControl(*pButton2);
132
133         return r;
134 }
135
136 result
137 TableViewSample::OnTerminating(void)
138 {
139         result r = E_SUCCESS;
140
141         // Deallocates the item context
142         delete __pItemContext;
143         __pItemContext = null;
144
145         return r;
146 }
147
148 // ITableViewItemEventListener implementation
149 void
150 TableViewSample::OnTableViewItemStateChanged(TableView& tableView, int itemIndex, TableViewItem* pItem, TableViewItemStatus status)
151 {
152         // ....
153 }
154
155 void
156 TableViewSample::OnTableViewContextItemActivationStateChanged(TableView& tableView, int itemIndex, TableViewContextItem* pContextItem, bool activated)
157 {
158         // ....
159 }
160
161 void
162 TableViewSample::OnTableViewItemReordered(Tizen::Ui::Controls::TableView& tableView, int itemIndexFrom, int itemIndexTo)
163 {
164         // ....
165 }
166
167 // ITableViewItemProvider implementation
168 int
169 TableViewSample::GetItemCount(void)
170 {
171         return 50;
172 }
173
174 int
175 TableViewSample::GetDefaultItemHeight(void)
176 {
177         return 100;
178 }
179
180 TableViewItem*
181 TableViewSample::CreateItem(int itemIndex, int itemWidth)
182 {
183         TableViewAnnexStyle style = TABLE_VIEW_ANNEX_STYLE_NORMAL;
184         TableViewItem* pItem = new TableViewItem();
185
186         switch (itemIndex % 6)
187         {
188         case 0:
189                 style = TABLE_VIEW_ANNEX_STYLE_NORMAL;
190                 break;
191         case 1:
192                 style = TABLE_VIEW_ANNEX_STYLE_MARK;
193                 break;
194         case 2:
195                 style = TABLE_VIEW_ANNEX_STYLE_ONOFF_SLIDING;
196                 break;
197         case 3:
198                 style = TABLE_VIEW_ANNEX_STYLE_DETAILED;
199                 break;
200         case 4:
201                 style = TABLE_VIEW_ANNEX_STYLE_RADIO;
202                 break;
203         case 5:
204                 style = TABLE_VIEW_ANNEX_STYLE_ONOFF_SLIDING_WITH_DIVIDER;
205                 break;
206         default:
207                 break;
208         }
209
210         pItem->Construct(Dimension(itemWidth, GetDefaultItemHeight()), style);
211
212         String text;
213         text.Format(30, L"TableViewItem %d", itemIndex);
214
215         Label* pLabel = new Label();
216         pLabel->Construct(Rectangle(0, 0, itemWidth, GetDefaultItemHeight(), text);
217
218         pItem->AddControl(*pLabel);
219         pItem->SetContextItem(__pContextItem);
220
221         return pItem;
222 }
223
224 bool
225 TableViewSample::DeleteItem(int itemIndex, Tizen::Ui::Controls::TableViewItem* pItem)
226 {
227         pItem->Destroy();
228
229         return true;
230 }
231
232 void
233 TableViewSample::UpdateItem(int itemIndex, Tizen::Ui::Controls::TableViewItem* pItem)
234 {
235         // ....
236 }
237  * @endcode
238  *
239  */
240
241 class _OSP_EXPORT_ TableView
242         : public Tizen::Ui::Container
243 {
244 public:
245         /**
246         * The object is not fully constructed after this constructor is called. Hence, the Construct() method must be called after calling this constructor.
247         *
248         * @since 2.0
249         */
250         TableView(void);
251
252         /**
253         * This destructor overrides Tizen::Base::Object::~Object().
254         *
255         * @since 2.0
256         */
257         virtual ~TableView(void);
258
259         /**
260         * Initializes this instance of %TableView with the specified parameters.
261         *
262         * @since 2.0
263         *
264         * @return  An error code
265         * @param[in] rect    An instance of the Graphics::Rectangle class
266         *                              This instance represents the x and y coordinates of the left top corner of the created %TableView along with the width and height.
267         * @param[in] itemDivider       Set to @c true to display an item divider, @n
268         *                              else @c false
269         * @param[in] scrollStyle       The style of %TableView scroll bar style
270         * @exception E_SUCCESS         The method is successful.
271         * @exception E_INVALID_ARG     A specified input parameter is invalid, or either the rect.width or rect.height parameter has a negative value.
272         *
273         */
274         result Construct(const Tizen::Graphics::Rectangle& rect, bool itemDivider, TableViewScrollBarStyle scrollStyle);
275
276         /**
277         * Initializes this instance of %TableView with the specified parameters.
278         *
279         * @since 2.1
280         *
281         * @return  An error code
282         * @param[in] rect    An instance of the Graphics::FloatRectangle class
283         *                              This instance represents the x and y coordinates of the left top corner of the created %TableView along with the width and height.
284         * @param[in] itemDivider       Set to @c true to display an item divider, @n
285         *                              else @c false
286         * @param[in] scrollStyle       The style of %TableView scroll bar style
287         * @exception E_SUCCESS         The method is successful.
288         * @exception E_INVALID_ARG     A specified input parameter is invalid, or either the rect.width or rect.height parameter has a negative value.
289         *
290         */
291         result Construct(const Tizen::Graphics::FloatRectangle& rect, bool itemDivider, TableViewScrollBarStyle scrollStyle);
292
293         /**
294         * Sets the item provider that creates and deletes items for the simple style table view.
295         *
296         * @since 2.0
297         *
298         * @param[in] pProvider          The item provider to create and delete items
299         * @remarks If an item provider is not set for the table view, the table view does not work. The specified provider should be allocated in heap memory.
300         *          To reset the item provider, pass @c null to @c pProvider.
301         */
302         void SetItemProvider(ITableViewItemProvider* pProvider);
303
304         /**
305         * Sets the item provider that creates and deletes items for the simple style table view.
306         *
307         * @since 2.1
308         *
309         * @param[in] pProvider          The item provider to create and delete items
310         * @remarks If an item provider is not set for the table view, the table view does not work. The specified provider should be allocated in heap memory.
311         *          To reset the item provider, pass @c null to @c pProvider.
312         */
313         void SetItemProviderF(ITableViewItemProviderF* pProvider);
314
315         /**
316         * Begins the reordering mode.
317         *
318         * @since 2.0
319         *
320         * @see    ITableViewViewItemEventListener::OnTableViewItemReordered()
321         */
322         void BeginReorderingMode(void);
323
324         /**
325         * Ends the reordering mode.
326         *
327         * @since 2.0
328         *
329         * @see    ITableViewViewItemEventListener::OnTableViewItemReordered()
330         */
331         void EndReorderingMode(void);
332
333         /**
334         * Returns whether the %TableView control is in reordering mode or not.
335         *
336         * @since 2.0
337         *
338         * @return        @c true if the %TableView is in reordering mode, @n
339         *                   else @c false
340         */
341         bool IsInReorderingMode(void) const;
342
343         /**
344         * Adds a listener instance that listens to state changes of table view items. @n
345         * The added listener can listen to events on the specified event dispatcher's context when they are fired.
346         *
347         * @since 2.0
348         *
349         * @return        An error code
350         * @param[in] listener               The event listener to add
351         * @exception E_SUCCESS                                The method is successful.
352         * @exception E_OBJ_ALREADY_EXIST       The listener is already added.
353         * @remarks   The specified listener should be allocated in heap memory.
354         */
355         result AddTableViewItemEventListener(ITableViewItemEventListener& listener);
356
357         /**
358         * Removes a listener instance that listens to state changes of table view items. @n
359         * The removed listener cannot listen to events when they are fired.
360         *
361         * @since 2.0
362         *
363         * @return        An error code
364         * @param[in] listener     The event listener to remove
365         * @exception    E_SUCCESS                             The method is successful.
366         * @exception    E_OBJ_NOT_FOUND        The listener is not found.
367         */
368         result RemoveTableViewItemEventListener(ITableViewItemEventListener& listener);
369
370         /**
371         * Adds a listener instance that listens to state changes of a fast scroll. @n
372         * The added listener can listen to events on the specified event dispatcher's context when they are fired.
373         *
374         * @since 2.0
375         *
376         * @return        An error code
377         * @param[in] listener     The event listener to add
378         * @exception    E_SUCCESS                             The method is successful.
379         * @exception    E_INVALID_OPERATION The current state of the instance prohibits the execution of the specified operation.
380         * @exception    E_OBJ_ALREADY_EXIST The listener is already added.
381         * @remarks   The specified listener should be allocated in heap memory.
382         */
383         result AddFastScrollListener(IFastScrollListener& listener);
384
385         /**
386         * Removes a listener instance that listens to state changes of a fast scroll. @n
387         * The removed listener cannot listen to events when they are fired.
388         *
389         * @since 2.0
390         *
391         * @return        An error code
392         * @param[in] listener     The event listener to remove
393         * @exception    E_SUCCESS                             The method is successful.
394         * @exception    E_INVALID_OPERATION The current state of the instance prohibits the execution of the specified operation.
395         * @exception    E_OBJ_NOT_FOUND        The listener is not found.
396         */
397         result RemoveFastScrollListener(IFastScrollListener& listener);
398
399         /**
400         * Adds a listener instance that listens to state changes of a scroll event. @n
401         * The added listener can listen to events on the specified event dispatcher's context when they are fired.
402         *
403         * @since 2.0
404         *
405         * @return        An error code
406         * @param[in] listener                          The event listener to add
407         * @see                  IScrollEventListener::OnScrollEndReached()
408         * @see                  RemoveScrollEventListener()
409         * @exception    E_SUCCESS                             The method is successful.
410         * @exception    E_INVALID_OPERATION The current state of the instance prohibits the execution of the specified operation.
411         * @exception    E_OBJ_ALREADY_EXIST The listener is already added.
412         * @remarks   The specified listener should be allocated in heap memory.
413         */
414         result AddScrollEventListener(IScrollEventListener& listener);
415
416         /**
417         * Removes a listener instance that listens to state changes of a scroll event. @n
418         * The removed listener cannot listen to events when they are fired.
419         *
420         * @since 2.0
421         *
422         * @return        An error code
423         * @param[in] listener     The event listener to remove
424         * @see  IScrollEventListener::OnScrollEndReached()
425         * @see           AddScrollEventListener()
426         * @exception    E_SUCCESS                             The method is successful.
427         * @exception    E_INVALID_OPERATION The current state of the instance prohibits the execution of the specified operation.
428         * @exception    E_OBJ_NOT_FOUND        The listener is not found.
429         */
430         result RemoveScrollEventListener(IScrollEventListener& listener);
431
432         /**
433         * Adds a listener instance that listens to state changes of a scroll event. @n
434         * The added listener can listen to events on the specified event dispatcher's context when they are fired.
435         *
436         * @since 2.1
437         *
438         * @return        An error code
439         * @param[in] listener                          The event listener to add
440         * @see                  IScrollEventListenerF::OnScrollEndReached()
441         * @see                  RemoveScrollEventListenerF()
442         * @exception    E_SUCCESS                             The method is successful.
443         * @exception    E_INVALID_OPERATION The current state of the instance prohibits the execution of the specified operation.
444         * @exception    E_OBJ_ALREADY_EXIST The listener is already added.
445         * @remarks   The specified listener should be allocated in heap memory.
446         */
447         result AddScrollEventListener(IScrollEventListenerF& listener);
448
449         /**
450         * Removes a listener instance that listens to state changes of a scroll event. @n
451         * The removed listener cannot listen to events when they are fired.
452         *
453         * @since 2.1
454         *
455         * @return        An error code
456         * @param[in] listener     The event listener to remove
457         * @see  IScrollEventListenerF::OnScrollEndReached()
458         * @see           AddScrollEventListenerF()
459         * @exception    E_SUCCESS                             The method is successful.
460         * @exception    E_INVALID_OPERATION The current state of the instance prohibits the execution of the specified operation.
461         * @exception    E_OBJ_NOT_FOUND        The listener is not found.
462         */
463         result RemoveScrollEventListener(IScrollEventListenerF& listener);
464
465         /**
466         * Sets the index table view of the scroll by texts.
467         *
468         * @since 2.0
469         *
470         * @return        An error code
471         * @param[in] text                                         The text of the index
472         * @param[in] useSearchIcon  Set to @c true to show the magnifying icon, @n
473         *                                                                                   else @c false
474         * @exception E_SUCCESS                     The method is successful.
475         * @exception E_INVALID_ARG     A specified input parameter is invalid.
476         * @exception E_INVALID_OPERATION      The current state of the instance prohibits the execution of the specified operation.
477         */
478         result SetFastScrollIndex(const Tizen::Base::String& text, bool useSearchIcon);
479
480         /**
481         * Gets the group and item indexes of the top item.
482         *
483         * @since 2.0
484         *
485         * @return        The item index
486         * @exception    E_SUCCESS                   The method is successful.
487         * @exception    E_OBJ_NOT_FOUND             Top drawn item is not found.
488         */
489         int GetTopDrawnItemIndex(void) const;
490
491         /**
492         * Gets the group and item indexes of the bottom item.
493         *
494         * @since 2.0
495         *
496         * @return        The item index
497         * @exception    E_SUCCESS                   The method is successful.
498         * @exception    E_OBJ_NOT_FOUND             Bottom drawn item is not found.
499         */
500         int GetBottomDrawnItemIndex(void) const;
501
502         /**
503         * Scrolls to the item at the specified index.
504         * The specified item is drawn at the position specified by the item alignment.
505         *
506         * @since 2.0
507         *
508         * @return  An error code
509         * @param[in] itemIndex             The targeted item index
510         * @param[in] itemAlignment         The item alignment
511         * @exception E_SUCCESS             The method is successful.
512         * @exception E_OUT_OF_RANGE        A specified input parameter is invalid.
513         * @exception E_INVALID_OPERATION The current state of the instance prohibits the execution of the specified operation @b Since: @b 2.1.
514         * @remarks This method does not work inside the ITableViewItemProvider callback.
515         * @remarks This method should be called only after TableView items are created. If this method needs to be called early in the lifecycle of the TableView, then UpdateTableView() method should be called explicitly (e.g. during Tizen::Ui::Control::OnInitializing()).
516         */
517         result ScrollToItem(int itemIndex, TableViewScrollItemAlignment itemAlignment = TABLE_VIEW_SCROLL_ITEM_ALIGNMENT_TOP);
518
519         /**
520         * Checks or unchecks the item at the specified index.
521         *
522         * @since 2.0
523         *
524         * @return  An error code
525         * @param[in] itemIndex  The item index to check
526         * @param[in] check    Set to @c true to select the item, @n
527         *         else @c false
528         * @exception E_SUCCESS   The method is successful.
529         * @exception E_OUT_OF_RANGE            A specified input parameter is invalid.
530         * @exception E_INVALID_OPERATION      The item is disabled or the current state of the instance prohibits the execution of the specified operation.
531         * @remarks This method works only when the annex style of the item allows selection. @n
532         * This method does not work during the ITableViewItemProvider call-back procedure.
533         * @remarks This method should be called only after TableView items are created. If this method needs to be called early in the lifecycle of the TableView, then UpdateTableView() method should be called explicitly (e.g. during Tizen::Ui::Control::OnInitializing()).
534         */
535         result SetItemChecked(int itemIndex, bool check);
536
537         /**
538         * Returns whether the item at the specified index is selected or not.
539         *
540         * @since 2.0
541         *
542         * @return @c true if the item is selected, @n
543         *   else @c false
544         * @param[in] itemIndex  The item itemIndex
545         * @exception E_SUCCESS                                The method is successful.
546         * @exception E_OUT_OF_RANGE  A specified input parameter is invalid.
547         * @remarks This method returns @c false, if the annex style of the item does not allow selection.
548         * @remarks This method should be called only after TableView items are created. If this method needs to be called early in the lifecycle of the TableView, then UpdateTableView() method should be called explicitly (e.g. during Tizen::Ui::Control::OnInitializing()).
549         */
550         bool IsItemChecked(int itemIndex) const;
551
552         /**
553         * Enables or disables the item at the specified index.
554         *
555         * @since 2.0
556         *
557         * @return An error code
558         * @param[in] itemIndex  The item index
559         * @param[in] enable    Set to @c true to enable the specified item, @n
560         *         else @c false
561         * @exception E_SUCCESS   The method is successful.
562         * @exception E_OUT_OF_RANGE  A specified input parameter is invalid.
563         * @exception E_INVALID_OPERATION The current state of the instance prohibits the execution of the specified operation @b Since: @b 2.1.
564         * @remarks This method does not work during the ITableViewItemProvider call-back procedure.
565         * @remarks This method should be called only after TableView items are created. If this method needs to be called early in the lifecycle of the TableView, then UpdateTableView() method should be called explicitly (e.g. during Tizen::Ui::Control::OnInitializing()).
566         */
567         result SetItemEnabled(int itemIndex, bool enable);
568
569         /**
570         * Returns whether the item at the specified index is enabled or disabled.
571         *
572         * @since 2.0
573         *
574         * @return @c true if the item is enabled, @n
575         *   else @c false
576         * @param[in] itemIndex  The item index
577         * @exception E_SUCCESS                                The method is successful.
578         * @exception E_OUT_OF_RANGE  A specified input parameter is invalid.
579         * @remarks This method should be called only after TableView items are created. If this method needs to be called early in the lifecycle of the TableView, then UpdateTableView() method should be called explicitly (e.g. during Tizen::Ui::Control::OnInitializing()).
580         */
581         bool IsItemEnabled(int itemIndex) const;
582
583         /**
584         * Counts all the items of the specified group.
585         *
586         * @since 2.0
587         *
588         * @return The total number of items
589         */
590         int GetItemCount(void) const;
591
592         /**
593         * Updates the specified item. @n
594         * For instance, TABLE_VIEW_REFRESH_TYPE_ITEM_ADD is used when a new item needs to be added and TABLE_VIEW_REFRESH_TYPE_ITEM_REMOVE is used when an item is deleted from the
595         * table view. Moreover, TABLE_VIEW_REFRESH_TYPE_ITEM_MODIFY is used when the content of an existing item has changed and it needs to be updated.
596         * Note that calling this method with TABLE_VIEW_REFRESH_TYPE_ITEM_MODIFY invokes item provider's UpdateItem() for the given index in sequence.
597         *
598         * @since 2.0
599         *
600         * @return An error code
601         * @param[in] itemIndex  The item index
602         * @param[in] type                The item to add, remove, or modify
603         * @exception E_SUCCESS   The method is successful.
604         * @exception E_OUT_OF_RANGE  A specified input parameter is invalid.
605         * @exception E_INVALID_OPERATION The current state of the instance prohibits the execution of the specified operation @b Since: @b 2.1.
606         * @remarks If the specified itemIndex. @n
607         * This method does not work during the ITableViewItemProvider call-back procedure.
608         */
609         result RefreshItem(int itemIndex, TableViewRefreshType type);
610
611         /**
612         * Updates all items of the table view. @n
613         * Note that calling this method invokes its item provider's UpdateItem() for all loaded items.
614         *
615         * @since 2.1
616         *
617         * @return An error code
618         * @exception E_SUCCESS The method is successful.
619         * @exception E_INVALID_OPERATION The %TableView item provider is processing the other request.
620         */
621         result RefreshAllItems(void);
622
623         /**
624         * Updates all the items of a table view. @n
625         * This method deletes all the items in the table view and invokes the methods of the item provider again to update the table view.
626         *
627         * @since 2.0
628         *
629         * @exception E_SUCCESS The method is successful.
630         * @exception E_INVALID_OPERATION The current state of the instance prohibits the execution of the specified operation @b Since: @b 2.1.
631         * @remarks This method will delete all the items and recreate them, so it should not be called from the inside of 
632         * OnTableViewItemStateChanged() callback as this leads to self deletion. If you need to update an Item, you should use RefreshItem() method.
633         * @remarks This method should not be called from ITableViewItemProvider implementation because of recursion.
634         * @remarks The specific error code can be accessed using the GetLastResult() method.
635         */
636         void UpdateTableView(void);
637
638         /**
639         * Gets the index of the item at the specified position.
640         *
641         * @since 2.0
642         *
643         * @return  The item index of the item on specified position
644         * @param[in] position   The position of the item
645         * @remarks This method returns -1 if no item is found at the given position.
646         * @remarks This method should be called only after TableView items are created. If this method needs to be called early in the lifecycle of the TableView, then UpdateTableView() method should be called explicitly (e.g. during Tizen::Ui::Control::OnInitializing()).
647         */
648         int GetItemIndexFromPosition(const Tizen::Graphics::Point& position) const;
649
650         /**
651         * Gets the index of the item at the specified position.
652         *
653         * @since 2.1
654         *
655         * @return  The item index of the item on specified position
656         * @param[in] position   The position of the item
657         * @remarks This method returns -1 if no item is found at the given position.
658         * @remarks This method should be called only after TableView items are created. If this method needs to be called early in the lifecycle of the TableView, then UpdateTableView() method should be called explicitly (e.g. during Tizen::Ui::Control::OnInitializing()).
659         */
660         int GetItemIndexFromPosition(const Tizen::Graphics::FloatPoint& position) const;
661
662         /**
663         * Sets the color of a division line between items.
664         *
665         * @since 2.0
666         *
667         * @return An error code
668         * @param[in] color    The division line color
669         */
670         void SetItemDividerColor(const Tizen::Graphics::Color& color);
671
672         /**
673         * Gets the color of a division line between items.
674         *
675         * @since 2.0
676         *
677         * @return        The color of a division line
678         */
679         Tizen::Graphics::Color GetItemDividerColor(void) const;
680
681         /**
682         * Sets the background color of this control.
683         *
684         * @since 2.0
685         *
686         * @param[in] color          The background color
687         * @remarks The background bitmap has priority over the background color. When both the background bitmap and the background color are specified,
688         *        only the bitmap image is displayed.
689         */
690         void SetBackgroundColor(const Tizen::Graphics::Color& color);
691
692         /**
693         * Gets the background color of this control.
694         *
695         * @since 2.0
696         *
697         * @return The background color
698         */
699         Tizen::Graphics::Color GetBackgroundColor(void) const;
700
701         /**
702         * Sets the scroll input handling mode.
703         *
704         * @since 2.0
705         *
706         * @param[in] mode  The scroll input handling mode
707         * @see         GetScrollInputMode()
708         */
709         void SetScrollInputMode(ScrollInputMode mode);
710
711
712         /**
713         * Gets the scroll input handling mode.
714         *
715         * @since 2.0
716         *
717         * @return     The scroll input handling mode
718         * @see         SetScrollInputMode()
719         */
720         ScrollInputMode GetScrollInputMode(void) const;
721
722         /**
723         * Scrolls the list contents by the specified number of pixels. When it is negative, it scrolls to opposite direction in current scroll style.
724         *
725         * @since 2.1
726         *
727         * @return  An error code
728         * @param[in]   pixel                                            The amount of pixels to scroll
729         * @exception   E_SUCCESS                                The method is successful.
730         * @exception   E_OUT_OF_RANGE           The specified @c pixel is out of range.
731         * @exception E_INVALID_OPERATION The current state of the instance prohibits the execution of the specified operation
732         * @remarks If you call ScrollByPixel() with negative @c pixel when position of scroll is already top of contents then it will return E_OUT_OF_RANGE.
733         * Likewise, in case of positive @c pixel on the bottom position of scroll it will also return E_OUT_OF_RANGE. @n
734         * This method does not work during the ITableViewItemProvider call-back procedure.
735         */
736         result ScrollByPixel(int pixel);
737
738         /**
739         * Scrolls the list contents by the specified number of pixels. When it is negative, it scrolls to opposite direction in current scroll style.
740         *
741         * @since 2.1
742         *
743         * @return  An error code
744         * @param[in]   pixel                                            The amount of pixels to scroll
745         * @exception   E_SUCCESS                                The method is successful.
746         * @exception   E_OUT_OF_RANGE           The specified @c pixel is out of range.
747         * @exception E_INVALID_OPERATION The current state of the instance prohibits the execution of the specified operation
748         * @remarks If you call ScrollByPixel() with negative @c pixel when position of scroll is already top of contents then it will return E_OUT_OF_RANGE.
749         * Likewise, in case of positive @c pixel on the bottom position of scroll it will also return E_OUT_OF_RANGE. @n
750         * This method does not work during the ITableViewItemProvider call-back procedure.
751         */
752         result ScrollByPixel(float pixel);
753
754         /**
755         * Gets the current scroll position
756         *
757         * @since 2.1
758         */
759         int GetCurrentScrollPosition(void) const;
760
761         /**
762         * Gets the current scroll position
763         *
764         * @since 2.1
765         */
766         float GetCurrentScrollPositionF(void) const;
767
768         /*
769         * Enables or disables the scroll of TableView items.
770         *
771         * @since 2.0
772         */
773         void SetScrollEnabled(bool enable);
774
775         /*
776         * Checks whether the scroll is enabled or disabled.
777         *
778         * @since 2.0
779         */
780         bool IsScrollEnabled(void) const;
781
782         /**
783         * Opens the context item at the specified index.
784         *
785         * @since 2.1
786         *
787         * @return  An error code
788         * @param[in] itemIndex  The item index
789         * @exception E_SUCCESS   The method is successful.
790         * @exception E_OUT_OF_RANGE                A specified input parameter is invalid.
791         * @exception E_INVALID_OPERATION  The current state of the instance prohibits the execution of the specified operation.
792         */
793         result OpenContextItem(int itemIndex);
794
795         /**
796         * Closes the context item at the specified index.
797         *
798         * @since 2.1
799         *
800         * @return  An error code
801         * @param[in] itemIndex  The item index
802         * @exception E_SUCCESS   The method is successful.
803         * @exception E_OUT_OF_RANGE                A specified input parameter is invalid.
804         * @exception E_INVALID_OPERATION  The current state of the instance prohibits the execution of the specified operation.
805         */
806         result CloseContextItem(int itemIndex);
807
808         /**
809         * Returns whether the context item at the specified index is opened.
810         *
811         * @since 2.1
812         *
813         * @return @c true if the context item is opened, else @c false
814         * @param[in] itemIndex  The item itemIndex
815         * @exception E_SUCCESS           The method is successful.
816         * @exception E_OUT_OF_RANGE  A specified input parameter is invalid.
817         */
818         bool IsContextItemOpened(int itemIndex) const;
819
820 private:
821         friend class _TableViewImpl;
822
823         // The implementation of this copy constructor is intentionally blank and declared as private to prohibit copying of objects.
824         TableView(const TableView& rhs);
825
826         // The implementation of this copy assignment operator is intentionally blank and declared as private to prohibit copying of objects.
827         TableView& operator =(const TableView& rhs);
828 }; // TableView
829
830 }}} // Tizen::Ui::Controls
831
832 #endif  // _FUI_CTRL_TABLE_VIEW_H_