From 7664498ab388f28374cc15e64b56fd4f8e9d6e3b Mon Sep 17 00:00:00 2001 From: "keonpyo.kong" Date: Mon, 18 Mar 2013 20:01:14 +0900 Subject: [PATCH] Sync XML size when called SetSize() Change-Id: Ib48648aada751786e74f7a0576342981541d7b11 Signed-off-by: keonpyo.kong apply codereview Change-Id: I8938dfbcac7a001396d33c3aeded7ae85c7ce8ee Signed-off-by: keonpyo.kong apply code review2 Change-Id: I49685caaf87d468a856235bd6810f50b04e95dd8 Signed-off-by: keonpyo.kong --- src/ui/FUi_ControlImpl.cpp | 119 ++++++++++++++++++---------------- src/ui/FUi_UiBuilder.cpp | 4 +- src/ui/controls/FUiCtrl_PopupImpl.cpp | 12 +++- src/ui/inc/FUi_ControlImpl.h | 6 +- 4 files changed, 79 insertions(+), 62 deletions(-) diff --git a/src/ui/FUi_ControlImpl.cpp b/src/ui/FUi_ControlImpl.cpp index 296122d..648ad10 100644 --- a/src/ui/FUi_ControlImpl.cpp +++ b/src/ui/FUi_ControlImpl.cpp @@ -3546,72 +3546,77 @@ _ControlImpl::GetSizeF(void) const return GetCore().GetSizeF(); } -result -_ControlImpl::SetBounds(const Rectangle& bounds, bool callBoundsChangeCallbacks, bool callUpdateBoundsOfVisualElement) +void + _ControlImpl::UpdateBuilderBounds(const Tizen::Graphics::FloatRectangle& bounds) +{ + FloatRectangle builderBounds; + + _ControlOrientation controlOrientation = _CONTROL_ORIENTATION_PORTRAIT; + bool exist = GetBuilderBoundsF(controlOrientation, builderBounds); + if (exist) + { + if (IsAttachedToMainTree()) + { + _ControlImplManager* pControlImplManager = _ControlImplManager::GetInstance(); + OrientationStatus orientation = pControlImplManager->GetFormOrientationStatus(this); + + if (orientation == ORIENTATION_STATUS_NONE) + { + return; + } + + if (orientation == ORIENTATION_STATUS_LANDSCAPE + || orientation == ORIENTATION_STATUS_LANDSCAPE_REVERSE) + { + SetBuilderBounds(_CONTROL_ORIENTATION_LANDSCAPE, bounds); + } + else + { + SetBuilderBounds(_CONTROL_ORIENTATION_PORTRAIT, bounds); + } + } + else + { + SetBuilderBounds(_CONTROL_ORIENTATION_PORTRAIT, bounds); + SetBuilderBounds(_CONTROL_ORIENTATION_LANDSCAPE, bounds); + } + } +} + +void +_ControlImpl::UpdateBuilderSize(const Tizen::Graphics::FloatDimension& dimension) { - Rectangle builderBounds; + FloatRectangle builderBounds; _ControlOrientation controlOrientation = _CONTROL_ORIENTATION_PORTRAIT; - bool exist = GetBuilderBounds(controlOrientation, builderBounds); - if (exist) - { - if (IsAttachedToMainTree()) - { - _ControlImplManager* pControlImplManager = _ControlImplManager::GetInstance(); - OrientationStatus orientation = pControlImplManager->GetFormOrientationStatus(this); + _ControlImplManager* pControlImplManager = _ControlImplManager::GetInstance(); + OrientationStatus orientation = pControlImplManager->GetFormOrientationStatus(this); - if (orientation == ORIENTATION_STATUS_NONE) - { - return GetCore().SetBounds(bounds, callBoundsChangeCallbacks, callUpdateBoundsOfVisualElement); - } + if (orientation == ORIENTATION_STATUS_LANDSCAPE + || orientation == ORIENTATION_STATUS_LANDSCAPE_REVERSE) + { + controlOrientation = _CONTROL_ORIENTATION_LANDSCAPE; + } - if (orientation == ORIENTATION_STATUS_LANDSCAPE - || orientation == ORIENTATION_STATUS_LANDSCAPE_REVERSE) - { - SetBuilderBounds(_CONTROL_ORIENTATION_LANDSCAPE, bounds); - } - else - { - SetBuilderBounds(_CONTROL_ORIENTATION_PORTRAIT, bounds); - } - } - else - { - SetBuilderBounds(_CONTROL_ORIENTATION_PORTRAIT, bounds); - SetBuilderBounds(_CONTROL_ORIENTATION_LANDSCAPE, bounds); - } + bool exist = GetBuilderBoundsF(controlOrientation, builderBounds); + if (exist) + { + builderBounds.width = dimension.width; + builderBounds.height = dimension.height; + UpdateBuilderBounds(builderBounds); } +} + +result +_ControlImpl::SetBounds(const Rectangle& bounds, bool callBoundsChangeCallbacks, bool callUpdateBoundsOfVisualElement) +{ + UpdateBuilderBounds(_CoordinateSystemUtils::ConvertToFloat(bounds)); return GetCore().SetBounds(bounds, callBoundsChangeCallbacks, callUpdateBoundsOfVisualElement); } result _ControlImpl::SetBounds(const FloatRectangle& bounds, bool callBoundsChangeCallbacks, bool callUpdateBoundsOfVisualElement) { - FloatRectangle builderBounds; - _ControlOrientation controlOrientation = _CONTROL_ORIENTATION_PORTRAIT; - bool exist = GetBuilderBoundsF(controlOrientation, builderBounds); - if (exist) - { - if (IsAttachedToMainTree()) - { - _ControlImplManager* pControlImplManager = _ControlImplManager::GetInstance(); - OrientationStatus orientation = pControlImplManager->GetFormOrientationStatus(this); - - if (orientation == ORIENTATION_STATUS_LANDSCAPE - || orientation == ORIENTATION_STATUS_LANDSCAPE_REVERSE) - { - SetBuilderBoundsF(_CONTROL_ORIENTATION_LANDSCAPE, bounds); - } - else - { - SetBuilderBoundsF(_CONTROL_ORIENTATION_PORTRAIT, bounds); - } - } - else - { - SetBuilderBoundsF(_CONTROL_ORIENTATION_PORTRAIT, bounds); - SetBuilderBoundsF(_CONTROL_ORIENTATION_LANDSCAPE, bounds); - } - } + UpdateBuilderBounds(bounds); return GetCore().SetBounds(bounds, callBoundsChangeCallbacks, callUpdateBoundsOfVisualElement); } @@ -3652,12 +3657,14 @@ _ControlImpl::SetPosition(const FloatPoint& position) result _ControlImpl::SetSize(const Dimension& size) { + UpdateBuilderSize(_CoordinateSystemUtils::ConvertToFloat(size)); return GetCore().SetSize(size); } result _ControlImpl::SetSize(const FloatDimension& size) { + UpdateBuilderSize(size); return GetCore().SetSize(size); } @@ -4261,7 +4268,7 @@ _ControlImpl::SetBuilderBounds(_ControlOrientation orientation, const Rectangle& } result -_ControlImpl::SetBuilderBoundsF(_ControlOrientation orientation, const FloatRectangle& bounds) +_ControlImpl::SetBuilderBounds(_ControlOrientation orientation, const FloatRectangle& bounds) { ClearLastResult(); diff --git a/src/ui/FUi_UiBuilder.cpp b/src/ui/FUi_UiBuilder.cpp index 0b7389a..b97047b 100644 --- a/src/ui/FUi_UiBuilder.cpp +++ b/src/ui/FUi_UiBuilder.cpp @@ -450,11 +450,11 @@ _UiBuilder::SetLayoutOrientation(_UiBuilderControl* pUiBuilderControl, Tizen::Ui pLayout = pUiBuilderControl->GetAttribute(UIBUILDER_ATTRIBUTE_PORTRAIT); rect = pLayout->GetRectF(); - pControlImpl->SetBuilderBoundsF(_CONTROL_ORIENTATION_PORTRAIT, rect); + pControlImpl->SetBuilderBounds(_CONTROL_ORIENTATION_PORTRAIT, rect); pLayout = pUiBuilderControl->GetAttribute(UIBUILDER_ATTRIBUTE_LANDSCAPE); rect = pLayout->GetRectF(); - pControlImpl->SetBuilderBoundsF(_CONTROL_ORIENTATION_LANDSCAPE, rect); + pControlImpl->SetBuilderBounds(_CONTROL_ORIENTATION_LANDSCAPE, rect); } _ICoordinateSystemTransformer* diff --git a/src/ui/controls/FUiCtrl_PopupImpl.cpp b/src/ui/controls/FUiCtrl_PopupImpl.cpp index 160ac4d..da72626 100644 --- a/src/ui/controls/FUiCtrl_PopupImpl.cpp +++ b/src/ui/controls/FUiCtrl_PopupImpl.cpp @@ -323,10 +323,9 @@ void _PopupImpl::OnChangeLayout(_ControlOrientation orientation) { result r = E_SUCCESS; - + FloatRectangle bounds; if (!__callBoundsChange) { - FloatRectangle bounds; _centerAlign = true; if(GetXmlBounds(bounds)) @@ -340,6 +339,15 @@ _PopupImpl::OnChangeLayout(_ControlOrientation orientation) r = SetBounds(bounds); SysTryReturnVoidResult(NID_UI_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r)); } + else + { + if(GetXmlBounds(bounds)) + { + r = SetBounds(bounds); + } + SysTryReturnVoidResult(NID_UI_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r)); + + } return GetCore().OnChangeLayout(orientation); } diff --git a/src/ui/inc/FUi_ControlImpl.h b/src/ui/inc/FUi_ControlImpl.h index 5c0b7f0..364199f 100644 --- a/src/ui/inc/FUi_ControlImpl.h +++ b/src/ui/inc/FUi_ControlImpl.h @@ -166,7 +166,7 @@ public: virtual void OnFontInfoRequested(unsigned long& style, int& size); virtual void OnFontInfoRequested(unsigned long& style, float& size); virtual void OnBackgroundColorChanged(Tizen::Graphics::Color& backgroundColor); - virtual void OnDrawFocus(void); + virtual void OnDrawFocus(void); virtual void OnChildControlFocusMoved(const _Control& control); // Event Callbacks @@ -311,7 +311,9 @@ public: bool GetBuilderBounds(_ControlOrientation orientation, Tizen::Graphics::Rectangle& bounds) const; bool GetBuilderBoundsF(_ControlOrientation orientation, Tizen::Graphics::FloatRectangle& bounds) const; result SetBuilderBounds(_ControlOrientation orientation, const Tizen::Graphics::Rectangle& bounds); - result SetBuilderBoundsF(_ControlOrientation orientation, const Tizen::Graphics::FloatRectangle& bounds); + result SetBuilderBounds(_ControlOrientation orientation, const Tizen::Graphics::FloatRectangle& bounds); + void UpdateBuilderBounds(const Tizen::Graphics::FloatRectangle& bounds); + void UpdateBuilderSize(const Tizen::Graphics::FloatDimension& dimension); // Layout bool IsLayoutable(void) const; -- 2.7.4