modified DCM-882 for Popup. center aligned calling SetSize()
authorDongJinJeon <dongjin2193.jeon@samsung.com>
Sat, 23 Mar 2013 12:19:51 +0000 (21:19 +0900)
committerDongJinJeon <dongjin2193.jeon@samsung.com>
Sat, 23 Mar 2013 12:34:31 +0000 (21:34 +0900)
Change-Id: I63ad8f8a52f802a8d227d8db8f6f2021582a185a
Signed-off-by: DongJinJeon <dongjin2193.jeon@samsung.com>
src/ui/controls/FUiCtrl_PopupImpl.cpp
src/ui/inc/FUiCtrl_PopupImpl.h

index da72626..66ace78 100644 (file)
@@ -32,6 +32,7 @@
 #include "FUi_ResourceManager.h"
 #include "FUi_ControlImplManager.h"
 #include "FUi_LayoutImpl.h"
+#include "FUi_Math.h"
 #include "FUiCtrl_FrameImpl.h"
 #include "FUiCtrl_PopupImpl.h"
 #include "FUiCtrl_Popup.h"
@@ -78,6 +79,7 @@ _PopupImpl::_PopupImpl(Popup* pPublic, _Popup* pCore, Layout* pPublicPortraitLay
        , _centerAlign(false)
        , __init(false)
        , __callBoundsChange(false)
+       , __prevPos(0.0f, 0.0f)
 {
        //empty statement
 }
@@ -352,16 +354,23 @@ _PopupImpl::OnChangeLayout(_ControlOrientation orientation)
        return GetCore().OnChangeLayout(orientation);
 }
 
+result
+_PopupImpl::OnBoundsChanging(const FloatRectangle& bounds)
+{
+       __prevPos = GetBoundsF().GetTopLeft();
+
+       return _ControlImpl::OnBoundsChanging(bounds);
+}
+
 void
 _PopupImpl::OnBoundsChanged(void)
 {
        FloatRectangle rect = GetBoundsF();
        if (__init)
        {
-               if (_centerAlign)
+               if ((_centerAlign || (_FloatCompare(__prevPos.x, rect.x) && _FloatCompare(__prevPos.y, rect.y))) && __callBoundsChange == false)
                {
                        rect = GetCenterAlignedRect(GetSizeF().width, GetSizeF().height);
-                       _centerAlign = false;
                }
                else
                {
@@ -374,6 +383,7 @@ _PopupImpl::OnBoundsChanged(void)
                rect = GetCenterAlignedRect(rect.width, rect.height);
        }
 
+       _centerAlign = true;
 
        result r = SetBounds(rect, true);
        if (IsFailed(r))
@@ -383,6 +393,8 @@ _PopupImpl::OnBoundsChanged(void)
        }
 
        _ControlImpl::OnBoundsChanged();
+
+       _centerAlign = false;
 }
 
 
index 6c8b95e..33f034f 100644 (file)
@@ -80,6 +80,7 @@ public:
        Tizen::Graphics::FloatRectangle GetCenterAlignedRect(float width, float height) const;
 
        virtual void OnChangeLayout(Tizen::Ui::_ControlOrientation orientation);
+       virtual result OnBoundsChanging(const Tizen::Graphics::FloatRectangle& bounds);
        virtual void OnBoundsChanged(void);
 
 public:
@@ -109,6 +110,7 @@ protected:
 private:
        bool __init;
        bool __callBoundsChange;
+       Tizen::Graphics::FloatPoint __prevPos;
 }; // _PopupImpl