Changed indicator bg color.
[platform/framework/native/uifw.git] / src / ui / FUiTouchEffect.cpp
1 //
2 // Open Service Platform
3 // Copyright (c) 2012 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                FUiTouchEffect.cpp
20  * @brief               This is the implementation for TouchEffect class.
21  *
22  * This file contains definitions of %TouchEffect class.
23  */
24
25 #include <new>
26 #include <FBaseErrors.h>
27 #include <FBaseSysLog.h>
28 #include <FUiTouchEffect.h>
29 #include <FUi_TouchEffectImpl.h>
30
31 namespace Tizen { namespace Ui
32 {
33
34 TouchEffect::TouchEffect(void)
35         : __pTouchEffectImpl(null)
36 {
37 }
38
39 TouchEffect::~TouchEffect(void)
40 {
41         delete __pTouchEffectImpl;
42 }
43
44 result
45 TouchEffect::Construct(void)
46 {
47     result r = E_SUCCESS;
48
49     SysAssertf(__pTouchEffectImpl == null, "Already constructed! Calling Construct() twice or more on a same instance is not allowed for this class.");
50
51     __pTouchEffectImpl = new (std::nothrow) _TouchEffectImpl;
52
53     r = __pTouchEffectImpl->Construct();
54     SysTryCatch(NID_UI, !IsFailed(r), , r, "[%s] Propagating.", GetErrorMessage(r));
55
56     return E_SUCCESS;
57
58 CATCH:
59         delete __pTouchEffectImpl;
60         __pTouchEffectImpl = null;
61
62         return r;
63 }
64
65 result
66 TouchEffect::Play(TouchEffectType type)
67 {
68     result r = E_SUCCESS;
69
70     SysAssertf(__pTouchEffectImpl != null,
71                         "Not yet constructed. Construct() should be called before use.");
72
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.");
75
76     r = __pTouchEffectImpl->Play(type);
77     SysTryReturn(NID_UI, r == E_SUCCESS, r, r, "[%s] A system error has occurred.", GetErrorMessage(r));
78
79     return r;
80 }
81
82 } } // Tizen::Ui