2 // Open Service Platform
3 // Copyright (c) 2012-2013 Samsung Electronics Co., Ltd.
5 // Licensed under the Apache License, Version 2.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://www.apache.org/licenses/LICENSE-2.0/
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.
24 #include "FUiCtrl_IconListUtils.h"
26 namespace Tizen { namespace Ui { namespace Controls
29 namespace _IconListUtils
32 const float TouchAnimation::FRAME_RATIO[TouchAnimation::FRAME_COUNT] =
33 {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};
35 TouchAnimation::TouchAnimation(void)
41 TouchAnimation::~TouchAnimation(void)
47 TouchAnimation::GetTouchAnimationFrame(float& ratio)
49 ratio = FRAME_RATIO[__frame++];
50 if (__frame >= FRAME_COUNT)
52 __frame = FRAME_COUNT - 1;
59 TouchAnimation::GetCurrentAnimationFrame(void) const
61 return FRAME_RATIO[__frame];
65 TouchAnimation::StartAnimation(void)
70 MagneticScrollAnimation::MagneticScrollAnimation(void)
76 MagneticScrollAnimation::~MagneticScrollAnimation(void)
82 MagneticScrollAnimation::GetMagneticScrollAnimationFrame(float& diff)
84 if (_FloatCompare(__scroll, 0.0f))
89 else if (!_FloatCompareLE(__scroll, 0.0f))
91 diff = (__scroll - 1) / MAGNETIC_SCROLL_EFFECT_DIVIDER + 1;
102 diff = (__scroll + 1) / MAGNETIC_SCROLL_EFFECT_DIVIDER - 1;
114 MagneticScrollAnimation::StartAnimation(float scroll)
119 CheckAnimation::CheckAnimation(void)
124 CheckAnimation::~CheckAnimation(void)
129 CheckAnimation::GetCheckAnimationFrame(float& ratio)
132 ratio = (float)__frame / (float)FRAME_COUNT;
134 if (__frame >= FRAME_COUNT)
143 CheckAnimation::GetCurrentAnimationFrame(void) const
145 float frame = (float) __frame;
151 return frame / (float) FRAME_COUNT;
155 CheckAnimation::StartAnimation(void)
161 EnumConverter::ConvertIconListViewItemDrawingStatusToListItemState(IconListViewItemDrawingStatus status)
165 case ICON_LIST_VIEW_ITEM_DRAWING_STATUS_NORMAL:
166 return LIST_ITEM_STATE_NORMAL;
168 case ICON_LIST_VIEW_ITEM_DRAWING_STATUS_PRESSED:
169 return LIST_ITEM_STATE_PRESSED;
171 case ICON_LIST_VIEW_ITEM_DRAWING_STATUS_HIGHLIGHTED:
172 return LIST_ITEM_STATE_HIGHLIGHTED;
175 return LIST_ITEM_STATE_NORMAL;
178 IconListViewItemDrawingStatus
179 EnumConverter::ConvertListItemStateToIconListViewItemDrawingStatus(ListItemState state)
183 case LIST_ITEM_STATE_NORMAL:
184 return ICON_LIST_VIEW_ITEM_DRAWING_STATUS_NORMAL;
186 case LIST_ITEM_STATE_PRESSED:
187 return ICON_LIST_VIEW_ITEM_DRAWING_STATUS_PRESSED;
189 case LIST_ITEM_STATE_HIGHLIGHTED:
190 return ICON_LIST_VIEW_ITEM_DRAWING_STATUS_HIGHLIGHTED;
193 return ICON_LIST_VIEW_ITEM_DRAWING_STATUS_NORMAL;
196 return ICON_LIST_VIEW_ITEM_DRAWING_STATUS_NORMAL;
199 } // Tizen::Ui::Controls::_IconListUtils
201 }}} // Tizen::Ui::Controls