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.
18 * @file FUiCtrlAnimationFrame.cpp
19 * @brief This is the implementation file for AnimationFrame class.
22 #include <FUiCtrlAnimationFrame.h>
23 #include <FBaseSysLog.h>
24 #include "FUiCtrl_AnimationFrameImpl.h"
26 using namespace Tizen::Graphics;
28 namespace Tizen { namespace Ui { namespace Controls
31 AnimationFrame::AnimationFrame(void)
32 : __pAnimationFrameImpl(null)
36 __pAnimationFrameImpl = new (std::nothrow) _AnimationFrameImpl();
37 SysTryReturnVoidResult(NID_UI_CTRL, __pAnimationFrameImpl != null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.");
40 AnimationFrame::AnimationFrame(const Bitmap& frame, long duration)
41 : __pAnimationFrameImpl(null)
45 __pAnimationFrameImpl = new (std::nothrow) _AnimationFrameImpl(frame, duration);
46 SysTryReturnVoidResult(NID_UI_CTRL, __pAnimationFrameImpl != null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.");
49 AnimationFrame::~AnimationFrame(void)
51 delete __pAnimationFrameImpl;
52 __pAnimationFrameImpl = null;
56 AnimationFrame::SetFrame(const Bitmap& frame)
58 SysAssertf(__pAnimationFrameImpl != null, "Not yet constructed. Construct() should be called before use.");
60 result r = __pAnimationFrameImpl->SetFrame(frame);
61 SysTryReturnVoidResult(NID_UI_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
63 SetLastResult(E_SUCCESS);
68 AnimationFrame::GetFrame(void) const
72 SysAssertf(__pAnimationFrameImpl != null, "Not yet constructed. Construct() should be called before use.");
74 return __pAnimationFrameImpl->GetFrame();
78 AnimationFrame::SetDuration(long duration)
80 SysAssertf(__pAnimationFrameImpl != null, "Not yet constructed. Construct() should be called before use.");
82 result r = __pAnimationFrameImpl->SetDuration(duration);
83 SysTryReturnVoidResult(NID_UI_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
85 SetLastResult(E_SUCCESS);
90 AnimationFrame::GetDuration(void) const
94 SysAssertf(__pAnimationFrameImpl != null, "Not yet constructed. Construct() should be called before use.");
96 return __pAnimationFrameImpl->GetDuration();
99 }}} // Tizen::Ui::Controls