From: Choi Munseok Date: Mon, 17 Jun 2013 08:27:23 +0000 (+0900) Subject: Added ChangeLayout and OnChangeLayout for 4 directions X-Git-Tag: accepted/tizen/20130924.144426~1^2~517^2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=360d9b2595797ea51ee9f82fa4a1a398d2bc2c0c;p=platform%2Fframework%2Fnative%2Fuifw.git Added ChangeLayout and OnChangeLayout for 4 directions Change-Id: I7dcf72e07d2c0c4de06d57fb34eac1ab7f2c193a Signed-off-by: Choi Munseok --- diff --git a/src/ui/FUi_Control.cpp b/src/ui/FUi_Control.cpp index 733cefc..d757490 100644 --- a/src/ui/FUi_Control.cpp +++ b/src/ui/FUi_Control.cpp @@ -912,6 +912,11 @@ _Control::OnChangeLayout(_ControlOrientation orientation) } void +_Control::OnChangeLayout(_ControlRotation rotation) +{ +} + +void _Control::OnZOrderChanging(_ControlZOrderUpdate zOrderUpdate) { } @@ -1064,7 +1069,7 @@ _Control::Show(void) } void -_Control::ChangeLayout(_ControlOrientation orientation) +_Control::ChangeLayout(_ControlOrientation orientation, bool callRotation) { ClearLastResult(); @@ -1094,6 +1099,49 @@ private: Accept(visitor); SysAssert(GetLastResult() == E_SUCCESS); + + if (callRotation == true) + { + _ControlManager* pMgr = _ControlManager::GetInstance(); + if (pMgr) + { + _ControlRotation rotation = pMgr->GetOrientationStatus(); + ChangeLayout(rotation); + } + } +} + +void +_Control::ChangeLayout(_ControlRotation rotation) +{ + ClearLastResult(); + + struct _Visitor + : public Visitor + { + _Visitor(_ControlRotation rotation) + : __rotation(rotation){} + + virtual VisitType Visit(_Control& control) + { + if (control.__rotation != __rotation) + { + control.__rotation = __rotation; + control.GetControlDelegate().OnChangeLayout(__rotation); + ClearLastResult(); + } + + return VISIT_DOWNWARD; + } + +private: + _ControlRotation __rotation; + }; + + _Visitor visitor(rotation); + Accept(visitor); + + SysAssert(GetLastResult() == E_SUCCESS); } bool @@ -3859,6 +3907,7 @@ _Control::_Control(void) , __area(_CONTROL_AREA_NONE) , __layer(_CONTROL_LAYER_NONE) , __orientation(_CONTROL_ORIENTATION_PORTRAIT) + , __rotation(_CONTROL_ROTATION_0) , __pTouchEventPreviewer(null) , __pKeyEventPreviewer(null) , __pNotificationEventPreviewer(null) diff --git a/src/ui/FUi_ControlImpl.cpp b/src/ui/FUi_ControlImpl.cpp index d925419..a67375e 100644 --- a/src/ui/FUi_ControlImpl.cpp +++ b/src/ui/FUi_ControlImpl.cpp @@ -2778,6 +2778,12 @@ _ControlImpl::OnChangeLayout(_ControlOrientation orientation) } void +_ControlImpl::OnChangeLayout(_ControlRotation rotation) +{ + GetCore().OnChangeLayout(rotation); +} + +void _ControlImpl::OnZOrderChanging(_ControlZOrderUpdate zOrderUpdate) { GetCore().OnZOrderChanging(zOrderUpdate); diff --git a/src/ui/FUi_Window.cpp b/src/ui/FUi_Window.cpp index 8df262f..c3fa3df 100644 --- a/src/ui/FUi_Window.cpp +++ b/src/ui/FUi_Window.cpp @@ -680,7 +680,27 @@ _Window::OnWindowStateChanged(void) SysLog(NID_UI, "[Window Manager Rotation] ---------- Update Ownee Window : START ----------"); _ControlOrientation controlOrientation = (rotation == 0 || rotation == 180) ? _CONTROL_ORIENTATION_PORTRAIT : _CONTROL_ORIENTATION_LANDSCAPE; - ChangeLayout(controlOrientation); + ChangeLayout(controlOrientation, false); + + _ControlRotation controlRotation = _CONTROL_ROTATION_0; + switch (rotation) + { + case 0: + controlRotation = _CONTROL_ROTATION_0; + break; + case 90: + controlRotation = _CONTROL_ROTATION_90; + break; + case 180: + controlRotation = _CONTROL_ROTATION_180; + break; + case 270: + controlRotation = _CONTROL_ROTATION_270; + break; + default: + break; + } + ChangeLayout(controlRotation); pEcoreEvas->RotateWindow(*this, __rotation, false); diff --git a/src/ui/inc/FUi_Control.h b/src/ui/inc/FUi_Control.h index 0ac77bc..1609eea 100644 --- a/src/ui/inc/FUi_Control.h +++ b/src/ui/inc/FUi_Control.h @@ -102,6 +102,7 @@ public: virtual void OnChildBoundsChanged(const _Control& child) = 0; virtual void OnChildVisibleStateChanged(const _Control& child) = 0; virtual void OnChangeLayout(_ControlOrientation orientation) = 0; // [ToDo] Generalize orientation to screen. + virtual void OnChangeLayout(_ControlRotation rotation) = 0; virtual void OnZOrderChanging(_ControlZOrderUpdate zOrderUpdate) = 0; virtual void OnVisibleStateChanging(void) = 0; virtual void OnVisibleStateChanged(void) = 0; @@ -258,6 +259,7 @@ public: virtual void OnChildBoundsChanged(const _Control& child); virtual void OnChildVisibleStateChanged(const _Control& child); virtual void OnChangeLayout(_ControlOrientation orientation); + virtual void OnChangeLayout(_ControlRotation rotation); virtual void OnZOrderChanging(_ControlZOrderUpdate zOrderUpdate); virtual void OnVisibleStateChanging(void); virtual void OnVisibleStateChanged(void); @@ -494,7 +496,8 @@ public: void SetUpdateLayoutState(bool state); // Orientation - void ChangeLayout(_ControlOrientation orientation); + void ChangeLayout(_ControlOrientation orientation, bool callRotation = true); + void ChangeLayout(_ControlRotation rotation); _ControlOrientation GetOrientation(void) const; virtual bool IsLayoutChangable(void) const; virtual bool IsOrientationRoot(void) const; @@ -678,6 +681,7 @@ private: _ControlArea __area; _ControlLayer __layer; _ControlOrientation __orientation; + _ControlRotation __rotation; _ITouchEventPreviewer* __pTouchEventPreviewer; _IKeyEventPreviewer* __pKeyEventPreviewer; diff --git a/src/ui/inc/FUi_ControlImpl.h b/src/ui/inc/FUi_ControlImpl.h index b79d7a2..46b96c5 100644 --- a/src/ui/inc/FUi_ControlImpl.h +++ b/src/ui/inc/FUi_ControlImpl.h @@ -154,6 +154,7 @@ public: virtual void OnChildBoundsChanged(const _Control& child); virtual void OnChildVisibleStateChanged(const _Control& child); virtual void OnChangeLayout(_ControlOrientation orientation); + virtual void OnChangeLayout(_ControlRotation rotation); virtual void OnZOrderChanging(_ControlZOrderUpdate zOrderUpdate); virtual void OnVisibleStateChanging(void); virtual void OnVisibleStateChanged(void);