2 // Open Service Platform
3 // Copyright (c) 2012-2013 Samsung Electronics Co., Ltd.
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
9 // http://www.apache.org/licenses/LICENSE-2.0/
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 * The following example demonstrates how to use the %GroupedTableView class.
54 //Sample code for GroupedTableViewSample.h
57 class GroupedTableViewSample
58 : public Tizen::Ui::Controls::Form
59 , public Tizen::Ui::Controls::IGroupedTableViewItemProvider
60 , public Tizen::Ui::Controls::IGroupedTableViewItemEventListener
61 , public Tizen::Ui::Controls::IFastScrollListener
64 GroupedTableViewSample(void)
65 : __pGroupedTableView(null)
66 , __pContextItem(null){}
68 bool Initialize(void);
69 virtual result OnInitializing(void);
70 virtual result OnTerminating(void);
72 // IGroupedTableViewItemEventListener
73 virtual void OnGroupedTableViewGroupItemStateChanged(Tizen::Ui::Controls::GroupedTableView& tableView, int groupIndex, Tizen::Ui::Controls::TableViewGroupItem* pItem, Tizen::Ui::Controls::TableViewItemStatus status);
74 virtual void OnGroupedTableViewItemStateChanged(Tizen::Ui::Controls::GroupedTableView& tableView, int groupIndex, int itemIndex, Tizen::Ui::Controls::TableViewItem* pItem, Tizen::Ui::Controls::TableViewItemStatus status);
75 virtual void OnGroupedTableViewContextItemActivationStateChanged(Tizen::Ui::Controls::GroupedTableView& tableView, int groupIndex, int itemIndex, Tizen::Ui::Controls::TableViewContextItem* pContextItem, bool activated);
77 // IGroupedTableViewItemProvider
78 virtual int GetGroupCount(void);
79 virtual int GetItemCount(int groupIndex);
80 virtual Tizen::Ui::Controls::TableViewGroupItem* CreateGroupItem(int groupIndex, int itemWidth);
81 virtual bool DeleteGroupItem(int groupIndex, Tizen::Ui::Controls::TableViewGroupItem* pItem);
82 virtual void UpdateGroupItem(int groupIndex, Tizen::Ui::Controls::TableViewGroupItem* pItem);
83 virtual Tizen::Ui::Controls::TableViewItem* CreateItem(int groupIndex, int itemIndex, int itemWidth);
84 virtual bool DeleteItem(int groupIndex, int itemIndex, Tizen::Ui::Controls::TableViewItem* pItem);
85 virtual void UpdateItem(int groupIndex, int itemIndex, Tizen::Ui::Controls::TableViewItem* pItem);
86 virtual int GetDefaultItemHeight(void);
87 virtual int GetDefaultGroupItemHeight(void);
89 // IFastScrollListener
90 virtual void OnFastScrollIndexSelected(Tizen::Ui::Control& source, Tizen::Base::String& index);
93 Tizen::Ui::Controls::GroupedTableView* __pGroupedTableView;
94 Tizen::Ui::Controls::TableViewContextItem* __pContextItem;
100 //Sample code for GroupedTableViewSample.cpp
102 #include <FGraphics.h>
104 #include "GroupedTableViewSample.h"
106 using namespace Tizen::App;
107 using namespace Tizen::Base;
108 using namespace Tizen::Graphics;
109 using namespace Tizen::Media;
110 using namespace Tizen::Ui::Controls;
113 GroupedTableViewSample::Initialize(void)
115 Construct(FORM_STYLE_NORMAL);
120 GroupedTableViewSample::OnInitializing(void)
122 result r = E_SUCCESS;
124 // Creates an instance of TableView
125 __pGroupedTableView = new GroupedTableView();
126 __pGroupedTableView->Construct(Rectangle(0, 0, GetClientAreaBounds().width, GetClientAreaBounds().height), true, TABLE_VIEW_SCROLL_BAR_STYLE_FAST_SCROLL);
127 __pGroupedTableView->SetItemProvider(this);
128 __pGroupedTableView->AddGroupedTableViewItemEventListener(*this);
130 __pGroupedTableView->AddFastScrollListener(*this);
131 __pGroupedTableView->SetFastScrollIndex(L"ABCDEFGHIJKLMNOPQRSTUVWXYZ", true);
133 // Adds the TableView to the form
134 AddControl(__pGroupedTableView);
136 // Creates an instance of TableViewContextItem
137 __pContextItem = new TableViewContextItem();
138 __pContextItem->Construct(Dimension(720, 100));
140 Button* pButton = new Button();
141 pButton->Construct(Rectangle(10, 10, 200, 80), L"Context1");
143 Button* pButton2 = new Button();
144 pButton2->Construct(Rectangle(250, 10, 200, 80), L"Context2");
146 __pContextItem->AddControl(pButton);
147 __pContextItem->AddControl(pButton2);
153 GroupedTableViewSample::OnTerminating(void)
155 result r = E_SUCCESS;
157 // Deallocates the item context
158 delete __pContextItem;
159 __pContextItem = null;
164 // IGroupedTableViewItemEventListener implementation
166 GroupedTableViewSample::OnGroupedTableViewGroupItemStateChanged(GroupedTableView& tableView, int groupIndex, TableViewGroupItem* pItem, TableViewItemStatus status)
168 if (tableView.IsGroupExpanded(groupIndex))
170 tableView.CollapseGroup(groupIndex);
174 tableView.ExpandGroup(groupIndex);
179 GroupedTableViewSample::OnGroupedTableViewItemStateChanged(GroupedTableView& tableView, int groupIndex, int itemIndex, TableViewItem* pItem, TableViewItemStatus status)
185 GroupedTableViewSample::OnGroupedTableViewContextItemActivationStateChanged(GroupedTableView& tableView, int groupIndex, int itemIndex, TableViewContextItem* pContextItem, bool activated)
190 // IFastScrollListener implementation
192 GroupedTableViewSample::OnFastScrollIndexSelected(Tizen::Ui::Control& source, Tizen::Base::String& index)
197 // IGroupedTableViewItemProvider implementation
199 GroupedTableViewSample::GetGroupCount(void)
205 GroupedTableViewSample::GetItemCount(int groupIndex)
211 GroupedTableViewSample::GetDefaultItemHeight(void)
217 GroupedTableViewSample::GetDefaultGroupItemHeight(void)
223 GroupedTableViewSample::CreateGroupItem(int groupIndex, int itemWidth)
225 TableViewGroupItem* pItem = new TableViewGroupItem();
226 pItem->Construct(Dimension(itemWidth, GetDefaultGroupItemHeight()));
229 text.Format(30, L"Group title %d", groupIndex);
231 Label* pLabel = new Label();
232 pLabel->Construct(Rectangle(0, 0, itemWidth, GetDefaultGroupItemHeight()), text);
234 pItem->AddControl(pLabel);
240 GroupedTableViewSample::DeleteGroupItem(int groupIndex, TableViewGroupItem* pItem)
248 GroupedTableViewSample::UpdateGroupItem(int groupIndex, TableViewGroupItem* pItem)
254 GroupedTableViewSample::CreateItem(int groupIndex, int itemIndex, int itemWidth)
256 TableViewAnnexStyle style = TABLE_VIEW_ANNEX_STYLE_NORMAL;
257 TableViewItem* pItem = new TableViewItem();
259 switch (itemIndex % 6)
262 style = TABLE_VIEW_ANNEX_STYLE_NORMAL;
265 style = TABLE_VIEW_ANNEX_STYLE_MARK;
268 style = TABLE_VIEW_ANNEX_STYLE_ONOFF_SLIDING;
271 style = TABLE_VIEW_ANNEX_STYLE_DETAILED;
274 style = TABLE_VIEW_ANNEX_STYLE_RADIO;
277 style = TABLE_VIEW_ANNEX_STYLE_ONOFF_SLIDING_WITH_DIVIDER;
283 pItem->Construct(Dimension(itemWidth, GetDefaultItemHeight()), style);
286 text.Format(30, L"TableViewItem %d", itemIndex);
288 Label* pLabel = new Label();
289 pLabel->Construct(Rectangle(0, 0, itemWidth, GetDefaultItemHeight()), text);
291 pItem->AddControl(pLabel);
292 pItem->SetContextItem(__pContextItem);
298 GroupedTableViewSample::DeleteItem(int groupIndex, int itemIndex, TableViewItem* pItem)
306 GroupedTableViewSample::UpdateItem(int groupIndex, int itemIndex, TableViewItem* pItem)
314 class _OSP_EXPORT_ GroupedTableView
315 : public Tizen::Ui::Container
319 * The object is not fully constructed after this constructor is called. @n
320 * For full construction, the %Construct() method must be called right after calling this constructor.
324 GroupedTableView(void);
327 * This destructor overrides Tizen::Base::Object::~Object().
331 virtual ~GroupedTableView(void);
334 * Initializes this instance of %GroupedTableView with the specified parameters.
338 * @return An error code
339 * @param[in] rect An instance of the Graphics::Rectangle class @n
340 * This instance represents the x and y coordinates of the left top corner of the created %GroupedTableView along with
341 * the width and height.@n
342 * The optimal size of the control is defined in
343 * <a href="../org.tizen.native.appprogramming/html/guide/ui/control_optimalsize.htm">Optimal Size of UI Controls</a>.
344 * @param[in] itemDivider Set to @c true to display an item divider, @n
346 * @param[in] scrollStyle The style of %GroupedTableView scroll bar style
347 * @exception E_SUCCESS The method is successful.
348 * @exception E_INVALID_ARG A specified input parameter is invalid, or either the rect.width or rect.height parameter has a negative value.
351 result Construct(const Tizen::Graphics::Rectangle& rect, bool itemDivider, TableViewScrollBarStyle scrollStyle);
354 * Initializes this instance of %GroupedTableView with the specified parameters.
358 * @return An error code
359 * @param[in] rect An instance of the Tizen::Graphics::FloatRectangle class @n
360 * This instance represents the x and y coordinates of the left top corner of the created %GroupedTableView along with
361 * the width and height.@n
362 * The optimal size of the control is defined in
363 * <a href="../org.tizen.native.appprogramming/html/guide/ui/control_optimalsize.htm">Optimal Size of UI Controls</a>.
364 * @param[in] itemDivider Set to @c true to display an item divider, @n
366 * @param[in] scrollStyle The style of %GroupedTableView scroll bar style
367 * @exception E_SUCCESS The method is successful.
368 * @exception E_INVALID_ARG A specified input parameter is invalid, or either the rect.width or rect.height parameter has a negative value.
371 result Construct(const Tizen::Graphics::FloatRectangle& rect, bool itemDivider, TableViewScrollBarStyle scrollStyle);
374 * Sets the item provider that creates and deletes items for the grouped style table view.
378 * @param[in] pProvider The item provider to create and delete items
380 * - If an item provider is not set for the table view, the table view does not work.
381 * - The specified provider should be allocated in heap memory.
382 * - To reset the item provider, pass @c null to @c pProvider.
384 void SetItemProvider(IGroupedTableViewItemProvider* pProvider);
387 * Sets the item provider that creates and deletes items for the grouped style table view.
391 * @param[in] pProvider The item provider to create and delete items
393 * - If an item provider is not set for the table view, the table view does not work.
394 * - The specified provider should be allocated in heap memory.
395 * - To reset the item provider, pass @c null to @c pProvider.
397 void SetItemProviderF(IGroupedTableViewItemProviderF* pProvider);
400 * Expands the group's items.
404 * @return An error code
405 * @param[in] groupIndex The index of the group
406 * @exception E_SUCCESS The method is successful.
407 * @exception E_OUT_OF_RANGE A specified input parameter is invalid.
408 * @exception E_INVALID_OPERATION The current state of the instance prohibits the execution of the specified operation @b Since: @b 2.1.
410 * - This method does not work during the ITableViewItemProvider call-back procedure.
411 * - This method should be called only after TableView items are created. If this method needs to be called early in the lifecycle of the
412 * TableView, then UpdateTableView() method should be called explicitly (for example, during Tizen::Ui::Control::OnInitializing()).
414 result ExpandGroup(int groupIndex);
417 * Collapses the group's items.
421 * @return An error code
422 * @param[in] groupIndex The index of the group
423 * @exception E_SUCCESS The method is successful.
424 * @exception E_OUT_OF_RANGE A specified input parameter is invalid.
425 * @exception E_INVALID_OPERATION The current state of the instance prohibits the execution of the specified operation @b Since: @b 2.1.
427 * - This method does not work during the ITableViewItemProvider call-back procedure.
428 * - This method should be called only after TableView items are created. If this method needs to be called early in the lifecycle of the
429 * TableView, then UpdateTableView() method should be called explicitly (for example, during Tizen::Ui::Control::OnInitializing()).
431 result CollapseGroup(int groupIndex);
434 * Expands all groups of table view.
438 * @return An error code
439 * @exception E_SUCCESS The method is successful.
440 * @exception E_INVALID_OPERATION The current state of the instance prohibits the execution of the specified operation @b Since: @b 2.1.
441 * @remarks This method does not work during the ITableViewItemProvider call-back procedure.
443 result ExpandAllGroups(void);
446 * Collapses all groups of table view.
450 * @return An error code
451 * @exception E_SUCCESS The method is successful.
452 * @exception E_INVALID_OPERATION The current state of the instance prohibits the execution of the specified operation @b Since: @b 2.1.
453 * @remarks This method does not work during the ITableViewItemProvider call-back procedure.
455 result CollapseAllGroups(void);
458 * Expands all groups of table view.
463 inline void ExpandAllGroup(void)
469 * Collapses all groups of table view.
474 inline void CollapseAllGroup(void)
480 * Returns whether the group is expanded or not.
484 * @return @c true if the group is expanded, @n
486 * @param[in] groupIndex The index of the group
487 * @exception E_SUCCESS The method is successful.
488 * @exception E_OUT_OF_RANGE A specified input parameter is invalid.
489 * @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
490 * TableView, then UpdateTableView() method should be called explicitly (for example, during Tizen::Ui::Control::OnInitializing()).
492 bool IsGroupExpanded(int groupIndex) const;
495 * Sets the grouped look is enabled.
499 * @param[in] enable The enabled/disabled status
501 void SetGroupedLookEnabled(bool enable);
504 * Returns whether the grouped look is enabled or not.
508 * @return @c true if the grouped look is enabled, @n
511 bool IsGroupedLookEnabled(void) const;
514 * Adds a listener instance that listens to state changes of table view items. @n
515 * The added listener can listen to events on the specified event dispatcher's context when they are fired.
519 * @return An error code
520 * @param[in] listener The event listener to add
521 * @exception E_SUCCESS The method is successful.
522 * @exception E_OBJ_ALREADY_EXIST The listener is already added.
523 * @remarks The specified listener should be allocated in heap memory.
525 result AddGroupedTableViewItemEventListener(IGroupedTableViewItemEventListener& listener);
528 * Removes a listener instance that listens to state changes of table view items. @n
529 * The removed listener cannot listen to events when they are fired.
533 * @return An error code
534 * @param[in] listener The event listener to remove
535 * @exception E_SUCCESS The method is successful.
536 * @exception E_OBJ_NOT_FOUND The listener is not found.
538 result RemoveGroupedTableViewItemEventListener(IGroupedTableViewItemEventListener& listener);
541 * Adds a listener instance that listens to state changes of a fast scroll. @n
542 * The added listener can listen to events on the specified event dispatcher's context when they are fired.
546 * @return An error code
547 * @param[in] listener The event listener to add
548 * @exception E_SUCCESS The method is successful.
549 * @exception E_INVALID_OPERATION The current state of the instance prohibits the execution of the specified operation.
550 * @exception E_OBJ_ALREADY_EXIST The listener is already added.
551 * @remarks The specified listener should be allocated in heap memory.
553 result AddFastScrollListener(IFastScrollListener& listener);
556 * Removes a listener instance that listens to state changes of a fast scroll. @n
557 * The removed listener cannot listen to events when they are fired.
561 * @return An error code
562 * @param[in] listener The event listener to remove
563 * @exception E_SUCCESS The method is successful.
564 * @exception E_INVALID_OPERATION The current state of the instance prohibits the execution of the specified operation.
565 * @exception E_OBJ_NOT_FOUND The listener is not found.
567 result RemoveFastScrollListener(IFastScrollListener& listener);
570 * Adds a listener instance that listens to state changes of a scroll event. @n
571 * The added listener can listen to events on the specified event dispatcher's context when they are fired.
575 * @return An error code
576 * @param[in] listener The event listener to add
577 * @exception E_SUCCESS The method is successful.
578 * @exception E_INVALID_OPERATION The current state of the instance prohibits the execution of the specified operation.
579 * @exception E_OBJ_ALREADY_EXIST The listener is already added.
580 * @remarks The specified listener should be allocated in heap memory.
581 * @see IScrollEventListener::OnScrollEndReached()
582 * @see RemoveScrollEventListener()
584 result AddScrollEventListener(IScrollEventListener& listener);
587 * Removes a listener instance that listens to state changes of a scroll event. @n
588 * The removed listener cannot listen to events when they are fired.
592 * @return An error code
593 * @param[in] listener The event listener to remove
594 * @exception E_SUCCESS The method is successful.
595 * @exception E_INVALID_OPERATION The current state of the instance prohibits the execution of the specified operation.
596 * @exception E_OBJ_NOT_FOUND The listener is not found.
597 * @see IScrollEventListener::OnScrollEndReached()
598 * @see AddScrollEventListener()
600 result RemoveScrollEventListener(IScrollEventListener& listener);
603 * Adds a listener instance that listens to state changes of a scroll event. @n
604 * The added listener can listen to events on the specified event dispatcher's context when they are fired.
608 * @return An error code
609 * @param[in] listener The event listener to add
610 * @exception E_SUCCESS The method is successful.
611 * @exception E_INVALID_OPERATION The current state of the instance prohibits the execution of the specified operation.
612 * @exception E_OBJ_ALREADY_EXIST The listener is already added.
613 * @remarks The specified listener should be allocated in heap memory.
614 * @see IScrollEventListenerF::OnScrollEndReached()
615 * @see RemoveScrollEventListenerF()
617 result AddScrollEventListener(IScrollEventListenerF& listener);
620 * Removes a listener instance that listens to state changes of a scroll event. @n
621 * The removed listener cannot listen to events when they are fired.
625 * @return An error code
626 * @param[in] listener The event listener to remove
627 * @exception E_SUCCESS The method is successful.
628 * @exception E_INVALID_OPERATION The current state of the instance prohibits the execution of the specified operation.
629 * @exception E_OBJ_NOT_FOUND The listener is not found.
630 * @see IScrollEventListenerF::OnScrollEndReached()
631 * @see AddScrollEventListenerF()
633 result RemoveScrollEventListener(IScrollEventListenerF& listener);
636 * Enables or disables the collapse by pinch gesture.
640 * @param[in] enable Set to @c true to enable the collapse by pinch gesture, else @c false
642 void SetCollapseByPinchGestureEnabled(bool enable);
645 * Returns whether the collapse by pinch gesture is enabled or not.
649 * @return @c true if the collapse by pinch gesture is enabled, @n
652 bool IsCollapseByPinchGestureEnabled(void) const;
655 * Sets the text index of the fast scroll.
659 * @return An error code
660 * @param[in] text The text of the index
661 * @param[in] useSearchIcon Set to @c true to show the magnifying icon, @n
663 * @exception E_SUCCESS The method is successful.
664 * @exception E_INVALID_OPERATION The current state of the instance prohibits the execution of the specified operation.
666 result SetFastScrollIndex(const Tizen::Base::String& text, bool useSearchIcon);
669 * Gets the group and item indexes of the top item.
673 * @return An error code
674 * @param[out] groupIndex The group index
675 * @param[out] itemIndex The item index
676 * @exception E_SUCCESS The method is successful.
677 * @exception E_OBJ_NOT_FOUND Top drawn item is not found.
679 result GetTopDrawnItemIndex(int& groupIndex, int& itemIndex) const;
682 * Gets the group and item indexes of the bottom item.
686 * @return An error code
687 * @param[out] groupIndex The group index
688 * @param[out] itemIndex The item index
689 * @exception E_SUCCESS The method is successful.
690 * @exception E_OBJ_NOT_FOUND Bottom drawn item is not found.
692 result GetBottomDrawnItemIndex(int& groupIndex, int& itemIndex) const;
695 * Scrolls to the item at the specified index.
696 * The specified item is drawn at the position specified by the item alignment.
700 * @return An error code
701 * @param[in] groupIndex The group index
702 * @param[in] itemIndex The item index
703 * @param[in] itemAlignment The item alignment
704 * @exception E_SUCCESS The method is successful.
705 * @exception E_OUT_OF_RANGE A specified input parameter is invalid.
706 * @exception E_INVALID_OPERATION The current state of the instance prohibits the execution of the specified operation @b Since: @b 2.1.
708 * - If the specified item. itemIndex is @c -1, then the method is applied to the group item with the given index.
709 * This method does not work during the ITableViewItemProvider call-back procedure.
710 * - This method should be called only after TableView items are created. If this method needs to be called early in the lifecycle of the
711 * TableView, then UpdateTableView() method should be called explicitly (for example, during Tizen::Ui::Control::OnInitializing()).
713 result ScrollToItem(int groupIndex, int itemIndex, TableViewScrollItemAlignment itemAlignment = TABLE_VIEW_SCROLL_ITEM_ALIGNMENT_TOP);
716 * Checks or unchecks the item at the specified index.
720 * @return An error code
721 * @param[in] groupIndex The group index
722 * @param[in] itemIndex The item index
723 * @param[in] check Set to @c true to select the item, @n
725 * @exception E_SUCCESS The method is successful.
726 * @exception E_OUT_OF_RANGE A specified input parameter is invalid.
727 * @exception E_INVALID_OPERATION The item is disabled or the current state of the instance prohibits the execution of the specified operation.
729 * - This method works only when the annex style of the item allows selection.
730 * This method does not work during the ITableViewItemProvider call-back procedure.
731 * - This method should be called only after TableView items are created. If this method needs to be called early in the lifecycle of the
732 * TableView, then UpdateTableView() method should be called explicitly (for example, during Tizen::Ui::Control::OnInitializing()).
734 result SetItemChecked(int groupIndex, int itemIndex, bool check);
737 * Returns whether the item at the specified index is selected or not.
741 * @return @c true if the item is selected, @n
743 * @param[in] groupIndex The group index
744 * @param[in] itemIndex The item index
745 * @exception E_SUCCESS The method is successful.
746 * @exception E_OUT_OF_RANGE A specified input parameter is invalid.
748 * - This method returns @c false, if the annex style of the item does not allow selection.
749 * - This method should be called only after TableView items are created. If this method needs to be called early in the lifecycle of the
750 * TableView, then UpdateTableView() method should be called explicitly (for example, during Tizen::Ui::Control::OnInitializing()).
752 bool IsItemChecked(int groupIndex, int itemIndex) const;
755 * Enables or disables the item at the specified index.
759 * @return An error code
760 * @param[in] groupIndex The group index
761 * @param[in] itemIndex The item index
762 * @param[in] enable Set to @c true to enable the specified item, @n
764 * @exception E_SUCCESS The method is successful.
765 * @exception E_OUT_OF_RANGE A specified input parameter is invalid.
766 * @exception E_INVALID_OPERATION The current state of the instance prohibits the execution of the specified operation @b Since: @b 2.1.
768 * - This method does not work during the ITableViewItemProvider call-back procedure.
769 * - This method should be called only after TableView items are created. If this method needs to be called early in the lifecycle of the
770 * TableView, then UpdateTableView() method should be called explicitly (for example, during Tizen::Ui::Control::OnInitializing()).
772 result SetItemEnabled(int groupIndex, int itemIndex, bool enable);
775 * Returns whether the item at the specified index is enabled or disabled.
779 * @return @c true if the item is enabled, @n
781 * @param[in] groupIndex The group index
782 * @param[in] itemIndex The item index
783 * @exception E_SUCCESS The method is successful.
784 * @exception E_OUT_OF_RANGE A specified input parameter is invalid.
785 * @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
786 * TableView, then UpdateTableView() method should be called explicitly (for example, during Tizen::Ui::Control::OnInitializing()).
788 bool IsItemEnabled(int groupIndex, int itemIndex) const;
791 * Counts the total number of groups.
795 * @return The total number of groups
797 int GetGroupCount(void) const;
800 * Counts all the items of the specified group.
804 * @return The total number of items in the specified group
805 * @param[in] groupIndex The group index
806 * @exception E_SUCCESS The method is successful.
807 * @exception E_OUT_OF_RANGE A specified input parameter is invalid.
809 int GetItemCountAt(int groupIndex) const;
812 * Updates the specified item. @n
813 * For instance, @c TABLE_VIEW_REFRESH_TYPE_ITEM_ADD is used when a new item needs to be added and
814 * @c TABLE_VIEW_REFRESH_TYPE_ITEM_REMOVE is used when an item is deleted from the
815 * table view. Moreover, @c TABLE_VIEW_REFRESH_TYPE_ITEM_MODIFY is used when the content of an existing item has changed and it needs to
817 * Note that calling the %RefreshAllItems() method with @c TABLE_VIEW_REFRESH_TYPE_ITEM_MODIFY invokes
818 * IGroupedTableViewItemProvider::UpdateItem() or IGroupedTableViewItemProviderF::UpdateItem() for the given index in sequence.
822 * @return An error code
823 * @param[in] groupIndex The group index
824 * @param[in] itemIndex The item index
825 * @param[in] type The item to add, remove, or modify
826 * @exception E_SUCCESS The method is successful.
827 * @exception E_OUT_OF_RANGE A specified input parameter is invalid.
828 * @exception E_INVALID_OPERATION The current state of the instance prohibits the execution of the specified operation @b Since: @b 2.1.
830 * - If the specified @c itemIndex is @c -1, then the method is applied to the group item with the given index.
831 * - Note that if @c TABLE_VIEW_REFRESH_TYPE_ITEM_REMOVE option is used to a group item, all the items in the
832 * group (including the group item itself) are removed from the table view.
833 * - This method does not work during the ITableViewItemProvider call-back procedure.
835 result RefreshItem(int groupIndex, int itemIndex, TableViewRefreshType type);
838 * Updates all items of the table view. @n
839 * Note that calling the %RefreshAllItems() method invokes IGroupedTableViewItemProvider::UpdateItem() or
840 * IGroupedTableViewItemProviderF::UpdateItem() for all loaded items.
844 * @return An error code
845 * @exception E_SUCCESS The method is successful.
846 * @exception E_INVALID_OPERATION The %GroupedTableView item provider is processing another request.
848 result RefreshAllItems(void);
851 * Updates all the items of a table view. @n
852 * This method deletes all the items in the table view and invokes the methods of the item provider again to update the table view.
856 * @exception E_SUCCESS The method is successful.
857 * @exception E_INVALID_OPERATION The current state of the instance prohibits the execution of the specified operation @b Since: @b 2.1.
859 * - This method will delete all the items and recreate them, so it should not be called from the inside of
860 * OnGroupedTableViewItemStateChanged() call-back as this leads to self deletion. If you need to update an Item, you should use RefreshItem() method.
861 * - This method should not be called from IGroupedTableViewItemProvider implementation because of recursion.
862 * - The specific error code can be accessed using the GetLastResult() method.
864 void UpdateTableView(void);
867 * Gets the index of the item at the specified position.
871 * @param[in] position The position of the item
872 * @param[out] groupIndex The group index of the item on specified position
873 * @param[out] itemIndex The item index of the item on specified position
875 * - This method sets both of groupIndex and itemIndex to @c -1 if no item is found at the given position.
876 * - This method should be called only after TableView items are created. If this method needs to be called early in the lifecycle of the
877 * TableView, then UpdateTableView() method should be called explicitly (for example, during Tizen::Ui::Control::OnInitializing()).
879 void GetItemIndexFromPosition(const Tizen::Graphics::Point& position, int& groupIndex, int& itemIndex) const;
882 * Gets the index of the item at the specified position.
886 * @param[in] position The position of the item
887 * @param[out] groupIndex The group index of the item on specified position
888 * @param[out] itemIndex The item index of the item on specified position
890 * - This method sets both of groupIndex and itemIndex to @c -1 if no item is found at the given position.
891 * - This method should be called only after TableView items are created. @n
892 * If this method needs to be called early in the lifecycle of the TableView, then UpdateTableView() method should be called
893 * explicitly (for example, during Tizen::Ui::Control::OnInitializing()).
895 void GetItemIndexFromPosition(const Tizen::Graphics::FloatPoint& position, int& groupIndex, int& itemIndex) const;
898 * Sets the color of a division line between items.
902 * @return An error code
903 * @param[in] color The division line color
905 void SetItemDividerColor(const Tizen::Graphics::Color& color);
908 * Gets the color of a division line between items.
912 * @return The color of a division line
914 Tizen::Graphics::Color GetItemDividerColor(void) const;
917 * Sets the background color of this control.
921 * @param[in] color The background color
922 * @remarks The background bitmap has priority over the background color. When both the background bitmap and the background color are specified,
923 * only the bitmap image is displayed.
925 void SetBackgroundColor(const Tizen::Graphics::Color& color);
928 * Sets the scroll input handling mode.
932 * @param[in] mode The scroll input handling mode
933 * @see GetScrollInputMode()
935 void SetScrollInputMode(ScrollInputMode mode);
938 * Gets the scroll input handling mode.
942 * @return The scroll input handling mode
943 * @see SetScrollInputMode()
945 ScrollInputMode GetScrollInputMode(void) const;
948 * Gets the background color of this control.
952 * @return The background color
954 Tizen::Graphics::Color GetBackgroundColor(void) const;
957 * Scrolls the list contents by a specified number of pixels. @n
958 * If the specified number is negative, it scrolls in the opposite direction in current scroll style.
962 * @return An error code
963 * @param[in] pixel The amount of pixels to scroll
964 * @exception E_SUCCESS The method is successful.
965 * @exception E_OUT_OF_RANGE The specified @c pixel is out of range.
966 * @exception E_INVALID_OPERATION The current state of the instance prohibits the execution of the specified operation
968 * - If you call ScrollByPixel() with negative @c pixel when position of scroll is already top of contents then it
969 * will return @c E_OUT_OF_RANGE. @n
970 * Likewise, in case of positive @c pixel on the bottom position of scroll it will also return @c E_OUT_OF_RANGE.
971 * - This method does not work during the ITableViewItemProvider call-back procedure.
973 result ScrollByPixel(int pixel);
976 * Scrolls the list contents by a specified number of pixels. @n
977 * If the specified number is negative, it scrolls in the opposite direction in current scroll style.
981 * @return An error code
982 * @param[in] pixel The amount of pixels to scroll
983 * @exception E_SUCCESS The method is successful.
984 * @exception E_OUT_OF_RANGE The specified @c pixel is out of range.
985 * @exception E_INVALID_OPERATION The current state of the instance prohibits the execution of the specified operation
987 * - If you call ScrollByPixel() with negative @c pixel when position of scroll is already top of contents then
988 * it will return @c E_OUT_OF_RANGE. @n
989 * Likewise, in case of positive @c pixel on the bottom position of scroll it will also return @c E_OUT_OF_RANGE.
990 * - This method does not work during the ITableViewItemProvider call-back procedure.
992 result ScrollByPixel(float pixel);
995 * Gets the current scroll position
999 int GetCurrentScrollPosition(void) const;
1002 * Gets the current scroll position
1006 float GetCurrentScrollPositionF(void) const;
1009 * Enables or disables the scroll of GroupedTableView items.
1013 void SetScrollEnabled(bool enable);
1016 * Checks whether the scroll is enabled or disabled.
1020 bool IsScrollEnabled(void) const;
1023 * Begins the reordering mode.
1027 * @see IGroupedTableViewItemEventListener::OnGroupedTableViewItemReordered()
1029 void BeginReorderingMode(void);
1032 * Ends the reordering mode.
1036 * @see IGroupedTableViewItemEventListener::OnGroupedTableViewItemReordered()
1038 void EndReorderingMode(void);
1041 * Checks whether the %GroupedTableView control is in reordering mode.
1045 * @return @c true if the %GroupedTableView is in reordering mode, @n
1048 bool IsInReorderingMode(void) const;
1051 * Opens the context item at a specified index.
1055 * @return An error code
1056 * @param[in] groupIndex The group index
1057 * @param[in] itemIndex The item index
1058 * @exception E_SUCCESS The method is successful.
1059 * @exception E_OUT_OF_RANGE A specified input parameter is invalid.
1060 * @exception E_INVALID_OPERATION The current state of the instance prohibits the execution of the specified operation.
1062 result OpenContextItem(int groupIndex, int itemIndex);
1065 * Closes the context item at a specified index.
1069 * @return An error code
1070 * @param[in] groupIndex The group index
1071 * @param[in] itemIndex The item index
1072 * @exception E_SUCCESS The method is successful.
1073 * @exception E_OUT_OF_RANGE A specified input parameter is invalid.
1074 * @exception E_INVALID_OPERATION The current state of the instance prohibits the execution of the specified operation.
1076 result CloseContextItem(int groupIndex, int itemIndex);
1079 * Checks whether the context item at a specified index has been opened or not.
1083 * @return @c true if the context item has been opened, @n
1085 * @param[in] groupIndex The group index
1086 * @param[in] itemIndex The item index
1087 * @exception E_SUCCESS The method is successful.
1088 * @exception E_OUT_OF_RANGE A specified input parameter is invalid.
1090 bool IsContextItemOpened(int groupIndex, int itemIndex) const;
1093 friend class _TableViewImpl;
1095 // The implementation of this copy constructor is intentionally blank and declared as private to prohibit copying of objects.
1096 GroupedTableView(const GroupedTableView& rhs);
1098 // The implementation of this copy assignment operator is intentionally blank and declared as private to prohibit copying of objects.
1099 GroupedTableView& operator =(const GroupedTableView& rhs);
1100 }; // GroupedTableView
1102 }}} // Tizen::Ui::Controls
1104 #endif // _FUI_CTRL_GROUPED_TABLE_VIEW_H_