From: Choi Munseok Date: Mon, 8 Jul 2013 09:08:24 +0000 (+0900) Subject: Fixed to decide the position of the mini App X-Git-Tag: accepted/tizen/20130924.144426~1^2~139^2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=9d79922e94340196bcff0b2c7760e59abb7e8de5;hp=f411487fba90fcda3b1ff3bd042e002b9fae9f3d;p=platform%2Fframework%2Fnative%2Fuifw.git Fixed to decide the position of the mini App Change-Id: I96115fa51a565314af8b33615ed6a54a47b1c7b9 Signed-off-by: Choi Munseok --- diff --git a/src/ui/controls/FUiCtrl_FormImpl.cpp b/src/ui/controls/FUiCtrl_FormImpl.cpp index 8176e42..ae4e508 100644 --- a/src/ui/controls/FUiCtrl_FormImpl.cpp +++ b/src/ui/controls/FUiCtrl_FormImpl.cpp @@ -1205,6 +1205,7 @@ _FormImpl::OnChangeLayout(_ControlOrientation orientation) portraitSize = pFrameImpl->GetSizeF(); landscapeSize = portraitSize; pFrameImpl->GetCore().SetMovable(movable); + pFrameImpl->GetCore().SetFloatingOrientation(orientation); } } diff --git a/src/ui/controls/FUiCtrl_Frame.cpp b/src/ui/controls/FUiCtrl_Frame.cpp index 6cc5b56..e318c02 100644 --- a/src/ui/controls/FUiCtrl_Frame.cpp +++ b/src/ui/controls/FUiCtrl_Frame.cpp @@ -61,6 +61,7 @@ _Frame::_Frame(void) : __pFramePresenter(null) , __pFrameEvent(null) , __floatingBounds(0.0f, 0.0f, 0.0f, 0.0f) + , __floatingOrientation(_CONTROL_ORIENTATION_PORTRAIT) , __showMode(FRAME_SHOW_MODE_FULL_SCREEN) , __restore(false) , __minimized(false) @@ -448,6 +449,15 @@ _Frame::SetFloatingBounds(const Rectangle& rect) __floatingBounds = _CoordinateSystemUtils::ConvertToFloat(rect); } +void +_Frame::SetFloatingOrientation(_ControlOrientation orientation) +{ + if ((__showMode == FRAME_SHOW_MODE_PARTIAL_SCREEN) || (__showMode == FRAME_SHOW_MODE_PARTIAL_SCREEN_FLOATING)) + { + __floatingOrientation = orientation; + } +} + result _Frame::SetShowMode(FrameShowMode showMode) { @@ -494,6 +504,67 @@ _Frame::SetShowMode(FrameShowMode showMode) int oldShowMode = __showMode; __showMode = showMode; + if ((__showMode == FRAME_SHOW_MODE_PARTIAL_SCREEN) || (__showMode == FRAME_SHOW_MODE_PARTIAL_SCREEN_FLOATING)) + { + _ControlOrientation orientation = _CONTROL_ORIENTATION_PORTRAIT; + _Form* pCurForm = GetCurrentForm(); + if (pCurForm) + { + orientation = pCurForm->GetOrientation(); + } + else + { + orientation = GetOrientation(); + } + + if (orientation == _CONTROL_ORIENTATION_PORTRAIT) + { + if (__floatingOrientation == _CONTROL_ORIENTATION_LANDSCAPE) + { + FloatDimension screenSize = _ControlManager::GetInstance()->_ControlManager::GetScreenSizeF(); + FloatPoint prevPoint(__floatingBounds.x, __floatingBounds.y); + FloatPoint curPoint(prevPoint.x, prevPoint.y); + float ratio = screenSize.width / screenSize.height; + + if (prevPoint.x > 0.0f) + { + curPoint.x = prevPoint.x * ratio; + } + + if (prevPoint.y > 0.0f) + { + curPoint.y = prevPoint.y / ratio; + } + + __floatingBounds.x = curPoint.x; + __floatingBounds.y = curPoint.y; + } + } + else + { + if (__floatingOrientation == _CONTROL_ORIENTATION_PORTRAIT) + { + FloatDimension screenSize = _ControlManager::GetInstance()->_ControlManager::GetScreenSizeF(); + FloatPoint prevPoint(__floatingBounds.x, __floatingBounds.y); + FloatPoint curPoint(prevPoint.x, prevPoint.y); + float ratio = screenSize.width / screenSize.height; + + if (prevPoint.x > 0.0f) + { + curPoint.x = prevPoint.x / ratio; + } + + if (prevPoint.y > 0.0f) + { + curPoint.y = prevPoint.y * ratio; + } + + __floatingBounds.x = curPoint.x; + __floatingBounds.y = curPoint.y; + } + } + } + result r = E_SUCCESS; switch (__showMode) @@ -558,6 +629,19 @@ _Frame::SetShowMode(FrameShowMode showMode) break; } + if ((__showMode == FRAME_SHOW_MODE_PARTIAL_SCREEN) || (__showMode == FRAME_SHOW_MODE_PARTIAL_SCREEN_FLOATING)) + { + _Form* pCurForm = GetCurrentForm(); + if (pCurForm) + { + __floatingOrientation = pCurForm->GetOrientation(); + } + else + { + __floatingOrientation = GetOrientation(); + } + } + return E_SUCCESS; } diff --git a/src/ui/controls/FUiCtrl_FrameImpl.cpp b/src/ui/controls/FUiCtrl_FrameImpl.cpp index c05cb7c..94a8dfa 100644 --- a/src/ui/controls/FUiCtrl_FrameImpl.cpp +++ b/src/ui/controls/FUiCtrl_FrameImpl.cpp @@ -390,6 +390,7 @@ _FrameImpl::OnChangeLayout(_ControlOrientation orientation) SetPosition(curPoint); SetMovable(movable); + GetCore().SetFloatingOrientation(orientation); } SetResizable(resizable); diff --git a/src/ui/inc/FUiCtrl_Frame.h b/src/ui/inc/FUiCtrl_Frame.h index e1f1784..532d4a4 100644 --- a/src/ui/inc/FUiCtrl_Frame.h +++ b/src/ui/inc/FUiCtrl_Frame.h @@ -81,6 +81,7 @@ public: // Floating void SetFloatingBounds(const Tizen::Graphics::Rectangle& rect); void SetFloatingBounds(const Tizen::Graphics::FloatRectangle& rect); + void SetFloatingOrientation(Tizen::Ui::_ControlOrientation orientation); result SetShowMode(FrameShowMode showMode); FrameShowMode GetShowMode(bool minimize = true) const; bool IsActivated(void) const; @@ -112,6 +113,7 @@ private: _FramePresenter* __pFramePresenter; _FrameEvent* __pFrameEvent; Tizen::Graphics::FloatRectangle __floatingBounds; + Tizen::Ui::_ControlOrientation __floatingOrientation; FrameShowMode __showMode; bool __restore; bool __minimized;