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