add patch
[framework/osp/uifw.git] / src / ui / controls / FUiCtrl_OverlayPanelImpl.cpp
index e687b2c..1b1c203 100644 (file)
@@ -31,6 +31,7 @@
 #include "FUi_ControlManager.h"
 #include "FUi_ResourceSizeInfo.h"
 #include "FUi_UiBuilder.h"
+#include "FUiCtrl_FormImpl.h"
 #include "FUiCtrl_OverlayAgent.h"
 #include "FUiCtrl_OverlayPanelImpl.h"
 
@@ -118,6 +119,79 @@ _OverlayPanelImpl::~_OverlayPanelImpl(void)
 }
 
 void
+_OverlayPanelImpl::SetChildBuilderBounds(_ContainerImpl* pContainerImpl, _ControlOrientation controlOrientation)
+{
+       FloatRectangle builderBounds;
+       _ContainerImpl* pTempContainerImpl;
+
+       for(int i = 0; i < pContainerImpl->GetChildCount(); i++)
+       {
+               _ControlImpl* pControlImpl =  pContainerImpl->GetChild(i);
+               bool exist = pControlImpl->GetBuilderBoundsF(controlOrientation, builderBounds);
+               if (!exist)
+               {
+                       continue;
+               }
+
+               pControlImpl->SetBounds(builderBounds);
+               pTempContainerImpl = dynamic_cast<_ContainerImpl*>(pControlImpl);
+               if (pTempContainerImpl != null)
+               {
+                       SetChildBuilderBounds(pTempContainerImpl, controlOrientation);
+               }
+       }
+}
+
+result
+_OverlayPanelImpl::OnAttachedToMainTree(void)
+{
+       //result r = SetFocusable(false);
+       result r = E_SUCCESS;
+
+       _ControlOrientation controlOrientation = _CONTROL_ORIENTATION_PORTRAIT;
+       FloatRectangle builderBounds;
+       bool exist = GetBuilderBoundsF(controlOrientation, builderBounds);
+
+       if (exist)
+       {
+               _ContainerImpl* pContainerImpl = this;
+               _FormImpl* pParentImpl = null;
+
+               while (pContainerImpl)
+               {
+                       pParentImpl = dynamic_cast<_FormImpl*>(pContainerImpl->GetParent());
+                       if (pParentImpl != null)
+                       {
+                               break;
+                       }
+                       else
+                       {
+                               pContainerImpl = pContainerImpl->GetParent();
+                       }
+               }
+
+               if (pParentImpl)
+               {
+                       OrientationStatus orientation = pParentImpl->GetOrientationStatus();
+                       if (orientation == ORIENTATION_STATUS_LANDSCAPE || orientation == ORIENTATION_STATUS_LANDSCAPE_REVERSE)
+                       {
+                               controlOrientation = _CONTROL_ORIENTATION_LANDSCAPE;
+                               GetBuilderBoundsF(controlOrientation, builderBounds);
+                       }
+
+                       r = SetBounds(builderBounds);
+                       SysTryLog(NID_UI_CTRL, r == E_SUCCESS, "[%s] Failed to SetBounds", GetErrorMessage(r));
+                       SetChildBuilderBounds(this, controlOrientation);
+               }
+       }
+
+       r = _ContainerImpl::OnAttachedToMainTree();
+       SysTryLog(NID_UI_CTRL, r == E_SUCCESS, "[%s] Failed to OnAttachedToMainTree", GetErrorMessage(r));
+
+       return r;
+}
+
+void
 _OverlayPanelImpl::SetRendererRotation(OverlayPanel::Rotation rotation)
 {
        GetCore().SetRendererRotation(rotation);