Adding the integer APIs for the GroupContainer control
authorSyed Khaja Moinuddin <moinuddin.s@samsung.com>
Mon, 18 Mar 2013 10:15:38 +0000 (19:15 +0900)
committerSyed Khaja Moinuddin <moinuddin.s@samsung.com>
Mon, 18 Mar 2013 10:15:38 +0000 (19:15 +0900)
Signed-off-by: Syed Khaja Moinuddin <moinuddin.s@samsung.com>
Change-Id: Ib0818bec4b6388f670ab72f96a7fcfff661dd8c2

inc/FUiCtrlGroupContainer.h
src/ui/controls/FUiCtrlGroupContainer.cpp
src/ui/controls/FUiCtrl_GroupContainerImpl.cpp
src/ui/inc/FUiCtrl_GroupContainerImpl.h

index ddf5177..019dc91 100644 (file)
@@ -62,6 +62,24 @@ public:
      * @since 2.1
      *
      * @return      An error code
+     * @param[in]   rect                The location and size of the %GroupContainer control as an instance of Rectangle
+     * @param[in]   rowCount            The number of rows
+     * @param[in]   columnCount         The number of columns
+     * @param[in]   lineWidth           Width of the grid lines to draw
+     * @exception   E_SUCCESS           The method is successful.
+     * @exception   E_INVALID_ARG      A specified input parameter is invalid. @n
+     *                                 The width or height of @c rect or @c rowCount or @c columnnCount is negative or the value of @c lineWidth is @c 0 or negative.
+     * @exception E_OPERATION_FAILED    The operation has failed.
+     * @remarks The available space for controls is less than the width or height of the container by the total width or height of the grid lines.
+     */
+     result Construct(const Tizen::Graphics::Rectangle& rect, int rowCount, int columnCount, int lineWidth = 1);
+
+     /**
+     * Initializes this instance of %GroupContainer with the specified parameters.
+     *
+     * @since 2.1
+     *
+     * @return      An error code
      * @param[in]   rect                The location and size of the %GroupContainer control as an instance of FloatRectangle
      * @param[in]   rowCount            The number of rows
      * @param[in]   columnCount         The number of columns
@@ -156,6 +174,21 @@ public:
      * @exception   E_INVALID_ARG              The specified @c width must be greater than or equal to @c 0.
      *
      */
+     result SetColumnWidth(int columnIndex, int width);
+
+     /**
+     * Sets the width of a column.
+     *
+     * @since 2.1
+     *
+     * @return         An error code
+     * @param[in]      columnIndex                     The column index
+     * @param[in]      width                           The new width of the column
+     * @exception      E_SUCCESS                       The method is successful.
+     * @exception      E_OUT_OF_RANGE          The specified @c columnIndex is greater than the number of elements or less than @c 0.
+     * @exception   E_INVALID_ARG              The specified @c width must be greater than or equal to @c 0.0f.
+     *
+     */
      result SetColumnWidth(int columnIndex, float width);
 
      /**
@@ -168,7 +201,34 @@ public:
      * @exception      E_SUCCESS                       The method is successful.
      * @exception      E_OUT_OF_RANGE      The specified @c columnIndex is greater than the number of elements or less than @c 0.
      */
-     float GetColumnWidth(int columnIndex) const;
+     int GetColumnWidth(int columnIndex) const;
+
+     /**
+     * Gets the width of a column.
+     *
+     * @since 2.1
+     *
+     * @return         The width of the column
+     * @param[in]      columnIndex                     The column index
+     * @exception      E_SUCCESS                       The method is successful.
+     * @exception      E_OUT_OF_RANGE      The specified @c columnIndex is greater than the number of elements or less than @c 0.
+     */
+     float GetColumnWidthF(int columnIndex) const;
+
+     /**
+     * Sets the height of a row.
+     *
+     * @since 2.1
+     *
+     * @return         An error code
+     * @param[in]      rowIndex                        The row index
+     * @param[in]      height                          The new height of the row
+     * @exception      E_SUCCESS                       The method is successful.
+     * @exception      E_OUT_OF_RANGE          The specified @c rowIndex is greater than the number of elements or less than @c 0.
+     * @exception      E_INVALID_ARG           The specified @c height must be greater than or equal to @c 0.
+     *
+     */
+     result SetRowHeight(int rowIndex, int height);
 
      /**
      * Sets the height of a row.
@@ -196,7 +256,21 @@ public:
      * @exception      E_OUT_OF_RANGE          The specified @c rowIndex is greater than the number of elements or less than @c 0.
      *
      */
-     float GetRowHeight(int rowIndex) const;
+     int GetRowHeight(int rowIndex) const;
+
+     /**
+     * Gets the height of a row.
+     *
+     * @since 2.1
+     *
+     * @return         The height of the row
+     * @param[in]      rowIndex                        The row index
+     * @exception      E_SUCCESS                       The method is successful.
+     * @exception      E_OUT_OF_RANGE          The specified @c rowIndex is greater than the number of elements or less than @c 0.
+     *
+     */
+     float GetRowHeightF(int rowIndex) const;
+
      /**
      * Merges the cells for the given row and column index.
      *
@@ -245,9 +319,29 @@ public:
      * @exception      E_SUCCESS                       The method is successful.
      * @exception      E_OUT_OF_RANGE          The specified @c rowIndex  or @c columnIndex is greater than the number of elements or less than @c 0.
      * @exception   E_INVALID_ARG              The specified @c leftMargin or @c topMargin or @c rightMargin or @c bottomMargin must be greater than or equal to @c 0.
-     * @remarks     The default margin value is 2 logical pixel.
+     * @remarks     The default margin value is 2.0f logical pixel.
+     */
+     result SetMargin(int rowIndex, int columnIndex, int leftMargin, int rightMargin, int topMargin, int bottomMargin);
+
+     /**
+     * Sets the margin of a cell
+     *
+     * @since 2.1
+     *
+     * @return         An error code
+     * @param[in]      rowIndex                        The row index of the cell
+     * @param[in]      columnIndex                     The column index of the cell
+     * @param[in]      leftMargin                      The left margin
+     * @param[in]      rightMargin                     The right margin
+     * @param[in]      topMargin                       The top margin
+     * @param[in]      bottomMargin            The bottom margin
+     * @exception      E_SUCCESS                       The method is successful.
+     * @exception      E_OUT_OF_RANGE          The specified @c rowIndex  or @c columnIndex is greater than the number of elements or less than @c 0.
+     * @exception   E_INVALID_ARG              The specified @c leftMargin or @c topMargin or @c rightMargin or @c bottomMargin must be greater than or equal to @c 0.0f.
+     * @remarks     The default margin value is 2.0f logical pixel.
      */
      result SetMargin(int rowIndex, int columnIndex, float leftMargin, float rightMargin, float topMargin, float bottomMargin);
+
      /**
      * Splits the merged cells
      *
@@ -268,13 +362,27 @@ public:
      * @since 2.1
      *
      * @return         An instance of the FloatRectangle that represents the position of top-left corner,
-     *              the width, and the height of the cell, @n else Rectangle(0.0f,  0.0f, -1.0f, -1.0f)  if an error occurs
+     *              the width, and the height of the cell, @n else Rectangle(0, 0, -1, -1)  if an error occurs
+     * @param[in]      rowIndex                        The row index of the cell
+     * @param[in]      columnIndex                     The column index of the cell
+     * @exception      E_SUCCESS                       The method is successful.
+     * @exception      E_OUT_OF_RANGE          The specified @c rowIndex  or @c columnIndex is greater than the number of elements or less than @c 0.
+     */
+     Tizen::Graphics::Rectangle GetBoundsAt(int rowIndex, int columnIndex) const;
+
+     /**
+     * Gets the bounds of specified cell
+     *
+     * @since 2.1
+     *
+     * @return         An instance of the FloatRectangle that represents the position of top-left corner,
+     *              the width, and the height of the cell, @n else Rectangle(0.0f, 0.0f, -1.0f, -1.0f)  if an error occurs
      * @param[in]      rowIndex                        The row index of the cell
      * @param[in]      columnIndex                     The column index of the cell
      * @exception      E_SUCCESS                       The method is successful.
      * @exception      E_OUT_OF_RANGE          The specified @c rowIndex  or @c columnIndex is greater than the number of elements or less than @c 0.
      */
-     Tizen::Graphics::FloatRectangle GetBoundsAt(int rowIndex, int columnIndex) const;
+     Tizen::Graphics::FloatRectangle GetBoundsAtF(int rowIndex, int columnIndex) const;
 
      /**
      * Enables/disables stretchable or shrinkable property of a column
index b25daed..71e84fb 100644 (file)
@@ -42,7 +42,7 @@ GroupContainer::~GroupContainer(void)
 }
 
 result
-GroupContainer::Construct(const FloatRectangle& rect, int rowCount, int columnCount, float lineWidth)
+GroupContainer::Construct(const Rectangle& rect, int rowCount, int columnCount, int lineWidth)
 {
        result r = E_SUCCESS;
        _GroupContainerImpl* pGroupContainerImpl = _GroupContainerImpl::GetInstance(*this);
@@ -61,6 +61,25 @@ GroupContainer::Construct(const FloatRectangle& rect, int rowCount, int columnCo
 }
 
 result
+GroupContainer::Construct(const FloatRectangle& rect, int rowCount, int columnCount, float lineWidth)
+{
+       result r = E_SUCCESS;
+       _GroupContainerImpl* pGroupContainerImpl = _GroupContainerImpl::GetInstance(*this);
+       SysAssertf(pGroupContainerImpl == null, "Already constructed! Calling Construct() twice or more on a same instance is not allowed for this class.");
+
+       pGroupContainerImpl = _GroupContainerImpl::CreateGroupContainerImplFN(this, rect, rowCount, columnCount, lineWidth);
+
+       r = GetLastResult();
+       SysTryReturnResult(NID_UI_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
+
+       pGroupContainerImpl->Initialize();
+       r = GetLastResult();
+       _pControlImpl = pGroupContainerImpl;
+
+       return r;
+}
+
+result
 GroupContainer::AddControlAt(Control& control, int rowIndex, int columnIndex)
 {
        _GroupContainerImpl* pGroupContainerImpl = _GroupContainerImpl::GetInstance(*this);
@@ -97,6 +116,15 @@ GroupContainer::RemoveControlAt(int rowIndex, int columnIndex)
 }
 
 result
+GroupContainer::SetColumnWidth(int columnIndex, int width)
+{
+       _GroupContainerImpl* pGroupContainerImpl = _GroupContainerImpl::GetInstance(*this);
+       SysAssertf(pGroupContainerImpl != null, "Not yet constructed. Construct() should be called before use.");
+
+       return pGroupContainerImpl->SetColumnWidth(columnIndex, width);
+}
+
+result
 GroupContainer::SetColumnWidth(int columnIndex, float width)
 {
        _GroupContainerImpl* pGroupContainerImpl = _GroupContainerImpl::GetInstance(*this);
@@ -105,7 +133,7 @@ GroupContainer::SetColumnWidth(int columnIndex, float width)
        return pGroupContainerImpl->SetColumnWidth(columnIndex, width);
 }
 
-float
+int
 GroupContainer::GetColumnWidth(int columnIndex) const
 {
        _GroupContainerImpl* pGroupContainerImpl = const_cast<_GroupContainerImpl*>(_GroupContainerImpl::GetInstance(*this));
@@ -114,6 +142,24 @@ GroupContainer::GetColumnWidth(int columnIndex) const
        return pGroupContainerImpl->GetColumnWidth(columnIndex);
 }
 
+float
+GroupContainer::GetColumnWidthF(int columnIndex) const
+{
+       _GroupContainerImpl* pGroupContainerImpl = const_cast<_GroupContainerImpl*>(_GroupContainerImpl::GetInstance(*this));
+       SysAssertf(pGroupContainerImpl != null, "Not yet constructed. Construct() should be called before use.");
+
+       return pGroupContainerImpl->GetColumnWidthF(columnIndex);
+}
+
+result
+GroupContainer::SetRowHeight(int rowIndex, int height)
+{
+       _GroupContainerImpl* pGroupContainerImpl = _GroupContainerImpl::GetInstance(*this);
+       SysAssertf(pGroupContainerImpl != null, "Not yet constructed. Construct() should be called before use.");
+
+       return pGroupContainerImpl->SetRowHeight(rowIndex, height);
+}
+
 result
 GroupContainer::SetRowHeight(int rowIndex, float height)
 {
@@ -123,7 +169,7 @@ GroupContainer::SetRowHeight(int rowIndex, float height)
        return pGroupContainerImpl->SetRowHeight(rowIndex, height);
 }
 
-float
+int
 GroupContainer::GetRowHeight(int rowIndex) const
 {
        _GroupContainerImpl* pGroupContainerImpl = const_cast<_GroupContainerImpl*>(_GroupContainerImpl::GetInstance(*this));
@@ -132,6 +178,15 @@ GroupContainer::GetRowHeight(int rowIndex) const
        return pGroupContainerImpl->GetRowHeight(rowIndex);
 }
 
+float
+GroupContainer::GetRowHeightF(int rowIndex) const
+{
+       _GroupContainerImpl* pGroupContainerImpl = const_cast<_GroupContainerImpl*>(_GroupContainerImpl::GetInstance(*this));
+       SysAssertf(pGroupContainerImpl != null, "Not yet constructed. Construct() should be called before use.");
+
+       return pGroupContainerImpl->GetRowHeightF(rowIndex);
+}
+
 result
 GroupContainer::Merge(int rowStartIndex, int columnStartIndex, int rowCount, int columnCount)
 {
@@ -151,6 +206,15 @@ GroupContainer::SetChildResizingEnabled(int rowIndex, int columnIndex, bool enab
 }
 
 result
+GroupContainer::SetMargin(int rowIndex, int columnIndex, int leftMargin, int topMargin, int rightMargin, int bottomMargin)
+{
+       _GroupContainerImpl* pGroupContainerImpl = _GroupContainerImpl::GetInstance(*this);
+       SysAssertf(pGroupContainerImpl != null, "Not yet constructed. Construct() should be called before use.");
+
+       return pGroupContainerImpl->SetMargin(rowIndex, columnIndex, leftMargin, topMargin, rightMargin, bottomMargin);
+}
+
+result
 GroupContainer::SetMargin(int rowIndex, int columnIndex, float leftMargin, float topMargin, float rightMargin, float bottomMargin)
 {
        _GroupContainerImpl* pGroupContainerImpl = _GroupContainerImpl::GetInstance(*this);
@@ -168,7 +232,7 @@ GroupContainer::Split(int rowIndex, int columnIndex)
        return pGroupContainerImpl->Split(rowIndex, columnIndex);
 }
 
-FloatRectangle
+Rectangle
 GroupContainer::GetBoundsAt(int rowIndex, int columnIndex) const
 {
        const _GroupContainerImpl* pGroupContainerImpl = _GroupContainerImpl::GetInstance(*this);
@@ -177,6 +241,15 @@ GroupContainer::GetBoundsAt(int rowIndex, int columnIndex) const
        return pGroupContainerImpl->GetBoundsAt(rowIndex, columnIndex);
 }
 
+FloatRectangle
+GroupContainer::GetBoundsAtF(int rowIndex, int columnIndex) const
+{
+       const _GroupContainerImpl* pGroupContainerImpl = _GroupContainerImpl::GetInstance(*this);
+       SysAssertf(pGroupContainerImpl != null, "Not yet constructed. Construct() should be called before use.");
+
+       return pGroupContainerImpl->GetBoundsAtF(rowIndex, columnIndex);
+}
+
 result
 GroupContainer::SetColumnStretchable(int columnIndex, bool stretchable)
 {
index 877c4f5..44d40f8 100644 (file)
@@ -44,7 +44,29 @@ _GroupContainerImpl::~_GroupContainerImpl(void)
 }
 
 _GroupContainerImpl*
-_GroupContainerImpl::CreateGroupContainerImplN(GroupContainer* pControl, const FloatRectangle& rect, int rowCount, int columnCount, float lineWidth)
+_GroupContainerImpl::CreateGroupContainerImplN(GroupContainer* pControl, const Rectangle& rect, int rowCount, int columnCount, int lineWidth)
+{
+       ClearLastResult();
+
+       _GroupContainerImpl* pImpl = null;
+       _GroupContainer* pCore = null;
+
+       FloatRectangle floatBounds = _CoordinateSystemUtils::ConvertToFloat(rect);
+       float floatLineWidth = _CoordinateSystemUtils::ConvertToFloat(lineWidth);
+
+       pCore = _GroupContainer::CreateGroupContainerN(floatBounds, rowCount, columnCount, floatLineWidth);
+       result r = GetLastResult();
+       SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, null, r, "[%s] Propagating.", GetErrorMessage(r));
+
+       pImpl = new (std::nothrow) _GroupContainerImpl(pControl, pCore);
+       r = CheckConstruction(pCore, pImpl);
+       SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, null, r, "[%s] Propagating.", GetErrorMessage(r));
+
+       return pImpl;
+}
+
+_GroupContainerImpl*
+_GroupContainerImpl::CreateGroupContainerImplFN(GroupContainer* pControl, const FloatRectangle& rect, int rowCount, int columnCount, float lineWidth)
 {
        ClearLastResult();
 
@@ -129,26 +151,53 @@ _GroupContainerImpl::RemoveControlAt(int rowIndex, int columnIndex)
 }
 
 result
+_GroupContainerImpl::SetColumnWidth(int columnIndex, int width)
+{
+       float floatWidth = _CoordinateSystemUtils::ConvertToFloat(width);
+       return GetCore().SetColumnWidth(columnIndex, floatWidth);
+}
+
+result
 _GroupContainerImpl::SetColumnWidth(int columnIndex, float width)
 {
        return GetCore().SetColumnWidth(columnIndex, width);
 }
 
-float
+int
 _GroupContainerImpl::GetColumnWidth(int columnIndex)
 {
+       int width = _CoordinateSystemUtils::ConvertToInteger(GetCore().GetColumnWidth(columnIndex));
+       return width;
+}
+
+float
+_GroupContainerImpl::GetColumnWidthF(int columnIndex)
+{
        return GetCore().GetColumnWidth(columnIndex);
 }
 
 result
+_GroupContainerImpl::SetRowHeight(int rowIndex, int height)
+{
+       float floatHeight = _CoordinateSystemUtils::ConvertToFloat(height);
+       return GetCore().SetRowHeight(rowIndex, floatHeight);
+}
+
+result
 _GroupContainerImpl::SetRowHeight(int rowIndex, float height)
 {
        return GetCore().SetRowHeight(rowIndex, height);
 }
 
-float
+int
 _GroupContainerImpl::GetRowHeight(int rowIndex)
 {
+       return _CoordinateSystemUtils::ConvertToInteger(GetCore().GetRowHeight(rowIndex));
+}
+
+float
+_GroupContainerImpl::GetRowHeightF(int rowIndex)
+{
        return GetCore().GetRowHeight(rowIndex);
 }
 
@@ -165,6 +214,17 @@ _GroupContainerImpl::SetChildResizingEnabled(int rowIndex, int columnIndex, bool
 }
 
 result
+_GroupContainerImpl::SetMargin(int rowIndex, int columnIndex, int leftMargin, int rightMargin, int topMargin, int bottomMargin)
+{
+       float floatLeftMargin = _CoordinateSystemUtils::ConvertToFloat(leftMargin);
+       float floatRightMargin = _CoordinateSystemUtils::ConvertToFloat(rightMargin);
+       float floatTopMargin = _CoordinateSystemUtils::ConvertToFloat(topMargin);
+       float floatBottomMargin = _CoordinateSystemUtils::ConvertToFloat(bottomMargin);
+
+       return GetCore().SetMargin(rowIndex, columnIndex, floatLeftMargin, floatRightMargin, floatTopMargin, floatBottomMargin);
+}
+
+result
 _GroupContainerImpl::SetMargin(int rowIndex, int columnIndex, float leftMargin, float rightMargin, float topMargin, float bottomMargin)
 {
        return GetCore().SetMargin(rowIndex, columnIndex, leftMargin, rightMargin, topMargin, bottomMargin);
@@ -176,9 +236,15 @@ _GroupContainerImpl::Split(int rowIndex, int columnIndex)
        return GetCore().Split(rowIndex, columnIndex);
 }
 
-FloatRectangle
+Rectangle
 _GroupContainerImpl::GetBoundsAt(int rowIndex, int columnIndex) const
 {
+       return _CoordinateSystemUtils::ConvertToInteger(GetCore().GetBoundsAt(rowIndex, columnIndex));
+}
+
+FloatRectangle
+_GroupContainerImpl::GetBoundsAtF(int rowIndex, int columnIndex) const
+{
        return GetCore().GetBoundsAt(rowIndex, columnIndex);
 }
 
index 35244da..85aac13 100644 (file)
@@ -45,7 +45,8 @@ class _GroupContainerImpl
 public:
        virtual ~_GroupContainerImpl(void);
 
-       static _GroupContainerImpl* CreateGroupContainerImplN(GroupContainer* pControl, const Tizen::Graphics::FloatRectangle& rect, int rowCount, int columnCount, float lineWidth);
+       static _GroupContainerImpl* CreateGroupContainerImplN(GroupContainer* pControl, const Tizen::Graphics::Rectangle& rect, int rowCount, int columnCount, int lineWidth);
+       static _GroupContainerImpl* CreateGroupContainerImplFN(GroupContainer* pControl, const Tizen::Graphics::FloatRectangle& rect, int rowCount, int columnCount, float lineWidth);
        void Initialize(void);
        //Accessor
 
@@ -61,15 +62,21 @@ public:
        result AddControlAt(Control& control, int rowIndex, int columnIndex);
        Tizen::Ui::Control* GetControlAt(int rowIndex, int columnIndex);
        result RemoveControlAt(int rowIndex, int columnIndex);
+       result SetColumnWidth(int columnIndex, int width);
        result SetColumnWidth(int columnIndex, float width);
-       float GetColumnWidth(int columnIndex);
+       int GetColumnWidth(int columnIndex);
+       float GetColumnWidthF(int columnIndex);
+       result SetRowHeight(int rowIndex, int rowHeight);
        result SetRowHeight(int rowIndex, float rowHeight);
-       float GetRowHeight(int rowIndex);
+       int GetRowHeight(int rowIndex);
+       float GetRowHeightF(int rowIndex);
        result Merge(int rowStartIndex, int columnStartIndex, int rowCount, int columnCount);
        result SetChildResizingEnabled(int rowIndex, int columnIndex, bool enable);
+       result SetMargin(int rowIndex, int columnIndex, int leftMargin, int rightMargin, int topMargin, int bottomMargin);
        result SetMargin(int rowIndex, int columnIndex, float leftMargin, float rightMargin, float topMargin, float bottomMargin);
        result Split(int rowIndex, int columnIndex);
-       Tizen::Graphics::FloatRectangle GetBoundsAt(int rowIndex, int columnIndex) const;
+       Tizen::Graphics::Rectangle GetBoundsAt(int rowIndex, int columnIndex) const;
+       Tizen::Graphics::FloatRectangle GetBoundsAtF(int rowIndex, int columnIndex) const;
        result SetColumnStretchable(int columnIndex, bool stretchable);
        bool IsColumnStretchable(int columnIndex);
        result SetRowStretchable(int rowIndex, bool stretchable);