From 3019a2eb9d70862ba052115e50c7cef66b585339 Mon Sep 17 00:00:00 2001 From: Arun S Devarajan Date: Fri, 22 Mar 2013 11:39:03 +0530 Subject: [PATCH] Floating point impl for 1.x Lists Signed-off-by: Arun S Devarajan Change-Id: Id9ee0b2cacf192b0817339e3829f890406c22c20 Signed-off-by: Syed Khaja Moinuddin --- src/ui/controls/FUiCtrlSlidableGroupedList.cpp | 5 +-- src/ui/controls/FUiCtrl_CustomListElements.cpp | 45 +++++++++++----------- src/ui/controls/FUiCtrl_CustomListImpl.cpp | 6 +-- src/ui/controls/FUiCtrl_CustomListItemImpl.cpp | 5 +-- src/ui/controls/FUiCtrl_ExpandableListImpl.cpp | 29 +++++++------- src/ui/controls/FUiCtrl_GroupedListImpl.cpp | 9 ++--- src/ui/controls/FUiCtrl_ListBaseImpl.cpp | 17 ++++---- src/ui/controls/FUiCtrl_ListImpl.cpp | 21 +++++----- .../controls/FUiCtrl_SlidableGroupedListImpl.cpp | 19 ++++++--- src/ui/controls/FUiCtrl_SlidableListImpl.cpp | 11 +++--- src/ui/inc/FUiCtrl_CustomListItemImpl.h | 4 +- src/ui/inc/FUiCtrl_SlidableGroupedListImpl.h | 2 +- src/ui/inc/FUi_ResourceSizeInfo.h | 1 + src/ui/resource/FUi_ResourceSizeInfo.cpp | 8 ++++ 14 files changed, 97 insertions(+), 85 deletions(-) diff --git a/src/ui/controls/FUiCtrlSlidableGroupedList.cpp b/src/ui/controls/FUiCtrlSlidableGroupedList.cpp index 5ea2a64..190866f 100644 --- a/src/ui/controls/FUiCtrlSlidableGroupedList.cpp +++ b/src/ui/controls/FUiCtrlSlidableGroupedList.cpp @@ -54,15 +54,12 @@ SlidableGroupedList::Construct(const Rectangle& rect, CustomListStyle style, boo SysAssertf((_SlidableGroupedListImpl::GetInstance(*this) == null), "Already constructed. Calling Construct() twice or more on a same instance is not allowed for this class."); - _SlidableGroupedListImpl* pImpl = _SlidableGroupedListImpl::CreateSlidableGroupedListImplN(this, itemDivider, bFastScroll); + _SlidableGroupedListImpl* pImpl = _SlidableGroupedListImpl::CreateSlidableGroupedListImplN(this, rect, itemDivider, bFastScroll); r = GetLastResult(); SysTryReturn(NID_UI_CTRL, pImpl, r, r, "[%s] Propagating.", GetErrorMessage(r)); _pControlImpl = pImpl; - r = Control::SetBounds(rect.x, rect.y, rect.width, rect.height); - SysTryCatch(NID_UI_CTRL, (r == E_SUCCESS), , r, "[%s] Propagating.", GetErrorMessage(r)); - r = pImpl->SetListStyle(style); SysTryCatch(NID_UI_CTRL, (r == E_SUCCESS), , r, "[%s] Propagating.", GetErrorMessage(r)); diff --git a/src/ui/controls/FUiCtrl_CustomListElements.cpp b/src/ui/controls/FUiCtrl_CustomListElements.cpp index 9e402ad..6ca0587 100755 --- a/src/ui/controls/FUiCtrl_CustomListElements.cpp +++ b/src/ui/controls/FUiCtrl_CustomListElements.cpp @@ -28,6 +28,7 @@ #include "FUiCtrl_CustomListItemFormatImpl.h" #include "FUiCtrl_PanelImpl.h" #include "FUi_ResourceManager.h" +#include "FUi_CoordinateSystemUtils.h" using namespace Tizen::Base; using namespace Tizen::Base::Collection; @@ -137,7 +138,7 @@ _TextElementModel::CreateElementView(_ElementViewParams& elementParams) _TextElementView* pTextElementView = new (std::nothrow) _TextElementView(pText); SysTryReturn(NID_UI_CTRL, (pTextElementView != null), E_OUT_OF_MEMORY, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed."); - pTextElementView->Construct(elementParams.pElementFormatData->rect); + pTextElementView->Construct(_CoordinateSystemUtils::ConvertToFloat(elementParams.pElementFormatData->rect)); pTextElementView->AddTouchEventListener(*elementParams.pCustomListItemImpl); elementParams.pTableViewItemBase->AddControl(*pTextElementView); pTextElementView->SetModel(pTextElementModel); @@ -181,7 +182,7 @@ _BitmapElementModel::CreateElementView(_ElementViewParams& elementParams) _BitmapElementView* pBitmapElementView = new (std::nothrow) _BitmapElementView(); SysTryReturn(NID_UI_CTRL, (pBitmapElementView != null), E_OUT_OF_MEMORY, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed."); - pBitmapElementView->Construct(elementParams.pElementFormatData->rect); + pBitmapElementView->Construct(_CoordinateSystemUtils::ConvertToFloat(elementParams.pElementFormatData->rect)); pBitmapElementView->AddTouchEventListener(*elementParams.pCustomListItemImpl); elementParams.pTableViewItemBase->AddControl(*pBitmapElementView); pBitmapElementView->SetModel(pBitmapElementModel); @@ -218,7 +219,7 @@ _CustomElementModel::CreateElementView(_ElementViewParams& elementParams) _CustomElementView* pCustomElementView = new (std::nothrow) _CustomElementView(); SysTryReturn(NID_UI_CTRL, (pCustomElementView != null), E_OUT_OF_MEMORY, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed."); - pCustomElementView->Construct(elementParams.pElementFormatData->rect); + pCustomElementView->Construct(_CoordinateSystemUtils::ConvertToFloat(elementParams.pElementFormatData->rect)); pCustomElementView->AddTouchEventListener(*elementParams.pCustomListItemImpl); elementParams.pTableViewItemBase->AddControl(*pCustomElementView); pCustomElementView->SetModel(pCustomElementModel); @@ -321,7 +322,7 @@ _CheckElementModel::CreateElementView(_ElementViewParams& elementParams) _CheckElementView* pCheckElementView = new (std::nothrow) _CheckElementView(); SysTryReturn(NID_UI_CTRL, (pCheckElementView != null), E_OUT_OF_MEMORY, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed."); - pCheckElementView->Construct(checkBoxBounds); + pCheckElementView->Construct(_CoordinateSystemUtils::ConvertToFloat(elementParams.pElementFormatData->rect)); pCheckElementView->AddTouchEventListener(*elementParams.pCustomListItemImpl); elementParams.pTableViewItemBase->AddControl(*pCheckElementView); pCheckElementView->SetModel(pCheckElementModel); @@ -390,9 +391,9 @@ _TextElementView::OnDraw(void) if (__pText) { - Rectangle bounds = GetBounds(); - bounds.x = 0; - bounds.y = 0; + FloatRectangle bounds = GetBoundsF(); + bounds.x = 0.0f; + bounds.y = 0.0f; _ListBaseImpl* pListBaseImpl = _CustomListItemImpl::GetListBaseImplFromElement(*this); SysTryCatch(NID_UI_CTRL, (pListBaseImpl != null), , E_SYSTEM, "[E_SYSTEM] A system error has occurred. Failed to get _ListBaseImpl instance."); @@ -504,11 +505,11 @@ _BitmapElementView::OnDraw(void) if (_BitmapImpl::CheckNinePatchedBitmapStrictly(*pBitmap)) { - pCanvas->DrawNinePatchedBitmap(Rectangle(0, 0, GetWidth(), GetHeight()), *pBitmap); + pCanvas->DrawNinePatchedBitmap(FloatRectangle(0.0f, 0.0f, GetWidthF(), GetHeightF()), *pBitmap); } else { - pCanvas->DrawBitmap(Rectangle(0, 0, GetWidth(), GetHeight()), *pBitmap); + pCanvas->DrawBitmap(FloatRectangle(0.0f, 0.0f, GetWidthF(), GetHeightF()), *pBitmap); } } @@ -639,36 +640,36 @@ _CheckElementView::OnDraw(void) if (isDividerEnabled) { - int lineWidth = 0; + float lineWidth = 0.0f; GET_SHAPE_CONFIG(LIST::CHECK_ELEMENT_DIVIDER_WIDTH, _CONTROL_ORIENTATION_PORTRAIT, lineWidth); - Rectangle bounds = GetBounds(); - int dividerHeight = 0; + FloatRectangle bounds = GetBoundsF(); + float dividerHeight = 0.0f; - dividerHeight = bounds.height / 2; - bounds.y = bounds.y + ((bounds.height - dividerHeight) / 2); + dividerHeight = bounds.height / 2.0f; + bounds.y = bounds.y + ((bounds.height - dividerHeight) / 2.0f); if (leftDivider) { - pCanvas->SetLineWidth(lineWidth / 2); + pCanvas->SetLineWidth(lineWidth / 2.0f); pCanvas->SetForegroundColor(__leftHalfDividerColor); - pCanvas->DrawLine(Point(0, bounds.y), Point(0, dividerHeight + bounds.y)); + pCanvas->DrawLine(FloatPoint(0.0f, bounds.y), FloatPoint(0.0f, dividerHeight + bounds.y)); - pCanvas->SetLineWidth(lineWidth / 2); + pCanvas->SetLineWidth(lineWidth / 2.0f); pCanvas->SetForegroundColor(__rightHalfDividerColor); - pCanvas->DrawLine(Point(1, bounds.y), Point(1, dividerHeight + bounds.y)); + pCanvas->DrawLine(FloatPoint(1.0f, bounds.y), FloatPoint(1.0f, dividerHeight + bounds.y)); } if (rightDivider) { - pCanvas->SetLineWidth(lineWidth / 2); + pCanvas->SetLineWidth(lineWidth / 2.0f); pCanvas->SetForegroundColor(__leftHalfDividerColor); - pCanvas->DrawLine(Point(bounds.width - lineWidth, bounds.y), Point(bounds.width - lineWidth, dividerHeight + bounds.y)); + pCanvas->DrawLine(FloatPoint(bounds.width - lineWidth, bounds.y), FloatPoint(bounds.width - lineWidth, dividerHeight + bounds.y)); - pCanvas->SetLineWidth(lineWidth / 2); + pCanvas->SetLineWidth(lineWidth / 2.0f); pCanvas->SetForegroundColor(__rightHalfDividerColor); - pCanvas->DrawLine(Point(bounds.width - lineWidth + 1, bounds.y), Point(bounds.width - lineWidth + 1, dividerHeight + bounds.y)); + pCanvas->DrawLine(FloatPoint(bounds.width - lineWidth + 1.0f, bounds.y), FloatPoint(bounds.width - lineWidth + 1.0f, dividerHeight + bounds.y)); } } diff --git a/src/ui/controls/FUiCtrl_CustomListImpl.cpp b/src/ui/controls/FUiCtrl_CustomListImpl.cpp index e11d863..d8f8be1 100644 --- a/src/ui/controls/FUiCtrl_CustomListImpl.cpp +++ b/src/ui/controls/FUiCtrl_CustomListImpl.cpp @@ -30,7 +30,7 @@ #include "FUiCtrl_CustomListImpl.h" #include "FUiCtrl_ListListener.h" #include "FUiCtrl_ListItemBaseImpl.h" - +#include "FUi_CoordinateSystemUtils.h" #include "FUiCtrl_TableViewItemProvider.h" using namespace Tizen::Base; @@ -187,7 +187,7 @@ _CustomListImpl::CreateCustomListImplN(CustomList* pControl, const Rectangle& bo { result r = E_SUCCESS; - r = GET_SIZE_INFO(CustomList).CheckInitialSizeValid(Dimension(bounds.width, bounds.height), _CONTROL_ORIENTATION_PORTRAIT); + r = GET_SIZE_INFO(CustomList).CheckInitialSizeValidF(FloatDimension(bounds.width, bounds.height), _CONTROL_ORIENTATION_PORTRAIT); SysTryReturn(NID_UI_CTRL, (r == E_SUCCESS), null, r, "[%s] Propagating.", GetErrorMessage(r)); _TableView* pCore = null; @@ -215,7 +215,7 @@ _CustomListImpl::InitializeBounds(const Rectangle& rect) { result r = E_SUCCESS; - r = InitializeBoundsProperties(GET_SIZE_INFO(CustomList), rect, GetCore().GetOrientation()); + r = InitializeBoundsPropertiesF(GET_SIZE_INFO(CustomList), _CoordinateSystemUtils::ConvertToFloat(rect), GetCore().GetOrientation()); SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r)); return E_SUCCESS; diff --git a/src/ui/controls/FUiCtrl_CustomListItemImpl.cpp b/src/ui/controls/FUiCtrl_CustomListItemImpl.cpp index 2e9bc5f..e25bd4c 100644 --- a/src/ui/controls/FUiCtrl_CustomListItemImpl.cpp +++ b/src/ui/controls/FUiCtrl_CustomListItemImpl.cpp @@ -648,10 +648,9 @@ _CustomListItemImpl::CreateTableViewGroupItemN(_TableViewItemParams& tableViewIt pTableViewGroupItemData = new (std::nothrow) _TableViewGroupItemData(); SysTryReturn(NID_UI_CTRL, pTableViewGroupItemData, null, E_SYSTEM, "[E_OUT_OF_MEMORY] Memory allocation failed."); - r = pTableViewGroupItemData->Construct(Dimension(tableViewItemParams.width, tableViewItemParams.pItem->__pCustomListItemImpl->height)); + r = pTableViewGroupItemData->Construct(FloatDimension(tableViewItemParams.width, tableViewItemParams.pItem->__pCustomListItemImpl->height)); SysTryCatch(NID_UI_CTRL, pTableViewGroupItemData, , E_SYSTEM, "[%s] Failed to create an item.", GetErrorMessage(r)); - pTableViewGroupItemData->groupIndex = tableViewItemParams.groupIndex; tableViewItemParams.pItem->__pCustomListItemImpl->__pTableViewGroupItemData = pTableViewGroupItemData; @@ -673,7 +672,7 @@ _CustomListItemImpl::CreateTableViewItemN(_TableViewItemParams& tableViewItemPar pTableViewItemData = new (std::nothrow) _TableViewItemData(); SysTryReturn(NID_UI_CTRL, pTableViewItemData, null, E_SYSTEM, "[E_OUT_OF_MEMORY] Memory allocation failed."); - r = pTableViewItemData->Construct(Dimension(tableViewItemParams.width, tableViewItemParams.pItem->__pCustomListItemImpl->height), TABLE_VIEW_ANNEX_STYLE_NORMAL); + r = pTableViewItemData->Construct(FloatDimension(tableViewItemParams.width, tableViewItemParams.pItem->__pCustomListItemImpl->height), TABLE_VIEW_ANNEX_STYLE_NORMAL); SysTryCatch(NID_UI_CTRL, pTableViewItemData, , E_SYSTEM, "[%s] Failed to create an item.", GetErrorMessage(r)); pTableViewItemData->groupIndex = tableViewItemParams.groupIndex; diff --git a/src/ui/controls/FUiCtrl_ExpandableListImpl.cpp b/src/ui/controls/FUiCtrl_ExpandableListImpl.cpp index daf79b8..125acf2 100755 --- a/src/ui/controls/FUiCtrl_ExpandableListImpl.cpp +++ b/src/ui/controls/FUiCtrl_ExpandableListImpl.cpp @@ -31,6 +31,7 @@ #include "FUiCtrl_ListItemBaseImpl.h" #include "FUiCtrl_CustomListImpl.h" #include "FUi_UiBuilder.h" +#include "FUi_CoordinateSystemUtils.h" using namespace Tizen::Base; using namespace Tizen::Base::Runtime; @@ -42,8 +43,8 @@ namespace Tizen { namespace Ui { namespace Controls extern const int INVALID_INDEX; -static const int _EXPANDABLE_ARROW_X_POSITION = 5; -static const int _EXPANDABLE_ARROW_Y_POSITION = 20; +static const float _EXPANDABLE_ARROW_X_POSITION = 5.0f; +static const float _EXPANDABLE_ARROW_Y_POSITION = 20.0f; static const char* ARROW_ELEMENT_NAME = "Arrow"; _ExpandableListItemDataProvider::_ExpandableListItemDataProvider(_ExpandableListImpl* pList) @@ -280,15 +281,15 @@ _ExpandableListArrowBitmap::OnDraw(void) r = GetLastResult(); SysTryReturn(NID_UI_CTRL, (pCanvas != null), r, r, "[%s] Propagating.", GetErrorMessage(r)); - const Rectangle bounds = GetBounds(); + const FloatRectangle bounds = GetBoundsF(); if (_BitmapImpl::CheckNinePatchedBitmapStrictly(*__pNormalBitmap)) { - r = pCanvas->DrawNinePatchedBitmap(Rectangle(0, 0, bounds.width, bounds.height), *__pNormalBitmap); + r = pCanvas->DrawNinePatchedBitmap(FloatRectangle(0.0f, 0.0f, bounds.width, bounds.height), *__pNormalBitmap); } else { - r = pCanvas->DrawBitmap(Rectangle(0, 0, bounds.width, bounds.height), *__pNormalBitmap); + r = pCanvas->DrawBitmap(FloatRectangle(0.0f, 0.0f, bounds.width, bounds.height), *__pNormalBitmap); } SysTryCatch(NID_UI_CTRL, (r == E_SUCCESS), , r, "[%s] Propagating.", GetErrorMessage(r)); @@ -297,12 +298,12 @@ _ExpandableListArrowBitmap::OnDraw(void) { if (_BitmapImpl::CheckNinePatchedBitmapStrictly(*__pEffectBitmap)) { - r = pCanvas->DrawNinePatchedBitmap(Rectangle(0, 0, bounds.width, bounds.height), *__pEffectBitmap); + r = pCanvas->DrawNinePatchedBitmap(FloatRectangle(0.0f, 0.0f, bounds.width, bounds.height), *__pEffectBitmap); } else { - r = pCanvas->DrawBitmap(Rectangle(0, 0, bounds.width, bounds.height), *__pEffectBitmap); + r = pCanvas->DrawBitmap(FloatRectangle(0.0f, 0.0f, bounds.width, bounds.height), *__pEffectBitmap); } SysTryCatch(NID_UI_CTRL, (r == E_SUCCESS), , r, "[%s] Propagating.", GetErrorMessage(r)); @@ -421,7 +422,7 @@ _ExpandableListImpl::CreateExpandableListImplN(ExpandableList* pControl, const R { result r = E_SUCCESS; - r = GET_SIZE_INFO(ExpandableList).CheckInitialSizeValid(Dimension(bounds.width, bounds.height), _CONTROL_ORIENTATION_PORTRAIT); + r = GET_SIZE_INFO(ExpandableList).CheckInitialSizeValidF(FloatDimension(bounds.width, bounds.height), _CONTROL_ORIENTATION_PORTRAIT); SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, null, r, "[%s] Propagating.", GetErrorMessage(r)); _TableView* pCore = _TableView::CreateTableViewN(TABLE_VIEW_STYLE_GROUPED, true, TABLE_VIEW_SCROLL_BAR_STYLE_FADE_OUT); @@ -451,7 +452,7 @@ _ExpandableListImpl::UpdateBounds(const Rectangle& rect) { result r = E_SUCCESS; - r = InitializeBoundsProperties(GET_SIZE_INFO(CustomList), rect, GetCore().GetOrientation()); + r = InitializeBoundsPropertiesF(GET_SIZE_INFO(CustomList), _CoordinateSystemUtils::ConvertToFloat(rect), GetCore().GetOrientation()); SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r)); return E_SUCCESS; @@ -514,7 +515,7 @@ _ExpandableListImpl::CreateArrowIcon(int groupIndex) _ExpandableListArrowBitmap* pArrowIcon = new (std::nothrow) _ExpandableListArrowBitmap(); SysTryReturn(NID_UI_CTRL, pArrowIcon, E_OUT_OF_MEMORY, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed."); - r = pArrowIcon->Construct(Rectangle((GetCore().GetBounds().width - (size + _EXPANDABLE_ARROW_X_POSITION)), _EXPANDABLE_ARROW_Y_POSITION, size, size), GROUP_STYLE_NONE); + r = pArrowIcon->Construct(FloatRectangle((GetCore().GetBoundsF().width - (size + _EXPANDABLE_ARROW_X_POSITION)), _EXPANDABLE_ARROW_Y_POSITION, size, size), GROUP_STYLE_NONE); SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r)); pArrowIcon->SetName(ARROW_ELEMENT_NAME); @@ -1872,11 +1873,11 @@ _ExpandableListImpl::OnTouchPressed (const Control &source, const Point ¤t isCustomBitmap = IS_CUSTOM_BITMAP(LIST::BUTTON_COLLAPSE_GROUP); if (isCustomBitmap) { - pArrowIcon->SetBitmap(*__pOpenedPressedImage); + pArrowIcon->SetBitmap(*__pOpenedPressedImage); } else { - pArrowIcon->SetBitmap(*__pOpenedPressedImage, __pEffectOpenedImage); + pArrowIcon->SetBitmap(*__pOpenedPressedImage, __pEffectOpenedImage); } } else @@ -1887,11 +1888,11 @@ _ExpandableListImpl::OnTouchPressed (const Control &source, const Point ¤t if (isCustomBitmap) { - pArrowIcon->SetBitmap(*__pClosedPressedImage); + pArrowIcon->SetBitmap(*__pClosedPressedImage); } else { - pArrowIcon->SetBitmap(*__pClosedPressedImage, __pEffectClosedImage); + pArrowIcon->SetBitmap(*__pClosedPressedImage, __pEffectClosedImage); } } diff --git a/src/ui/controls/FUiCtrl_GroupedListImpl.cpp b/src/ui/controls/FUiCtrl_GroupedListImpl.cpp index c94bba6..5a214c1 100644 --- a/src/ui/controls/FUiCtrl_GroupedListImpl.cpp +++ b/src/ui/controls/FUiCtrl_GroupedListImpl.cpp @@ -32,7 +32,7 @@ #include "FUiCtrl_FastScroll.h" #include "FUiCtrl_FastScrollIndex.h" #include "FUiCtrl_ListListener.h" - +#include "FUi_CoordinateSystemUtils.h" #include "FUi_UiBuilder.h" #include "FUi_ResourceSizeInfo.h" #include "FUi_ResourceManager.h" @@ -282,7 +282,7 @@ _GroupedListImpl::CreateGroupedListImplN(GroupedList* pControl, const Rectangle& _TableView* pCore = null; _GroupedListImpl* pImpl = null; - r = GET_SIZE_INFO(GroupedList).CheckInitialSizeValid(Dimension(bounds.width, bounds.height), _CONTROL_ORIENTATION_PORTRAIT); + r = GET_SIZE_INFO(GroupedList).CheckInitialSizeValidF(FloatDimension(bounds.width, bounds.height), _CONTROL_ORIENTATION_PORTRAIT); SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, null, r, "[%s] Propagating.", GetErrorMessage(r)); if(fastScroll == true) @@ -300,7 +300,7 @@ _GroupedListImpl::CreateGroupedListImplN(GroupedList* pControl, const Rectangle& pImpl = new (std::nothrow) _GroupedListImpl(pControl, pCore); SysTryCatch(NID_UI_CTRL, pImpl, , E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed."); - r = pImpl->InitializeBoundsProperties(GET_SIZE_INFO(GroupedList), bounds, pCore->GetOrientation()); + r = pImpl->InitializeBoundsPropertiesF(GET_SIZE_INFO(GroupedList), _CoordinateSystemUtils::ConvertToFloat(bounds), pCore->GetOrientation()); SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r)); pCore->SetItemDividerEnabled(itemDivider); @@ -309,10 +309,7 @@ _GroupedListImpl::CreateGroupedListImplN(GroupedList* pControl, const Rectangle& CATCH: delete pCore; - pCore = null; - delete pImpl; - pImpl = null; return null; } diff --git a/src/ui/controls/FUiCtrl_ListBaseImpl.cpp b/src/ui/controls/FUiCtrl_ListBaseImpl.cpp index 5f15d8f..90f5142 100644 --- a/src/ui/controls/FUiCtrl_ListBaseImpl.cpp +++ b/src/ui/controls/FUiCtrl_ListBaseImpl.cpp @@ -27,6 +27,7 @@ #include "FUiCtrl_CustomListElements.h" #include "FUiCtrl_CustomListItemImpl.h" #include "FUiCtrl_Label.h" +#include "FUi_CoordinateSystemUtils.h" using namespace Tizen::Base::Collection; using namespace Tizen::Base; @@ -679,20 +680,20 @@ _ListBaseImpl::SetTextOfEmptyList(const String& text) font.Construct(GetFont(), FONT_STYLE_PLAIN, textSize); pText->SetFont(&font, 0, pText->GetTextLength()); - Dimension listDimension = GetCore().GetSize(); + FloatDimension listDimension = GetCore().GetSizeF(); - pText->SetBounds(Rectangle(0, 0, listDimension.width, 1)); + pText->SetBounds(FloatRectangle(0.0f, 0.0f, listDimension.width, 1.0f)); pText->Compose(); - Dimension labelDimension = pText->GetTextExtent(0, pText->GetTextLength()); - labelDimension.height = pText->GetTotalHeight(); + FloatDimension labelDimension = pText->GetTextExtentF(0, pText->GetTextLength()); + labelDimension.height = pText->GetTotalHeightF(); if (labelDimension.width > listDimension.width) { - pText->SetBounds(Rectangle(0, 0, listDimension.width, 1)); + pText->SetBounds(FloatRectangle(0.0f, 0.0f, listDimension.width, 1.0f)); pText->Compose(); - int labelHeight = pText->GetTotalHeight(); + float labelHeight = pText->GetTotalHeightF(); labelDimension.width = listDimension.width; labelDimension.height = ((listDimension.height < labelHeight) ? listDimension.height : labelHeight); @@ -700,9 +701,9 @@ _ListBaseImpl::SetTextOfEmptyList(const String& text) delete pText; - Rectangle bounds = GetCore().GetBounds(); + FloatRectangle bounds = GetCore().GetBoundsF(); - __pEmptyText->SetBounds(Rectangle((bounds.width - labelDimension.width)/2, (bounds.height - labelDimension.height)/2, labelDimension.width, labelDimension.height)); + __pEmptyText->SetBounds(FloatRectangle((bounds.width - labelDimension.width)/2.0f, (bounds.height - labelDimension.height)/2.0f, labelDimension.width, labelDimension.height)); __pEmptyText->SetBackgroundColor(Color(0, 0, 0, 0)); __pEmptyText->SetTextColor(__emptyTextColor); __pEmptyText->SetTextConfig(textSize, LABEL_TEXT_STYLE_NORMAL); diff --git a/src/ui/controls/FUiCtrl_ListImpl.cpp b/src/ui/controls/FUiCtrl_ListImpl.cpp index b84c72e..eb7a591 100644 --- a/src/ui/controls/FUiCtrl_ListImpl.cpp +++ b/src/ui/controls/FUiCtrl_ListImpl.cpp @@ -27,6 +27,7 @@ #include "FUiCtrl_ListListener.h" #include "FUi_ResourceSizeInfo.h" #include "FUi_UiBuilder.h" +#include "FUi_CoordinateSystemUtils.h" using namespace Tizen::Base; using namespace Tizen::Graphics; @@ -138,12 +139,8 @@ _ListItemDataProvider::UpdateItem(int itemIndex, TableViewItem* pItem) int height = __pListImpl->__row1Height + __pListImpl->__row2Height; pCustomListItemImpl->height = height; - SysTryReturnVoidResult(NID_UI_CTRL, pItem, E_SYSTEM, - "[E_SYSTEM] A system error has occurred. Failed to get an item at index(%d).", itemIndex); - Rectangle rect = pItem->GetBounds(); - pItem->SetSize(rect.width, height); - - //return true; + FloatRectangle rect = pItem->GetBoundsF(); + pItem->SetSize(FloatDimension(rect.width, height)); } result @@ -156,15 +153,15 @@ _NumberElement::DrawElement(const Canvas& canvas, const Rectangle& rect, CustomL SysTryReturnResult(NID_UI_CTRL, (pCanvas != null), E_SYSTEM, "A system error has occurred. Failed to get the canvas."); - pCanvas->FillRectangle(Color::GetColor(COLOR_ID_MAGENTA), rect); + pCanvas->FillRectangle(Color::GetColor(COLOR_ID_MAGENTA), _CoordinateSystemUtils::ConvertToFloat(rect)); pCanvas->SetForegroundColor(Color::GetColor(COLOR_ID_WHITE)); Font font; - font.Construct(FONT_STYLE_PLAIN, 18); + font.Construct(FONT_STYLE_PLAIN, 18.0f); pCanvas->SetFont(font); - if (pCanvas->DrawText(Point(rect.x + 5, rect.y + 5), String(text)) != E_SUCCESS) + if (pCanvas->DrawText(FloatPoint(rect.x + 5.0f, rect.y + 5.0f), String(text)) != E_SUCCESS) { return E_SYSTEM; } @@ -267,13 +264,13 @@ _ListImpl::CreateListImplN(List* pControl, const Rectangle& bounds) { result r = E_SUCCESS; - r = GET_SIZE_INFO(List).CheckInitialSizeValid(Dimension(bounds.width, bounds.height), _CONTROL_ORIENTATION_PORTRAIT); + r = GET_SIZE_INFO(List).CheckInitialSizeValidF(FloatDimension(bounds.width, bounds.height), _CONTROL_ORIENTATION_PORTRAIT); SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, null, r, "[%s] Propagating.", GetErrorMessage(r)); _TableView* pCore = null; _ListImpl* pImpl = null; - pCore = _TableView::CreateTableViewN(TABLE_VIEW_STYLE_SIMPLE, true, TABLE_VIEW_SCROLL_BAR_STYLE_FADE_OUT); + pCore = _TableView::CreateTableViewN(TABLE_VIEW_STYLE_SIMPLE, true, TABLE_VIEW_SCROLL_BAR_STYLE_FIXED); r = GetLastResult(); SysTryReturn(NID_UI_CTRL, pCore, null, r, "[%s] Propagating.", GetErrorMessage(r)); @@ -356,7 +353,7 @@ _ListImpl::UpdateBounds(const Rectangle& rect) { result r = E_SUCCESS; - r = InitializeBoundsProperties(GET_SIZE_INFO(CustomList), rect, GetCore().GetOrientation()); + r = InitializeBoundsPropertiesF(GET_SIZE_INFO(CustomList), _CoordinateSystemUtils::ConvertToFloat(rect), GetCore().GetOrientation()); SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r)); return E_SUCCESS; diff --git a/src/ui/controls/FUiCtrl_SlidableGroupedListImpl.cpp b/src/ui/controls/FUiCtrl_SlidableGroupedListImpl.cpp index 51ed6c1..4c8b774 100644 --- a/src/ui/controls/FUiCtrl_SlidableGroupedListImpl.cpp +++ b/src/ui/controls/FUiCtrl_SlidableGroupedListImpl.cpp @@ -33,6 +33,7 @@ #include "FUiCtrl_FastScroll.h" #include "FUiCtrl_FastScrollIndex.h" #include "FUi_ResourceSizeInfo.h" +#include "FUi_CoordinateSystemUtils.h" using namespace Tizen::Graphics; using namespace Tizen::Base; @@ -602,8 +603,13 @@ _SlidableGroupedListImpl::~_SlidableGroupedListImpl(void) } _SlidableGroupedListImpl* -_SlidableGroupedListImpl::CreateSlidableGroupedListImplN(SlidableGroupedList* pControl, bool itemDivider, bool fastScroll) +_SlidableGroupedListImpl::CreateSlidableGroupedListImplN(SlidableGroupedList* pControl, const Rectangle& bounds, bool itemDivider, bool fastScroll) { + result r = E_SUCCESS; + + r = GET_SIZE_INFO(SlidableGroupedList).CheckInitialSizeValidF(FloatDimension(bounds.width, bounds.height), _CONTROL_ORIENTATION_PORTRAIT); + SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, null, r, "[%s] Propagating.", GetErrorMessage(r)); + TableViewScrollBarStyle scrollStyle = TABLE_VIEW_SCROLL_BAR_STYLE_NONE; if (fastScroll == true) @@ -616,12 +622,15 @@ _SlidableGroupedListImpl::CreateSlidableGroupedListImplN(SlidableGroupedList* pC } _TableView* pTableView = _TableView::CreateTableViewN(TABLE_VIEW_STYLE_GROUPED, itemDivider, scrollStyle); - result r = GetLastResult(); + r = GetLastResult(); SysTryReturn(NID_UI_CTRL, pTableView, null, r, "[%s] Propagating.", GetErrorMessage(r)); _SlidableGroupedListImpl* pImpl = new (std::nothrow) _SlidableGroupedListImpl(pControl, pTableView); SysTryCatch(NID_UI_CTRL, pImpl, , E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed."); + r = pImpl->InitializeBoundsPropertiesF(GET_SIZE_INFO(SlidableGroupedList), _CoordinateSystemUtils::ConvertToFloat(bounds), pTableView->GetOrientation()); + SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r)); + return pImpl; CATCH: @@ -1133,7 +1142,7 @@ _SlidableGroupedListImpl::InsertItemAt(int groupIndex, int index, const CustomLi _TableViewItemParams tableViewItemParams; tableViewItemParams.pItem = (const_cast(&item)); - tableViewItemParams.width = GetCore().GetBounds().width; + tableViewItemParams.width = GetCore().GetBoundsF().width; tableViewItemParams.itemIndex = index; tableViewItemParams.groupIndex = -1; tableViewItemParams.isDividerEnabled = _isDividerEnabled; @@ -1275,7 +1284,7 @@ _SlidableGroupedListImpl::LoadItemToBottom(const CustomListItem& item, int itemI _TableViewItemParams tableViewItemParams; tableViewItemParams.pItem = (const_cast(&item)); - tableViewItemParams.width = GetCore().GetBounds().width; + tableViewItemParams.width = GetCore().GetBoundsF().width; tableViewItemParams.groupIndex = __bottomGroup; tableViewItemParams.itemIndex = (itemIndex + topIndex); tableViewItemParams.isDividerEnabled = _isDividerEnabled; @@ -1306,7 +1315,7 @@ _SlidableGroupedListImpl::LoadItemToTop(const CustomListItem& item, int itemId) _TableViewItemParams tableViewItemParams; tableViewItemParams.pItem = (const_cast(&item)); - tableViewItemParams.width = GetCore().GetBounds().width; + tableViewItemParams.width = GetCore().GetBoundsF().width; tableViewItemParams.itemId = itemId; tableViewItemParams.itemIndex = pGroupObject->__topIndex; tableViewItemParams.groupIndex = __topGroup; diff --git a/src/ui/controls/FUiCtrl_SlidableListImpl.cpp b/src/ui/controls/FUiCtrl_SlidableListImpl.cpp index 06718cd..f5f84ae 100644 --- a/src/ui/controls/FUiCtrl_SlidableListImpl.cpp +++ b/src/ui/controls/FUiCtrl_SlidableListImpl.cpp @@ -32,6 +32,7 @@ #include "FUi_UiBuilder.h" #include "FUiCtrl_TableViewItemProvider.h" #include "FUiCtrl_TableViewPresenter.h" +#include "FUi_CoordinateSystemUtils.h" using namespace Tizen::Base; @@ -404,7 +405,7 @@ _SlidableListImpl::CreateSlidableListImplN(SlidableList* pControl, const Rectang { result r = E_SUCCESS; - r = GET_SIZE_INFO(SlidableList).CheckInitialSizeValid(Dimension(bounds.width, bounds.height), _CONTROL_ORIENTATION_PORTRAIT); + r = GET_SIZE_INFO(SlidableList).CheckInitialSizeValidF(FloatDimension(bounds.width, bounds.height), _CONTROL_ORIENTATION_PORTRAIT); if (IsFailed(r)) { return null; @@ -429,7 +430,7 @@ _SlidableListImpl::UpdateBounds(const Rectangle& rect) { result r = E_SUCCESS; - r = InitializeBoundsProperties(GET_SIZE_INFO(SlidableList), rect, GetCore().GetOrientation()); + r = InitializeBoundsPropertiesF(GET_SIZE_INFO(SlidableList), _CoordinateSystemUtils::ConvertToFloat(rect), GetCore().GetOrientation()); SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r)); return E_SUCCESS; @@ -690,7 +691,7 @@ _SlidableListImpl::InsertItemAt(int index, const CustomListItem& item, int itemI _TableViewItemParams tableViewItemParams; tableViewItemParams.pItem = (const_cast(&item)); - tableViewItemParams.width = GetCore().GetBounds().width; + tableViewItemParams.width = GetCore().GetBoundsF().width; tableViewItemParams.itemIndex = index; tableViewItemParams.groupIndex = -1; tableViewItemParams.isDividerEnabled = _isDividerEnabled; @@ -829,7 +830,7 @@ _SlidableListImpl::LoadItemToBottom(const CustomListItem& item, int itemId) _TableViewItemParams tableViewItemParams; tableViewItemParams.pItem = (const_cast(&item)); - tableViewItemParams.width = GetCore().GetBounds().width; + tableViewItemParams.width = GetCore().GetBoundsF().width; tableViewItemParams.itemIndex = _itemsList.GetCount() + __topIndex; tableViewItemParams.groupIndex = -1; tableViewItemParams.isDividerEnabled = _isDividerEnabled; @@ -855,7 +856,7 @@ _SlidableListImpl::LoadItemToTop(const CustomListItem& item, int itemId) _TableViewItemParams tableViewItemParams; tableViewItemParams.pItem = (const_cast(&item)); - tableViewItemParams.width = GetCore().GetBounds().width; + tableViewItemParams.width = GetCore().GetBoundsF().width; tableViewItemParams.itemIndex = (__topIndex - 1); tableViewItemParams.groupIndex = -1; tableViewItemParams.isDividerEnabled = _isDividerEnabled; diff --git a/src/ui/inc/FUiCtrl_CustomListItemImpl.h b/src/ui/inc/FUiCtrl_CustomListItemImpl.h index b8bf957..06794f7 100644 --- a/src/ui/inc/FUiCtrl_CustomListItemImpl.h +++ b/src/ui/inc/FUiCtrl_CustomListItemImpl.h @@ -41,7 +41,7 @@ extern const int INVALID_INDEX; struct _TableViewItemParams { CustomListItem* pItem; - int width; + float width; int groupIndex; int itemIndex; int itemId; @@ -181,7 +181,7 @@ private: void StartTextSlideTimer(void); void StopTextSlideTimer(void); public: - int height; + float height; int itemId; Tizen::Base::Collection::LinkedList elements; diff --git a/src/ui/inc/FUiCtrl_SlidableGroupedListImpl.h b/src/ui/inc/FUiCtrl_SlidableGroupedListImpl.h index 76f4261..33b72c2 100644 --- a/src/ui/inc/FUiCtrl_SlidableGroupedListImpl.h +++ b/src/ui/inc/FUiCtrl_SlidableGroupedListImpl.h @@ -112,7 +112,7 @@ class _SlidableGroupedListImpl public: _SlidableGroupedListImpl(Control* pList, _TableView* pCore); ~_SlidableGroupedListImpl(void); - static _SlidableGroupedListImpl* CreateSlidableGroupedListImplN(SlidableGroupedList* pControl, bool itemDivider, bool fastScroll); + static _SlidableGroupedListImpl* CreateSlidableGroupedListImplN(SlidableGroupedList* pControl, const Tizen::Graphics::Rectangle& bounds, bool itemDivider, bool fastScroll); //@See doxygen void AddSlidableGroupedListEventListener(Tizen::Ui::ISlidableGroupedListEventListener& listener); diff --git a/src/ui/inc/FUi_ResourceSizeInfo.h b/src/ui/inc/FUi_ResourceSizeInfo.h index ed5e4b4..8208e51 100644 --- a/src/ui/inc/FUi_ResourceSizeInfo.h +++ b/src/ui/inc/FUi_ResourceSizeInfo.h @@ -64,6 +64,7 @@ public: static Tizen::Ui::_ControlImpl::SizeInfo& GetListSizeInfo(void); static Tizen::Ui::_ControlImpl::SizeInfo& GetOverlayPanelSizeInfo(void); static Tizen::Ui::_ControlImpl::SizeInfo& GetSlidableListSizeInfo(void); + static Tizen::Ui::_ControlImpl::SizeInfo& GetSlidableGroupedListSizeInfo(void); static Tizen::Ui::_ControlImpl::SizeInfo& GetWebSizeInfo(void); static Tizen::Ui::_ControlImpl::SizeInfo& GetMapSizeInfo(void); static Tizen::Ui::_ControlImpl::SizeInfo& GetEditDateSizeInfo(void); diff --git a/src/ui/resource/FUi_ResourceSizeInfo.cpp b/src/ui/resource/FUi_ResourceSizeInfo.cpp index 3020238..3c286f5 100644 --- a/src/ui/resource/FUi_ResourceSizeInfo.cpp +++ b/src/ui/resource/FUi_ResourceSizeInfo.cpp @@ -211,6 +211,14 @@ SizeInfo::GetSlidableListSizeInfo(void) static _ControlImpl::SizeInfo sizeInfo; return sizeInfo; } + +_ControlImpl::SizeInfo& +SizeInfo::GetSlidableGroupedListSizeInfo(void) +{ + static _ControlImpl::SizeInfo sizeInfo; + return sizeInfo; +} + _ControlImpl::SizeInfo& SizeInfo::GetWebSizeInfo(void) { -- 2.7.4