Applied auto hide and fixed popup bug regarding indicator.
authorKeuckdo Bang <keuckdo.bang@samsung.net>
Tue, 11 Jun 2013 00:32:33 +0000 (09:32 +0900)
committerKeuckdo Bang <keuckdo.bang@samsung.net>
Tue, 11 Jun 2013 02:22:07 +0000 (11:22 +0900)
Change-Id: Iab298526b051865904d24ace402e9e9694721e05

src/ui/controls/FUiCtrl_Form.cpp
src/ui/controls/FUiCtrl_FormImpl.cpp
src/ui/controls/FUiCtrl_Indicator.cpp
src/ui/controls/FUiCtrl_Popup.cpp
src/ui/inc/FUiCtrl_Form.h
src/ui/inc/FUiCtrl_Indicator.h

index e8ba268..487ff38 100644 (file)
@@ -2031,6 +2031,10 @@ _Form::IsIndicatorTranslucent(void) const
                        {
                                transparent = false;
                        }
+                       else
+                       {
+                               transparent = true;
+                       }
                }
        }
        else
@@ -2042,6 +2046,22 @@ _Form::IsIndicatorTranslucent(void) const
 }
 
 bool
+_Form::IsIndicatorAutoHide(void) const
+{
+       _Control* pParent = GetParent();
+       _Frame* pFrame = dynamic_cast<_Frame*>(pParent);
+
+       bool autohide = false;
+
+       if (pFrame && IsAttachedToMainTree())
+       {
+               autohide = __pIndicator->GetIndicatorAutoHide();
+       }
+
+       return autohide;
+}
+
+bool
 _Form::IsHeaderTranslucent(void) const
 {
        return __transparentHeader;
@@ -2916,7 +2936,7 @@ _Form::SetTabStyle(int style)
 }
 
 result
-_Form::SetIndicatorShowState(bool state, bool hide)
+_Form::SetIndicatorShowState(bool state)
 {
        result r = E_SUCCESS;
 
@@ -2939,7 +2959,7 @@ _Form::SetIndicatorShowState(bool state, bool hide)
                        {
                                if (pFrame->GetShowMode(false) == FRAME_SHOW_MODE_FULL_SCREEN)
                                {
-                                       r = __pIndicator->SetIndicatorShowState(state, hide);
+                                       r = __pIndicator->SetIndicatorShowState(state);
                                        SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
                                }
                        }
@@ -2951,13 +2971,13 @@ _Form::SetIndicatorShowState(bool state, bool hide)
                }
                else if (mode == FRAME_SHOW_MODE_FULL_SCREEN)
                {
-                       r = __pIndicator->SetIndicatorShowState(state, hide);
+                       r = __pIndicator->SetIndicatorShowState(state);
                        SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
                }
        }
        else if (!pFrame && IsAttachedToMainTree())
        {
-               r = __pIndicator->SetIndicatorShowState(false, true);
+               r = __pIndicator->SetIndicatorShowState(false);
        }
 
        __indicatorShowState = state;
@@ -2966,6 +2986,26 @@ _Form::SetIndicatorShowState(bool state, bool hide)
 }
 
 result
+_Form::SetIndicatorAutoHide(bool autohide)
+{
+       result r = E_SUCCESS;
+
+       _Control* pParent = GetParent();
+       _Frame* pFrame = dynamic_cast<_Frame*>(pParent);
+
+       if (pFrame && IsAttachedToMainTree())
+       {
+               FrameShowMode mode = pFrame->GetShowMode();
+               if (mode == FRAME_SHOW_MODE_FULL_SCREEN)
+               {
+                       r = __pIndicator->SetIndicatorAutoHide(autohide);
+                       SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
+               }
+       }
+       return r;
+}
+
+result
 _Form::SetIndicatorOpacity(_IndicatorOpacity opacity)
 {
        result r = E_SUCCESS;
@@ -3137,12 +3177,15 @@ _Form::AttachedToMainTree(void)
                                SetIndicatorShowState(__indicatorShowState);
                }
 
+               SetIndicatorAutoHide(false);
                r = GetLastResult();
                SysTryReturnResult(NID_UI_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
        }
        else if (FORM_STYLE_INDICATOR_AUTO_HIDE & GetFormStyle())
        {
-               SetIndicatorShowState(__indicatorShowState, true);
+               AddIndicatorObject();
+               SetIndicatorShowState(__indicatorShowState);
+               SetIndicatorAutoHide(true);
        }
        else
        {
@@ -3488,7 +3531,21 @@ _Form::OnVisibleStateChanged(void)
 {
        if (GetVisibleState())
        {
-               SetIndicatorShowState(__indicatorShowState);
+               if (FORM_STYLE_INDICATOR & GetFormStyle())
+               {
+                       SetIndicatorShowState(__indicatorShowState);
+                       SetIndicatorAutoHide(false);
+               }
+               else if (FORM_STYLE_INDICATOR_AUTO_HIDE & GetFormStyle())
+               {
+                       SetIndicatorShowState(true);
+                       SetIndicatorAutoHide(true);
+               }
+               else
+               {
+                       SetIndicatorShowState(false);
+                       SetIndicatorAutoHide(false);
+               }
        }
 }
 
index 3475998..de0c8d7 100644 (file)
@@ -328,18 +328,21 @@ _FormImpl::SetFormStyle(unsigned long formStyle)
        {
                GetCore().SetIndicatorShowState(true);
                indicatorBounds = GetCore().GetIndicatorBoundsF();
+               GetCore().SetIndicatorAutoHide(false);
                r = GetLastResult();
                SysTryReturnVoidResult(NID_UI_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
 
        }
        else if(FORM_STYLE_INDICATOR_AUTO_HIDE & formStyle)
        {
-               r = GetCore().SetIndicatorShowState(false, true);
+               r = GetCore().SetIndicatorShowState(true);
+               r = GetCore().SetIndicatorAutoHide(true);
                SysTryReturnVoidResult(NID_UI_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
        }
        else
        {
                r = GetCore().SetIndicatorShowState(false);
+               r = GetCore().SetIndicatorAutoHide(false);
                SysTryReturnVoidResult(NID_UI_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
        }
 
@@ -1190,7 +1193,6 @@ _FormImpl::OnChangeLayout(_ControlOrientation orientation)
                                {
                                        curPoint.y = portraitSize.width / portraitSize.height * prevPoint.y;
                                }
-
                        }
 
                        pFrameImpl->SetPosition(curPoint);
index 777694a..fe5af99 100644 (file)
@@ -57,10 +57,10 @@ static const int CONNECTION_INTERVAL = 1000;
 
 typedef enum
 {
-   INDICATOR_TYPE_UNKNOWN, /**< Unknown indicator type mode */
-   INDICATOR_TYPE_1, /**< Type 0 the the indicator */
-   INDICATOR_TYPE_2, /**< Type 1 the indicator */
-} IndicatorTypeMode;
+   _INDICATOR_TYPE_UNKNOWN, /**< Unknown indicator type mode */
+   _INDICATOR_TYPE_1, /**< Type 0 the the indicator */
+   _INDICATOR_TYPE_2, /**< Type 1 the indicator */
+} _IndicatorTypeMode;
 
 _Indicator*
 _Indicator::CreateIndicator(void)
@@ -93,6 +93,7 @@ _Indicator::_Indicator(void)
        , __pCurrentVisualElement(null)
        , __pWindow(null)
        , __showstate(false)
+       , __autohide(false)
        , __opacity(_INDICATOR_OPACITY_OPAQUE)
        , __orientation(_CONTROL_ORIENTATION_PORTRAIT)
 {
@@ -109,7 +110,7 @@ _Indicator::~_Indicator(void)
 }
 
 result
-_Indicator::SetIndicatorShowState(bool state, bool hide)
+_Indicator::SetIndicatorShowState(bool state)
 {
        result r = E_SUCCESS;
 
@@ -118,18 +119,10 @@ _Indicator::SetIndicatorShowState(bool state, bool hide)
 
        if (__pWindow)
        {
-               if (hide)
-               {
-                       r = pEcoreEvas->SetIndicatorShowState(*__pWindow, true);
-               }
-               else
-               {
-                       r = pEcoreEvas->SetIndicatorShowState(*__pWindow, state);
-               }
+               r = pEcoreEvas->SetIndicatorShowState(*__pWindow, state);
+               SysTryReturnResult(NID_UI_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
        }
 
-       SysTryReturnResult(NID_UI_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
-
        __showstate = state;
 
        SetShowState(state);
@@ -143,6 +136,35 @@ _Indicator::SetIndicatorShowState(bool state, bool hide)
 }
 
 result
+_Indicator::SetIndicatorAutoHide(bool autohide)
+{
+       Ecore_X_Window win;
+       if (__pWindow)
+       {
+               win = (Ecore_X_Window)__pWindow->GetNativeHandle();
+       }
+
+       Ecore_Evas *pPortraitEe = ecore_evas_object_ecore_evas_get(__pPortraitIndicatorEvasObject);
+       SysTryReturnResult(NID_UI_CTRL, pPortraitEe, E_SYSTEM, "[E_SYSTEM] Unable to get evas.");
+       Ecore_Evas *pLandscapeEe = ecore_evas_object_ecore_evas_get(__pLandscapeIndicatorEvasObject);
+       SysTryReturnResult(NID_UI_CTRL, pLandscapeEe, E_SYSTEM, "[E_SYSTEM] Unable to get evas.");
+
+       if (autohide)
+       {
+               Color bgColor(0x00000000);
+               SetBackgroundColor(_Colorf((float)bgColor.GetRed() / 255.0f, (float)bgColor.GetGreen() / 255.0f, (float)bgColor.GetBlue() / 255.0f, (float)bgColor.GetAlpha() / 255.0f));
+   ecore_x_e_illume_indicator_opacity_set(win, ECORE_X_ILLUME_INDICATOR_TRANSPARENT);
+       }
+       else
+       {
+               SetIndicatorOpacity(__opacity);
+               ecore_x_e_illume_indicator_opacity_set(win, ECORE_X_ILLUME_INDICATOR_OPAQUE);
+       }
+
+       __autohide = autohide;
+}
+
+result
 _Indicator::SetIndicatorOpacity(_IndicatorOpacity opacity)
 {
        result r = E_SUCCESS;
@@ -180,9 +202,20 @@ _Indicator::GetIndicatorShowState(void) const
 _IndicatorOpacity
 _Indicator::GetIndicatorOpacity(void) const
 {
+       if (__autohide)
+       {
+               return _INDICATOR_OPACITY_TRANSPARENT;
+       }
+
        return __opacity;
 }
 
+bool
+_Indicator::GetIndicatorAutoHide(void) const
+{
+       return __autohide;
+}
+
 Rectangle
 _Indicator::GetIndicatorBounds(void) const
 {
@@ -365,7 +398,10 @@ _Indicator::OnChangeLayout(_ControlOrientation orientation)
                SetClipChildrenEnabled(false);
        }
        __orientation = orientation;
-       SetIndicatorOpacity(__opacity);
+       if (!__autohide)
+       {
+               SetIndicatorOpacity(__opacity);
+       }
 
        _EcoreEvas* pEcoreEvas = GetEcoreEvasMgr()->GetEcoreEvas();
        int rotation = 0;
@@ -515,18 +551,18 @@ _Indicator::OnMessageHandle(Ecore_Evas *pEe, int msgDomain, int msgId, void *dat
                }*/
                if (msgId == MSG_ID_INDICATOR_TYPE)
                {
-                       IndicatorTypeMode *pIndicatorTypeMode = (IndicatorTypeMode*)(data);
+                       _IndicatorTypeMode *pIndicatorTypeMode = (_IndicatorTypeMode*)(data);
 
                        _Window* pWindow =      _ControlManager::GetInstance()->_ControlManager::GetTopVisibleWindow();
                        SysTryReturnVoidResult(NID_UI_CTRL, pWindow, E_INVALID_STATE, "[E_INVALID_STATE] Indicator is not attached main tree.");
 
                        Ecore_X_Window win = (Ecore_X_Window)pWindow->GetNativeHandle();
 
-                       if (*pIndicatorTypeMode == INDICATOR_TYPE_1)
+                       if (*pIndicatorTypeMode == _INDICATOR_TYPE_1)
                        {
                          ecore_x_e_illume_indicator_type_set(win, ECORE_X_ILLUME_INDICATOR_TYPE_1);
                        }
-                       else if (*pIndicatorTypeMode == INDICATOR_TYPE_2)
+                       else if (*pIndicatorTypeMode == _INDICATOR_TYPE_2)
                        {
                          ecore_x_e_illume_indicator_type_set   (win, ECORE_X_ILLUME_INDICATOR_TYPE_2);
                        }
index 805acfa..ac7ef50 100644 (file)
@@ -422,6 +422,7 @@ _Popup::OnActivated(void)
 
        bool showstate = false;
        bool opacity = false;
+       bool autohide = false;
 
        _Control* pOwner = GetOwner();
        if (pOwner == null)
@@ -436,6 +437,7 @@ _Popup::OnActivated(void)
 
                        showstate = pForm->IsIndicatorVisible();
                        opacity = pForm->IsIndicatorTranslucent();
+                       autohide = pForm->IsIndicatorAutoHide();
                }
                else
                {
@@ -449,6 +451,7 @@ _Popup::OnActivated(void)
                {
                        showstate = pForm->IsIndicatorVisible();
                        opacity = pForm->IsIndicatorTranslucent();
+                       autohide = pForm->IsIndicatorAutoHide();
                }
 
                pOwner->LockInputEvent();
@@ -482,6 +485,7 @@ _Popup::OnActivated(void)
                {
                        __pIndicator->SetIndicatorOpacity(_INDICATOR_OPACITY_OPAQUE);
                }
+               __pIndicator->SetIndicatorAutoHide(autohide);
        }
 
        _Window::OnActivated();
@@ -498,11 +502,6 @@ _Popup::OnDeactivated(void)
 
        ReleaseTouchCapture();
 
-       if (__pIndicator)
-       {
-               __pIndicator->DeleteIndicatorObject();
-       }
-
        _Window::OnDeactivated();
 }
 
index 635a830..a40ec80 100644 (file)
@@ -135,6 +135,7 @@ public:
        bool IsHeaderVisible(void) const;
        bool IsFooterVisible(void) const;
        bool IsIndicatorTranslucent(void) const;
+       bool IsIndicatorAutoHide(void) const;
        bool IsHeaderTranslucent(void) const;
        bool IsFooterTranslucent(void) const;
        bool IsTabTranslucent(void) const;
@@ -180,7 +181,8 @@ public:
        void CreateSoftkey(unsigned long formStyle);
        void SetTabStyle(int style);
 
-       result SetIndicatorShowState(bool state, bool hide = false);
+       result SetIndicatorShowState(bool state);
+       result SetIndicatorAutoHide(bool autohide);
        result SetIndicatorOpacity(_IndicatorOpacity opacity);
 
        virtual bool OnMousePressed(const _Control& source, const _MouseInfo& mouseinfo);
index 76fd916..43b1d4f 100644 (file)
@@ -51,10 +51,12 @@ public:
 
                static _Indicator* CreateIndicator(void);
 
-               result SetIndicatorShowState(bool state, bool hide = false);
+               result SetIndicatorShowState(bool state);
+               result SetIndicatorAutoHide(bool autohide);
                result SetIndicatorOpacity(_IndicatorOpacity opacity);
                bool GetIndicatorShowState(void) const;
                _IndicatorOpacity GetIndicatorOpacity(void) const;
+               bool GetIndicatorAutoHide(void) const;
                result AddIndicatorObject(_Control* pControl, _Window* pWindow);
                result DeleteIndicatorObject(void);
                result ChangeCurrentVisualElement(Tizen::Ui::Animations::_VisualElement* pVisualElement);
@@ -84,6 +86,7 @@ private:
                Tizen::Ui::Animations::_VisualElement* __pCurrentVisualElement;
                _Window* __pWindow;
                bool __showstate;
+               bool __autohide;
                _IndicatorOpacity __opacity;
                Tizen::Ui::_ControlOrientation __orientation;