Fixed Coding Idioms Violations
[platform/framework/native/uifw.git] / src / ui / controls / FUiCtrl_Indicator.cpp
index cc7b448..c6da460 100644 (file)
@@ -118,6 +118,7 @@ _Indicator::_Indicator(void)
        , __startTouchPoint(0.0f, 0.0f)
        , __animationing(false)
        , __touchPressed(false)
+       , __quickpanelOpened(false)
 {
 }
 
@@ -386,9 +387,9 @@ _Indicator::AddIndicatorObject(_Control* pControl, _Window* pWindow)
                r = ChangeCurrentVisualElement(__pLandscapeVisualElement);
        }
 
-       Ecore_Evas *pPortraitEe = ecore_evas_object_ecore_evas_get(__pPortraitIndicatorEvasObject);
+       Ecore_EvaspPortraitEe = ecore_evas_object_ecore_evas_get(__pPortraitIndicatorEvasObject);
        SysTryReturn(NID_UI_CTRL, pPortraitEe, E_SYSTEM, E_SYSTEM, "[E_SYSTEM] Unable to get evas.");
-       Ecore_Evas *pLandscapeEe = ecore_evas_object_ecore_evas_get(__pLandscapeIndicatorEvasObject);
+       Ecore_EvaspLandscapeEe = ecore_evas_object_ecore_evas_get(__pLandscapeIndicatorEvasObject);
        SysTryReturn(NID_UI_CTRL, pLandscapeEe, E_SYSTEM, E_SYSTEM, "[E_SYSTEM] Unable to get evas.");
 
        ecore_evas_data_set(pPortraitEe, pPortPublicKey, __pPortraitIndicatorEvasObject);
@@ -429,8 +430,8 @@ _Indicator::DeleteIndicatorObject(void)
                }
        }
 
-       Ecore_Evas *pPortraitEe = ecore_evas_object_ecore_evas_get(__pPortraitIndicatorEvasObject);
-       Ecore_Evas *pLandscapeEe = ecore_evas_object_ecore_evas_get(__pLandscapeIndicatorEvasObject);
+       Ecore_EvaspPortraitEe = ecore_evas_object_ecore_evas_get(__pPortraitIndicatorEvasObject);
+       Ecore_EvaspLandscapeEe = ecore_evas_object_ecore_evas_get(__pLandscapeIndicatorEvasObject);
 
        if (pPortraitEe)
        {
@@ -595,7 +596,7 @@ _Indicator::OnTimerExpired(Timer& timer)
 }
 
 void
-_Indicator::OnDisconnected(Ecore_Evas *pEe)
+_Indicator::OnDisconnected(Ecore_EvaspEe)
 {
        _Indicator* pIndicator = (_Indicator*)ecore_evas_data_get(pEe, pIndicatorKey);
        SysTryReturnVoidResult(NID_UI_CTRL, pIndicator, E_SYSTEM, "[E_SYSTEM] Unable to get Indicator Object");
@@ -673,7 +674,7 @@ _Indicator::IsNotificationTrayOpenEnabled(void) const
 }
 
 void
-_Indicator::OnMessageHandle(Ecore_Evas *pEe, int msgDomain, int msgId, void *data, int size)
+_Indicator::OnMessageHandle(Ecore_EvaspEe, int msgDomain, int msgId, void *data, int size)
 {
        if (!data)
        {
@@ -690,7 +691,7 @@ _Indicator::OnMessageHandle(Ecore_Evas *pEe, int msgDomain, int msgId, void *dat
        {
                if (msgId == MSG_ID_INDICATOR_REPEAT_EVENT)
                {
-                       int *repeat = (int*)data;
+                       intrepeat = (int*)data;
                        if (1 == *repeat)
                        {
                                if (pPortraitIndicatorEvasObject)
@@ -726,7 +727,20 @@ _Indicator::OnMessageHandle(Ecore_Evas *pEe, int msgDomain, int msgId, void *dat
 
                        if (pData->xwin == win)
                        {
-                               pIndicator->ShowIndicatorEffect(true, pData->duration);
+                               if (pIndicator->__orientation == _CONTROL_ORIENTATION_PORTRAIT)
+                               {
+                                       if (pIndicator->__portraitautohide)
+                                       {
+                                               pIndicator->ShowIndicatorEffect(true, pData->duration);
+                                       }
+                               }
+                               else
+                               {
+                                       if (pIndicator->__landscapeautohide)
+                                       {
+                                               pIndicator->ShowIndicatorEffect(true, pData->duration);
+                                       }
+                               }
                        }
                }
 
@@ -796,7 +810,7 @@ _Indicator::ShowIndicatorEffect(bool down, int duration)
        SysTryReturnResult(NID_UI_CTRL, pSlideAnimation, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.");
 
        pSlideAnimation->SetDuration(duration);
-       pSlideAnimation->SetPropertyName( L"bounds.position");
+       pSlideAnimation->SetPropertyName(L"bounds.position");
        pSlideAnimation->SetVisualElementAnimationStatusEventListener(this);
 
        float indicatorHeight = 0.0f;
@@ -838,7 +852,7 @@ _Indicator::ShowIndicatorEffect(bool down, int duration)
                SysTryReturnResult(NID_UI_CTRL, pUserData, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.");
        }
        pSlideAnimation->SetUserData((void*)(pUserData));
-       AddAnimation( L"bounds.position", *pSlideAnimation);
+       AddAnimation(L"bounds.position", *pSlideAnimation);
 
        delete pSlideAnimation;
 
@@ -885,7 +899,7 @@ _Indicator::OnTouchPressed(const _Control& source, const _TouchInfo& touchinfo)
                }
                else
                {
-                       __startTouchPoint = touchinfo.GetCurrentPosition();
+                       __startTouchPoint = touchPosition;
                        __touchPressed = true;
                        __pointId = pointId;
                }
@@ -914,7 +928,7 @@ _Indicator::OnTouchPressed(const _Control& source, const _TouchInfo& touchinfo)
                }
        }
 
-       if (pTouchManager->IsListenerOnly(pointId) == true )
+       if (pTouchManager->IsListenerOnly(pointId) == true)
        {
                return true;
        }
@@ -961,6 +975,15 @@ _Indicator::OnTouchReleased(const _Control& source, const _TouchInfo& touchinfo)
 
                if (pTouchManager->IsListenerOnly(touchinfo.GetPointId()) == true)
                {
+                       _TouchManager* pTouchManager = _TouchManager::GetInstance();
+                       if (pTouchManager)
+                       {
+                               if(pTouchManager->GetTouchControlSource() == &source)
+                               {
+                                       SysLog(NID_UI, "VisibleState changed false, Call SetTouchCanceled");
+                                       pTouchManager->SetTouchCanceled(null);
+                               }
+                       }
                        return true;
                }
                else
@@ -968,6 +991,11 @@ _Indicator::OnTouchReleased(const _Control& source, const _TouchInfo& touchinfo)
                        return false;
                }
        }
+       else if (__quickpanelOpened == true)
+       {
+               OnChangeLayout(__orientation);
+               __quickpanelOpened = false;
+       }
        return false;
 }
 
@@ -986,7 +1014,7 @@ _Indicator::OnTouchMoved(const _Control& source, const _TouchInfo& touchinfo)
 
        if (__touchPressed)
        {
-               FloatPoint touchPoint = touchinfo.GetCurrentPosition();
+               FloatPoint touchPoint = source.ConvertToScreenPosition(touchinfo.GetCurrentPosition());
                float gap = touchPoint.y - __startTouchPoint.y;
 
                int touchGap = 0;
@@ -1031,6 +1059,12 @@ _Indicator::OnTouchMoved(const _Control& source, const _TouchInfo& touchinfo)
        }
        else
        {
+               if (__pAnimationTimer)
+               {
+                       __pAnimationTimer->Cancel();
+               }
+               __quickpanelOpened = true;
+               __animationing = false;
                r = false;
        }
        return r;
@@ -1095,6 +1129,9 @@ _Indicator::OnVisualElementAnimationRepeated(const Tizen::Ui::Animations::Visual
 void
 _Indicator::OnVisualElementAnimationFinished(const Tizen::Ui::Animations::VisualElementAnimation& animation, const Tizen::Base::String& keyName, Tizen::Ui::Animations::VisualElement& target, bool completedNormally)
 {
+       const FloatDimension portraitSize = _ControlManager::GetInstance()->_ControlManager::GetScreenSizeF();
+       const FloatDimension landscapeSize = FloatDimension(portraitSize.height, portraitSize.width);
+
        String* pUserData = (String*) animation.GetUserData();
 
        if ((pUserData != null) && (*pUserData == String(L"UpAnimation")))
@@ -1103,7 +1140,6 @@ _Indicator::OnVisualElementAnimationFinished(const Tizen::Ui::Animations::Visual
 
                int indicatorHeight = 0;
                GET_SHAPE_CONFIG(FORM::INDICATOR_HEIGHT, __pWindow->GetOrientation(), indicatorHeight);
-               SetBounds(FloatRectangle(0.0f, 0.0f, GetIndicatorBoundsF().width, indicatorHeight));
 
                if (__orientation == _CONTROL_ORIENTATION_PORTRAIT)
                {
@@ -1115,6 +1151,7 @@ _Indicator::OnVisualElementAnimationFinished(const Tizen::Ui::Animations::Visual
                                        __pPortraitVisualElement->SetShowState(false);
                                }
                        }
+                       SetBounds(FloatRectangle(0.0f, 0.0f, portraitSize.width, indicatorHeight));
                }
                else
                {
@@ -1126,6 +1163,7 @@ _Indicator::OnVisualElementAnimationFinished(const Tizen::Ui::Animations::Visual
                                        __pLandscapeVisualElement->SetShowState(false);
                                }
                        }
+                       SetBounds(FloatRectangle(0.0f, 0.0f, landscapeSize.width, indicatorHeight));
                }
                delete pUserData;
        }