2 // Open Service Platform
3 // Copyright (c) 2012 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 FUiTouchEffect.cpp
20 * @brief This is the implementation for TouchEffect class.
22 * This file contains definitions of %TouchEffect class.
26 #include <FBaseErrors.h>
27 #include <FBaseSysLog.h>
28 #include <FUiTouchEffect.h>
29 #include <FUi_TouchEffectImpl.h>
31 namespace Tizen { namespace Ui
34 TouchEffect::TouchEffect(void)
35 : __pTouchEffectImpl(null)
39 TouchEffect::~TouchEffect(void)
41 delete __pTouchEffectImpl;
45 TouchEffect::Construct(void)
49 SysAssertf(__pTouchEffectImpl == null, "Already constructed! Calling Construct() twice or more on a same instance is not allowed for this class.");
51 __pTouchEffectImpl = new (std::nothrow) _TouchEffectImpl;
53 r = __pTouchEffectImpl->Construct();
54 SysTryCatch(NID_UI, !IsFailed(r), , r, "[%s] Propagating.", GetErrorMessage(r));
59 delete __pTouchEffectImpl;
60 __pTouchEffectImpl = null;
66 TouchEffect::Play(TouchEffectType type)
70 SysAssertf(__pTouchEffectImpl != null,
71 "Not yet constructed. Construct() should be called before use.");
73 SysTryReturn(NID_UI, (type >= TOUCH_EFFECT_TAP && type <= TOUCH_EFFECT_NO_SOUND),
74 E_INVALID_ARG, E_INVALID_ARG,"[E_INVALID_ARG] The specified Effect type is invalid.");
76 r = __pTouchEffectImpl->Play(type);
77 SysTryReturn(NID_UI, r == E_SUCCESS, r, r, "[%s] A system error has occurred.", GetErrorMessage(r));