Sync XML size when called SetSize()
authorkeonpyo.kong <keonpyo.kong@samsung.com>
Mon, 18 Mar 2013 11:01:14 +0000 (20:01 +0900)
committerkeonpyo.kong <keonpyo.kong@samsung.com>
Tue, 19 Mar 2013 03:48:38 +0000 (12:48 +0900)
Change-Id: Ib48648aada751786e74f7a0576342981541d7b11
Signed-off-by: keonpyo.kong <keonpyo.kong@samsung.com>
apply codereview

Change-Id: I8938dfbcac7a001396d33c3aeded7ae85c7ce8ee
Signed-off-by: keonpyo.kong <keonpyo.kong@samsung.com>
apply code review2

Change-Id: I49685caaf87d468a856235bd6810f50b04e95dd8
Signed-off-by: keonpyo.kong <keonpyo.kong@samsung.com>
src/ui/FUi_ControlImpl.cpp
src/ui/FUi_UiBuilder.cpp
src/ui/controls/FUiCtrl_PopupImpl.cpp
src/ui/inc/FUi_ControlImpl.h

index 296122d..648ad10 100644 (file)
@@ -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();
 
index 0b7389a..b97047b 100644 (file)
@@ -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*
index 160ac4d..da72626 100644 (file)
@@ -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);
 }
index 5c0b7f0..364199f 100644 (file)
@@ -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;