Popup Fix.
authorsriram.k <sriram.k@samsung.com>
Fri, 2 Aug 2013 14:50:00 +0000 (20:20 +0530)
committersriram.k <sriram.k@samsung.com>
Mon, 5 Aug 2013 07:16:20 +0000 (12:46 +0530)
Signed-off-by: sriram.k <sriram.k@samsung.com>
Change-Id: I396efdf03f34a35f412ed066e719c4adf24538b7

src/ui/controls/FUiCtrl_PopupImpl.cpp
src/ui/inc/FUiCtrl_PopupImpl.h

index 9863e43..274fa79 100644 (file)
@@ -81,6 +81,8 @@ _PopupImpl::_PopupImpl(Popup* pPublic, _Popup* pCore, Layout* pPublicPortraitLay
        , __init(false)
        , __callBoundsChange(false)
        , __prevPos(0.0f, 0.0f)
+       , __boundsChangedInternally(false)
+       , __boundsChangedExternally(false)
 {
        //empty statement
 }
@@ -129,10 +131,10 @@ _PopupImpl::Initialize(bool hasTitle, const Tizen::Graphics::FloatDimension& dim
        FloatRectangle bounds = GetCenterAlignedRect(dim.width, dim.height);
        __init = true;
        _centerAlign = true;
-
+       __boundsChangedInternally = true;
        r = SetBounds(bounds);
+       __boundsChangedInternally = false;
        SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
-
        return GetCore().Initialize(hasTitle, bounds);
 }
 
@@ -312,23 +314,43 @@ _PopupImpl::OnChangeLayout(_ControlOrientation orientation)
        {
                _centerAlign = true;
 
-               if(GetXmlBounds(bounds))
+               if (__boundsChangedExternally)
                {
-                       bounds = GetCenterAlignedRect(bounds.width, bounds.height);
+                       bounds = GetCenterAlignedRect(GetBounds().width, GetBounds().height);
+                       __boundsChangedInternally = true;
+                       r = SetBounds(bounds);
+                       __boundsChangedInternally = false;
                }
                else
                {
-                       bounds = GetCenterAlignedRect(GetBounds().width, GetBounds().height);
+
+                       if(GetXmlBounds(bounds))
+                       {
+                               bounds = GetCenterAlignedRect(bounds.width, bounds.height);
+                       }
+                       else
+                       {
+                               bounds = GetCenterAlignedRect(GetBounds().width, GetBounds().height);
+                       }
+                       __boundsChangedInternally = true;
+                       r = SetBounds(bounds);
+                       __boundsChangedInternally =  false;
                }
-               r = SetBounds(bounds);
+
                SysTryReturnVoidResult(NID_UI_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
        }
        else
        {
-               if(GetXmlBounds(bounds))
+               if (!__boundsChangedExternally)
                {
-                       r = SetBounds(bounds);
+                       if(GetXmlBounds(bounds))
+                       {
+                               __boundsChangedInternally = true;
+                               r = SetBounds(bounds);
+                               __boundsChangedInternally = false;
+                       }
                }
+
                SysTryReturnVoidResult(NID_UI_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
 
        }
@@ -362,6 +384,11 @@ _PopupImpl::OnBoundsChanging(const FloatRectangle& bounds)
 void
 _PopupImpl::OnBoundsChanged(void)
 {
+       if (!__boundsChangedInternally && __init)
+       {
+               __boundsChangedExternally = true;
+       }
+
        FloatRectangle rect = GetBoundsF();
        if (__init)
        {
@@ -376,8 +403,9 @@ _PopupImpl::OnBoundsChanged(void)
        }
 
        _centerAlign = true;
-
+       __boundsChangedInternally = true;
        result r = SetBounds(rect, true);
+       __boundsChangedInternally = false;
        if (IsFailed(r))
        {
                // Error propagation fall through
index bd05613..4c3613c 100644 (file)
@@ -111,6 +111,8 @@ private:
        bool __init;
        bool __callBoundsChange;
        Tizen::Graphics::FloatPoint __prevPos;
+       bool __boundsChangedInternally;
+       bool __boundsChangedExternally;
 }; // _PopupImpl