Fix for klockwork minor issues.
[platform/framework/native/uifw.git] / inc / FUiCtrlExpandableList.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  * @if OSPDEPREC
20  * @file        FUiCtrlExpandableList.h
21  * @brief       This is the header file for the %ExpandableList class.
22  *
23  * This header file contains the declarations of the %ExpandableList class and its helper classes.
24  * @endif
25  */
26
27 #ifndef _FUI_CTRL_EXPANDABLE_LIST_H_
28 #define _FUI_CTRL_EXPANDABLE_LIST_H_
29
30 #include <FBaseObject.h>
31 #include <FBaseTypes.h>
32 #include <FGrpRectangle.h>
33 #include <FUiContainer.h>
34 #include <FUiIExpandableItemEventListener.h>
35 #include <FUiCtrlCustomListTypes.h>
36 #include <FUiCtrlListTypes.h>
37 #include <FUiCtrlCustomListItem.h>
38
39 namespace Tizen { namespace Ui { namespace Controls
40 {
41
42 /**
43  * @if OSPDEPREC
44  * @class       ExpandableList
45  * @brief <i> [Deprecated] </i> This class defines the common behavior of an %ExpandableList control.
46  *
47  * @deprecated This class is deprecated. Instead of using this class, use GroupedTableView class. @n
48  * @since               2.0
49  *
50  * The %ExpandableList class defines the common behavior of an %ExpandableList control.
51  * An expandable list is a list with a hierarchy of depth 2. List items of %ExpandableList
52  * consist of main items and sub-items which are CustomListItem. Main items are inserted
53  * into the first level as items are inserted into List class. Sub-items are inserted under
54  * related main items. So, sub-items are uniquely identified with two indices: main item
55  * index and sub-item index.
56  *
57  * If an application wants to perform tasks when the state of a list item is changed,
58  * it must implement IExpandableItemEventListener and register it to the expandable list,
59  * It will then receive related events from %ExpandableList.
60  *
61  * Unlike GroupedList which is also a list with the hierarch of depth 2, main items of
62  * %ExpandableList can be expanded or closed.
63  *
64  * Note that CustomListItem and CustomListItemFormat need to be created on a heap. CustomListItems will be deleted automatically
65  * when the %ExpandableList itself is destroyed. If you want to remove certain list items, you must use RemoveItemAt(). CustomListItemFormat
66  * must be deleted by the application.
67  *
68  * Refer to CustomListItem and CustomListItemFormat.
69  *
70  * Example:
71  *
72  * @image html ui_controls_expandablelist.png
73  *
74  * This is the simple UI application which uses an %ExpandableList control.
75  *
76  * @code
77 //Sample code for ExpandableListSample.h
78 #include <FUi.h>
79
80 class ExpandableListSample
81         : public Tizen::Ui::Controls::Form
82         , public Tizen::Ui::IExpandableItemEventListener
83 {
84 public:
85         ExpandableListSample(void)
86         : __pMainItemFormat(null)
87         , __pSubItemFormat(null){}
88
89         bool Initialize(void);
90         result AddListMainItem(Tizen::Ui::Controls::ExpandableList& expandableList, Tizen::Base::String itemText,
91                         Tizen::Graphics::Bitmap* pBitmapNormal, Tizen::Graphics::Bitmap* pBitmapFocused);
92         result AddListSubItem(Tizen::Ui::Controls::ExpandableList& expandableList, int itemId, Tizen::Base::String itemText);
93
94         virtual result OnInitializing(void);
95         virtual result OnTerminating(void);
96
97         // IExpandableItemEventListener
98         virtual void OnItemStateChanged(const Control& source, int mainIndex, int subIndex, int itemId, Tizen::Ui::ItemStatus status);
99         virtual void OnItemStateChanged(const Control& source, int mainIndex, int subIndex, int itemId, int elementId, Tizen::Ui::ItemStatus status);
100
101
102
103 private:
104         static const int ID_LIST_MAINITEM = 101;
105         static const int ID_LIST_SUBITEM = 102;
106         static const int ID_LIST_TEXT = 103;
107         static const int ID_LIST_BITMAP = 104;
108
109         Tizen::Ui::Controls::CustomListItemFormat* __pMainItemFormat;
110         Tizen::Ui::Controls::CustomListItemFormat* __pSubItemFormat;
111 };
112  *      @endcode
113  *
114  *      @code
115 //Sample code for ExpandableListSample.cpp
116 #include <FApp.h>
117 #include <FGraphics.h>
118
119 #include "ExpandableListSample.h"
120
121 using namespace Tizen::App;
122 using namespace Tizen::Base;
123 using namespace Tizen::Ui;
124 using namespace Tizen::Ui::Controls;
125 using namespace Tizen::Graphics;
126
127 bool
128 ExpandableListSample::Initialize(void)
129 {
130         Construct(FORM_STYLE_NORMAL);
131         return true;
132 }
133
134 result
135 ExpandableListSample::OnInitializing(void)
136 {
137         result r = E_SUCCESS;
138
139         // Creates an instance of ExpandableList
140         ExpandableList* pExpandableList = new ExpandableList();
141         pExpandableList->Construct(Rectangle(0, 0, 480, 500), CUSTOM_LIST_STYLE_NORMAL);
142         pExpandableList->AddExpandableItemEventListener(*this);
143
144         // Creates an instance of CustomListItemFormat of the main item
145         __pMainItemFormat = new CustomListItemFormat();
146         __pMainItemFormat->Construct();
147         __pMainItemFormat->AddElement(ID_LIST_TEXT, Rectangle(10, 25, 200, 80));
148         __pMainItemFormat->AddElement(ID_LIST_BITMAP, Rectangle(220, 10, 70, 80));
149
150         // Creates an instance of CustomListItemFormat of the sub item
151         __pSubItemFormat = new CustomListItemFormat();
152         __pSubItemFormat->Construct();
153         __pSubItemFormat->AddElement(ID_LIST_TEXT, Rectangle(20, 25, 450, 50));
154
155         // Gets instances of Bitmap
156         AppResource *pAppResource = Application::GetInstance()->GetAppResource();
157         Bitmap *pBitmapNormal  = pAppResource->GetBitmapN(L"tizen.png");
158         Bitmap *pBitmapFocused = pAppResource->GetBitmapN(L"tizen.png");
159
160         // Adds the main item
161         AddListMainItem(*pExpandableList, L"MainItem", pBitmapNormal, pBitmapFocused);
162
163         // Adds the sub item
164         AddListSubItem(*pExpandableList, ID_LIST_MAINITEM, L"SubItem");
165
166         // Adds the expandable list to the form
167         AddControl(pExpandableList);
168
169         // Deallocates bitmaps
170         delete pBitmapNormal;
171         delete pBitmapFocused;
172
173         return r;
174 }
175
176 result
177 ExpandableListSample::OnTerminating(void)
178 {
179         result r = E_SUCCESS;
180
181         // Deallocates item formats
182         delete __pMainItemFormat;
183         delete __pSubItemFormat;
184
185         return r;
186 }
187
188 result
189 ExpandableListSample::AddListMainItem(ExpandableList& expandableList, String itemText, Bitmap* pBitmapNormal, Bitmap* pBitmapFocused)
190 {
191         result r = E_SUCCESS;
192
193         // Creates a main instance of CustomListItem of the expandable list
194         CustomListItem* pMainItem = new CustomListItem();
195         pMainItem->Construct(100);
196         pMainItem->SetItemFormat(*__pMainItemFormat);
197         pMainItem->SetElement(ID_LIST_TEXT, itemText);
198         pMainItem->SetElement(ID_LIST_BITMAP, *pBitmapNormal, pBitmapFocused);
199
200         // Adds the item to the expandable list
201         expandableList.AddItem(*pMainItem, ID_LIST_MAINITEM);
202
203         return r;
204 }
205
206 result
207 ExpandableListSample::AddListSubItem(ExpandableList& expandableList, int itemId, String itemText)
208 {
209         result r = E_SUCCESS;
210
211         // Creates a sub instance of CustomListItem of the expandable list
212         CustomListItem* pSubItem = new CustomListItem();
213         pSubItem->Construct(100);
214         pSubItem->SetItemFormat(*__pSubItemFormat);
215         pSubItem->SetElement(ID_LIST_TEXT, itemText);
216
217         // Adds the item to the expandable list
218         expandableList.AddSubItem(expandableList.GetItemIndexFromItemId(ID_LIST_MAINITEM), *pSubItem, ID_LIST_SUBITEM);
219
220         return r;
221 }
222
223 // IExpandableItemEventListener implementation
224 void
225 ExpandableListSample::OnItemStateChanged(const Control& source, int mainIndex, int subIndex, int itemId, ItemStatus status)
226 {
227         switch (itemId)
228         {
229         case ID_LIST_MAINITEM:
230                 {
231                         // ....
232                 }
233                 break;
234         case ID_LIST_SUBITEM:
235                 {
236                         // ....
237                 }
238                 break;
239         default:
240                 break;
241         }
242 }
243
244 void
245 ExpandableListSample::OnItemStateChanged(const Control& source, int mainIndex, int subIndex, int itemId, int elementId, ItemStatus status)
246 {
247         switch (itemId)
248         {
249         case ID_LIST_MAINITEM:
250                 {
251                         switch (elementId)
252                         {
253                         case ID_LIST_TEXT:
254                                 {
255                                         // ....
256                                 }
257                                 break;
258                         case ID_LIST_BITMAP:
259                                 {
260                                         // ....
261                                 }
262                                 break;
263                         default:
264                                 break;
265                         }
266                 }
267                 break;
268         case ID_LIST_SUBITEM:
269                 {
270                         switch (elementId)
271                         {
272                         case ID_LIST_TEXT:
273                                 {
274                                         // ....
275                                 }
276                                 break;
277                         case ID_LIST_BITMAP:
278                                 {
279                                         // ....
280                                 }
281                                 break;
282                         default:
283                                 break;
284                         }
285                 }
286                 break;
287         default:
288                 break;
289         }
290 }
291  * @endcode
292  * @endif
293  */
294 class _OSP_EXPORT_ ExpandableList
295         : public Tizen::Ui::Control
296 {
297 public:
298         /**
299          * @if OSPDEPREC
300          * The object is not fully constructed after this constructor is called. @n
301          * For full construction, the ExpandableList::Construct() method must be called right after calling this constructor.
302          *
303          * @brief       <i> [Deprecated] </i>
304          * @deprecated  This class is deprecated. Instead of using this class, use GroupedTableView class.
305          * @since               2.0
306          * @endif
307          */
308         ExpandableList(void);
309
310         /**
311          * @if OSPDEPREC
312          * This polymorphic destructor should be overridden if required. @n
313          * This way, the destructors of the derived classes are called when the destructor of this interface is called.
314          *
315          * @brief       <i> [Deprecated] </i>
316          * @deprecated  This class is deprecated. Instead of using this class, use GroupedTableView class.
317          * @since               2.0
318          * @endif
319          */
320         virtual ~ExpandableList(void);
321
322         /**
323          * @if OSPDEPREC
324          * Initializes this instance of %ExpandableList with the specified parameters.
325          *
326          * @brief       <i> [Deprecated] </i>
327          * @deprecated  This class is deprecated. Instead of using this class, use GroupedTableView class.
328          * @since       2.0
329          *
330          * @return      An error code
331          * @param[in]   rect                            The x, y position of the top-left corner of the %ExpandableList along with the width and the height of the control
332          * @param[in]   style                           The style set
333          * @param[in]   itemDivider                     Set to @c true to display the divider, @n
334          *                                                                      else @c false
335          * @exception   E_SUCCESS                       The method is successful.
336          * @exception   E_INVALID_ARG           A specified input parameter is invalid.
337          * @exception   E_SYSTEM                        A system error has occurred.
338          * @remarks     The size of the control must be within the range defined by the minimum size and the maximum size. @n
339          *              The minimum size of this control is 92 x 72 on a WVGA screen, 60 x 48 on a HVGA screen and 46 x 36 on a WQVGA screen.
340          * @endif
341          */
342         result Construct(const Tizen::Graphics::Rectangle& rect, CustomListStyle style, bool itemDivider = true);
343
344         /**
345          * @if OSPDEPREC
346          * Adds the ExpandableItemEventListener instance. @n
347          * The added listener gets notified when the state of an item is changed.
348          *
349          * @brief       <i> [Deprecated] </i>
350          * @deprecated  This class is deprecated. Instead of using this class, use GroupedTableView class.
351          * @since               2.0
352          *
353          * @param[in]   listener        The event listener to add
354          * @endif
355          */
356         void AddExpandableItemEventListener(Tizen::Ui::IExpandableItemEventListener& listener);
357
358         /**
359          * @if OSPDEPREC
360          * Removes the ExpandableItemEventListener instance. @n
361          * The removed listener is not notified even when the expandable item events are fired.
362          *
363          * @brief       <i> [Deprecated] </i>
364          * @deprecated  This class is deprecated. Instead of using this class, use GroupedTableView class.
365          * @since               2.0
366          *
367          * @param[in]   listener        The event listener to remove
368          * @endif
369          */
370         void RemoveExpandableItemEventListener(Tizen::Ui::IExpandableItemEventListener& listener);
371
372         /**
373          * @if OSPDEPREC
374          * Adds the specified item to the %ExpandableList control.
375          *
376          * @brief       <i> [Deprecated] </i>
377          * @deprecated  This class is deprecated. Instead of using this class, use GroupedTableView class.
378          * @since               2.0
379          *
380          * @return              An error code
381          * @param[in]   item                    The CustomListItem to add
382          * @param[in]   itemId                  The item ID for the item
383          * @exception   E_SUCCESS               The method is successful.
384          * @exception   E_SYSTEM                A system error has occurred.
385          * @remarks
386          *                      - The item ID can be used to identify the specific %CustomListItem instance or to associate the user-allocated resources.
387          *                      - Note that %ExpandableList does not throw an exception, if the same item ID is given to multiple items.
388          *                      - The added item is deleted automatically when the list is destroyed.
389          *                      - Do not add, insert, or set an item which already belongs to the %ExpandableList.
390          * @endif
391          */
392         result AddItem(const CustomListItem& item, int itemId = LIST_ITEM_UNSPECIFIED_ID);
393
394         /**
395          * @if OSPDEPREC
396          * Inserts the specified item to the %ExpandableList control at the specified index.
397          *
398          * @brief       <i> [Deprecated] </i>
399          * @deprecated  This class is deprecated. Instead of using this class, use GroupedTableView class.
400          * @since               2.0
401          *
402          * @return              An error code
403          * @param[in]   mainIndex               The index at which to insert the item
404          * @param[in]   item                    The CustomListItem instance to insert
405          * @param[in]   itemId                  The item ID for the item
406          * @exception   E_SUCCESS                       The method is successful.
407          * @exception   E_INVALID_ARG           The specified @c index is less than @c 0 or greater than the item count.
408          * @exception   E_SYSTEM                        A system error has occurred.
409          * @remarks
410          *                      - The inserted item is deleted automatically when the list is destroyed.
411          *                      - Do not add, insert, or set an item that already belongs to the %ExpandableList control.
412          * @endif
413          */
414         result InsertItemAt(int mainIndex, const CustomListItem& item, int itemId = LIST_ITEM_UNSPECIFIED_ID);
415
416         /**
417          * @if OSPDEPREC
418          * Changes the contents of the item at the specified index in the %ExpandableList control.
419          *
420          * @brief       <i> [Deprecated] </i>
421          * @deprecated  This class is deprecated. Instead of using this class, use GroupedTableView class.
422          * @since               2.0
423          *
424          * @return              An error code
425          * @param[in]   mainIndex               The index at which to set the contents of the item
426          * @param[in]   item                    The CustomListItem instance to set
427          * @param[in]   itemId                  The item ID for the item
428          * @exception   E_SUCCESS                       The method is successful.
429          * @exception   E_INVALID_ARG           The specified @c index is less than @c 0 or greater than the item count.
430          * @exception   E_SYSTEM                A system error has occurred.
431          * @remarks             Do not add, insert, or set an item that already belongs to the %ExpandableList control.
432          * @endif
433          */
434         result SetItemAt(int mainIndex, const CustomListItem& item, int itemId = LIST_ITEM_UNSPECIFIED_ID);
435
436         /**
437          * @if OSPDEPREC
438          * Removes the item at the specified index in the %ExpandableList control.
439          *
440          * @brief       <i> [Deprecated] </i>
441          * @deprecated  This class is deprecated. Instead of using this class, use GroupedTableView class.
442          * @since               2.0
443          *
444          * @return              An error code
445          * @param[in]   mainIndex                       The index of the item to delete
446          * @exception   E_SUCCESS                       The method is successful.
447          * @exception   E_INVALID_ARG           The specified @c index is less than @c 0 or greater than the item count.
448          * @exception   E_SYSTEM                        A system error has occurred.
449          * @remarks     The removed list item is deleted from the memory.
450          * @endif
451          */
452         result RemoveItemAt(int mainIndex);
453
454         /**
455          * @if OSPDEPREC
456          * Removes all the items from the %ExpandableList control.
457          *
458          * @brief       <i> [Deprecated] </i>
459          * @deprecated  This class is deprecated. Instead of using this class, use GroupedTableView class.
460          * @since               2.0
461          *
462          * @return              An error code
463          * @exception   E_SUCCESS                       The method is successful.
464          * @exception   E_SYSTEM                        A system error has occurred.
465          * @remarks   The removed list items are deleted from the memory.
466          * @endif
467          */
468         result RemoveAllItems(void);
469
470         /**
471          * @if OSPDEPREC
472          * Gets the item at the specified index in the %ExpandableList control.
473          *
474          * @brief       <i> [Deprecated] </i>
475          * @deprecated  This class is deprecated. Instead of using this class, use GroupedTableView class.
476          * @since               2.0
477          *
478          * @return              A CustomListItem instance, @n
479          *                              else @c null if the specified index is out of range
480          * @param[in]   mainIndex               The index of the item
481          * @endif
482          */
483         const CustomListItem* GetItemAt(int mainIndex) const;
484
485         /**
486          * @if OSPDEPREC
487          * Adds the specified sub-item to the main item in the %ExpandableList control.
488          *
489          * @brief       <i> [Deprecated] </i>
490          * @deprecated  This class is deprecated. Instead of using this class, use GroupedTableView class.
491          * @since               2.0
492          *
493          * @return              An error code
494          * @param[in]   mainIndex               The index of the main item to which the sub-item is added
495          * @param[in]   item                    The CustomListItem instance to add
496          * @param[in]   itemId                  The item ID for the sub-item
497          * @exception   E_SUCCESS               The method is successful.
498          * @exception   E_INVALID_ARG           The specified index is less than @c 0, or greater than the item count.
499          * @exception   E_SYSTEM                        A system error has occurred.
500          * @endif
501          */
502         result AddSubItem(int mainIndex, const CustomListItem& item, int itemId = LIST_ITEM_UNSPECIFIED_ID);
503
504         /**
505          * @if OSPDEPREC
506          * Inserts the specified sub-item at the specified index to the main item in the %ExpandableList control.
507          *
508          * @brief       <i> [Deprecated] </i>
509          * @deprecated  This class is deprecated. Instead of using this class, use GroupedTableView class.
510          * @since               2.0
511          *
512          * @return              An error code
513          * @param[in]   mainIndex               The index of the main item to which the sub-item is added
514          * @param[in]   subIndex                The index of the sub-item at which to insert the item
515          * @param[in]   item                    The CustomListItem instance to insert
516          * @param[in]   itemId                  The item ID
517          * @exception   E_SUCCESS               The method is successful.
518          * @exception   E_INVALID_ARG           The specified index is less than @c 0, or greater than the item count.
519          * @exception   E_SYSTEM                A system error has occurred.
520          * @endif
521          */
522         result InsertSubItemAt(int mainIndex, int subIndex, const CustomListItem& item, int itemId = LIST_ITEM_UNSPECIFIED_ID);
523
524         /**
525          * @if OSPDEPREC
526          * Changes the contents of the sub-item at the specified index in the %ExpandableList control.
527          *
528          * @brief       <i> [Deprecated] </i>
529          * @deprecated  This class is deprecated. Instead of using this class, use GroupedTableView class.
530          * @since               2.0
531          *
532          * @return              An error code
533          * @param[in]   mainIndex               The main index of the sub-item at which to set the contents of the item
534          * @param[in]   subIndex                The sub-index of the sub-item at which to set the contents of the item
535          * @param[in]   item                    The CustomListItem instance to set
536          * @param[in]   itemId                  The item ID
537          * @exception   E_SUCCESS               The method is successful.
538          * @exception   E_INVALID_ARG           The specified index is less than @c 0, or greater than the item count.
539          * @exception   E_SYSTEM                A system error has occurred.
540          * @endif
541          */
542         result SetSubItemAt(int mainIndex, int subIndex, const CustomListItem& item, int itemId = LIST_ITEM_UNSPECIFIED_ID);
543
544         /**
545          * @if OSPDEPREC
546          * Removes the sub-item at the specified index in the %ExpandableList control.
547          *
548          * @brief       <i> [Deprecated] </i>
549          * @deprecated  This class is deprecated. Instead of using this class, use GroupedTableView class.
550          * @since               2.0
551          *
552          * @return              An error code
553          * @param[in]   mainIndex               The index of the main item which the sub-item belongs to
554          * @param[in]   subIndex                The index of the sub-item to delete in the main item
555          * @exception   E_SUCCESS                       The method is successful.
556          * @exception   E_INVALID_ARG           The specified index is less than @c 0, or greater than the item count.
557          * @exception   E_SYSTEM                A system error has occurred.
558          * @endif
559          */
560         result RemoveSubItemAt(int mainIndex, int subIndex);
561
562         /**
563          * @if OSPDEPREC
564          * Removes all sub-items of the specified main item in the %ExpandableList control.
565          *
566          * @brief       <i> [Deprecated] </i>
567          * @deprecated  This class is deprecated. Instead of using this class, use GroupedTableView class.
568          * @since               2.0
569          *
570          * @return              An error code
571          * @param[in]   mainIndex                       The index of the main item of the %ExpandableList control
572          * @exception   E_SUCCESS                       The method is successful.
573          * @exception   E_INVALID_ARG           The specified index is less than @c 0, or greater than or equal to the item count.
574          * @exception   E_SYSTEM                        A system error has occurred.
575          * @endif
576          */
577         result RemoveAllSubItemsAt(int mainIndex);
578
579         /**
580          * @if OSPDEPREC
581          * Gets the number of items in the %ExpandableList control.
582          *
583          * @brief       <i> [Deprecated] </i>
584          * @deprecated  This class is deprecated. Instead of using this class, use GroupedTableView class.
585          * @since               2.0
586          *
587          * @return              The number of items in %ExpandableList, @n
588          *                              else @c -1 if an error occurs
589          * @endif
590          */
591         int GetItemCount(void) const;
592
593         /**
594          * @if OSPDEPREC
595          * Gets the number of sub-items in the main item.
596          *
597          * @brief       <i> [Deprecated] </i>
598          * @deprecated  This class is deprecated. Instead of using this class, use GroupedTableView class.
599          * @since               2.0
600          *
601          * @return              The number of sub-items in the main item, @n
602          *              else @c -1 if an error occurs
603          * @param[in] mainIndex The index of the main item
604          * @endif
605          */
606         int GetSubItemCount(int mainIndex) const;
607
608         /**
609          * @if OSPDEPREC
610          * Gets the sub-item at the specified index.
611          *
612          * @brief       <i> [Deprecated] </i>
613          * @deprecated  This class is deprecated. Instead of using this class, use GroupedTableView class.
614          * @since               2.0
615          *
616          * @return              A pointer to the CustomListItem instance at the specified index,  @n
617          *                              else @c null if the specified index does not exist in the %ExpandableList control
618          * @param[in]   mainIndex   The index of the main item which the sub-item belongs to
619          * @param[in]   subIndex    The index of the sub-item to get in the main index
620          * @endif
621          */
622         const CustomListItem* GetSubItemAt(int mainIndex, int subIndex) const;
623
624         /**
625          * @if OSPDEPREC
626          * Gets the first item of all the checked main items in the %ExpandableList control.
627          *
628          * @brief       <i> [Deprecated] </i>
629          * @deprecated  This class is deprecated. Instead of using this class, use GroupedTableView class.
630          * @since               2.0
631          *
632          * @return      The index of the first checked item,  @n
633          *              else @c -1 if no main item is checked
634          * @endif
635          */
636         int GetFirstCheckedItemIndex(void) const;
637
638         /**
639          * @if OSPDEPREC
640          * Gets the item ID of the specified main item.
641          *
642          * @brief       <i> [Deprecated] </i>
643          * @deprecated  This class is deprecated. Instead of using this class, use GroupedTableView class.
644          * @since          2.0
645          *
646          * @return      The item ID of the main item, @n
647          *              else @c -1 if the specified @c mainIndex is less than @c 0 or greater than the main item count
648          * @param[in]   mainIndex  The index of the main item
649          * @endif
650          */
651         int GetItemIdAt(int mainIndex) const;
652
653         /**
654          * @if OSPDEPREC
655          * Gets the index of the specified main item.
656          *
657          * @brief       <i> [Deprecated] </i>
658          * @deprecated  This class is deprecated. Instead of using this class, use GroupedTableView class.
659          * @since               2.0
660          *
661          * @return      The index of the main item, @n
662          *              else @c -1 if no main item has the specified item ID
663          * @param[in]   itemId          The item ID
664          * @remarks A main item can have the same item ID and this method returns the first main item among such items.
665          * @endif
666          */
667         int GetItemIndexFromItemId(int itemId) const;
668
669         /**
670          * @if OSPDEPREC
671          * Gets the item ID of the specified sub-item.
672          *
673          * @brief       <i> [Deprecated] </i>
674          * @deprecated  This class is deprecated. Instead of using this class, use GroupedTableView class.
675          * @since           2.0
676          *
677          * @return       The item ID of the specified sub-item, @n
678          *               else @c -1 if the specified sub-item does not exist
679          * @param[in]   mainIndex       The index of the main item, which the sub-item belongs to
680          * @param[in]    subIndex      The index of the sub-item
681          * @endif
682          */
683         int GetSubItemIdAt(int mainIndex, int subIndex) const;
684
685         /**
686          * @if OSPDEPREC
687          * Expands or shrinks the specified main item.
688          *
689          * @brief       <i> [Deprecated] </i>
690          * @deprecated  This class is deprecated. Instead of using this class, use GroupedTableView class.
691          * @since               2.0
692          *
693          * @return              An error code
694          * @param[in]   mainIndex               The index of the main item
695          * @param[in]   expand                          Set to @c true to expand the specified main item, @n
696          *                                                              else @c false
697          * @exception   E_SUCCESS                       The method is successful.
698          * @exception   E_INVALID_ARG           The specified @c mainIndex is less than @c 0, or greater than the main item count.
699          * @exception   E_SYSTEM                A system error has occurred.
700          * @endif
701          */
702         result SetItemExpanded(int mainIndex, bool expand);
703
704         /**
705          * @if OSPDEPREC
706          * Checks whether the main item is expanded.
707          *
708          * @brief       <i> [Deprecated] </i>
709          * @deprecated  This class is deprecated. Instead of using this class, use GroupedTableView class.
710          * @since               2.0
711          *
712          * @return      @c true if the main item is expanded, @n
713          *                              else @c false
714          * @param[in]   mainIndex   The index of the main item
715          * @endif
716          */
717         bool IsItemExpanded(int mainIndex) const;
718
719         /**
720          * @if OSPDEPREC
721          * Enables or disables the status of the main item at the specified index of the %ExpandableList control.
722          *
723          * @brief       <i> [Deprecated] </i>
724          * @deprecated  This class is deprecated. Instead of using this class, use GroupedTableView class.
725          * @since               2.0
726          *
727          * @return      An error code
728          * @param[in]   mainIndex               The index of the main item, for which the status is set
729          * @param[in]   enable                  Set to @c true to enable the main item, @n
730          *                                                                      else @c false
731          * @exception   E_SUCCESS                       The method is successful.
732          * @exception   E_INVALID_ARG           The specified @c mainIndex is less than @c 0, or no less than the main item count.
733          * @exception   E_SYSTEM                A system error has occurred.
734          * @endif
735          */
736         result SetItemEnabled(int mainIndex, bool enable);
737
738         /**
739          * @if OSPDEPREC
740          * Checks whether the main item at the specified index in the %ExpandableList control is enabled.
741          *
742          * @brief       <i> [Deprecated] </i>
743          * @deprecated  This class is deprecated. Instead of using this class, use GroupedTableView class.
744          * @since               2.0
745          *
746          * @return      @c true if the main item is enabled, @n
747          *              else @c false
748          * @param[in]   mainIndex       The index of the main item to check
749          * @endif
750          */
751         bool IsItemEnabled(int mainIndex) const;
752
753         /**
754          * @if OSPDEPREC
755          * Sets the enabled status of the specific sub-item.
756          *
757          * @brief       <i> [Deprecated] </i>
758          * @deprecated  This class is deprecated. Instead of using this class, use GroupedTableView class.
759          * @since               2.0
760          *
761          * @return              An error code
762          * @param[in]   mainIndex               The index of the main item which the sub-item belongs to
763          * @param[in]   subIndex                The index of the sub-item in the main item
764          * @param[in]   enable                          Set to @c true to enable the sub-item, @n
765          *                                                                      else @c false
766          * @exception   E_SUCCESS                       The method is successful.
767          * @exception   E_INVALID_ARG           The sub-item at the specified index does not exist.
768          * @exception   E_SYSTEM                A system error has occurred.
769          * @endif
770          */
771         result SetSubItemEnabled(int mainIndex, int subIndex, bool enable);
772
773         /**
774          * @if OSPDEPREC
775          * Checks whether the specified sub-item is enabled.
776          *
777          * @brief       <i> [Deprecated] </i>
778          * @deprecated  This class is deprecated. Instead of using this class, use GroupedTableView class.
779          * @since               2.0
780          *
781          * @return      @c true if the specified sub-item is enabled, @n
782          *                              else @c false
783          * @param[in]   mainIndex         The index of the main item which the sub-item belongs to
784          * @param[in]   subIndex          The index of the sub-item in the main item
785          * @endif
786          */
787         bool IsSubItemEnabled(int mainIndex, int subIndex) const;
788
789         /**
790          * @if OSPDEPREC
791          * Sets the check status of the main item at the specified index.
792          *
793          * @brief       <i> [Deprecated] </i>
794          * @deprecated  This class is deprecated. Instead of using this class, use GroupedTableView class.
795          * @since               2.0
796          *
797          * @return              An error code
798          * @param[in]   mainIndex               The index of the main item
799          * @param[in]   check                   Set to @c true to check the main item, @n
800          *                                                                      else @c false
801          * @exception   E_SUCCESS                       The method is successful.
802          * @exception   E_INVALID_ARG           The specified @c mainIndex is less than @c 0, or no less than the main item count.
803          * @exception   E_SYSTEM                A system error has occurred.
804          * @remarks             This method can only be used when the style of the list allows selection.
805          * @endif
806          */
807         result SetItemChecked(int mainIndex, bool check);
808
809         /**
810          * @if OSPDEPREC
811          * Checks whether the status of the main item at the specified index is checked.
812          *
813          * @brief       <i> [Deprecated] </i>
814          * @deprecated  This class is deprecated. Instead of using this class, use GroupedTableView class.
815          * @since               2.0
816          *
817          * @return      @c true if the main item is checked, @n
818          *                              else @c false
819          * @param[in]   mainIndex       The index of the main item
820          * @remarks             This method can only be used when the style of the list allows selection.
821          * @endif
822          */
823         bool IsItemChecked(int mainIndex) const;
824
825
826         /**
827          * @if OSPDEPREC
828          * Sets the check status of the specified sub-item of the %ExpandableList control.
829          *
830          * @brief       <i> [Deprecated] </i>
831          * @deprecated  This class is deprecated. Instead of using this class, use GroupedTableView class.
832          * @since               2.0
833          *
834          * @return          An error code
835          * @param[in]   mainIndex               The index of the main item which the sub-item belongs to
836          * @param[in]   subIndex                The index of the sub-item in the main index
837          * @param[in]   check                           Set to @c true to check the sub-item, @n
838          *                                                                      else @c false
839          * @exception   E_SUCCESS               The method is successful.
840          * @exception   E_INVALID_ARG           The sub-item at the specified index does not exist.
841          * @exception   E_SYSTEM                A system error has occurred.
842          * @remarks             This method can only be used when the style of the list allows selection.
843          * @endif
844          */
845         result SetSubItemChecked(int mainIndex, int subIndex, bool check);
846
847         /**
848          * @if OSPDEPREC
849          * Checks whether the specified sub-item is checked.
850          *
851          * @brief       <i> [Deprecated] </i>
852          * @deprecated  This class is deprecated. Instead of using this class, use GroupedTableView class.
853          * @since               2.0
854          *
855          * @return              @c true if the sub-item is checked, @n
856          *                              else @c false
857          * @param[in]   mainIndex  The index of the main item which the sub-item belongs to
858          * @param[in]   subIndex  The index of the sub-item in the main item
859          * @remarks             This method can only be used when the style of the list allows selection.
860          * @endif
861          */
862         bool IsSubItemChecked(int mainIndex, int subIndex) const;
863
864         /**
865          * @if OSPDEPREC
866          * Sets the check status of all sub-items of the specified main item.
867          *
868          * @brief       <i> [Deprecated] </i>
869          * @deprecated  This class is deprecated. Instead of using this class, use GroupedTableView class.
870          * @since               2.0
871          *
872          * @return              An error code
873          * @param[in]   mainIndex               The index of the main item
874          * @param[in]   check                           Set to @c true to check the items, @n
875          *                                                                      else @c false
876          * @exception   E_SUCCESS                       The method is successful.
877          * @exception   E_INVALID_ARG           The specified @c mainIndex is less than @c 0, or greater than the main item count.
878          * @exception   E_SYSTEM                A system error has occurred.
879          * @remarks             This method can only be used when the style of the list allows multiple selections.
880          * @endif
881          */
882         result SetAllSubItemsChecked(int mainIndex, bool check);
883
884         /**
885          * @if OSPDEPREC
886          * Removes all the checked sub-items of the specified main item.
887          *
888          * @brief       <i> [Deprecated] </i>
889          * @deprecated  This class is deprecated. Instead of using this class, use GroupedTableView class.
890          * @since               2.0
891          *
892          * @return              An error code
893          * @param[in]   mainIndex               The index of the main item
894          * @exception   E_SUCCESS                       The method is successful.
895          * @exception   E_INVALID_ARG           The specified @c mainIndex is less than @c 0, or not less than the main item count.
896          * @exception   E_SYSTEM                A system error has occurred.
897          * @remarks             This method can only be used when the style of the list allows multiple selections.
898          * @endif
899          */
900         result RemoveAllCheckedSubItemsAt(int mainIndex);
901
902         /**
903          * @if OSPDEPREC
904          * Gets the first sub-item of all the checked sub-items in the main item.
905          *
906          * @brief       <i> [Deprecated] </i>
907          * @deprecated  This class is deprecated. Instead of using this class, use GroupedTableView class.
908          * @since               2.0
909          *
910          * @return      The index of the first checked sub-item, @n
911          *              else @c -1 if no sub-item is checked, or the specified main item does not exist
912          * @endif
913          */
914         int GetFirstCheckedSubItemIndex(int mainIndex) const;
915
916         /**
917          * @if OSPDEPREC
918          * Gets the last item of all the checked main items in the %ExpandableList control.
919          *
920          * @brief       <i> [Deprecated] </i>
921          * @deprecated  This class is deprecated. Instead of using this class, use GroupedTableView class.
922          * @since               2.0
923          *
924          * @return       The index of the last checked item, @n
925          *               else @c -1 if no main item is checked
926          * @endif
927          */
928         int GetLastCheckedItemIndex(void) const;
929
930         /**
931          * @if OSPDEPREC
932          * Gets the last sub-item of all the checked sub-items in the main item.
933          *
934          * @brief       <i> [Deprecated] </i>
935          * @deprecated  This class is deprecated. Instead of using this class, use GroupedTableView class.
936          * @since               2.0
937          *
938          * @return       The index of the last checked sub-item, @n
939          *               else @c -1 if no sub-item is checked or the specified main item does not exist
940          * @endif
941          */
942         int GetLastCheckedSubItemIndex(int mainIndex) const;
943
944         /**
945          * @if OSPDEPREC
946          * Gets the next checked main item from the specified index in the %ExpandableList control.
947          *
948          * @brief       <i> [Deprecated] </i>
949          * @deprecated  This class is deprecated. Instead of using this class, use GroupedTableView class.
950          * @since               2.0
951          *
952          * @return       The index of the next checked main item, @n
953          *               else @c -1 if no more main item after the specified index is checked, or the specified main item does not exist
954          * @param[in]    mainIndex  The index of the main item
955          * @endif
956          */
957         int GetNextCheckedItemIndexAfter(int mainIndex) const;
958
959         /**
960          * @if OSPDEPREC
961          * Gets the next checked sub-item from the specified index in the main item.
962          *
963          * @brief       <i> [Deprecated] </i>
964          * @deprecated  This class is deprecated. Instead of using this class, use GroupedTableView class.
965          * @since               2.0
966          *
967          * @return       The index of the next checked sub-item, @n
968          *               else @c -1 if no more sub-item after the specified index is checked, or the specified sub-item does not exist
969          * @param[in]   mainIndex       The index of the main item, that the sub-item belongs to
970          * @param[in]    subIndex  The index of the sub-item in the main item
971          * @endif
972          */
973         int GetNextCheckedSubItemIndexAfter(int mainIndex, int subIndex) const;
974
975         /**
976          * @if OSPDEPREC
977          * Gets the index of the sub-item with the specified @c itemId.
978          *
979          * @brief       <i> [Deprecated] </i>
980          * @deprecated  This class is deprecated. Instead of using this class, use GroupedTableView class.
981          * @since               2.0
982          *
983          * @return              An error code
984          * @param[in]   itemId                          The item ID
985          * @param[out]  mainIndex               The index of the main item which the sub-item belongs to
986          * @param[out]  subIndex                        The index of the sub-item
987          * @exception   E_SUCCESS                       The method is successful.
988          * @exception   E_OBJ_NOT_FOUND         The specified item is not found.
989          * @remarks     Note that one or more sub-items can have the same item ID. This method returns the first sub-item among such sub-items.
990          * @endif
991          */
992         result GetSubItemIndexFromItemId(int itemId, int& mainIndex, int& subIndex) const;
993
994         /**
995          * @if OSPDEPREC
996          * Gets the index of the item at the specified position.
997          *
998          * @brief       <i> [Deprecated] </i>
999          * @deprecated  This class is deprecated. Instead of using this class, use GroupedTableView class.
1000          * @since               2.0
1001          *
1002          * @return              An error code
1003          * @param[in]   x                       The x position of the point
1004          * @param[in]   y                       The y position of the point
1005          * @param[out]  mainIndex               The index of the main item which the sub-item belongs to
1006          * @param[out]  subIndex                The index of the sub-item
1007          * @exception   E_SUCCESS                       The method is successful.
1008          * @exception   E_SYSTEM                A system error has occurred.
1009          * @endif
1010          */
1011         result GetItemIndexFromPosition(int x, int y, int& mainIndex, int& subIndex) const;
1012
1013         /**
1014          * @if OSPDEPREC
1015          * Gets the index of the item at the specified position.
1016          *
1017          * @brief       <i> [Deprecated] </i>
1018          * @deprecated  This class is deprecated. Instead of using this class, use GroupedTableView class.
1019          * @since               2.0
1020          *
1021          * @return              An error code
1022          * @param[in]   position                The position of the point
1023          * @param[out]  mainIndex               The index of the main item which the sub-item belongs to
1024          * @param[out]  subIndex                The index of the sub-item
1025          * @exception   E_SUCCESS                       The method is successful.
1026          * @exception   E_SYSTEM                A system error has occurred.
1027          * @endif
1028          */
1029         result GetItemIndexFromPosition(const Tizen::Graphics::Point& position, int& mainIndex, int& subIndex) const;
1030
1031         /**
1032          * @if OSPDEPREC
1033          * Gets the index of the first item of the visible items in the %ExpandableList control.
1034          *
1035          * @brief       <i> [Deprecated] </i>
1036          * @deprecated  This class is deprecated. Instead of using this class, use GroupedTableView class.
1037          * @since               2.0
1038          *
1039          * @return              An error code
1040          * @param[out]  mainIndex               The main index of the top drawn item
1041          * @param[out]  subIndex                        The sub-index of the top drawn item
1042          * @exception   E_SUCCESS                       The method is successful.
1043          * @exception   E_SYSTEM                        A system error has occurred.
1044          * @remarks
1045          *                      - @c mainIndex is @c -1 if no item is visible.
1046          *                      - @c subIndex is @c -1 if the top item drawn is a main item.
1047          * @endif
1048          */
1049         result GetTopDrawnItemIndex(int& mainIndex, int& subIndex) const;
1050
1051
1052         /**
1053          * @if OSPDEPREC
1054          * Gets the index of the last of the visible items in the %ExpandableList control.
1055          *
1056          * @brief       <i> [Deprecated] </i>
1057          * @deprecated  This class is deprecated. Instead of using this class, use GroupedTableView class.
1058          * @since               2.0
1059          *
1060          * @return              An error code
1061          * @param[out]  mainIndex               The main index of the bottom drawn item
1062          * @param[out]  subIndex                        The sub-index of the bottom drawn item
1063          * @exception   E_SUCCESS                       The method is successful.
1064          * @exception   E_SYSTEM                        A system error has occurred.
1065          * @remarks
1066          *                      - @c mainIndex is @c -1 if no item is visible.
1067          *                      - @c subIndex is @c -1 if the bottom item drawn is a main item.
1068          * @endif
1069          */
1070         result GetBottomDrawnItemIndex(int& mainIndex, int& subIndex) const;
1071
1072
1073         /**
1074          * @if OSPDEPREC
1075          * Sets the background color of this control.
1076          *
1077          * @brief       <i> [Deprecated] </i>
1078          * @deprecated  This class is deprecated. Instead of using this class, use GroupedTableView class.
1079          * @since        2.0
1080          *
1081          * @param[in]    color    The background color
1082          * @endif
1083          */
1084         void SetBackgroundColor(const Tizen::Graphics::Color& color);
1085
1086         /**
1087          * @if OSPDEPREC
1088          * Sets the text to display when there is no item in the %ExpandableList control.
1089          *
1090          * @brief       <i> [Deprecated] </i>
1091          * @deprecated  This class is deprecated. Instead of using this class, use GroupedTableView class.
1092          * @since               2.0
1093          *
1094          * @param[in]   text    The text message to display
1095          * @endif
1096          */
1097         void SetTextOfEmptyList(const Tizen::Base::String& text);
1098
1099         /**
1100          * @if OSPDEPREC
1101          * Sets the color of the text to be displayed when there is no item in the %ExpandableList control.
1102          *
1103          * @brief       <i> [Deprecated] </i>
1104          * @deprecated  This class is deprecated. Instead of using this class, use GroupedTableView class.
1105          * @since       2.0
1106          *
1107          * @param[in]   color   The color of the text to display
1108          * @endif
1109          */
1110         void SetTextColorOfEmptyList(const Tizen::Graphics::Color& color);
1111
1112         /**
1113          * @if OSPDEPREC
1114          * Gets the color of the text to be displayed when there is no item in the %ExpandableList control.
1115          *
1116          * @brief       <i> [Deprecated] </i>
1117          * @deprecated  This class is deprecated. Instead of using this class, use GroupedTableView class.
1118          * @since       2.0
1119          *
1120          * @return              The color of the text to be displayed
1121          * @endif
1122          */
1123         Tizen::Graphics::Color GetTextColorOfEmptyList(void) const;
1124
1125
1126         /**
1127          * @if OSPDEPREC
1128          * Scrolls to the bottom of the %ExpandableList control.
1129          *
1130          * @brief       <i> [Deprecated] </i>
1131          * @deprecated  This class is deprecated. Instead of using this class, use GroupedTableView class.
1132          * @since               2.0
1133          * @endif
1134          */
1135         void ScrollToBottom(void);
1136
1137         /**
1138          * @if OSPDEPREC
1139          * Scrolls to the top of the %ExpandableList control.
1140          *
1141          * @brief       <i> [Deprecated] </i>
1142          * @deprecated  This class is deprecated. Instead of using this class, use GroupedTableView class.
1143          * @since               2.0
1144          * @endif
1145          */
1146         void ScrollToTop(void);
1147
1148         /**
1149          * @if OSPDEPREC
1150          * Scrolls to the item at the specified index. @n
1151          * The specified item is drawn at the top of the %ExpandableList control.
1152          *
1153          * @brief       <i> [Deprecated] </i>
1154          * @deprecated  This class is deprecated. Instead of using this class, use GroupedTableView class.
1155          * @since               2.0
1156          *
1157          * @return              An error code
1158          * @param[in]   mainIndex               The index of the main item
1159          * @param[in]   subIndex                The index of the sub-item
1160          * @exception   E_SUCCESS                       The method is successful.
1161          * @exception   E_SYSTEM                        A system error has occurred.
1162          * @exception   E_INVALID_ARG           The specified item does not exist.
1163          * @endif
1164          */
1165         result ScrollToTop(int mainIndex, int subIndex);
1166
1167         /**
1168          * @if OSPDEPREC
1169          * Scrolls to the main item at the specified index. @n
1170          * The specified main item is drawn at the top of the %ExpandableList control.
1171          *
1172          * @brief       <i> [Deprecated] </i>
1173          * @deprecated  This class is deprecated. Instead of using this class, use GroupedTableView class.
1174          * @since               2.0
1175          *
1176          * @return              An error code
1177          * @param[in]   mainIndex               The index of the main item
1178          * @exception   E_SUCCESS                       The method is successful.
1179          * @exception   E_SYSTEM                A system error has occurred.
1180          * @exception   E_INVALID_ARG           The specified @c mainIndex is less than @c 0, or not less than the main item count.
1181          * @endif
1182          */
1183         result ScrollToTop(int mainIndex);
1184
1185         /**
1186          * @if OSPDEPREC
1187          * Draws and shows the item at the specified index in the %ExpandableList control.
1188          *
1189          * @brief       <i> [Deprecated] </i>
1190          * @deprecated  This class is deprecated. Instead of using this class, use GroupedTableView class.
1191          * @since               2.0
1192          *
1193          * @return              An error code
1194          * @param[in]   mainIndex               The index of the main item
1195          * @param[in]   subIndex                The index of the sub-item
1196          * @exception   E_SUCCESS                       The method is successful.
1197          * @exception   E_SYSTEM            A system error has occurred.
1198          * @exception   E_INVALID_OPERATION The item has never been drawn before calling this method.
1199          * @exception   E_INVALID_ARG           The specified item does not exist.
1200          * @endif
1201          */
1202         result RefreshSubItem(int mainIndex, int subIndex);
1203
1204         /**
1205          * @if OSPDEPREC
1206          * Draws and shows the main item at the specified index in the %ExpandableList control.
1207          *
1208          * @brief       <i> [Deprecated] </i>
1209          * @deprecated  This class is deprecated. Instead of using this class, use GroupedTableView class.
1210          * @since               2.0
1211          *
1212          * @return              An error code
1213          * @param[in]   mainIndex               The index of the main item
1214          * @exception   E_SUCCESS                       The method is successful.
1215          * @exception   E_SYSTEM                        A system error has occurred.
1216          * @exception   E_INVALID_OPERATION The item has never been drawn before calling this method.
1217          * @exception   E_INVALID_ARG           The specified @c mainIndex is invalid.
1218          * @endif
1219          */
1220         result RefreshItem(int mainIndex);
1221
1222 private:
1223         //
1224         // The implementation of this copy constructor is intentionally blank and declared as private to prohibit copying of objects.
1225         //
1226         ExpandableList(const ExpandableList& rhs);
1227
1228         //
1229         // The implementation of this copy assignment operator is intentionally blank and declared as private to prohibit copying of objects.
1230         //
1231         ExpandableList& operator =(const ExpandableList& rhs);
1232
1233         friend class _ExpandableListImpl;
1234 }; //ExpandableList
1235
1236 }}} // Tizen::Ui::Controls
1237 #endif // _FUI_CTRL_EXPANDABLE_LIST_H_