From 994c86fcb788c9990cf60478fecad42081bfbeb4 Mon Sep 17 00:00:00 2001 From: Choi Munseok Date: Tue, 4 Jun 2013 16:04:17 +0900 Subject: [PATCH] Add _WINDOW_TYPE_VE and apply it to _SliderOverlay Change-Id: I9b9276150af6afe56e326df104dbf7a4f1002560 Signed-off-by: Choi Munseok --- src/ui/FUi_ControlManager.cpp | 34 +++++++-- src/ui/FUi_OrientationAgent.cpp | 30 ++++++-- src/ui/FUi_Window.cpp | 123 ++++++++++++++++++++++++++---- src/ui/controls/FUiCtrl_SliderOverlay.cpp | 16 +--- src/ui/inc/FUiCtrl_SliderOverlay.h | 1 - src/ui/inc/FUi_Window.h | 2 + 6 files changed, 161 insertions(+), 45 deletions(-) diff --git a/src/ui/FUi_ControlManager.cpp b/src/ui/FUi_ControlManager.cpp index 86fdfb0..f164c9a 100644 --- a/src/ui/FUi_ControlManager.cpp +++ b/src/ui/FUi_ControlManager.cpp @@ -555,10 +555,17 @@ _ControlManager::ActivateWindow(_Window& window) if (window.IsOrientationRoot() == false) { - _EcoreEvas* pEcoreEvas = ::GetEcoreEvasMgr()->GetEcoreEvas(); - if (pEcoreEvas) + if (window.GetWindowType() == _WINDOW_TYPE_VE) { - pEcoreEvas->SetWindowPreferredRotation(window, ::Convert(__orientationStatus)); + window.ChangeLayout(__orientation); + } + else + { + _EcoreEvas* pEcoreEvas = ::GetEcoreEvasMgr()->GetEcoreEvas(); + if (pEcoreEvas) + { + pEcoreEvas->SetWindowPreferredRotation(window, ::Convert(__orientationStatus)); + } } } @@ -761,11 +768,14 @@ _ControlManager::GetWindowCount(void) const result _ControlManager::AttachWindow(_Window& window) { - _IndicatorManager::GetInstance()->AddWindow(&window); - - if (window.IsDimmingEnabled()) + if (window.GetWindowType() != _WINDOW_TYPE_VE) { - _DimmingManager::GetInstance()->RegisterWindow(&window); + _IndicatorManager::GetInstance()->AddWindow(&window); + + if (window.IsDimmingEnabled()) + { + _DimmingManager::GetInstance()->RegisterWindow(&window); + } } return __pWindowList->Add(&window); @@ -1006,6 +1016,11 @@ _ControlManager::GetTouchedWindow(void) const _Window* pWindow = GetWindow((count-1) - i); _RootVisualElement* pRootVE = pWindow->GetRootVisualElement(); + if (!pRootVE) + { + continue; + } + _EflLayer* pLayer = static_cast<_EflLayer*>(pRootVE->GetNativeLayer()); Ecore_Evas* pEcoreEvas = pLayer->GetEcoreEvas(); @@ -1288,6 +1303,11 @@ _ControlManager::GetTopmostTouchedControl(const Point& point) } _RootVisualElement* pRootVE = pWindow->GetRootVisualElement(); + if (!pRootVE) + { + continue; + } + _EflLayer* pLayer = static_cast<_EflLayer*>(pRootVE->GetNativeLayer()); Ecore_Evas* pEcoreEvas = pLayer->GetEcoreEvas(); diff --git a/src/ui/FUi_OrientationAgent.cpp b/src/ui/FUi_OrientationAgent.cpp index ed7b45f..690d85a 100644 --- a/src/ui/FUi_OrientationAgent.cpp +++ b/src/ui/FUi_OrientationAgent.cpp @@ -438,14 +438,21 @@ _OrientationAgent::FireEvent(OrientationStatus status, bool callback) _Window* pOwnee = pImpl->GetCore().GetOwnee(i); if (pOwnee) { - if (!((callback == true) && (pOwnee->IsRotationSynchronized() == true))) + if (pOwnee->GetWindowType() == _WINDOW_TYPE_VE) { pOwnee->ChangeLayout(coreOrientation); } - - if (pOwnee->GetVisibleState() == true) + else { - pEcoreEvas->SetOwner(*pOwnee, pImpl->GetCore()); + if (!((callback == true) && (pOwnee->IsRotationSynchronized() == true))) + { + pOwnee->ChangeLayout(coreOrientation); + } + + if (pOwnee->GetVisibleState() == true) + { + pEcoreEvas->SetOwner(*pOwnee, pImpl->GetCore()); + } } } } @@ -459,14 +466,21 @@ _OrientationAgent::FireEvent(OrientationStatus status, bool callback) _Window* pOwnee = pParent->GetOwnee(i); if (pOwnee) { - if (!((callback == true) && (pOwnee->IsRotationSynchronized() == true))) + if (pOwnee->GetWindowType() == _WINDOW_TYPE_VE) { pOwnee->ChangeLayout(coreOrientation); } - - if (pOwnee->GetVisibleState() == true) + else { - pEcoreEvas->SetOwner(*pOwnee, *pParent); + if (!((callback == true) && (pOwnee->IsRotationSynchronized() == true))) + { + pOwnee->ChangeLayout(coreOrientation); + } + + if (pOwnee->GetVisibleState() == true) + { + pEcoreEvas->SetOwner(*pOwnee, *pParent); + } } } } diff --git a/src/ui/FUi_Window.cpp b/src/ui/FUi_Window.cpp index 6c0042a..cc379fc 100644 --- a/src/ui/FUi_Window.cpp +++ b/src/ui/FUi_Window.cpp @@ -187,9 +187,12 @@ _Window::Open(bool drawAndShow) bool visibleState = GetVisibleState(); if (!__isOpened && visibleState) { - _EcoreEvas* pEcoreEvas = GetEcoreEvasMgr()->GetEcoreEvas(); - SysTryReturn(NID_UI, pEcoreEvas, E_SYSTEM, E_SYSTEM, "[E_SYSTEM] A system error occurred."); - pEcoreEvas->SetWindowVisibleState(*GetRootWindow(), visibleState); + if (__type != _WINDOW_TYPE_VE) + { + _EcoreEvas* pEcoreEvas = GetEcoreEvasMgr()->GetEcoreEvas(); + SysTryReturn(NID_UI, pEcoreEvas, E_SYSTEM, E_SYSTEM, "[E_SYSTEM] A system error occurred."); + pEcoreEvas->SetWindowVisibleState(*GetRootWindow(), visibleState); + } __isOpened = true; __isInitialized = true; return _ControlManager::GetInstance()->OpenWindow(*this, drawAndShow); @@ -203,10 +206,13 @@ _Window::Close(void) { if (__isOpened) { - bool visibleState = GetVisibleState(); - _EcoreEvas* pEcoreEvas = GetEcoreEvasMgr()->GetEcoreEvas(); - SysTryReturnVoidResult(NID_UI, pEcoreEvas, E_SYSTEM, "[E_SYSTEM] A system error occurred."); - pEcoreEvas->SetWindowVisibleState(*GetRootWindow(), visibleState); + if (__type != _WINDOW_TYPE_VE) + { + bool visibleState = GetVisibleState(); + _EcoreEvas* pEcoreEvas = GetEcoreEvasMgr()->GetEcoreEvas(); + SysTryReturnVoidResult(NID_UI, pEcoreEvas, E_SYSTEM, "[E_SYSTEM] A system error occurred."); + pEcoreEvas->SetWindowVisibleState(*GetRootWindow(), visibleState); + } _ControlManager::GetInstance()->CloseWindow(*this); __isOpened = false; @@ -227,15 +233,18 @@ _Window::SetOwner(_Control* pOwner) if (pOwner) { - _EcoreEvas* pEcoreEvas = GetEcoreEvasMgr()->GetEcoreEvas(); - if (pEcoreEvas) + if (__type != _WINDOW_TYPE_VE) { - if (__transient == true) + _EcoreEvas* pEcoreEvas = GetEcoreEvasMgr()->GetEcoreEvas(); + if (pEcoreEvas) { - pEcoreEvas->SetOwner(*this, *pOwner); - } + if (__transient == true) + { + pEcoreEvas->SetOwner(*this, *pOwner); + } - __transient = true; + __transient = true; + } } } @@ -244,14 +253,42 @@ _Window::SetOwner(_Control* pOwner) return; } + _VisualElement* pVE = GetVisualElement(); + if (__pOwner) { __pOwner->DetachOwnee(*this); + + if (__type == _WINDOW_TYPE_VE) + { + _Window* pRootWindow = __pOwner->GetRootWindow(); + if (pRootWindow) + { + _RootVisualElement* pRootVE = pRootWindow->GetRootVisualElement(); + if (pRootVE && pVE) + { + pRootVE->DetachChild(*pVE); + } + } + } } if (pOwner) { pOwner->AttachOwnee(*this); + + if (__type == _WINDOW_TYPE_VE) + { + _Window* pRootWindow = pOwner->GetRootWindow(); + if (pRootWindow) + { + _RootVisualElement* pRootVE = pRootWindow->GetRootVisualElement(); + if (pRootVE && pVE) + { + pRootVE->AttachChild(*pVE); + } + } + } } _Control* pOldOwner = __pOwner; @@ -264,6 +301,11 @@ _Window::CreateRootVisualElement(_WindowType windowType) { __type = windowType; + if (__type == _WINDOW_TYPE_VE) + { + return E_SUCCESS; + } + result r = CreateLayer(); SysTryReturn(NID_UI, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r)); @@ -348,6 +390,12 @@ _Window::IsFocusableDescendant(const _Control* pFocus) const void _Window::SetActivationEnabled(bool enable) { + if (__type == _WINDOW_TYPE_VE) + { + SetFocusable(enable); + return; + } + _EcoreEvas* pEcoreEvas = GetEcoreEvasMgr()->GetEcoreEvas(); SysTryReturnVoidResult(NID_UI, pEcoreEvas, E_SYSTEM, "[E_SYSTEM] A system error occurred."); @@ -359,6 +407,11 @@ _Window::SetActivationEnabled(bool enable) bool _Window::IsActivationEnabled(void) { + if (__type == _WINDOW_TYPE_VE) + { + return IsFocusable(); + } + _EcoreEvas* pEcoreEvas = GetEcoreEvasMgr()->GetEcoreEvas(); SysTryReturn(NID_UI, pEcoreEvas, true, E_SYSTEM, "[E_SYSTEM] A system error occurred."); @@ -378,6 +431,11 @@ _Window::GetRootVisualElement(void) const NativeWindowHandle _Window::GetNativeHandle(void) const { + if (__type == _WINDOW_TYPE_VE) + { + return 0; + } + _RootVisualElement* pRootVE = GetRootVisualElement(); SysAssert(pRootVE); @@ -434,10 +492,14 @@ _Window::OnNativeWindowActivated(void) void _Window::OnFocusableStateChanged(bool focusalbeState) { + if (__type == _WINDOW_TYPE_VE) + { + return; + } + SetActivationEnabled(focusalbeState); } - bool _Window::OnNotifiedN(const _Control& source, IList* pArgs) { @@ -490,6 +552,11 @@ _Window::OnOwnerChanged(_Control* pOldOwner) result _Window::OnBoundsChanging(const FloatRectangle& bounds) { + if (__type == _WINDOW_TYPE_VE) + { + return E_SUCCESS; + } + _EcoreEvas* pEcoreEvas = GetEcoreEvasMgr()->GetEcoreEvas(); SysTryReturn(NID_UI, pEcoreEvas, E_SYSTEM, E_SYSTEM, "[E_SYSTEM] A system error occurred."); @@ -520,6 +587,11 @@ _Window::OnVisibleStateChanged(void) result _Window::OnAttachingToMainTree(const _Control* pParent) { + if (__type == _WINDOW_TYPE_VE) + { + return E_SUCCESS; + } + _EflLayer* pLayer = static_cast<_EflLayer*>(__pRootVisualElement->GetNativeLayer()); SysAssert(pLayer); SetVisibleState(true); @@ -531,6 +603,11 @@ _Window::OnAttachingToMainTree(const _Control* pParent) result _Window::OnDetachingFromMainTree(void) { + if (__type == _WINDOW_TYPE_VE) + { + return E_SUCCESS; + } + _EflLayer* pLayer = static_cast<_EflLayer*>(__pRootVisualElement->GetNativeLayer()); SysAssert(pLayer); pLayer->SetShowState(false); @@ -554,6 +631,7 @@ _Window::OnWindowStateChanged(void) // Change layout // Rotate window + SetOrientationCallbackModeEnabled(true); _EcoreEvas* pEcoreEvas = GetEcoreEvasMgr()->GetEcoreEvas(); if (!pEcoreEvas) { @@ -618,6 +696,7 @@ _Window::OnWindowStateChanged(void) Invalidate(true); SysLog(NID_UI, "[Window Manager Rotation] ---------- Update Ownee Window : END ----------"); + SetOrientationCallbackModeEnabled(false); } void @@ -641,6 +720,11 @@ _Window::IsRotationSynchronized(void) const bool _Window::IsLayoutChangable(void) const { + if (__type == _WINDOW_TYPE_VE) + { + return true; + } + return false; } @@ -650,6 +734,12 @@ _Window::SetRotation(int rotation) __rotation = rotation; } +_WindowType +_Window::GetWindowType(void) +{ + return __type; +} + void _Window::OnChangeLayout(_ControlOrientation orientation) { @@ -696,6 +786,11 @@ _Window::GetDisplayContext(void) const result _Window::SetZOrderGroup(int windowZOrderGroup) { + if (__type == _WINDOW_TYPE_VE) + { + return E_SUCCESS; + } + _EcoreEvas* pEcoreEvas = GetEcoreEvasMgr()->GetEcoreEvas(); if (windowZOrderGroup == WINDOW_Z_ORDER_GROUP_HIGHEST) diff --git a/src/ui/controls/FUiCtrl_SliderOverlay.cpp b/src/ui/controls/FUiCtrl_SliderOverlay.cpp index 7bb7e02..0cb7d7f 100644 --- a/src/ui/controls/FUiCtrl_SliderOverlay.cpp +++ b/src/ui/controls/FUiCtrl_SliderOverlay.cpp @@ -69,7 +69,7 @@ _SliderOverlay::Construct(_Control& owner) __pOwner = &owner; - r = CreateRootVisualElement(_WINDOW_TYPE_SUB); + r = CreateRootVisualElement(_WINDOW_TYPE_VE); SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r)); SetActivationEnabled(false); @@ -270,20 +270,6 @@ CATCH: return E_SYSTEM; } -result -_SliderOverlay::OnBoundsChanging(const FloatRectangle& bounds) -{ - _EcoreEvas* pEcoreEvas = GetEcoreEvasMgr()->GetEcoreEvas(); - SysTryReturn(NID_UI, pEcoreEvas, E_SYSTEM, E_SYSTEM, "[E_SYSTEM] A system error occurred."); - - FloatRectangle newBounds( bounds.x, bounds.y , __overlayWidth, bounds.height); - - pEcoreEvas->SetWindowBounds(*GetRootWindow(), newBounds); - result r = GetLastResult(); - SysTryReturn(NID_UI, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage); - return r; -} - bool _SliderOverlay::IsActivatedOnOpen(void) const { diff --git a/src/ui/inc/FUiCtrl_SliderOverlay.h b/src/ui/inc/FUiCtrl_SliderOverlay.h index c74c9c4..bb8d804 100644 --- a/src/ui/inc/FUiCtrl_SliderOverlay.h +++ b/src/ui/inc/FUiCtrl_SliderOverlay.h @@ -46,7 +46,6 @@ public: void SetFont(Tizen::Graphics::Font* pFont); result DrawSliderOverlay(int positionX,int handleWidth, int value); - virtual result OnBoundsChanging(const Tizen::Graphics::FloatRectangle& bounds); virtual bool IsActivatedOnOpen(void) const; virtual result OnAttachedToMainTree(void); virtual result OnDetachingFromMainTree(void); diff --git a/src/ui/inc/FUi_Window.h b/src/ui/inc/FUi_Window.h index aad7128..d9aa69a 100644 --- a/src/ui/inc/FUi_Window.h +++ b/src/ui/inc/FUi_Window.h @@ -43,6 +43,7 @@ enum _WindowType { _WINDOW_TYPE_MAIN, _WINDOW_TYPE_SUB, + _WINDOW_TYPE_VE, }; class _IWindowDelegate @@ -82,6 +83,7 @@ public: virtual bool IsFocusableDescendant(const _Control* pFocus) const; virtual bool IsLayoutChangable(void) const; void SetRotation(int rotation); + _WindowType GetWindowType(void); // Focus _Control* GetFocusedControl(void) const; -- 2.7.4