add patch
[framework/osp/uifw.git] / src / ui / controls / FUiCtrl_Slider.cpp
index 8518e71..44eb70a 100644 (file)
@@ -25,7 +25,6 @@
 #include <FBaseErrorDefine.h>
 #include <FGrp_BitmapImpl.h>
 #include "FUi_ResourceManager.h"
-#include "FUi_TouchManager.h"
 #include "FUi_AccessibilityContainer.h"
 #include "FUi_AccessibilityElement.h"
 #include "FUiAnim_VisualElement.h"
@@ -71,7 +70,7 @@ _Slider::_Slider(void)
        }
 
        _AccessibilityContainer* pContainer = GetAccessibilityContainer();
-       if (pContainer)
+       if (pContainer != null)
        {
                pContainer->Activate(true);
        }
@@ -79,17 +78,11 @@ _Slider::_Slider(void)
 
 _Slider::~_Slider(void)
 {
-       if (__pAdjustmentEvent != null)
-       {
-               delete __pAdjustmentEvent;
-               __pAdjustmentEvent = null;
-       }
+       delete __pAdjustmentEvent;
+       __pAdjustmentEvent = null;
 
-       if (__pSliderEvent != null)
-       {
-               delete __pSliderEvent;
-               __pSliderEvent = null;
-       }
+       delete __pSliderEvent;
+       __pSliderEvent = null;
 
        delete __pLeftBitmap;
        __pLeftBitmap = null;
@@ -100,7 +93,7 @@ _Slider::~_Slider(void)
        delete __pSliderPresenter;
        __pSliderPresenter = null;
 
-       if (__pAccessibilityElement)
+       if (__pAccessibilityElement != null)
        {
                __pAccessibilityElement->Activate(false);
                __pAccessibilityElement = null;
@@ -208,13 +201,13 @@ _Slider::InitializeAccessibilityElement(void)
 {
        result r = E_SUCCESS;
 
-       if (__pAccessibilityElement)
+       if (__pAccessibilityElement != null)
        {
                return r;
        }
 
        _AccessibilityContainer* pContainer = GetAccessibilityContainer();
-       if (pContainer)
+       if (pContainer != null)
        {
                __pAccessibilityElement = new (std::nothrow) _AccessibilityElement(true);
                SysTryReturn(NID_UI_CTRL, __pAccessibilityElement, E_OUT_OF_MEMORY, E_OUT_OF_MEMORY,
@@ -333,13 +326,18 @@ _Slider::OnFocusLost(const _Control& source)
 {
        __pSliderPresenter->SetFocusMode(false);
 
-       if ((GetStyle() & _SLIDER_STYLE_OVERLAY) && (!__pSliderPresenter->IsTouchPressed()) && (__isKeyPressed == true))
+       if ((GetStyle() & _SLIDER_STYLE_OVERLAY) && (!__pSliderPresenter->IsTouchPressed()) && (__isKeyPressed))
        {
                _SliderOverlay* pSliderOverlay = __pSliderPresenter->GetSliderOverlay();
                pSliderOverlay->SetVisibleState(false);
                pSliderOverlay->Close();
        }
 
+       if (__isKeyPressed)
+       {
+               FireAdjustmentValueEvent(GetValue());
+       }
+
        __isKeyPressed = false;
        Invalidate();
 
@@ -350,6 +348,21 @@ void
 _Slider::OnFocusModeStateChanged()
 {
        __pSliderPresenter->SetFocusMode(false);
+
+       if ((GetStyle() & _SLIDER_STYLE_OVERLAY) && __isKeyPressed )
+       {
+               _SliderOverlay* pSliderOverlay = __pSliderPresenter->GetSliderOverlay();
+               pSliderOverlay->SetVisibleState(false);
+               pSliderOverlay->Close();
+       }
+
+       if (__isKeyPressed)
+       {
+               FireAdjustmentValueEvent(GetValue());
+       }
+
+       __isKeyPressed = false;
+
        Invalidate();
 }
 
@@ -440,7 +453,7 @@ _Slider::OnBoundsChanged(void)
 {
        __pSliderPresenter->OnBoundsChanged();
 
-       if (__pAccessibilityElement)
+       if (__pAccessibilityElement != null)
        {
                __pAccessibilityElement->SetBounds(FloatRectangle(0.0f, 0.0f, GetBounds().width, GetBounds().height));
        }
@@ -581,17 +594,17 @@ _Slider::SetPropertyValue(const Variant& value)
 void
 _Slider::SetAccessibilityElementValue()
 {
-       if (__pAccessibilityElement)
+       if (__pAccessibilityElement != null)
        {
-       String string;
-       GET_STRING_CONFIG(IDS_TPLATFORM_BODY_POSITION_P1SD_OF_P2SD_T_TTS, string);
-       char buffer[10] = {0,};
-       sprintf(buffer, "%d", GetValue());
-       string.Replace(L"%1$d", buffer);
-       memset(buffer, 0, 10);
-       sprintf(buffer, "%d", __pSliderPresenter->GetMaxValue());
-       string.Replace(L"%2$d", buffer);
-       __pAccessibilityElement->SetValue(string);
+               String string;
+               GET_STRING_CONFIG(IDS_TPLATFORM_BODY_POSITION_P1SD_OF_P2SD_T_TTS, string);
+               char buffer[10] = {0,};
+               sprintf(buffer, "%d", GetValue());
+               string.Replace(L"%1$d", buffer);
+               memset(buffer, 0, 10);
+               sprintf(buffer, "%d", __pSliderPresenter->GetMaxValue());
+               string.Replace(L"%2$d", buffer);
+               __pAccessibilityElement->SetValue(string);
        }
 
        return;
@@ -972,11 +985,7 @@ _Slider::OnFontInfoRequested(unsigned long& style, float& size)
 void
 _Slider::OnAncestorVisibleStateChanged(const _Control& control)
 {
-       _TouchManager* pTouchMgr = _TouchManager::GetInstance();
-       if (pTouchMgr && (IsVisible() == false))
-       {
-               pTouchMgr->SetTouchCanceled(null);
-       }
+       __pSliderPresenter->OnAncestorVisibleStateChanged(control);
 
        return;
 }
@@ -992,7 +1001,7 @@ _Slider::OnAncestorEnableStateChanged(const _Control& control)
 bool
 _Slider::OnAccessibilityValueIncreased(const _AccessibilityContainer& control, const _AccessibilityElement& element)
 {
-       if (GetEnableState() == false)
+       if (!GetEnableState())
        {
                return true;
        }
@@ -1017,7 +1026,7 @@ _Slider::OnAccessibilityValueIncreased(const _AccessibilityContainer& control, c
 bool
 _Slider::OnAccessibilityValueDecreased(const _AccessibilityContainer& control, const _AccessibilityElement& element)
 {
-       if (GetEnableState() == false)
+       if (!GetEnableState())
        {
                return true;
        }