2 // Open Service Platform
3 // Copyright (c) 2012-2013 Samsung Electronics Co., Ltd.
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
9 // http://floralicense.org/license/
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.
19 * @file FUiCtrlGroupedTableView.h
20 * @brief This is the header file for the %GroupedTableView class.
22 * This header file contains the declarations of the %GroupedTableView class and its helper classes.
25 #ifndef _FUI_CTRL_GROUPED_TABLE_VIEW_H_
26 #define _FUI_CTRL_GROUPED_TABLE_VIEW_H_
28 #include <FGrpRectangle.h>
29 #include <FGrpColor.h>
30 #include <FUiContainer.h>
31 #include <FUiCtrlTableViewTypes.h>
32 #include <FUiCtrlScrollPanelTypes.h>
34 namespace Tizen { namespace Ui { namespace Controls
36 class IGroupedTableViewItemProvider;
37 class IGroupedTableViewItemProviderF;
38 class IGroupedTableViewItemEventListener;
39 class IFastScrollListener;
40 class IScrollEventListener;
41 class IScrollEventListenerF;
44 * @class GroupedTableView
45 * @brief This class defines common behavior for a %GroupedTableView control.
49 * The %GroupedTableView class defines common behavior for a %GroupedTableView control.
51 //Sample code for GroupedTableViewSample.h
54 class GroupedTableViewSample
55 : public Tizen::Ui::Controls::Form
56 , public Tizen::Ui::Controls::IGroupedTableViewItemProvider
57 , public Tizen::Ui::Controls::IGroupedTableViewItemEventListener
58 , public Tizen::Ui::Controls::IFastScrollListener
61 GroupedTableViewSample(void)
62 : __pGroupedTableView(null)
63 , __pContextItem(null){}
65 bool Initialize(void);
66 virtual result OnInitializing(void);
67 virtual result OnTerminating(void);
69 // IGroupedTableViewItemEventListener
70 virtual void OnGroupedTableViewGroupItemStateChanged(Tizen::Ui::Controls::GroupedTableView& tableView, int groupIndex, Tizen::Ui::Controls::TableViewGroupItem* pItem, Tizen::Ui::Controls::TableViewItemStatus status);
71 virtual void OnGroupedTableViewItemStateChanged(Tizen::Ui::Controls::GroupedTableView& tableView, int groupIndex, int itemIndex, Tizen::Ui::Controls::TableViewItem* pItem, Tizen::Ui::Controls::TableViewItemStatus status);
72 virtual void OnGroupedTableViewContextItemActivationStateChanged(Tizen::Ui::Controls::GroupedTableView& tableView, int groupIndex, int itemIndex, Tizen::Ui::Controls::TableViewContextItem* pContextItem, bool activated);
74 // IGroupedTableViewItemProvider
75 virtual int GetGroupCount(void);
76 virtual int GetItemCount(int groupIndex);
77 virtual Tizen::Ui::Controls::TableViewGroupItem* CreateGroupItem(int groupIndex, int itemWidth);
78 virtual bool DeleteGroupItem(int groupIndex, Tizen::Ui::Controls::TableViewGroupItem* pItem);
79 virtual void UpdateGroupItem(int groupIndex, Tizen::Ui::Controls::TableViewGroupItem* pItem);
80 virtual Tizen::Ui::Controls::TableViewItem* CreateItem(int groupIndex, int itemIndex, int itemWidth);
81 virtual bool DeleteItem(int groupIndex, int itemIndex, Tizen::Ui::Controls::TableViewItem* pItem);
82 virtual void UpdateItem(int groupIndex, int itemIndex, Tizen::Ui::Controls::TableViewItem* pItem);
83 virtual int GetDefaultItemHeight(void);
84 virtual int GetDefaultGroupItemHeight(void);
86 // IFastScrollListener
87 virtual void OnFastScrollIndexSelected(Tizen::Ui::Control& source, Tizen::Base::String& index);
90 Tizen::Ui::Controls::GroupedTableView* __pGroupedTableView;
91 Tizen::Ui::Controls::TableViewContextItem* __pContextItem;
97 //Sample code for GroupedTableViewSample.cpp
99 #include <FGraphics.h>
101 #include "GroupedTableViewSample.h"
103 using namespace Tizen::App;
104 using namespace Tizen::Base;
105 using namespace Tizen::Graphics;
106 using namespace Tizen::Media;
107 using namespace Tizen::Ui::Controls;
110 GroupedTableViewSample::Initialize(void)
112 Construct(FORM_STYLE_NORMAL);
117 GroupedTableViewSample::OnInitializing(void)
119 result r = E_SUCCESS;
121 // Creates an instance of TableView
122 __pGroupedTableView = new GroupedTableView();
123 __pGroupedTableView->Construct(Rectangle(0, 0, GetClientAreaBounds().width, GetClientAreaBounds().height), true, TABLE_VIEW_SCROLL_BAR_STYLE_FAST_SCROLL);
124 __pGroupedTableView->SetItemProvider(*this);
125 __pGroupedTableView->AddTableViewItemEventListener(*this);
127 __pGroupedTableView->AddFastScrollListener(*this);
128 __pGroupedTableView->SetFastScrollIndex(L"ABCDEFGHIJKLMNOPQRSTUVWXYZ", true);
130 // Adds the TableView to the form
131 AddControl(*__pGroupedTableView);
133 // Creates an instance of TableViewContextItem
134 __pContextItem = new TableViewContextItem();
135 __pContextItem->Construct(Dimension(720, 100));
137 Button* pButton = new Button();
138 pButton->Construct(Rectangle(10, 10, 200, 80), L"Context1");
140 Button* pButton2 = new Button();
141 pButton2->Construct(Rectangle(250, 10, 200, 80), L"Context2");
143 __pContextItem->AddControl(*pButton);
144 __pContextItem->AddControl(*pButton2);
150 GroupedTableViewSample::OnTerminating(void)
152 result r = E_SUCCESS;
154 // Deallocates the item context
155 delete __pItemContext;
156 __pItemContext = null;
161 // IGroupedTableViewItemEventListener implementation
163 GroupedTableViewSample::OnGroupedTableViewGroupItemStateChanged(GroupedTableView& tableView, int groupIndex, TableViewGroupItem* pItem, TableViewItemStatus status)
165 if (tableView.IsGroupExpanded(groupIndex))
167 tableView.CollapseGroup(groupIndex);
171 tableView.ExpandGroup(groupIndex);
176 GroupedTableViewSample::OnGroupedTableViewItemStateChanged(GroupedTableView& tableView, int groupIndex, int itemIndex, TableViewItem* pItem, TableViewItemStatus status)
182 GroupedTableViewSample::OnGroupedTableViewContextItemActivationStateChanged(GroupedTableView& tableView, int groupIndex, int itemIndex, TableViewContextItem* pContextItem, bool activated)
187 // IFastScrollListener implementation
189 GroupedTableViewSample::OnFastScrollIndexSelected(Tizen::Ui::Control& source, Tizen::Base::String& index)
194 // IGroupedTableViewItemProvider implementation
196 GroupedTableViewSample::GetGroupCount(void)
202 GroupedTableViewSample::GetItemCount(int groupIndex)
208 GroupedTableViewSample::GetDefaultItemHeight(void)
214 GroupedTableViewSample::GetDefaultGroupItemHeight(void)
220 GroupedTableViewSample::CreateGroupItem(int groupIndex, int itemWidth)
222 TableViewGroupItem* pItem = new TableViewGroupItem();
223 pItem->Construct(Dimension(itemWidth, GetDefaultGroupItemHeight()));
226 text.Format(30, L"Group title %d", itemIndex);
228 Label* pLabel = new Label();
229 pLabel->Construct(Rectangle(0, 0, itemWidth, GetDefaultGroupItemHeight(), text);
231 pItem->AddControl(*pLable);
237 GroupedTableViewSample::DeleteGroupItem(int groupIndex, TableViewGroupItem* pItem)
245 GroupedTableViewSample::UpdateGroupItem(int groupIndex, TableViewGroupItem* pItem)
251 GroupedTableViewSample::CreateItem(int groupIndex, int itemIndex, int itemWidth)
253 TableViewAnnexStyle style = TABLE_VIEW_ANNEX_STYLE_NORMAL;
254 TableViewItem* pItem = new TableViewItem();
256 switch (itemIndex % 6)
259 style = TABLE_VIEW_ANNEX_STYLE_NORMAL;
262 style = TABLE_VIEW_ANNEX_STYLE_MARK;
265 style = TABLE_VIEW_ANNEX_STYLE_ONOFF_SLIDING;
268 style = TABLE_VIEW_ANNEX_STYLE_DETAILED;
271 style = TABLE_VIEW_ANNEX_STYLE_RADIO;
274 style = TABLE_VIEW_ANNEX_STYLE_ONOFF_SLIDING_WITH_DIVIDER;
280 pItem->Construct(Dimension(itemWidth, GetDefaultItemHeight()), style);
283 text.Format(30, L"TableViewItem %d", itemIndex);
285 Label* pLabel = new Label();
286 pLabel->Construct(Rectangle(0, 0, itemWidth, GetDefaultItemHeight(), text);
288 pItem->AddControl(*pLabel);
289 pItem->SetContextItem(__pContextItem);
295 GroupedTableViewSample::DeleteItem(int groupIndex, int itemIndex, Controls::TableViewItem* pItem)
303 GroupedTableViewSample::UpdateItem(int groupIndex, int itemIndex, Controls::TableViewItem* pItem)
311 class _OSP_EXPORT_ GroupedTableView
312 : public Tizen::Ui::Container
316 * The object is not fully constructed after this constructor is called. Hence, the Construct() method must be called after calling this constructor.
320 GroupedTableView(void);
323 * This destructor overrides Tizen::Base::Object::~Object().
327 virtual ~GroupedTableView(void);
330 * Initializes this instance of %GroupedTableView with the specified parameters.
334 * @return An error code
335 * @param[in] rect An instance of the Graphics::Rectangle class
336 * This instance represents the x and y coordinates of the left top corner of the created %GroupedTableView along with the width and height.
337 * @param[in] itemDivider Set to @c true to display an item divider, @n
339 * @param[in] scrollStyle The style of %GroupedTableView scroll bar style
340 * @exception E_SUCCESS The method is successful.
341 * @exception E_INVALID_ARG A specified input parameter is invalid, or either the rect.width or rect.height parameter has a negative value.
344 result Construct(const Tizen::Graphics::Rectangle& rect, bool itemDivider, TableViewScrollBarStyle scrollStyle);
347 * Initializes this instance of %GroupedTableView with the specified parameters.
351 * @return An error code
352 * @param[in] rect An instance of the Graphics::FloatRectangle class
353 * This instance represents the x and y coordinates of the left top corner of the created %GroupedTableView along with the width and height.
354 * @param[in] itemDivider Set to @c true to display an item divider, @n
356 * @param[in] scrollStyle The style of %GroupedTableView scroll bar style
357 * @exception E_SUCCESS The method is successful.
358 * @exception E_INVALID_ARG A specified input parameter is invalid, or either the rect.width or rect.height parameter has a negative value.
361 result Construct(const Tizen::Graphics::FloatRectangle& rect, bool itemDivider, TableViewScrollBarStyle scrollStyle);
364 * Sets the item provider that creates and deletes items for the grouped style table view.
368 * @param[in] pProvider The item provider to create and delete items
369 * @remarks If an item provider is not set for the table view, the table view does not work. The specified provider should be allocated in heap memory.
370 * To reset the item provider, pass @c null to @c pProvider.
372 void SetItemProvider(IGroupedTableViewItemProvider* pProvider);
375 * Sets the item provider that creates and deletes items for the grouped style table view.
379 * @param[in] pProvider The item provider to create and delete items
380 * @remarks If an item provider is not set for the table view, the table view does not work. The specified provider should be allocated in heap memory.
381 * To reset the item provider, pass @c null to @c pProvider.
383 void SetItemProviderF(IGroupedTableViewItemProviderF* pProvider);
386 * Expands the group's items.
390 * @return An error code
391 * @param[in] groupIndex The index of the group
392 * @exception E_SUCCESS The method is successful.
393 * @exception E_OUT_OF_RANGE A specified input parameter is invalid.
394 * @exception E_INVALID_OPERATION The current state of the instance prohibits the execution of the specified operation @b Since: @b 2.1.
395 * @remarks This method does not work during the ITableViewItemProvider call-back procedure.
396 * @remarks This method should be called only after TableView items are created. If this method needs to be called early in the lifecycle of the TableView, then UpdateTableView() method should be called explicitly (e.g. during Tizen::Ui::Control::OnInitializing()).
398 result ExpandGroup(int groupIndex);
401 * Collapses the group's items.
405 * @return An error code
406 * @param[in] groupIndex The index of the group
407 * @exception E_SUCCESS The method is successful.
408 * @exception E_OUT_OF_RANGE A specified input parameter is invalid.
409 * @exception E_INVALID_OPERATION The current state of the instance prohibits the execution of the specified operation @b Since: @b 2.1.
410 * @remarks This method does not work during the ITableViewItemProvider call-back procedure.
411 * @remarks This method should be called only after TableView items are created. If this method needs to be called early in the lifecycle of the TableView, then UpdateTableView() method should be called explicitly (e.g. during Tizen::Ui::Control::OnInitializing()).
413 result CollapseGroup(int groupIndex);
416 * Expands all groups of table view.
420 * @return An error code
421 * @exception E_SUCCESS The method is successful.
422 * @exception E_INVALID_OPERATION The current state of the instance prohibits the execution of the specified operation @b Since: @b 2.1.
423 * @remarks This method does not work during the ITableViewItemProvider call-back procedure.
425 result ExpandAllGroups(void);
428 * Collapses all groups of table view.
432 * @return An error code
433 * @exception E_SUCCESS The method is successful.
434 * @exception E_INVALID_OPERATION The current state of the instance prohibits the execution of the specified operation @b Since: @b 2.1.
435 * @remarks This method does not work during the ITableViewItemProvider call-back procedure.
437 result CollapseAllGroups(void);
440 * Expands all groups of table view.
445 inline void ExpandAllGroup(void)
451 * Collapses all groups of table view.
456 inline void CollapseAllGroup(void)
462 * Returns whether the group is expanded or not.
466 * @return @c true if the group is expanded, else @c false
467 * @param[in] groupIndex The index of the group
468 * @exception E_SUCCESS The method is successful.
469 * @exception E_OUT_OF_RANGE A specified input parameter is invalid.
470 * @remarks This method should be called only after TableView items are created. If this method needs to be called early in the lifecycle of the TableView, then UpdateTableView() method should be called explicitly (e.g. during Tizen::Ui::Control::OnInitializing()).
472 bool IsGroupExpanded(int groupIndex) const;
475 * Sets the grouped look is enabled.
479 * @param[in] enable The enabled/disabled status
481 void SetGroupedLookEnabled(bool enable);
484 * Returns whether the grouped look is enabled or not.
488 * @return @c true if the grouped look is enabled, else @c false
490 bool IsGroupedLookEnabled(void) const;
493 * Adds a listener instance that listens to state changes of table view items. @n
494 * The added listener can listen to events on the specified event dispatcher's context when they are fired.
498 * @return An error code
499 * @param[in] listener The event listener to add
500 * @exception E_SUCCESS The method is successful.
501 * @exception E_OBJ_ALREADY_EXIST The listener is already added.
502 * @remarks The specified listener should be allocated in heap memory.
504 result AddGroupedTableViewItemEventListener(IGroupedTableViewItemEventListener& listener);
507 * Removes a listener instance that listens to state changes of table view items. @n
508 * The removed listener cannot listen to events when they are fired.
512 * @return An error code
513 * @param[in] listener The event listener to remove
514 * @exception E_SUCCESS The method is successful.
515 * @exception E_OBJ_NOT_FOUND The listener is not found.
517 result RemoveGroupedTableViewItemEventListener(IGroupedTableViewItemEventListener& listener);
520 * Adds a listener instance that listens to state changes of a fast scroll. @n
521 * The added listener can listen to events on the specified event dispatcher's context when they are fired.
525 * @return An error code
526 * @param[in] listener The event listener to add
527 * @exception E_SUCCESS The method is successful.
528 * @exception E_INVALID_OPERATION The current state of the instance prohibits the execution of the specified operation.
529 * @exception E_OBJ_ALREADY_EXIST The listener is already added.
530 * @remarks The specified listener should be allocated in heap memory.
532 result AddFastScrollListener(IFastScrollListener& listener);
535 * Removes a listener instance that listens to state changes of a fast scroll. @n
536 * The removed listener cannot listen to events when they are fired.
540 * @return An error code
541 * @param[in] listener The event listener to remove
542 * @exception E_SUCCESS The method is successful.
543 * @exception E_INVALID_OPERATION The current state of the instance prohibits the execution of the specified operation.
544 * @exception E_OBJ_NOT_FOUND The listener is not found.
546 result RemoveFastScrollListener(IFastScrollListener& listener);
549 * Adds a listener instance that listens to state changes of a scroll event. @n
550 * The added listener can listen to events on the specified event dispatcher's context when they are fired.
554 * @return An error code
555 * @param[in] listener The event listener to add
556 * @see IScrollEventListener::OnScrollEndReached()
557 * @see RemoveScrollEventListener()
558 * @exception E_SUCCESS The method is successful.
559 * @exception E_INVALID_OPERATION The current state of the instance prohibits the execution of the specified operation.
560 * @exception E_OBJ_ALREADY_EXIST The listener is already added.
561 * @remarks The specified listener should be allocated in heap memory.
563 result AddScrollEventListener(IScrollEventListener& listener);
566 * Removes a listener instance that listens to state changes of a scroll event. @n
567 * The removed listener cannot listen to events when they are fired.
571 * @return An error code
572 * @param[in] listener The event listener to remove
573 * @see IScrollEventListener::OnScrollEndReached()
574 * @see AddScrollEventListener()
575 * @exception E_SUCCESS The method is successful.
576 * @exception E_INVALID_OPERATION The current state of the instance prohibits the execution of the specified operation.
577 * @exception E_OBJ_NOT_FOUND The listener is not found.
579 result RemoveScrollEventListener(IScrollEventListener& listener);
582 * Adds a listener instance that listens to state changes of a scroll event. @n
583 * The added listener can listen to events on the specified event dispatcher's context when they are fired.
587 * @return An error code
588 * @param[in] listener The event listener to add
589 * @see IScrollEventListenerF::OnScrollEndReached()
590 * @see RemoveScrollEventListenerF()
591 * @exception E_SUCCESS The method is successful.
592 * @exception E_INVALID_OPERATION The current state of the instance prohibits the execution of the specified operation.
593 * @exception E_OBJ_ALREADY_EXIST The listener is already added.
594 * @remarks The specified listener should be allocated in heap memory.
596 result AddScrollEventListener(IScrollEventListenerF& listener);
599 * Removes a listener instance that listens to state changes of a scroll event. @n
600 * The removed listener cannot listen to events when they are fired.
604 * @return An error code
605 * @param[in] listener The event listener to remove
606 * @see IScrollEventListenerF::OnScrollEndReached()
607 * @see AddScrollEventListenerF()
608 * @exception E_SUCCESS The method is successful.
609 * @exception E_INVALID_OPERATION The current state of the instance prohibits the execution of the specified operation.
610 * @exception E_OBJ_NOT_FOUND The listener is not found.
612 result RemoveScrollEventListener(IScrollEventListenerF& listener);
615 * Enables or disables the collapse by pinch gesture.
619 * @param[in] enable Set to @c true to enable the collapse by pinch gesture, else @c false
621 void SetCollapseByPinchGestureEnabled(bool enable);
624 * Returns whether the collapse by pinch gesture is enabled or not.
628 * @return @c true if the collapse by pinch gesture is enabled, else @c false
630 bool IsCollapseByPinchGestureEnabled(void) const;
633 * Sets the text index of the fast scroll.
637 * @return An error code
638 * @param[in] text The text of the index
639 * @param[in] useSearchIcon Set to @c true to show the magnifying icon, @n
641 * @exception E_SUCCESS The method is successful.
642 * @exception E_INVALID_OPERATION The current state of the instance prohibits the execution of the specified operation.
644 result SetFastScrollIndex(const Tizen::Base::String& text, bool useSearchIcon);
647 * Gets the group and item indexes of the top item.
651 * @return An error code
652 * @param[out] groupIndex The group index
653 * @param[out] itemIndex The item index
654 * @exception E_SUCCESS The method is successful.
655 * @exception E_OBJ_NOT_FOUND Top drawn item is not found.
657 result GetTopDrawnItemIndex(int& groupIndex, int& itemIndex) const;
660 * Gets the group and item indexes of the bottom item.
664 * @return An error code
665 * @param[out] groupIndex The group index
666 * @param[out] itemIndex The item index
667 * @exception E_SUCCESS The method is successful.
668 * @exception E_OBJ_NOT_FOUND Bottom drawn item is not found.
670 result GetBottomDrawnItemIndex(int& groupIndex, int& itemIndex) const;
673 * Scrolls to the item at the specified index.
674 * The specified item is drawn at the position specified by the item alignment.
678 * @return An error code
679 * @param[in] groupIndex The group index
680 * @param[in] itemIndex The item index
681 * @param[in] itemAlignment The item alignment
682 * @exception E_SUCCESS The method is successful.
683 * @exception E_OUT_OF_RANGE A specified input parameter is invalid.
684 * @exception E_INVALID_OPERATION The current state of the instance prohibits the execution of the specified operation @b Since: @b 2.1.
685 * @remarks If the specified item. itemIndex is -1, then the method is applied to the group item with the given index. @n
686 * This method does not work during the ITableViewItemProvider call-back procedure.
687 * @remarks This method should be called only after TableView items are created. If this method needs to be called early in the lifecycle of the TableView, then UpdateTableView() method should be called explicitly (e.g. during Tizen::Ui::Control::OnInitializing()).
689 result ScrollToItem(int groupIndex, int itemIndex, TableViewScrollItemAlignment itemAlignment = TABLE_VIEW_SCROLL_ITEM_ALIGNMENT_TOP);
692 * Checks or unchecks the item at the specified index.
696 * @return An error code
697 * @param[in] groupIndex The group index
698 * @param[in] itemIndex The item index
699 * @param[in] check Set to @c true to select the item, @n
701 * @exception E_SUCCESS The method is successful.
702 * @exception E_OUT_OF_RANGE A specified input parameter is invalid.
703 * @exception E_INVALID_OPERATION The item is disabled or the current state of the instance prohibits the execution of the specified operation.
704 * @remarks This method works only when the annex style of the item allows selection. @n
705 * This method does not work during the ITableViewItemProvider call-back procedure.
706 * @remarks This method should be called only after TableView items are created. If this method needs to be called early in the lifecycle of the TableView, then UpdateTableView() method should be called explicitly (e.g. during Tizen::Ui::Control::OnInitializing()).
708 result SetItemChecked(int groupIndex, int itemIndex, bool check);
711 * Returns whether the item at the specified index is selected or not.
715 * @return @c true if the item is selected, @n
717 * @param[in] groupIndex The group index
718 * @param[in] itemIndex The item index
719 * @exception E_SUCCESS The method is successful.
720 * @exception E_OUT_OF_RANGE A specified input parameter is invalid.
721 * @remarks This method returns @c false, if the annex style of the item does not allow selection.
722 * @remarks This method should be called only after TableView items are created. If this method needs to be called early in the lifecycle of the TableView, then UpdateTableView() method should be called explicitly (e.g. during Tizen::Ui::Control::OnInitializing()).
724 bool IsItemChecked(int groupIndex, int itemIndex) const;
727 * Enables or disables the item at the specified index.
731 * @return An error code
732 * @param[in] groupIndex The group index
733 * @param[in] itemIndex The item index
734 * @param[in] enable Set to @c true to enable the specified item, @n
736 * @exception E_SUCCESS The method is successful.
737 * @exception E_OUT_OF_RANGE A specified input parameter is invalid.
738 * @exception E_INVALID_OPERATION The current state of the instance prohibits the execution of the specified operation @b Since: @b 2.1.
739 * @remarks This method does not work during the ITableViewItemProvider call-back procedure.
740 * @remarks This method should be called only after TableView items are created. If this method needs to be called early in the lifecycle of the TableView, then UpdateTableView() method should be called explicitly (e.g. during Tizen::Ui::Control::OnInitializing()).
742 result SetItemEnabled(int groupIndex, int itemIndex, bool enable);
745 * Returns whether the item at the specified index is enabled or disabled.
749 * @return @c true if the item is enabled, @n
751 * @param[in] groupIndex The group index
752 * @param[in] itemIndex The item index
753 * @exception E_SUCCESS The method is successful.
754 * @exception E_OUT_OF_RANGE A specified input parameter is invalid.
755 * @remarks This method should be called only after TableView items are created. If this method needs to be called early in the lifecycle of the TableView, then UpdateTableView() method should be called explicitly (e.g. during Tizen::Ui::Control::OnInitializing()).
757 bool IsItemEnabled(int groupIndex, int itemIndex) const;
760 * Counts the total number of groups.
764 * @return The total number of groups
766 int GetGroupCount(void) const;
769 * Counts all the items of the specified group.
773 * @return The total number of items in the specified group
774 * @param[in] groupIndex The group index
775 * @exception E_SUCCESS The method is successful.
776 * @exception E_OUT_OF_RANGE A specified input parameter is invalid.
778 int GetItemCountAt(int groupIndex) const;
781 * Updates the specified item. @n
782 * For instance, TABLE_VIEW_REFRESH_TYPE_ITEM_ADD is used when a new item needs to be added and TABLE_VIEW_REFRESH_TYPE_ITEM_REMOVE is used when an item is deleted from the
783 * table view. Moreover, TABLE_VIEW_REFRESH_TYPE_ITEM_MODIFY is used when the content of an existing item has changed and it needs to be updated.
784 * Note that calling this method with TABLE_VIEW_REFRESH_TYPE_ITEM_MODIFY invokes item provider's UpdateItem() for the given index in sequence.
788 * @return An error code
789 * @param[in] groupIndex The group index
790 * @param[in] itemIndex The item index
791 * @param[in] type The item to be added, removed, or modified
792 * @exception E_SUCCESS The method is successful.
793 * @exception E_OUT_OF_RANGE A specified input parameter is invalid.
794 * @exception E_INVALID_OPERATION The current state of the instance prohibits the execution of the specified operation @b Since: @b 2.1.
795 * @remarks If the specified item. itemIndex is -1, then the method is applied to the group item with the given index.
796 * Note that if TABLE_VIEW_REFRESH_TYPE_ITEM_REMOVE option is used to a group item, all the items in the group (including the group item itself) are
797 * removed from the table view. @n
798 * This method does not work during the ITableViewItemProvider call-back procedure.
800 result RefreshItem(int groupIndex, int itemIndex, TableViewRefreshType type);
803 * Updates all items of the table view. @n
804 * Note that calling this method invokes its item provider's UpdateItem() for all loaded items.
808 * @return An error code
809 * @exception E_SUCCESS The method is successful.
810 * @exception E_INVALID_OPERATION The %GroupedTableView item provider is processing the other request.
812 result RefreshAllItems(void);
815 * Updates all the items of a table view.
819 * @exception E_SUCCESS The method is successful.
820 * @exception E_INVALID_OPERATION The current state of the instance prohibits the execution of the specified operation @b Since: @b 2.1.
821 * @remarks This method clears all the items in the table view and invokes the methods of the item provider again to update the table view. @n
822 * This method does not work during the ITableViewItemProvider call-back procedure.
823 * @remarks The specific error code can be accessed using the GetLastResult() method.
825 void UpdateTableView(void);
828 * Gets the index of the item at the specified position.
832 * @param[in] position The position of the item
833 * @param[out] groupIndex The group index of the item on specified position
834 * @param[out] itemIndex The item index of the item on specified position
835 * @remarks This method sets both of groupIndex and itemIndex to -1 if no item is found at the given position.
836 * @remarks This method should be called only after TableView items are created. If this method needs to be called early in the lifecycle of the TableView, then UpdateTableView() method should be called explicitly (e.g. during Tizen::Ui::Control::OnInitializing()).
838 void GetItemIndexFromPosition(const Tizen::Graphics::Point& position, int& groupIndex, int& itemIndex) const;
841 * Gets the index of the item at the specified position.
845 * @param[in] position The position of the item
846 * @param[out] groupIndex The group index of the item on specified position
847 * @param[out] itemIndex The item index of the item on specified position
848 * @remarks This method sets both of groupIndex and itemIndex to -1 if no item is found at the given position.
849 * @remarks This method should be called only after TableView items are created. If this method needs to be called early in the lifecycle of the TableView, then UpdateTableView() method should be called explicitly (e.g. during Tizen::Ui::Control::OnInitializing()).
851 void GetItemIndexFromPosition(const Tizen::Graphics::FloatPoint& position, int& groupIndex, int& itemIndex) const;
854 * Sets the color of a division line between items.
858 * @return An error code
859 * @param[in] color The division line color
861 void SetItemDividerColor(const Tizen::Graphics::Color& color);
864 * Gets the color of a division line between items.
868 * @return The color of a division line
870 Tizen::Graphics::Color GetItemDividerColor(void) const;
873 * Sets the background color of this control.
877 * @param[in] color The background color
878 * @remarks The background bitmap has priority over the background color. When both the background bitmap and the background color are specified,
879 * only the bitmap image is displayed.
881 void SetBackgroundColor(const Tizen::Graphics::Color& color);
884 * Sets the scroll input handling mode.
888 * @param[in] mode The scroll input handling mode
889 * @see GetScrollInputMode()
891 void SetScrollInputMode(ScrollInputMode mode);
894 * Gets the scroll input handling mode.
898 * @return The scroll input handling mode
899 * @see SetScrollInputMode()
901 ScrollInputMode GetScrollInputMode(void) const;
904 * Gets the background color of this control.
908 * @return The background color
910 Tizen::Graphics::Color GetBackgroundColor(void) const;
913 * Scrolls the list contents by the specified number of pixels. When it is negative, it scrolls to opposite direction in current scroll style.
917 * @return An error code
918 * @param[in] pixel The amount of pixels to scroll
919 * @exception E_SUCCESS The method is successful.
920 * @exception E_OUT_OF_RANGE The specified @c pixel is out of range.
921 * @exception E_INVALID_OPERATION The current state of the instance prohibits the execution of the specified operation
922 * @remarks If you call ScrollByPixel() with negative @c pixel when position of scroll is already top of contents then it will return E_OUT_OF_RANGE.
923 * Likewise, in case of positive @c pixel on the bottom position of scroll it will also return E_OUT_OF_RANGE. @n
924 * This method does not work during the ITableViewItemProvider call-back procedure.
926 result ScrollByPixel(int pixel);
929 * Scrolls the list contents by the specified number of pixels. When it is negative, it scrolls to opposite direction in current scroll style.
933 * @return An error code
934 * @param[in] pixel The amount of pixels to scroll
935 * @exception E_SUCCESS The method is successful.
936 * @exception E_OUT_OF_RANGE The specified @c pixel is out of range.
937 * @exception E_INVALID_OPERATION The current state of the instance prohibits the execution of the specified operation
938 * @remarks If you call ScrollByPixel() with negative @c pixel when position of scroll is already top of contents then it will return E_OUT_OF_RANGE.
939 * Likewise, in case of positive @c pixel on the bottom position of scroll it will also return E_OUT_OF_RANGE. @n
940 * This method does not work during the ITableViewItemProvider call-back procedure.
942 result ScrollByPixel(float pixel);
945 * Gets the current scroll position
949 int GetCurrentScrollPosition(void) const;
952 * Gets the current scroll position
956 float GetCurrentScrollPositionF(void) const;
959 * Enables or disables the scroll of GroupedTableView items.
963 void SetScrollEnabled(bool enable);
966 * Checks whether the scroll is enabled or disabled.
970 bool IsScrollEnabled(void) const;
973 * Begins the reordering mode.
977 * @see IGroupedTableViewItemEventListener::OnGroupedTableViewItemReordered()
979 void BeginReorderingMode(void);
982 * Ends the reordering mode.
986 * @see IGroupedTableViewItemEventListener::OnGroupedTableViewItemReordered()
988 void EndReorderingMode(void);
991 * Checks whether the %GroupedTableView control is in reordering mode.
995 * @return @c true if the %GroupedTableView is in reordering mode, else @c false
997 bool IsInReorderingMode(void) const;
1000 * Opens the context item at the specified index.
1004 * @return An error code
1005 * @param[in] groupIndex The group index
1006 * @param[in] itemIndex The item index
1007 * @exception E_SUCCESS The method is successful.
1008 * @exception E_OUT_OF_RANGE A specified input parameter is invalid.
1009 * @exception E_INVALID_OPERATION The current state of the instance prohibits the execution of the specified operation.
1011 result OpenContextItem(int groupIndex, int itemIndex);
1014 * Closes the context item at the specified index.
1018 * @return An error code
1019 * @param[in] groupIndex The group index
1020 * @param[in] itemIndex The item index
1021 * @exception E_SUCCESS The method is successful.
1022 * @exception E_OUT_OF_RANGE A specified input parameter is invalid.
1023 * @exception E_INVALID_OPERATION The current state of the instance prohibits the execution of the specified operation.
1025 result CloseContextItem(int groupIndex, int itemIndex);
1028 * Returns whether the context item at the specified index is opened.
1032 * @return @c true if the context item is opened, else @c false
1033 * @param[in] groupIndex The group index
1034 * @param[in] itemIndex The item index
1035 * @exception E_SUCCESS The method is successful.
1036 * @exception E_OUT_OF_RANGE A specified input parameter is invalid.
1038 bool IsContextItemOpened(int groupIndex, int itemIndex) const;
1041 friend class _TableViewImpl;
1043 // The implementation of this copy constructor is intentionally blank and declared as private to prohibit copying of objects.
1044 GroupedTableView(const GroupedTableView& rhs);
1046 // The implementation of this copy assignment operator is intentionally blank and declared as private to prohibit copying of objects.
1047 GroupedTableView& operator =(const GroupedTableView& rhs);
1048 }; // GroupedTableView
1050 }}} // Tizen::Ui::Controls
1052 #endif // _FUI_CTRL_GROUPED_TABLE_VIEW_H_