Merge "Fix Ime Rotation" into tizen_2.1
[platform/framework/native/uifw.git] / inc / FUiCtrlGroupedTableView.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 FUiCtrlGroupedTableView.h
20 * @brief This is the header file for the %GroupedTableView class.
21 *
22 * This header file contains the declarations of the %GroupedTableView class and its helper classes.
23 */
24
25 #ifndef _FUI_CTRL_GROUPED_TABLE_VIEW_H_
26 #define _FUI_CTRL_GROUPED_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 IGroupedTableViewItemProvider;
37 class IGroupedTableViewItemProviderF;
38 class IGroupedTableViewItemEventListener;
39 class IFastScrollListener;
40 class IScrollEventListener;
41 class IScrollEventListenerF;
42
43 /**
44  * @class GroupedTableView
45  * @brief   This class defines common behavior for a %GroupedTableView control.
46  *
47  * @since 2.0
48  *
49  * The %GroupedTableView class defines common behavior for a %GroupedTableView control.
50  * @code
51 //Sample code for GroupedTableViewSample.h
52 #include <FUi.h>
53
54 class GroupedTableViewSample
55         : public Tizen::Ui::Controls::Form
56         , public Tizen::Ui::Controls::IGroupedTableViewItemProvider
57         , public Tizen::Ui::Controls::IGroupedTableViewItemEventListener
58         , public Tizen::Ui::Controls::IFastScrollListener
59 {
60 public:
61         GroupedTableViewSample(void)
62         : __pGroupedTableView(null)
63         , __pContextItem(null){}
64
65         bool Initialize(void);
66         virtual result OnInitializing(void);
67         virtual result OnTerminating(void);
68
69         // IGroupedTableViewItemEventListener
70         virtual void OnGroupedTableViewGroupItemStateChanged(Tizen::Ui::Controls::GroupedTableView& tableView, int groupIndex, Tizen::Ui::Controls::TableViewGroupItem* pItem, Tizen::Ui::Controls::TableViewItemStatus status);
71         virtual void OnGroupedTableViewItemStateChanged(Tizen::Ui::Controls::GroupedTableView& tableView, int groupIndex, int itemIndex, Tizen::Ui::Controls::TableViewItem* pItem, Tizen::Ui::Controls::TableViewItemStatus status);
72         virtual void OnGroupedTableViewContextItemActivationStateChanged(Tizen::Ui::Controls::GroupedTableView& tableView, int groupIndex, int itemIndex, Tizen::Ui::Controls::TableViewContextItem* pContextItem, bool activated);
73
74         // IGroupedTableViewItemProvider
75         virtual int GetGroupCount(void);
76         virtual int GetItemCount(int groupIndex);
77         virtual Tizen::Ui::Controls::TableViewGroupItem* CreateGroupItem(int groupIndex, int itemWidth);
78         virtual bool DeleteGroupItem(int groupIndex, Tizen::Ui::Controls::TableViewGroupItem* pItem);
79         virtual void UpdateGroupItem(int groupIndex, Tizen::Ui::Controls::TableViewGroupItem* pItem);
80         virtual Tizen::Ui::Controls::TableViewItem* CreateItem(int groupIndex, int itemIndex, int itemWidth);
81         virtual bool DeleteItem(int groupIndex, int itemIndex, Tizen::Ui::Controls::TableViewItem* pItem);
82         virtual void UpdateItem(int groupIndex, int itemIndex, Tizen::Ui::Controls::TableViewItem* pItem);
83         virtual int GetDefaultItemHeight(void);
84         virtual int GetDefaultGroupItemHeight(void);
85
86         // IFastScrollListener
87         virtual void OnFastScrollIndexSelected(Tizen::Ui::Control& source, Tizen::Base::String& index);
88
89 private:
90         Tizen::Ui::Controls::GroupedTableView* __pGroupedTableView;
91         Tizen::Ui::Controls::TableViewContextItem* __pContextItem;
92 };
93  *  @endcode
94  *
95  *  @code
96
97 //Sample code for GroupedTableViewSample.cpp
98 #include <FApp.h>
99 #include <FGraphics.h>
100
101 #include "GroupedTableViewSample.h"
102
103 using namespace Tizen::App;
104 using namespace Tizen::Base;
105 using namespace Tizen::Graphics;
106 using namespace Tizen::Media;
107 using namespace Tizen::Ui::Controls;
108
109 bool
110 GroupedTableViewSample::Initialize(void)
111 {
112         Construct(FORM_STYLE_NORMAL);
113         return true;
114 }
115
116 result
117 GroupedTableViewSample::OnInitializing(void)
118 {
119         result r = E_SUCCESS;
120
121         // Creates an instance of TableView
122         __pGroupedTableView = new GroupedTableView();
123         __pGroupedTableView->Construct(Rectangle(0, 0, GetClientAreaBounds().width, GetClientAreaBounds().height), true, TABLE_VIEW_SCROLL_BAR_STYLE_FAST_SCROLL);
124         __pGroupedTableView->SetItemProvider(*this);
125         __pGroupedTableView->AddTableViewItemEventListener(*this);
126
127         __pGroupedTableView->AddFastScrollListener(*this);
128         __pGroupedTableView->SetFastScrollIndex(L"ABCDEFGHIJKLMNOPQRSTUVWXYZ", true);
129
130         // Adds the TableView to the form
131         AddControl(*__pGroupedTableView);
132
133         // Creates an instance of TableViewContextItem
134         __pContextItem = new TableViewContextItem();
135         __pContextItem->Construct(Dimension(720, 100));
136
137         Button* pButton = new Button();
138         pButton->Construct(Rectangle(10, 10, 200, 80), L"Context1");
139
140         Button* pButton2 = new Button();
141         pButton2->Construct(Rectangle(250, 10, 200, 80), L"Context2");
142
143         __pContextItem->AddControl(*pButton);
144         __pContextItem->AddControl(*pButton2);
145
146         return r;
147 }
148
149 result
150 GroupedTableViewSample::OnTerminating(void)
151 {
152         result r = E_SUCCESS;
153
154         // Deallocates the item context
155         delete __pItemContext;
156         __pItemContext = null;
157
158         return r;
159 }
160
161 // IGroupedTableViewItemEventListener implementation
162 void
163 GroupedTableViewSample::OnGroupedTableViewGroupItemStateChanged(GroupedTableView& tableView, int groupIndex, TableViewGroupItem* pItem, TableViewItemStatus status)
164 {
165         if (tableView.IsGroupExpanded(groupIndex))
166         {
167                 tableView.CollapseGroup(groupIndex);
168         }
169         else
170         {
171                 tableView.ExpandGroup(groupIndex);
172         }
173 }
174
175 void
176 GroupedTableViewSample::OnGroupedTableViewItemStateChanged(GroupedTableView& tableView, int groupIndex, int itemIndex, TableViewItem* pItem, TableViewItemStatus status)
177 {
178         // ....
179 }
180
181 void
182 GroupedTableViewSample::OnGroupedTableViewContextItemActivationStateChanged(GroupedTableView& tableView, int groupIndex, int itemIndex, TableViewContextItem* pContextItem, bool activated)
183 {
184         // ....
185 }
186
187 // IFastScrollListener implementation
188 void
189 GroupedTableViewSample::OnFastScrollIndexSelected(Tizen::Ui::Control& source, Tizen::Base::String& index)
190 {
191         // ....
192 }
193
194 // IGroupedTableViewItemProvider implementation
195 int
196 GroupedTableViewSample::GetGroupCount(void)
197 {
198         return 26;
199 }
200
201 int
202 GroupedTableViewSample::GetItemCount(int groupIndex)
203 {
204         return 10;
205 }
206
207 int
208 GroupedTableViewSample::GetDefaultItemHeight(void)
209 {
210         return 100;
211 }
212
213 int
214 GroupedTableViewSample::GetDefaultGroupItemHeight(void)
215 {
216         return 80;
217 }
218
219 TableViewGroupItem*
220 GroupedTableViewSample::CreateGroupItem(int groupIndex, int itemWidth)
221 {
222         TableViewGroupItem* pItem = new TableViewGroupItem();
223         pItem->Construct(Dimension(itemWidth, GetDefaultGroupItemHeight()));
224
225         String text;
226         text.Format(30, L"Group title %d", itemIndex);
227
228         Label* pLabel = new Label();
229         pLabel->Construct(Rectangle(0, 0, itemWidth, GetDefaultGroupItemHeight(), text);
230
231         pItem->AddControl(*pLable);
232
233         return pItem;
234 }
235
236 bool
237 GroupedTableViewSample::DeleteGroupItem(int groupIndex, TableViewGroupItem* pItem)
238 {
239         pItem->Destroy();
240
241         return true;
242 }
243
244 void
245 GroupedTableViewSample::UpdateGroupItem(int groupIndex, TableViewGroupItem* pItem)
246 {
247         // ....
248 }
249
250 TableViewItem*
251 GroupedTableViewSample::CreateItem(int groupIndex, int itemIndex, int itemWidth)
252 {
253         TableViewAnnexStyle style = TABLE_VIEW_ANNEX_STYLE_NORMAL;
254         TableViewItem* pItem = new TableViewItem();
255
256         switch (itemIndex % 6)
257         {
258         case 0:
259                 style = TABLE_VIEW_ANNEX_STYLE_NORMAL;
260                 break;
261         case 1:
262                 style = TABLE_VIEW_ANNEX_STYLE_MARK;
263                 break;
264         case 2:
265                 style = TABLE_VIEW_ANNEX_STYLE_ONOFF_SLIDING;
266                 break;
267         case 3:
268                 style = TABLE_VIEW_ANNEX_STYLE_DETAILED;
269                 break;
270         case 4:
271                 style = TABLE_VIEW_ANNEX_STYLE_RADIO;
272                 break;
273         case 5:
274                 style = TABLE_VIEW_ANNEX_STYLE_ONOFF_SLIDING_WITH_DIVIDER;
275                 break;
276         default:
277                 break;
278         }
279
280         pItem->Construct(Dimension(itemWidth, GetDefaultItemHeight()), style);
281
282         String text;
283         text.Format(30, L"TableViewItem %d", itemIndex);
284
285         Label* pLabel = new Label();
286         pLabel->Construct(Rectangle(0, 0, itemWidth, GetDefaultItemHeight(), text);
287
288         pItem->AddControl(*pLabel);
289         pItem->SetContextItem(__pContextItem);
290
291         return pItem;
292 }
293
294 bool
295 GroupedTableViewSample::DeleteItem(int groupIndex, int itemIndex, Controls::TableViewItem* pItem)
296 {
297         pItem->Destroy();
298
299         return true;
300 }
301
302 void
303 GroupedTableViewSample::UpdateItem(int groupIndex, int itemIndex, Controls::TableViewItem* pItem)
304 {
305         // ....
306 }
307  * @endcode
308  *
309  */
310
311 class _OSP_EXPORT_ GroupedTableView
312         : public Tizen::Ui::Container
313 {
314 public:
315         /**
316         * The object is not fully constructed after this constructor is called. Hence, the Construct() method must be called after calling this constructor.
317         *
318         * @since 2.0
319         */
320         GroupedTableView(void);
321
322         /**
323         * This destructor overrides Tizen::Base::Object::~Object().
324         *
325         * @since 2.0
326         */
327         virtual ~GroupedTableView(void);
328
329         /**
330         * Initializes this instance of %GroupedTableView with the specified parameters.
331         *
332         * @since 2.0
333         *
334         * @return  An error code
335         * @param[in] rect    An instance of the Graphics::Rectangle class
336         *                              This instance represents the x and y coordinates of the left top corner of the created %GroupedTableView along with the width and height.
337         * @param[in] itemDivider       Set to @c true to display an item divider, @n
338         *                              else @c false
339         * @param[in] scrollStyle       The style of %GroupedTableView scroll bar style
340         * @exception E_SUCCESS         The method is successful.
341         * @exception E_INVALID_ARG     A specified input parameter is invalid, or either the rect.width or rect.height parameter has a negative value.
342         *
343         */
344         result Construct(const Tizen::Graphics::Rectangle& rect, bool itemDivider, TableViewScrollBarStyle scrollStyle);
345
346         /**
347         * Initializes this instance of %GroupedTableView with the specified parameters.
348         *
349         * @since 2.1
350         *
351         * @return  An error code
352         * @param[in] rect    An instance of the Graphics::FloatRectangle class
353         *                              This instance represents the x and y coordinates of the left top corner of the created %GroupedTableView along with the width and height.
354         * @param[in] itemDivider       Set to @c true to display an item divider, @n
355         *                              else @c false
356         * @param[in] scrollStyle       The style of %GroupedTableView scroll bar style
357         * @exception E_SUCCESS         The method is successful.
358         * @exception E_INVALID_ARG     A specified input parameter is invalid, or either the rect.width or rect.height parameter has a negative value.
359         *
360         */
361         result Construct(const Tizen::Graphics::FloatRectangle& rect, bool itemDivider, TableViewScrollBarStyle scrollStyle);
362
363         /**
364         * Sets the item provider that creates and deletes items for the grouped style table view.
365         *
366         * @since 2.0
367         *
368         * @param[in] pProvider                                 The item provider to create and delete items
369         * @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.
370         *          To reset the item provider, pass @c null to @c pProvider.
371         */
372         void SetItemProvider(IGroupedTableViewItemProvider* pProvider);
373
374         /**
375         * Sets the item provider that creates and deletes items for the grouped style table view.
376         *
377         * @since 2.1
378         *
379         * @param[in] pProvider                                 The item provider to create and delete items
380         * @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.
381         *          To reset the item provider, pass @c null to @c pProvider.
382         */
383         void SetItemProviderF(IGroupedTableViewItemProviderF* pProvider);
384
385         /**
386         * Expands the group's items.
387         *
388         * @since 2.0
389         *
390         * @return An error code
391         * @param[in] groupIndex The index of the group
392         * @exception E_SUCCESS             The method is successful.
393         * @exception E_OUT_OF_RANGE        A specified input parameter is invalid.
394         * @exception E_INVALID_OPERATION The current state of the instance prohibits the execution of the specified operation @b Since: @b 2.1.
395         * @remarks This method does not work during the ITableViewItemProvider call-back procedure.
396         * @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()).
397         */
398         result ExpandGroup(int groupIndex);
399
400         /**
401         * Collapses the group's items.
402         *
403         * @since 2.0
404         *
405         * @return An error code
406         * @param[in] groupIndex The index of the group
407         * @exception E_SUCCESS         The method is successful.
408         * @exception E_OUT_OF_RANGE           A specified input parameter is invalid.
409         * @exception E_INVALID_OPERATION The current state of the instance prohibits the execution of the specified operation @b Since: @b 2.1.
410         * @remarks This method does not work during the ITableViewItemProvider call-back procedure.
411         * @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()).
412         */
413         result CollapseGroup(int groupIndex);
414
415         /**
416         * Expands all groups of table view.
417         *
418         * @since 2.0
419         *
420         * @return An error code
421         * @exception E_SUCCESS             The method is successful.
422         * @exception E_INVALID_OPERATION The current state of the instance prohibits the execution of the specified operation @b Since: @b 2.1.
423         * @remarks This method does not work during the ITableViewItemProvider call-back procedure.
424         */
425         result ExpandAllGroups(void);
426
427         /**
428         * Collapses all groups of table view.
429         *
430         * @since 2.0
431         *
432         * @return An error code
433         * @exception E_SUCCESS             The method is successful.
434         * @exception E_INVALID_OPERATION The current state of the instance prohibits the execution of the specified operation @b Since: @b 2.1.
435         * @remarks This method does not work during the ITableViewItemProvider call-back procedure.
436         */
437         result CollapseAllGroups(void);
438
439         /*
440         * Expands all groups of table view.
441         *
442         * @since 2.0
443         *
444         */
445         inline void ExpandAllGroup(void)
446         {
447                 ExpandAllGroups();
448         }
449
450         /*
451         * Collapses all groups of table view.
452         *
453         * @since 2.0
454         *
455         */
456         inline void CollapseAllGroup(void)
457         {
458                 CollapseAllGroups();
459         }
460
461         /**
462         * Returns whether the group is expanded or not.
463         *
464         * @since 2.0
465         *
466         * @return @c true if the group is expanded, else @c false
467         * @param[in] groupIndex The index of the group
468         * @exception E_SUCCESS  The method is successful.
469         * @exception E_OUT_OF_RANGE           A specified input parameter is invalid.
470         * @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()).
471         */
472         bool IsGroupExpanded(int groupIndex) const;
473
474         /**
475         * Sets the grouped look is enabled.
476         *
477         * @since 2.0
478         *
479         * @param[in] enable   The enabled/disabled status
480         */
481         void SetGroupedLookEnabled(bool enable);
482
483         /**
484         * Returns whether the grouped look is enabled or not.
485         *
486         * @since 2.0
487         *
488         * @return @c true if the grouped look is enabled, else @c false
489         */
490         bool IsGroupedLookEnabled(void) const;
491
492         /**
493         * Adds a listener instance that listens to state changes of table view items. @n
494         * The added listener can listen to events on the specified event dispatcher's context when they are fired.
495         *
496         * @since 2.0
497         *
498         * @return  An error code
499         * @param[in] listener      The event listener to add
500         * @exception E_SUCCESS                                          The method is successful.
501         * @exception E_OBJ_ALREADY_EXIST      The listener is already added.
502         * @remarks   The specified listener should be allocated in heap memory.
503         */
504         result AddGroupedTableViewItemEventListener(IGroupedTableViewItemEventListener& listener);
505
506         /**
507         * Removes a listener instance that listens to state changes of table view items. @n
508         * The removed listener cannot listen to events when they are fired.
509         *
510         * @since 2.0
511         *
512         * @return  An error code
513         * @param[in] listener   The event listener to remove
514         * @exception   E_SUCCESS                             The method is successful.
515         * @exception   E_OBJ_NOT_FOUND                  The listener is not found.
516         */
517         result RemoveGroupedTableViewItemEventListener(IGroupedTableViewItemEventListener& listener);
518
519         /**
520         * Adds a listener instance that listens to state changes of a fast scroll. @n
521         * The added listener can listen to events on the specified event dispatcher's context when they are fired.
522         *
523         * @since 2.0
524         *
525         * @return  An error code
526         * @param[in] listener   The event listener to add
527         * @exception   E_SUCCESS                             The method is successful.
528         * @exception   E_INVALID_OPERATION  The current state of the instance prohibits the execution of the specified operation.
529         * @exception   E_OBJ_ALREADY_EXIST   The listener is already added.
530         * @remarks   The specified listener should be allocated in heap memory.
531         */
532         result AddFastScrollListener(IFastScrollListener& listener);
533
534         /**
535         * Removes a listener instance that listens to state changes of a fast scroll. @n
536         * The removed listener cannot listen to events when they are fired.
537         *
538         * @since 2.0
539         *
540         * @return  An error code
541         * @param[in] listener   The event listener to remove
542         * @exception   E_SUCCESS                             The method is successful.
543         * @exception   E_INVALID_OPERATION  The current state of the instance prohibits the execution of the specified operation.
544         * @exception   E_OBJ_NOT_FOUND                  The listener is not found.
545         */
546         result RemoveFastScrollListener(IFastScrollListener& listener);
547
548         /**
549         * Adds a listener instance that listens to state changes of a scroll event. @n
550         * The added listener can listen to events on the specified event dispatcher's context when they are fired.
551         *
552         * @since 2.0
553         *
554         * @return  An error code
555         * @param[in] listener          The event listener to add
556         * @see     IScrollEventListener::OnScrollEndReached()
557         * @see     RemoveScrollEventListener()
558         * @exception   E_SUCCESS                             The method is successful.
559         * @exception   E_INVALID_OPERATION  The current state of the instance prohibits the execution of the specified operation.
560         * @exception   E_OBJ_ALREADY_EXIST   The listener is already added.
561         * @remarks   The specified listener should be allocated in heap memory.
562         */
563         result AddScrollEventListener(IScrollEventListener& listener);
564
565         /**
566         * Removes a listener instance that listens to state changes of a scroll event. @n
567         * The removed listener cannot listen to events when they are fired.
568         *
569         * @since 2.0
570         *
571         * @return  An error code
572         * @param[in] listener   The event listener to remove
573         * @see  IScrollEventListener::OnScrollEndReached()
574         * @see     AddScrollEventListener()
575         * @exception   E_SUCCESS                             The method is successful.
576         * @exception   E_INVALID_OPERATION  The current state of the instance prohibits the execution of the specified operation.
577         * @exception   E_OBJ_NOT_FOUND                  The listener is not found.
578         */
579         result RemoveScrollEventListener(IScrollEventListener& listener);
580
581         /**
582         * Adds a listener instance that listens to state changes of a scroll event. @n
583         * The added listener can listen to events on the specified event dispatcher's context when they are fired.
584         *
585         * @since 2.1
586         *
587         * @return  An error code
588         * @param[in] listener          The event listener to add
589         * @see     IScrollEventListenerF::OnScrollEndReached()
590         * @see     RemoveScrollEventListenerF()
591         * @exception   E_SUCCESS                             The method is successful.
592         * @exception   E_INVALID_OPERATION  The current state of the instance prohibits the execution of the specified operation.
593         * @exception   E_OBJ_ALREADY_EXIST   The listener is already added.
594         * @remarks   The specified listener should be allocated in heap memory.
595         */
596         result AddScrollEventListener(IScrollEventListenerF& listener);
597
598         /**
599         * Removes a listener instance that listens to state changes of a scroll event. @n
600         * The removed listener cannot listen to events when they are fired.
601         *
602         * @since 2.1
603         *
604         * @return  An error code
605         * @param[in] listener   The event listener to remove
606         * @see  IScrollEventListenerF::OnScrollEndReached()
607         * @see     AddScrollEventListenerF()
608         * @exception   E_SUCCESS                             The method is successful.
609         * @exception   E_INVALID_OPERATION  The current state of the instance prohibits the execution of the specified operation.
610         * @exception   E_OBJ_NOT_FOUND                  The listener is not found.
611         */
612         result RemoveScrollEventListener(IScrollEventListenerF& listener);
613
614         /**
615         * Enables or disables the collapse by pinch gesture.
616         *
617         * @since 2.0
618         *
619         * @param[in] enable   Set to @c true to enable the collapse by pinch gesture, else @c false
620         */
621         void SetCollapseByPinchGestureEnabled(bool enable);
622
623         /**
624         * Returns whether the collapse by pinch gesture is enabled or not.
625         *
626         * @since 2.0
627         *
628         * @return @c true if the collapse by pinch gesture is enabled, else @c false
629         */
630         bool IsCollapseByPinchGestureEnabled(void) const;
631
632         /**
633         * Sets the text index of the fast scroll.
634         *
635         * @since 2.0
636         *
637         * @return  An error code
638         * @param[in] text                    The text of the index
639         * @param[in] useSearchIcon           Set to @c true to show the magnifying icon, @n
640         *                                    else @c false
641         * @exception E_SUCCESS               The method is successful.
642         * @exception E_INVALID_OPERATION     The current state of the instance prohibits the execution of the specified operation.
643         */
644         result SetFastScrollIndex(const Tizen::Base::String& text, bool useSearchIcon);
645
646         /**
647         * Gets the group and item indexes of the top item.
648         *
649         * @since 2.0
650         *
651         * @return        An error code
652         * @param[out]  groupIndex                 The group index
653         * @param[out]  itemIndex                  The item index
654         * @exception   E_SUCCESS                  The method is successful.
655         * @exception   E_OBJ_NOT_FOUND            Top drawn item is not found.
656         */
657         result GetTopDrawnItemIndex(int& groupIndex, int& itemIndex) const;
658
659         /**
660         * Gets the group and item indexes of the bottom item.
661         *
662         * @since 2.0
663         *
664         * @return        An error code
665         * @param[out]  groupIndex                 The group index
666         * @param[out]  itemIndex                  The item index
667         * @exception   E_SUCCESS                  The method is successful.
668         * @exception   E_OBJ_NOT_FOUND            Bottom drawn item is not found.
669         */
670         result GetBottomDrawnItemIndex(int& groupIndex, int& itemIndex) const;
671
672         /**
673         * Scrolls to the item at the specified index.
674         * The specified item is drawn at the position specified by the item alignment.
675         *
676         * @since 2.0
677         *
678         * @return  An error code
679         * @param[in] groupIndex            The group index
680         * @param[in] itemIndex             The item index
681         * @param[in] itemAlignment         The item alignment
682         * @exception E_SUCCESS             The method is successful.
683         * @exception E_OUT_OF_RANGE        A specified input parameter is invalid.
684         * @exception E_INVALID_OPERATION The current state of the instance prohibits the execution of the specified operation @b Since: @b 2.1.
685         * @remarks If the specified item. itemIndex is -1, then the method is applied to the group item with the given index. @n
686         * This method does not work during the ITableViewItemProvider call-back procedure.
687         * @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()).
688         */
689         result ScrollToItem(int groupIndex, int itemIndex, TableViewScrollItemAlignment itemAlignment = TABLE_VIEW_SCROLL_ITEM_ALIGNMENT_TOP);
690
691         /**
692         * Checks or unchecks the item at the specified index.
693         *
694         * @since 2.0
695         *
696         * @return  An error code
697         * @param[in] groupIndex            The group index
698         * @param[in] itemIndex             The item index
699         * @param[in] check    Set to @c true to select the item, @n
700         *         else @c false
701         * @exception E_SUCCESS   The method is successful.
702         * @exception E_OUT_OF_RANGE           A specified input parameter is invalid.
703         * @exception E_INVALID_OPERATION The item is disabled or the current state of the instance prohibits the execution of the specified operation.
704         * @remarks This method works only when the annex style of the item allows selection. @n
705         * This method does not work during the ITableViewItemProvider call-back procedure.
706         * @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()).
707         */
708         result SetItemChecked(int groupIndex, int itemIndex, bool check);
709
710         /**
711         * Returns whether the item at the specified index is selected or not.
712         *
713         * @since 2.0
714         *
715         * @return @c true if the item is selected, @n
716         *   else @c false
717         * @param[in] groupIndex            The group index
718         * @param[in] itemIndex             The item index
719         * @exception E_SUCCESS                               The method is successful.
720         * @exception E_OUT_OF_RANGE A specified input parameter is invalid.
721         * @remarks This method returns @c false, if the annex style of the item does not allow selection.
722         * @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()).
723         */
724         bool IsItemChecked(int groupIndex, int itemIndex) const;
725
726         /**
727         * Enables or disables the item at the specified index.
728         *
729         * @since 2.0
730         *
731         * @return An error code
732         * @param[in] groupIndex            The group index
733         * @param[in] itemIndex             The item index
734         * @param[in] enable    Set to @c true to enable the specified item, @n
735         *         else @c false
736         * @exception E_SUCCESS   The method is successful.
737         * @exception E_OUT_OF_RANGE  A specified input parameter is invalid.
738         * @exception E_INVALID_OPERATION The current state of the instance prohibits the execution of the specified operation @b Since: @b 2.1.
739         * @remarks This method does not work during the ITableViewItemProvider call-back procedure.
740         * @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()).
741         */
742         result SetItemEnabled(int groupIndex, int itemIndex, bool enable);
743
744         /**
745         * Returns whether the item at the specified index is enabled or disabled.
746         *
747         * @since 2.0
748         *
749         * @return @c true if the item is enabled, @n
750         *   else @c false
751         * @param[in] groupIndex            The group index
752         * @param[in] itemIndex             The item index
753         * @exception E_SUCCESS                               The method is successful.
754         * @exception E_OUT_OF_RANGE A specified input parameter is invalid.
755         * @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()).
756         */
757         bool IsItemEnabled(int groupIndex, int itemIndex) const;
758
759         /**
760         * Counts the total number of groups.
761         *
762         * @since 2.0
763         *
764         * @return The total number of groups
765         */
766         int GetGroupCount(void) const;
767
768         /**
769         * Counts all the items of the specified group.
770         *
771         * @since 2.0
772         *
773         * @return The total number of items in the specified group
774         * @param[in] groupIndex   The group index
775         * @exception E_SUCCESS                               The method is successful.
776         * @exception E_OUT_OF_RANGE A specified input parameter is invalid.
777         */
778         int GetItemCountAt(int groupIndex) const;
779
780         /**
781         * Updates the specified item. @n
782         * 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
783         * 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.
784         * Note that calling this method with TABLE_VIEW_REFRESH_TYPE_ITEM_MODIFY invokes item provider's UpdateItem() for the given index in sequence.
785         *
786         * @since 2.0
787         *
788         * @return An error code
789         * @param[in] groupIndex                    The group index
790         * @param[in] itemIndex           The item index
791         * @param[in] type                             The item to be added, removed, or modified
792         * @exception E_SUCCESS   The method is successful.
793         * @exception E_OUT_OF_RANGE  A specified input parameter is invalid.
794         * @exception E_INVALID_OPERATION The current state of the instance prohibits the execution of the specified operation @b Since: @b 2.1.
795         * @remarks If the specified item. itemIndex is -1, then the method is applied to the group item with the given index.
796         * Note that if TABLE_VIEW_REFRESH_TYPE_ITEM_REMOVE option is used to a group item, all the items in the group (including the group item itself) are
797         * removed from the table view. @n
798         * This method does not work during the ITableViewItemProvider call-back procedure.
799         */
800         result RefreshItem(int groupIndex, int itemIndex, TableViewRefreshType type);
801
802         /**
803         * Updates all items of the table view. @n
804         * Note that calling this method invokes its item provider's UpdateItem() for all loaded items.
805         *
806         * @since 2.1
807         *
808         * @return An error code
809         * @exception E_SUCCESS The method is successful.
810         * @exception E_INVALID_OPERATION The %GroupedTableView item provider is processing the other request.
811         */
812         result RefreshAllItems(void);
813
814         /**
815         * Updates all the items of a table view.
816         *
817         * @since 2.0
818         *
819         * @exception E_SUCCESS The method is successful.
820         * @exception E_INVALID_OPERATION The current state of the instance prohibits the execution of the specified operation @b Since: @b 2.1.
821         * @remarks This method clears all the items in the table view and invokes the methods of the item provider again to update the table view. @n
822         * This method does not work during the ITableViewItemProvider call-back procedure.
823         * @remarks The specific error code can be accessed using the GetLastResult() method.
824         */
825         void UpdateTableView(void);
826
827         /**
828         * Gets the index of the item at the specified position.
829         *
830         * @since 2.0
831         *
832         * @param[in] position    The position of the item
833         * @param[out] groupIndex The group index of the item on specified position
834         * @param[out] itemIndex  The item index of the item on specified position
835         * @remarks This method sets both of groupIndex and itemIndex to -1 if no item is found at the given position.
836         * @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()).
837         */
838         void GetItemIndexFromPosition(const Tizen::Graphics::Point& position, int& groupIndex, int& itemIndex) const;
839
840         /**
841         * Gets the index of the item at the specified position.
842         *
843         * @since 2.1
844         *
845         * @param[in] position    The position of the item
846         * @param[out] groupIndex The group index of the item on specified position
847         * @param[out] itemIndex  The item index of the item on specified position
848         * @remarks This method sets both of groupIndex and itemIndex to -1 if no item is found at the given position.
849         * @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()).
850         */
851         void GetItemIndexFromPosition(const Tizen::Graphics::FloatPoint& position, int& groupIndex, int& itemIndex) const;
852
853         /**
854         * Sets the color of a division line between items.
855         *
856         * @since 2.0
857         *
858         * @return An error code
859         * @param[in] color    The division line color
860         */
861         void SetItemDividerColor(const Tizen::Graphics::Color& color);
862
863         /**
864         * Gets the color of a division line between items.
865         *
866         * @since 2.0
867         *
868         * @return  The color of a division line
869         */
870         Tizen::Graphics::Color GetItemDividerColor(void) const;
871
872         /**
873         * Sets the background color of this control.
874         *
875         * @since 2.0
876         *
877         * @param[in] color       The background color
878         * @remarks The background bitmap has priority over the background color. When both the background bitmap and the background color are specified,
879         *   only the bitmap image is displayed.
880         */
881         void SetBackgroundColor(const Tizen::Graphics::Color& color);
882
883         /**
884         * Sets the scroll input handling mode.
885         *
886         * @since 2.0
887         *
888         * @param[in] mode  The scroll input handling mode
889         * @see         GetScrollInputMode()
890         */
891         void SetScrollInputMode(ScrollInputMode mode);
892
893         /**
894         * Gets the scroll input handling mode.
895         *
896         * @since 2.0
897         *
898         * @return     The scroll input handling mode
899         * @see         SetScrollInputMode()
900         */
901         ScrollInputMode GetScrollInputMode(void) const;
902
903         /**
904         * Gets the background color of this control.
905         *
906         * @since 2.0
907         *
908         * @return The background color
909         */
910         Tizen::Graphics::Color GetBackgroundColor(void) const;
911
912         /**
913         * Scrolls the list contents by the specified number of pixels. When it is negative, it scrolls to opposite direction in current scroll style.
914         *
915         * @since 2.1
916         *
917         * @return  An error code
918         * @param[in]   pixel                                            The amount of pixels to scroll
919         * @exception   E_SUCCESS                                The method is successful.
920         * @exception   E_OUT_OF_RANGE           The specified @c pixel is out of range.
921         * @exception E_INVALID_OPERATION The current state of the instance prohibits the execution of the specified operation
922         * @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.
923         * Likewise, in case of positive @c pixel on the bottom position of scroll it will also return E_OUT_OF_RANGE. @n
924         * This method does not work during the ITableViewItemProvider call-back procedure.
925         */
926         result ScrollByPixel(int pixel);
927
928         /**
929         * Scrolls the list contents by the specified number of pixels. When it is negative, it scrolls to opposite direction in current scroll style.
930         *
931         * @since 2.1
932         *
933         * @return  An error code
934         * @param[in]   pixel                                            The amount of pixels to scroll
935         * @exception   E_SUCCESS                                The method is successful.
936         * @exception   E_OUT_OF_RANGE           The specified @c pixel is out of range.
937         * @exception E_INVALID_OPERATION The current state of the instance prohibits the execution of the specified operation
938         * @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.
939         * Likewise, in case of positive @c pixel on the bottom position of scroll it will also return E_OUT_OF_RANGE. @n
940         * This method does not work during the ITableViewItemProvider call-back procedure.
941         */
942         result ScrollByPixel(float pixel);
943
944         /**
945         * Gets the current scroll position
946         *
947         * @since 2.1
948         */
949         int GetCurrentScrollPosition(void) const;
950
951         /**
952         * Gets the current scroll position
953         *
954         * @since 2.1
955         */
956         float GetCurrentScrollPositionF(void) const;
957
958         /*
959         * Enables or disables the scroll of GroupedTableView items.
960         *
961         * @since 2.0
962         */
963         void SetScrollEnabled(bool enable);
964
965         /*
966         * Checks whether the scroll is enabled or disabled.
967         *
968         * @since 2.0
969         */
970         bool IsScrollEnabled(void) const;
971
972         /**
973         * Begins the reordering mode.
974         *
975         * @since                        2.1
976         *
977         * @see                           IGroupedTableViewItemEventListener::OnGroupedTableViewItemReordered()
978         */
979         void BeginReorderingMode(void);
980
981         /**
982         * Ends the reordering mode.
983         *
984         * @since                        2.1
985         *
986         * @see                           IGroupedTableViewItemEventListener::OnGroupedTableViewItemReordered()
987         */
988         void EndReorderingMode(void);
989
990         /**
991         * Checks whether the %GroupedTableView control is in reordering mode.
992         *
993         * @since                        2.1
994         *
995         * @return                        @c true if the %GroupedTableView is in reordering mode, else @c false
996         */
997         bool IsInReorderingMode(void) const;
998
999         /**
1000         * Opens the context item at the specified index.
1001         *
1002         * @since 2.1
1003         *
1004         * @return  An error code
1005         * @param[in] groupIndex The group index
1006         * @param[in] itemIndex  The item index
1007         * @exception E_SUCCESS   The method is successful.
1008         * @exception E_OUT_OF_RANGE                A specified input parameter is invalid.
1009         * @exception E_INVALID_OPERATION  The current state of the instance prohibits the execution of the specified operation.
1010         */
1011         result OpenContextItem(int groupIndex, int itemIndex);
1012
1013         /**
1014         * Closes the context item at the specified index.
1015         *
1016         * @since 2.1
1017         *
1018         * @return  An error code
1019         * @param[in] groupIndex The group index
1020         * @param[in] itemIndex  The item index
1021         * @exception E_SUCCESS   The method is successful.
1022         * @exception E_OUT_OF_RANGE                A specified input parameter is invalid.
1023         * @exception E_INVALID_OPERATION  The current state of the instance prohibits the execution of the specified operation.
1024         */
1025         result CloseContextItem(int groupIndex, int itemIndex);
1026
1027         /**
1028         * Returns whether the context item at the specified index is opened.
1029         *
1030         * @since 2.1
1031         *
1032         * @return @c true if the context item is opened, else @c false
1033         * @param[in] groupIndex The group index
1034         * @param[in] itemIndex  The item index
1035         * @exception E_SUCCESS           The method is successful.
1036         * @exception E_OUT_OF_RANGE  A specified input parameter is invalid.
1037         */
1038         bool IsContextItemOpened(int groupIndex, int itemIndex) const;
1039
1040 private:
1041         friend class _TableViewImpl;
1042
1043         // The implementation of this copy constructor is intentionally blank and declared as private to prohibit copying of objects.
1044         GroupedTableView(const GroupedTableView& rhs);
1045
1046         // The implementation of this copy assignment operator is intentionally blank and declared as private to prohibit copying of objects.
1047         GroupedTableView& operator =(const GroupedTableView& rhs);
1048 }; // GroupedTableView
1049
1050 }}} // Tizen::Ui::Controls
1051
1052 #endif  // _FUI_CTRL_GROUPED_TABLE_VIEW_H_