add patch
[framework/osp/uifw.git] / src / ui / controls / FUiCtrl_EditTimePresenter.cpp
index 9cbba23..2c12be0 100644 (file)
@@ -245,7 +245,7 @@ _EditTimePresenter::SetTimeConversion(void)
        int hour = GetHour();
        int minute = GetMinute();
 
-       if (__24hours == false)
+       if (!__24hours)
        {
                int max = DATETIME_HOUR_MAX_FOR_24NOTATION;
 
@@ -286,7 +286,7 @@ _EditTimePresenter::SetAmEnabled(bool amEnable)
        __amEnable = amEnable;
        int hour = GetHour();
 
-       if (__amEnable == true)
+       if (__amEnable)
        {
                __ampmString = textAm;
                if (hour >= DATETIME_HOUR_MAX_FOR_24NOTATION)
@@ -789,7 +789,7 @@ _EditTimePresenter::Draw(void)
        hourBounds = GetDisplayAreaBoundsFromHoursStyle(DATETIME_ID_HOUR);
        minuteBounds = GetDisplayAreaBoundsFromHoursStyle(DATETIME_ID_MINUTE);
 
-       if (__24hours == false)
+       if (!__24hours)
        {
                ampmBounds = GetDisplayAreaBoundsFromHoursStyle(DATETIME_ID_AMPM);
 
@@ -831,7 +831,7 @@ _EditTimePresenter::Draw(void)
        colonBounds.x = hourBounds.x + hourBounds.width + colonMargin;
        colonBounds.y = hourBounds.y + (hourBounds.height - colonBounds.height) / 2.0f;
 
-       if (__title.IsEmpty() == false)
+       if (!__title.IsEmpty())
        {
                r = DrawTitle(*pCanvas);
                SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
@@ -846,7 +846,7 @@ _EditTimePresenter::Draw(void)
        r = DrawColon(*pCanvas, colonBounds);
        SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
 
-       if (__24hours == false)
+       if (!__24hours)
        {
                r = DrawResourceBitmap(*pCanvas, ampmBounds, pReplacementBitmap);
                SysTryCatch(NID_UI_CTRL, (r == E_SUCCESS), , r, "[%s] Propagating.", GetErrorMessage(r));
@@ -1095,7 +1095,7 @@ _EditTimePresenter::GetBoxIdFromPosition(const FloatPoint& point) const
        FloatRectangle hoursBounds(0.0f, 0.0f, 0.0f, 0.0f);
        FloatRectangle minutesBounds(0.0f, 0.0f, 0.0f, 0.0f);
 
-       if (__24hours == false)
+       if (!__24hours)
        {
                ampmBounds = GetDisplayAreaBoundsFromHoursStyle(DATETIME_ID_AMPM);
        }
@@ -1108,15 +1108,15 @@ _EditTimePresenter::GetBoxIdFromPosition(const FloatPoint& point) const
                return displayBoxId;
        }
 
-       if (hoursBounds.Contains(point) == true)
+       if (hoursBounds.Contains(point))
        {
                displayBoxId = DATETIME_ID_HOUR;
        }
-       else if (minutesBounds.Contains(point) == true)
+       else if (minutesBounds.Contains(point))
        {
                displayBoxId = DATETIME_ID_MINUTE;
        }
-       else if (ampmBounds.Contains(point) == true)
+       else if (ampmBounds.Contains(point))
        {
                displayBoxId = DATETIME_ID_AMPM;
        }
@@ -1190,12 +1190,6 @@ _EditTimePresenter::OnKeyPressed(const _Control& source, const _KeyInfo& keyInfo
        }
        _KeyCode keyCode = keyInfo.GetKeyCode();
 
-       int minValue = -1;
-       int maxValue = -1;
-       int displayValue = -1;
-
-       _DateTimeId boxId = DATETIME_ID_HOUR;
-
        switch (keyCode)
        {
                case _KEY_RIGHT:
@@ -1220,7 +1214,6 @@ _EditTimePresenter::OnKeyPressed(const _Control& source, const _KeyInfo& keyInfo
                        __pEditTime->Invalidate();
                        break;
                }
-
                case _KEY_LEFT:
                {
                        __isEnterKeyPressed = false;
@@ -1240,6 +1233,39 @@ _EditTimePresenter::OnKeyPressed(const _Control& source, const _KeyInfo& keyInfo
                        break;
                }
 
+               default:
+               {
+                       return false;
+               }
+       }
+       return true;
+}
+
+bool
+_EditTimePresenter::OnKeyReleased(const _Control& source, const _KeyInfo& keyInfo)
+{
+       if (!__isFocused)
+       {
+               return false;
+       }
+       _KeyCode keyCode = keyInfo.GetKeyCode();
+
+       if (__isAnimating)
+       {
+               VisualElement *pEditTimeElement = __pEditTime->GetVisualElement();
+               result r = GetLastResult();
+               SysTryReturn(NID_UI_CTRL, (pEditTimeElement != null), false, r, "[%s] Propagating.", GetErrorMessage(r));
+               pEditTimeElement->RemoveAllAnimations();
+       }
+
+       int minValue = -1;
+       int maxValue = -1;
+       int displayValue = -1;
+
+       _DateTimeId boxId = DATETIME_ID_HOUR;
+
+       switch (keyCode)
+       {
                case _KEY_ENTER:
                {
                        __isEnterKeyPressed = true;
@@ -1350,7 +1376,7 @@ _EditTimePresenter::OnTouchPressed(const _Control& source, const _TouchInfo& tou
        hourBounds = GetDisplayAreaBoundsFromHoursStyle(DATETIME_ID_HOUR);
        minuteBounds = GetDisplayAreaBoundsFromHoursStyle(DATETIME_ID_MINUTE);
 
-       if (__24hours == false)
+       if (!__24hours)
        {
                ampmBounds = GetDisplayAreaBoundsFromHoursStyle(DATETIME_ID_AMPM);
        }
@@ -1367,7 +1393,7 @@ _EditTimePresenter::OnTouchPressed(const _Control& source, const _TouchInfo& tou
        {
                if (__pEditTime->GetDateTimeBar() != null)
                {
-                       if (__24hours == false)
+                       if (!__24hours)
                        {
                                if (GetHour() == 0)
                                {
@@ -1499,7 +1525,9 @@ _EditTimePresenter::OnTouchReleased(const _Control& source, const _TouchInfo& to
 
                if (__pEditTime->GetDateTimeBar()->IsActivated())
                {
+                       __pEditTime->GetDateTimeBar()->RemoveAllAnimations();
                        __pEditTime->GetDateTimeBar()->Close();
+                       __pEditTime->GetDateTimeBar()->SetVisibleState(true);
                        __pEditTime->GetDateTimeBar()->Open();
                }
                else
@@ -1651,7 +1679,7 @@ _EditTimePresenter::Initialize(void)
                editTimeHeight = __pEditTime->GetBoundsF().height;
        }
 
-       if (__title.IsEmpty() == false)
+       if (!__title.IsEmpty())
        {
                SetTitleBounds();
                if (!__isEditTimeInitialized)