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