logic caculcating clientbounds for layout was fixed.
authorKeuckdo Bang <keuckdo.bang@samsung.net>
Mon, 25 Mar 2013 09:53:17 +0000 (18:53 +0900)
committerKeuckdo Bang <keuckdo.bang@samsung.net>
Mon, 25 Mar 2013 10:47:15 +0000 (19:47 +0900)
Change-Id: I46bedf96f55c3651ba54125a38eb4f437bff13f8

src/ui/FUi_Control.cpp
src/ui/controls/FUiCtrl_Form.cpp
src/ui/inc/FUiCtrl_Form.h
src/ui/inc/FUi_Control.h

index 86b412b..188998f 100755 (executable)
@@ -414,8 +414,9 @@ public:
 
        FloatRectangle GetItemClientBoundsFromSize(const FloatDimension& size) const
        {
-               __pControl->UpdateClientBounds(size);
-               return __pControl->GetClientBoundsF(size);
+               FloatRectangle clientBounds(0.0f, 0.0f, 0.0f, 0.0f);
+               __pControl->UpdateClientBounds(size, clientBounds);
+               return clientBounds;
        }
 
        FloatDimension GetItemContentSize(void) const
@@ -3510,11 +3511,16 @@ _Control::SetClientBounds(const Rectangle& bounds)
        __clientBounds = _CoordinateSystemUtils::ConvertToFloat(bounds);
        __isSetClientBounds = true;
 
-       result r = AdjustAbsoluteBounds();
-       SysTryReturn(NID_UI, r == E_SUCCESS, r,         r, "[%s] Propagating.", GetErrorMessage(r));
+       const bool moved   = (__clientBounds.x != _CoordinateSystemUtils::ConvertToFloat(bounds).x) || (__clientBounds.y != _CoordinateSystemUtils::ConvertToFloat(bounds).y);
+       const bool resized = (__clientBounds.width != _CoordinateSystemUtils::ConvertToFloat(bounds).width) || (__clientBounds.height != _CoordinateSystemUtils::ConvertToFloat(bounds).height);
 
-       SetUpdateLayoutState(true);
+       if (moved || resized)
+       {
+               result r = AdjustAbsoluteBounds();
+               SysTryReturn(NID_UI, r == E_SUCCESS, r,         r, "[%s] Propagating.", GetErrorMessage(r));
 
+               SetUpdateLayoutState(true);
+       }
        return E_SUCCESS;
 }
 
@@ -3529,10 +3535,16 @@ _Control::SetClientBounds(const FloatRectangle& bounds)
        __clientBounds = bounds;
        __isSetClientBounds = true;
 
-       result r = AdjustAbsoluteBounds();
-       SysTryReturn(NID_UI, r == E_SUCCESS, r,         r, "[%s] Propagating.", GetErrorMessage(r));
+       const bool moved   = (__clientBounds.x != bounds.x) || (__clientBounds.y != bounds.y);
+       const bool resized = (__clientBounds.width != bounds.width) || (__clientBounds.height != bounds.height);
 
-       SetUpdateLayoutState(true);
+       if (moved || resized)
+       {
+               result r = AdjustAbsoluteBounds();
+               SysTryReturn(NID_UI, r == E_SUCCESS, r,         r, "[%s] Propagating.", GetErrorMessage(r));
+
+               SetUpdateLayoutState(true);
+       }
 
        return E_SUCCESS;
 }
@@ -3544,9 +3556,10 @@ _Control::IsCalledSetClientBounds(void)
 }
 
 void 
-_Control::UpdateClientBounds(const FloatDimension& size)
+_Control::UpdateClientBounds(const FloatDimension& size, FloatRectangle& clientBounds)
 {
-
+       clientBounds.width = size.width;
+       clientBounds.height = size.height;
 }
 
 Color
index 7ec3058..b066e9b 100644 (file)
@@ -2684,9 +2684,10 @@ _Form::GetFocusList(void) const
 }
 
 void
-_Form::UpdateClientBounds(const FloatDimension& size)
+_Form::UpdateClientBounds(const FloatDimension& size, FloatRectangle& clientBounds)
 {
-       FloatRectangle clientBounds(0.0f, 0.0f, size.width, size.height);
+       clientBounds.width = size.width;
+       clientBounds.height = size.height;
 
        if (__deflated)
        {
@@ -2753,8 +2754,6 @@ _Form::UpdateClientBounds(const FloatDimension& size)
                        }
                }
        }
-
-       SetClientBounds(clientBounds);
 }
 
 }}} // Tizen::Ui::Controls
index ffef5a0..a64d9ad 100644 (file)
@@ -198,7 +198,7 @@ public:
        virtual void OnActionPerformed(const Tizen::Ui::_Control& source, int actionId);
        virtual void OnChildVisibleStateChanged(const _Control& child);
        virtual void OnBoundsChanged(void);
-       virtual void UpdateClientBounds(const Tizen::Graphics::FloatDimension& size);
+       virtual void UpdateClientBounds(const Tizen::Graphics::FloatDimension& size, Tizen::Graphics::FloatRectangle& clientBounds);
 
 // Focus UI
    Tizen::Base::Collection::IListT<_Control*>* GetFocusList(void) const;
index 4954595..0e0c935 100755 (executable)
@@ -449,7 +449,7 @@ public:
        result SetClientBounds(const Tizen::Graphics::Rectangle& bounds);
        result SetClientBounds(const Tizen::Graphics::FloatRectangle& bounds);
        bool IsCalledSetClientBounds(void);
-       virtual void UpdateClientBounds(const Tizen::Graphics::FloatDimension& size);
+       virtual void UpdateClientBounds(const Tizen::Graphics::FloatDimension& size, Tizen::Graphics::FloatRectangle& clientBounds);
 
        bool Contains(const Tizen::Graphics::Point& point) const;
        bool Contains(const Tizen::Graphics::FloatPoint& point) const;