Add _WINDOW_TYPE_VE and apply it to _SliderOverlay
authorChoi Munseok <ms47.choi@samsung.com>
Tue, 4 Jun 2013 06:41:39 +0000 (15:41 +0900)
committerChoi Munseok <ms47.choi@samsung.com>
Tue, 4 Jun 2013 06:41:39 +0000 (15:41 +0900)
Change-Id: Ic8be801ffbdd3e5f399c2595c88f222d47fc86f5
Signed-off-by: Choi Munseok <ms47.choi@samsung.com>
src/ui/FUi_ControlManager.cpp
src/ui/FUi_OrientationAgent.cpp
src/ui/FUi_Window.cpp
src/ui/controls/FUiCtrl_SliderOverlay.cpp
src/ui/inc/FUiCtrl_SliderOverlay.h
src/ui/inc/FUi_Window.h

index 86fdfb0..f164c9a 100644 (file)
@@ -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();
index ed7b45f..690d85a 100644 (file)
@@ -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);
+                                       }
                                }
                        }
                }
index 8257763..cc379fc 100644 (file)
@@ -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);
@@ -643,6 +720,11 @@ _Window::IsRotationSynchronized(void) const
 bool
 _Window::IsLayoutChangable(void) const
 {
+       if (__type == _WINDOW_TYPE_VE)
+       {
+               return true;
+       }
+
        return false;
 }
 
@@ -652,6 +734,12 @@ _Window::SetRotation(int rotation)
        __rotation = rotation;
 }
 
+_WindowType
+_Window::GetWindowType(void)
+{
+       return __type;
+}
+
 void
 _Window::OnChangeLayout(_ControlOrientation orientation)
 {
@@ -698,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)
index 7bb7e02..0cb7d7f 100644 (file)
@@ -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
 {
index c74c9c4..6f8b920 100644 (file)
@@ -46,7 +46,7 @@ public:
        void SetFont(Tizen::Graphics::Font* pFont);
        result DrawSliderOverlay(int positionX,int handleWidth, int value);
 
-       virtual result OnBoundsChanging(const Tizen::Graphics::FloatRectangle& bounds);
+//     virtual result OnBoundsChanging(const Tizen::Graphics::FloatRectangle& bounds);
        virtual bool IsActivatedOnOpen(void) const;
        virtual result OnAttachedToMainTree(void);
        virtual result OnDetachingFromMainTree(void);
index aad7128..d9aa69a 100644 (file)
@@ -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;