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