show OverlayRegion when FormActivated
[platform/framework/native/uifw.git] / inc / FUiCtrlTableView.h
index 17dd149..023eec0 100644 (file)
@@ -2,14 +2,14 @@
 // Open Service Platform
 // Copyright (c) 2012-2013 Samsung Electronics Co., Ltd.
 //
-// Licensed under the Flora License, Version 1.0 (the License);
+// Licensed under the Apache License, Version 2.0 (the License);
 // you may not use this file except in compliance with the License.
 // You may obtain a copy of the License at
 //
-//     http://floralicense.org/license/
+//     http://www.apache.org/licenses/LICENSE-2.0/
 //
 // Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an AS IS BASIS,
+// distributed under the License is distributed on an "AS IS" BASIS,
 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 // See the License for the specific language governing permissions and
 // limitations under the License.
@@ -47,6 +47,9 @@ class IScrollEventListenerF;
  * @since 2.0
  *
  * The %TableView class defines common behavior for a %TableView control.
+ *
+ * The following example demonstrates how to use the %TableView class.
+ *
  * @code
 //Sample code for TableViewSample.h
 #include <FUi.h>
@@ -112,10 +115,10 @@ TableViewSample::OnInitializing(void)
        __pTableView = new TableView();
        __pTableView->Construct(Rectangle(0, 0, GetClientAreaBounds().width, GetClientAreaBounds().height), true, TABLE_VIEW_SCROLL_BAR_STYLE_FADE_OUT);
        __pTableView->SetItemProvider(*this);
-       __pTableView->AddTableViewItemEventListener(*this);
+       __pTableView->AddTableViewItemEventListener(this);
 
        // Adds the TableView to the form
-       AddControl(*__pTableView);
+       AddControl(__pTableView);
 
        // Creates an instance of TableViewContextItem
        __pContextItem = new TableViewContextItem();
@@ -127,8 +130,8 @@ TableViewSample::OnInitializing(void)
        Button* pButton2 = new Button();
        pButton2->Construct(Rectangle(250, 10, 200, 80), L"Context2");
 
-       __pContextItem->AddControl(*pButton);
-       __pContextItem->AddControl(*pButton2);
+       __pContextItem->AddControl(pButton);
+       __pContextItem->AddControl(pButton2);
 
        return r;
 }
@@ -139,8 +142,8 @@ TableViewSample::OnTerminating(void)
        result r = E_SUCCESS;
 
        // Deallocates the item context
-       delete __pItemContext;
-       __pItemContext = null;
+       delete __pContextItem;
+       __pContextItem = null;
 
        return r;
 }
@@ -213,9 +216,9 @@ TableViewSample::CreateItem(int itemIndex, int itemWidth)
        text.Format(30, L"TableViewItem %d", itemIndex);
 
        Label* pLabel = new Label();
-       pLabel->Construct(Rectangle(0, 0, itemWidth, GetDefaultItemHeight(), text);
+       pLabel->Construct(Rectangle(0, 0, itemWidth, GetDefaultItemHeight()), text);
 
-       pItem->AddControl(*pLabel);
+       pItem->AddControl(pLabel);
        pItem->SetContextItem(__pContextItem);
 
        return pItem;
@@ -224,7 +227,7 @@ TableViewSample::CreateItem(int itemIndex, int itemWidth)
 bool
 TableViewSample::DeleteItem(int itemIndex, Tizen::Ui::Controls::TableViewItem* pItem)
 {
-       delete pItem;
+       pItem->Destroy();
 
        return true;
 }
@@ -243,7 +246,8 @@ class _OSP_EXPORT_ TableView
 {
 public:
        /**
-       * The object is not fully constructed after this constructor is called. Hence, the Construct() method must be called after calling this constructor.
+       * The object is not fully constructed after this constructor is called. @n
+       * For full construction, the %Construct() method must be called right after calling this constructor.
        *
        * @since 2.0
        */
@@ -279,13 +283,13 @@ public:
        * @since 2.1
        *
        * @return  An error code
-       * @param[in] rect    An instance of the Graphics::FloatRectangle class
+       * @param[in] rect    An instance of the Tizen::Graphics::FloatRectangle class @n
        *                              This instance represents the x and y coordinates of the left top corner of the created %TableView along with the width and height.
        * @param[in] itemDivider       Set to @c true to display an item divider, @n
        *                              else @c false
        * @param[in] scrollStyle       The style of %TableView scroll bar style
        * @exception E_SUCCESS         The method is successful.
-       * @exception E_INVALID_ARG     A specified input parameter is invalid, or either the rect.width or rect.height parameter has a negative value.
+       * @exception E_INVALID_ARG     A specified input parameter is invalid, or either the @c rect.width or @c rect.height parameter has a negative value.
        *
        */
        result Construct(const Tizen::Graphics::FloatRectangle& rect, bool itemDivider, TableViewScrollBarStyle scrollStyle);
@@ -296,8 +300,10 @@ public:
        * @since 2.0
        *
        * @param[in] pProvider          The item provider to create and delete items
-       * @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.
-       *          To reset the item provider, pass @c null to @c pProvider.
+       * @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.
+       *                               - To reset the item provider, pass @c null to @c pProvider.
        */
        void SetItemProvider(ITableViewItemProvider* pProvider);
 
@@ -307,8 +313,10 @@ public:
        * @since 2.1
        *
        * @param[in] pProvider          The item provider to create and delete items
-       * @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.
-       *          To reset the item provider, pass @c null to @c pProvider.
+       * @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.
+       *                               - To reset the item provider, pass @c null to @c pProvider.
        */
        void SetItemProviderF(ITableViewItemProviderF* pProvider);
 
@@ -404,12 +412,12 @@ public:
        *
        * @return        An error code
        * @param[in] listener                          The event listener to add
-       * @see                  IScrollEventListener::OnScrollEndReached()
-       * @see                  RemoveScrollEventListener()
        * @exception    E_SUCCESS                             The method is successful.
        * @exception    E_INVALID_OPERATION The current state of the instance prohibits the execution of the specified operation.
        * @exception    E_OBJ_ALREADY_EXIST The listener is already added.
        * @remarks   The specified listener should be allocated in heap memory.
+       * @see                  IScrollEventListener::OnScrollEndReached()
+       * @see                  RemoveScrollEventListener()
        */
        result AddScrollEventListener(IScrollEventListener& listener);
 
@@ -421,11 +429,11 @@ public:
        *
        * @return        An error code
        * @param[in] listener     The event listener to remove
-       * @see  IScrollEventListener::OnScrollEndReached()
-       * @see           AddScrollEventListener()
        * @exception    E_SUCCESS                             The method is successful.
        * @exception    E_INVALID_OPERATION The current state of the instance prohibits the execution of the specified operation.
        * @exception    E_OBJ_NOT_FOUND        The listener is not found.
+       * @see  IScrollEventListener::OnScrollEndReached()
+       * @see           AddScrollEventListener()
        */
        result RemoveScrollEventListener(IScrollEventListener& listener);
 
@@ -437,12 +445,12 @@ public:
        *
        * @return        An error code
        * @param[in] listener                          The event listener to add
-       * @see                  IScrollEventListenerF::OnScrollEndReached()
-       * @see                  RemoveScrollEventListenerF()
        * @exception    E_SUCCESS                             The method is successful.
        * @exception    E_INVALID_OPERATION The current state of the instance prohibits the execution of the specified operation.
        * @exception    E_OBJ_ALREADY_EXIST The listener is already added.
        * @remarks   The specified listener should be allocated in heap memory.
+       * @see                  IScrollEventListenerF::OnScrollEndReached()
+       * @see                  RemoveScrollEventListenerF()
        */
        result AddScrollEventListener(IScrollEventListenerF& listener);
 
@@ -454,11 +462,11 @@ public:
        *
        * @return        An error code
        * @param[in] listener     The event listener to remove
-       * @see  IScrollEventListenerF::OnScrollEndReached()
-       * @see           AddScrollEventListenerF()
        * @exception    E_SUCCESS                             The method is successful.
        * @exception    E_INVALID_OPERATION The current state of the instance prohibits the execution of the specified operation.
        * @exception    E_OBJ_NOT_FOUND        The listener is not found.
+       * @see  IScrollEventListenerF::OnScrollEndReached()
+       * @see           AddScrollEventListenerF()
        */
        result RemoveScrollEventListener(IScrollEventListenerF& listener);
 
@@ -510,9 +518,11 @@ public:
        * @param[in] itemAlignment         The item alignment
        * @exception E_SUCCESS             The method is successful.
        * @exception E_OUT_OF_RANGE        A specified input parameter is invalid.
-       * @exception E_INVALID_OPERATION The current state of the instance prohibits the execution of the specified operation @b Since: @b 2.1.
-       * @remarks This method does not work inside the ITableViewItemProvider callback.
-       * @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()).
+       * @exception E_INVALID_OPERATION The current state of the instance prohibits the execution of the specified operation. @b Since: @b 2.1
+       * @remarks
+       *                       - This method does not work inside the ITableViewItemProvider callback.
+       *                       - 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 (for example, during Tizen::Ui::Control::OnInitializing()).
        */
        result ScrollToItem(int itemIndex, TableViewScrollItemAlignment itemAlignment = TABLE_VIEW_SCROLL_ITEM_ALIGNMENT_TOP);
 
@@ -528,9 +538,11 @@ public:
        * @exception E_SUCCESS   The method is successful.
        * @exception E_OUT_OF_RANGE            A specified input parameter is invalid.
        * @exception E_INVALID_OPERATION      The item is disabled or the current state of the instance prohibits the execution of the specified operation.
-       * @remarks This method works only when the annex style of the item allows selection. @n
-       * This method does not work during the ITableViewItemProvider call-back procedure.
-       * @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()).
+       * @remarks
+       *                       - This method works only when the annex style of the item allows selection.
+       *                       - This method does not work during the ITableViewItemProvider call-back procedure.
+       *                       - 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 (for example, during Tizen::Ui::Control::OnInitializing()).
        */
        result SetItemChecked(int itemIndex, bool check);
 
@@ -544,8 +556,10 @@ public:
        * @param[in] itemIndex  The item itemIndex
        * @exception E_SUCCESS                                The method is successful.
        * @exception E_OUT_OF_RANGE  A specified input parameter is invalid.
-       * @remarks This method returns @c false, if the annex style of the item does not allow selection.
-       * @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()).
+       * @remarks
+       *                       - This method returns @c false, if the annex style of the item does not allow selection.
+       *                       - 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 (for example, during Tizen::Ui::Control::OnInitializing()).
        */
        bool IsItemChecked(int itemIndex) const;
 
@@ -560,9 +574,11 @@ public:
        *         else @c false
        * @exception E_SUCCESS   The method is successful.
        * @exception E_OUT_OF_RANGE  A specified input parameter is invalid.
-       * @exception E_INVALID_OPERATION The current state of the instance prohibits the execution of the specified operation @b Since: @b 2.1.
-       * @remarks This method does not work during the ITableViewItemProvider call-back procedure.
-       * @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()).
+       * @exception E_INVALID_OPERATION The current state of the instance prohibits the execution of the specified operation. @b Since: @b 2.1
+       * @remarks
+       *                       - This method does not work during the ITableViewItemProvider call-back procedure.
+       *                       - 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 (for example, during Tizen::Ui::Control::OnInitializing()).
        */
        result SetItemEnabled(int itemIndex, bool enable);
 
@@ -576,7 +592,10 @@ public:
        * @param[in] itemIndex  The item index
        * @exception E_SUCCESS                                The method is successful.
        * @exception E_OUT_OF_RANGE  A specified input parameter is invalid.
-       * @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()).
+       * @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 (for example, during Tizen::Ui::Control::OnInitializing()).
        */
        bool IsItemEnabled(int itemIndex) const;
 
@@ -591,9 +610,12 @@ public:
 
        /**
        * Updates the specified item. @n
-       * 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
-       * 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.
-       * Note that calling this method with TABLE_VIEW_REFRESH_TYPE_ITEM_MODIFY invokes item provider's UpdateItem() for the given index in sequence.
+       * For instance, @c TABLE_VIEW_REFRESH_TYPE_ITEM_ADD is used when a new item needs to be added and
+       * @c TABLE_VIEW_REFRESH_TYPE_ITEM_REMOVE is used when an item is deleted from the
+       * table view. Moreover, @c TABLE_VIEW_REFRESH_TYPE_ITEM_MODIFY is used when the content of an existing item has changed and it
+       * needs to be updated. @n
+       * Note that calling the %RefreshAllItems() method with @c TABLE_VIEW_REFRESH_TYPE_ITEM_MODIFY invokes
+       * ITableViewItemProvider::UpdateItem() or ITableViewItemProviderF::UpdateItem() for the given index in sequence.
        *
        * @since 2.0
        *
@@ -602,15 +624,14 @@ public:
        * @param[in] type                The item to add, remove, or modify
        * @exception E_SUCCESS   The method is successful.
        * @exception E_OUT_OF_RANGE  A specified input parameter is invalid.
-       * @exception E_INVALID_OPERATION The current state of the instance prohibits the execution of the specified operation @b Since: @b 2.1.
-       * @remarks If the specified itemIndex. @n
-       * This method does not work during the ITableViewItemProvider call-back procedure.
+       * @exception E_INVALID_OPERATION The current state of the instance prohibits the execution of the specified operation. @b Since: @b 2.1
+       * @remarks      This method does not work during the ITableViewItemProvider call-back procedure.
        */
        result RefreshItem(int itemIndex, TableViewRefreshType type);
 
        /**
        * Updates all items of the table view. @n
-       * Note that calling this method invokes its item provider's UpdateItem() for all loaded items.
+       * Note that calling the %RefreshAllItems() method invokes ITableViewItemProvider::UpdateItem() or ITableViewItemProviderF::UpdateItem() for all loaded items.
        *
        * @since 2.1
        *
@@ -621,15 +642,18 @@ public:
        result RefreshAllItems(void);
 
        /**
-       * Updates all the items of a table view.
+       * Updates all the items of a table view. @n
+       * This method deletes all the items in the table view and invokes the methods of the item provider again to update the table view.
        *
        * @since 2.0
        *
-       * @excpetion E_SUCCESS The method is successful.
-       * @exception E_INVALID_OPERATION The current state of the instance prohibits the execution of the specified operation @b Since: @b 2.1.
-       * @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
-       * This method does not work during the ITableViewItemProvider call-back procedure.
-       * @remarks The specific error code can be accessed using the GetLastResult() method.
+       * @exception E_SUCCESS The method is successful.
+       * @exception E_INVALID_OPERATION The current state of the instance prohibits the execution of the specified operation. @b Since: @b 2.1
+       * @remarks
+       *                       - This method will delete all the items and recreate them, so it should not be called from the inside of
+       *                       OnTableViewItemStateChanged() call-back as this leads to self deletion. If you need to update an Item, you should use RefreshItem() method.
+       *                       - This method should not be called from ITableViewItemProvider implementation because of recursion.
+       *                       - The specific error code can be accessed using the GetLastResult() method.
        */
        void UpdateTableView(void);
 
@@ -640,8 +664,11 @@ public:
        *
        * @return  The item index of the item on specified position
        * @param[in] position   The position of the item
-       * @remarks This method returns -1 if no item is found at the given position.
-       * @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()).
+       * @remarks
+       *                               - This method returns @c -1 if no item is found at the given position.
+       *                               - 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 (for example, during Tizen::Ui::Control::OnInitializing()).
        */
        int GetItemIndexFromPosition(const Tizen::Graphics::Point& position) const;
 
@@ -652,8 +679,11 @@ public:
        *
        * @return  The item index of the item on specified position
        * @param[in] position   The position of the item
-       * @remarks This method returns -1 if no item is found at the given position.
-       * @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()).
+       * @remarks
+       *                               - This method returns @c -1 if no item is found at the given position.
+       *                               - 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 (for example, during Tizen::Ui::Control::OnInitializing()).
        */
        int GetItemIndexFromPosition(const Tizen::Graphics::FloatPoint& position) const;
 
@@ -718,7 +748,7 @@ public:
        ScrollInputMode GetScrollInputMode(void) const;
 
        /**
-       * Scrolls the list contents by the specified number of pixels. When it is negative, it scrolls to opposite direction in current scroll style.
+       * Scrolls the list contents by a specified number of pixels. @n When it is negative, it scrolls to opposite direction in current scroll style.
        *
        * @since 2.1
        *
@@ -726,15 +756,17 @@ public:
        * @param[in]   pixel                                            The amount of pixels to scroll
        * @exception   E_SUCCESS                                The method is successful.
        * @exception   E_OUT_OF_RANGE           The specified @c pixel is out of range.
-       * @exception E_INVALID_OPERATION The current state of the instance prohibits the execution of the specified operation
-       * @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.
-       * Likewise, in case of positive @c pixel on the bottom position of scroll it will also return E_OUT_OF_RANGE. @n
-       * This method does not work during the ITableViewItemProvider call-back procedure.
+       * @exception E_INVALID_OPERATION The current state of the instance prohibits the execution of the specified operation.
+       * @remarks
+       *                               - If you call this method with negative @c pixel when position of scroll is already top of contents then
+       *                               it will return @c E_OUT_OF_RANGE. @n
+       *                               Likewise, in case of positive @c pixel on the bottom position of scroll it will also return @c E_OUT_OF_RANGE.
+       *                               - This method does not work during the ITableViewItemProvider call-back procedure.
        */
        result ScrollByPixel(int pixel);
 
        /**
-       * Scrolls the list contents by the specified number of pixels. When it is negative, it scrolls to opposite direction in current scroll style.
+       * Scrolls the list contents by a specified number of pixels. @n When it is negative, it scrolls to opposite direction in current scroll style.
        *
        * @since 2.1
        *
@@ -742,29 +774,31 @@ public:
        * @param[in]   pixel                                            The amount of pixels to scroll
        * @exception   E_SUCCESS                                The method is successful.
        * @exception   E_OUT_OF_RANGE           The specified @c pixel is out of range.
-       * @exception E_INVALID_OPERATION The current state of the instance prohibits the execution of the specified operation
-       * @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.
-       * Likewise, in case of positive @c pixel on the bottom position of scroll it will also return E_OUT_OF_RANGE. @n
-       * This method does not work during the ITableViewItemProvider call-back procedure.
+       * @exception E_INVALID_OPERATION The current state of the instance prohibits the execution of the specified operation.
+       * @remarks
+       *                               - If you call this method with negative @c pixel when position of scroll is already top of contents then it will
+       *                               return @c E_OUT_OF_RANGE. @n
+       *                               Likewise, in case of positive @c pixel on the bottom position of scroll it will also return @c E_OUT_OF_RANGE.
+       *                               - This method does not work during the ITableViewItemProvider call-back procedure.
        */
        result ScrollByPixel(float pixel);
 
        /**
-       * Gets the current scroll position
+       * Gets the current scroll position.
        *
        * @since 2.1
        */
        int GetCurrentScrollPosition(void) const;
 
        /**
-       * Gets the current scroll position
+       * Gets the current scroll position.
        *
        * @since 2.1
        */
        float GetCurrentScrollPositionF(void) const;
 
        /*
-       * Enables or disables the scroll of TableView items.
+       * Enables or disables the scroll of %TableView items.
        *
        * @since 2.0
        */
@@ -778,40 +812,41 @@ public:
        bool IsScrollEnabled(void) const;
 
        /**
-       * Opens the context item at the specified index.
+       * Opens the context item at a specified index.
        *
        * @since 2.1
        *
        * @return  An error code
        * @param[in] itemIndex  The item index
        * @exception E_SUCCESS   The method is successful.
-       * @exception E_OUT_OF_RANGE                A specified input parameter is invalid.
+       * @exception E_OUT_OF_RANGE                The specified input parameter is invalid.
        * @exception E_INVALID_OPERATION  The current state of the instance prohibits the execution of the specified operation.
        */
        result OpenContextItem(int itemIndex);
 
        /**
-       * Closes the context item at the specified index.
+       * Closes the context item at a specified index.
        *
        * @since 2.1
        *
        * @return  An error code
        * @param[in] itemIndex  The item index
        * @exception E_SUCCESS   The method is successful.
-       * @exception E_OUT_OF_RANGE                A specified input parameter is invalid.
+       * @exception E_OUT_OF_RANGE                The specified input parameter is invalid.
        * @exception E_INVALID_OPERATION  The current state of the instance prohibits the execution of the specified operation.
        */
        result CloseContextItem(int itemIndex);
 
        /**
-       * Returns whether the context item at the specified index is opened.
+       * Checks whether the context item at a specified index is opened.
        *
        * @since 2.1
        *
-       * @return @c true if the context item is opened, else @c false
-       * @param[in] itemIndex  The item itemIndex
+       * @return @c true if the context item is opened, @n
+       *         else @c false
+       * @param[in] itemIndex  The item index
        * @exception E_SUCCESS           The method is successful.
-       * @exception E_OUT_OF_RANGE  A specified input parameter is invalid.
+       * @exception E_OUT_OF_RANGE  The specified input parameter is invalid.
        */
        bool IsContextItemOpened(int itemIndex) const;