2 // Open Service Platform
3 // Copyright (c) 2012-2013 Samsung Electronics Co., Ltd.
5 // Licensed under the Flora License, Version 1.0 (the License);
6 // you may not use this file except in compliance with the License.
7 // You may obtain a copy of the License at
9 // http://floralicense.org/license/
11 // Unless required by applicable law or agreed to in writing, software
12 // distributed under the License is distributed on an AS IS BASIS,
13 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 // See the License for the specific language governing permissions and
15 // limitations under the License.
19 * @file FUiCtrl_IconListUtils.cpp
20 * @brief This is the implementation file for the _IconListUtils.
23 #include "FUiCtrl_IconListUtils.h"
25 namespace Tizen { namespace Ui { namespace Controls
28 namespace _IconListUtils
31 const float TouchAnimation::FRAME_RATIO[TouchAnimation::FRAME_COUNT] =
32 {0.9375, 0.875, 0.8125, 0.75, 0.6875, 0.625, 0.5625, 0.5, 0.5625, 0.625, 0.6875, 0.75, 0.8125, 0.875, 0.9375, 1.0};
34 TouchAnimation::TouchAnimation(void)
40 TouchAnimation::~TouchAnimation(void)
46 TouchAnimation::GetTouchAnimationFrame(float& ratio)
48 ratio = FRAME_RATIO[__frame++];
49 if (__frame >= FRAME_COUNT)
51 __frame = FRAME_COUNT - 1;
58 TouchAnimation::GetCurrentAnimationFrame(void) const
60 return FRAME_RATIO[__frame];
64 TouchAnimation::StartAnimation(void)
69 MagneticScrollAnimation::MagneticScrollAnimation(void)
75 MagneticScrollAnimation::~MagneticScrollAnimation(void)
81 MagneticScrollAnimation::GetMagneticScrollAnimationFrame(int& dif)
88 else if (__scroll > 0)
90 dif = (__scroll - 1) / MAGNETIC_SCROLL_EFFECT_DIVIDER + 1;
94 dif = (__scroll + 1) / MAGNETIC_SCROLL_EFFECT_DIVIDER - 1;
102 MagneticScrollAnimation::StartAnimation(int scroll)
107 CheckAnimation::CheckAnimation(void)
112 CheckAnimation::~CheckAnimation(void)
117 CheckAnimation::GetCheckAnimationFrame(float& ratio)
120 ratio = (float)__frame / (float)FRAME_COUNT;
122 if (__frame >= FRAME_COUNT)
131 CheckAnimation::GetCurrentAnimationFrame(void) const
133 float frame = (float)__frame;
139 return frame / (float)FRAME_COUNT;
143 CheckAnimation::StartAnimation(void)
149 EnumConverter::ConvertIconListViewItemDrawingStatusToListItemState(IconListViewItemDrawingStatus status)
153 case ICON_LIST_VIEW_ITEM_DRAWING_STATUS_NORMAL:
154 return LIST_ITEM_STATE_NORMAL;
156 case ICON_LIST_VIEW_ITEM_DRAWING_STATUS_PRESSED:
157 return LIST_ITEM_STATE_PRESSED;
159 case ICON_LIST_VIEW_ITEM_DRAWING_STATUS_HIGHLIGHTED:
160 return LIST_ITEM_STATE_HIGHLIGHTED;
163 return LIST_ITEM_STATE_NORMAL;
166 IconListViewItemDrawingStatus
167 EnumConverter::ConvertListItemStateToIconListViewItemDrawingStatus(ListItemState state)
171 case LIST_ITEM_STATE_NORMAL:
172 return ICON_LIST_VIEW_ITEM_DRAWING_STATUS_NORMAL;
174 case LIST_ITEM_STATE_PRESSED:
175 return ICON_LIST_VIEW_ITEM_DRAWING_STATUS_PRESSED;
177 case LIST_ITEM_STATE_HIGHLIGHTED:
178 return ICON_LIST_VIEW_ITEM_DRAWING_STATUS_HIGHLIGHTED;
181 return ICON_LIST_VIEW_ITEM_DRAWING_STATUS_NORMAL;
184 return ICON_LIST_VIEW_ITEM_DRAWING_STATUS_NORMAL;
187 } // Tizen::Ui::Controls::_IconListUtils
189 }}} // Tizen::Ui::Controls