Changed indicator bg color.
[platform/framework/native/uifw.git] / src / ui / controls / FUiCtrl_AnimationFrameImpl.cpp
1 //
2 // Open Service Platform
3 // Copyright (c) 2012-2013 Samsung Electronics Co., Ltd.
4 //
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
8 //
9 //     http://www.apache.org/licenses/LICENSE-2.0/
10 //
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.
16 //
17
18 /**
19  * @file                FUiCtrl_AnimationFrameImpl.cpp
20  * @brief               This is the implementation file for the _AnimationFrameImpl class.
21  */
22
23 #include <FUiCtrlAnimationFrame.h>
24 #include <FBaseSysLog.h>
25 #include <FGrp_BitmapImpl.h>
26 #include "FUiCtrl_AnimationFrameImpl.h"
27
28 using namespace Tizen::Graphics;
29
30 namespace Tizen { namespace Ui { namespace Controls
31 {
32
33 _AnimationFrameImpl::_AnimationFrameImpl(void)
34         : __pFrame(null)
35         , __duration(0)
36 {
37 }
38
39 _AnimationFrameImpl::_AnimationFrameImpl(const Bitmap& frame, long duration)
40         : __pFrame(null)
41         , __duration(0)
42 {
43         result r = E_SUCCESS;
44
45         r = SetFrame(frame);
46         SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
47         r = SetDuration(duration);
48         SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
49
50         return;
51
52 CATCH:
53         delete __pFrame;
54         __pFrame = null;
55
56         return;
57 }
58
59 _AnimationFrameImpl::~_AnimationFrameImpl(void)
60 {
61         delete __pFrame;
62         __pFrame = null;
63 }
64
65 result
66 _AnimationFrameImpl::SetFrame(const Bitmap& frame)
67 {
68         Bitmap* pNewFrame = _BitmapImpl::CloneN(frame);
69         result r = GetLastResult();
70
71         SysTryReturn(NID_UI_CTRL, pNewFrame != null, r, r, "[%s] Propagating.", GetErrorMessage(r));
72
73         delete __pFrame;
74         __pFrame = pNewFrame;
75
76         return r;
77 }
78
79 const Bitmap*
80 _AnimationFrameImpl::GetFrame(void) const
81 {
82         return __pFrame;
83 }
84
85 result
86 _AnimationFrameImpl::SetDuration(long duration)
87 {
88         SysTryReturnResult(NID_UI_CTRL, duration > 0, E_INVALID_ARG, "Invalid argument(s) is used. Duration must be a positive integer.");
89
90         __duration = duration;
91
92         return E_SUCCESS;
93 }
94
95 long
96 _AnimationFrameImpl::GetDuration(void) const
97 {
98         return __duration;
99 }
100
101 }}} // Tizen::Ui::Controls