Tizen 2.1 base
[framework/osp/uifw.git] / src / ui / FUiTouchTapGestureDetector.cpp
1 //
2 // Open Service Platform
3 // Copyright (c) 2012-2013 Samsung Electronics Co., Ltd.
4 //
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
8 //
9 //     http://floralicense.org/license/
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  * @file                        FUiTouchTapGestureDetector.cpp
19  * @brief               This is the implementation file for %TouchTapGestureDetector class
20  * @version     2.0
21  *
22  * This file contains the implementation of %TouchTapGestureDetector class.
23  *
24  */
25
26 #include <FUiITouchTapGestureEventListener.h>
27 #include <FBaseSysLog.h>
28 #include "FUi_TouchTapGestureDetectorImpl.h"
29
30 namespace Tizen { namespace Ui
31 {
32 TouchTapGestureDetector::TouchTapGestureDetector(void)
33 {
34 }
35
36 TouchTapGestureDetector::~TouchTapGestureDetector(void)
37 {
38 }
39
40 result
41 TouchTapGestureDetector::Construct(void)
42 {
43         SysAssertf(__pTouchGestureDetectorImpl == null, "Already constructed. Calling Construct() twice or more on a same instance is not allowed for this class.");
44
45         _TouchGestureDetectorImpl* pImpl =  _TouchTapGestureDetectorImpl::CreateInstanceN(this);
46         result r = GetLastResult();
47         SysTryReturn(NID_UI, pImpl, r, r, "[%s] Propagating.", GetErrorMessage(r));
48
49         __pTouchGestureDetectorImpl = pImpl;
50
51         return E_SUCCESS;
52 }
53
54 result
55 TouchTapGestureDetector::AddTapGestureEventListener(ITouchTapGestureEventListener& listener)
56 {
57         SysAssertf(__pTouchGestureDetectorImpl != null, "Not yet constructed. Construct() should be called before used.");
58
59         return __pTouchGestureDetectorImpl->AddGestureEventListener(listener);
60 }
61
62 result
63 TouchTapGestureDetector::RemoveTapGestureEventListener(ITouchTapGestureEventListener& listener)
64 {
65         SysAssertf(__pTouchGestureDetectorImpl != null, "Not yet constructed. Construct() should be called before used.");
66
67         return __pTouchGestureDetectorImpl->RemoveGestureEventListener(listener);
68 }
69
70 result
71 TouchTapGestureDetector::SetTapCount(int count)
72 {
73         SysAssertf(__pTouchGestureDetectorImpl != null, "Not yet constructed. Construct() should be called before used.");
74
75         _TouchTapGestureDetectorImpl* pTouchTapGestureDetectorImpl = _TouchTapGestureDetectorImpl::GetInstance(*this);
76         SysAssertf(pTouchTapGestureDetectorImpl != null, "Not yet constructed. Construct() should be called before used.");
77
78         return pTouchTapGestureDetectorImpl->SetTapCount(count);
79 }
80
81 int
82 TouchTapGestureDetector::GetTapCount(void) const
83 {
84         SysAssertf(__pTouchGestureDetectorImpl != null, "Not yet constructed. Construct() should be called before used.");
85
86         const _TouchTapGestureDetectorImpl* pTouchTapGestureDetectorImpl = _TouchTapGestureDetectorImpl::GetInstance(*this);
87         SysAssertf(pTouchTapGestureDetectorImpl != null, "Not yet constructed. Construct() should be called before used.");
88
89         return pTouchTapGestureDetectorImpl->GetTapCount();
90 }
91
92 result
93 TouchTapGestureDetector::SetTapInterval(int intarval)
94 {
95         SysAssertf(__pTouchGestureDetectorImpl != null, "Not yet constructed. Construct() should be called before used.");
96
97         _TouchTapGestureDetectorImpl* pTouchTapGestureDetectorImpl = _TouchTapGestureDetectorImpl::GetInstance(*this);
98         SysAssertf(pTouchTapGestureDetectorImpl != null, "Not yet constructed. Construct() should be called before used.");
99
100         return pTouchTapGestureDetectorImpl->SetTapInterval(intarval);
101 }
102
103 int
104 TouchTapGestureDetector::GetTapInterval(void) const
105 {
106         SysAssertf(__pTouchGestureDetectorImpl != null, "Not yet constructed. Construct() should be called before used.");
107
108         const _TouchTapGestureDetectorImpl* pTouchTapGestureDetectorImpl = _TouchTapGestureDetectorImpl::GetInstance(*this);
109         SysAssertf(pTouchTapGestureDetectorImpl != null, "Not yet constructed. Construct() should be called before used.");
110
111         return pTouchTapGestureDetectorImpl->GetTapInterval();
112 }
113
114 result
115 TouchTapGestureDetector::SetMoveAllowance(int allowance)
116 {
117         SysAssertf(__pTouchGestureDetectorImpl != null, "Not yet constructed. Construct() should be called before used.");
118
119         _TouchTapGestureDetectorImpl* pTouchTapGestureDetectorImpl = _TouchTapGestureDetectorImpl::GetInstance(*this);
120         SysAssertf(pTouchTapGestureDetectorImpl != null, "Not yet constructed. Construct() should be called before used.");
121
122         return pTouchTapGestureDetectorImpl->SetMoveAllowance(allowance);
123 }
124
125 int
126 TouchTapGestureDetector::GetMoveAllowance(void) const
127 {
128         SysAssertf(__pTouchGestureDetectorImpl != null, "Not yet constructed. Construct() should be called before used.");
129
130         const _TouchTapGestureDetectorImpl* pTouchTapGestureDetectorImpl = _TouchTapGestureDetectorImpl::GetInstance(*this);
131         SysAssertf(pTouchTapGestureDetectorImpl != null, "Not yet constructed. Construct() should be called before used.");
132
133         return pTouchTapGestureDetectorImpl->GetMoveAllowance();
134 }
135
136 result
137 TouchTapGestureDetector::SetTouchCount(int count)
138 {
139         SysAssertf(__pTouchGestureDetectorImpl != null, "Not yet constructed. Construct() should be called before used.");
140
141         _TouchTapGestureDetectorImpl* pTouchTapGestureDetectorImpl = _TouchTapGestureDetectorImpl::GetInstance(*this);
142         SysAssertf(pTouchTapGestureDetectorImpl != null, "Not yet constructed. Construct() should be called before used.");
143
144         return pTouchTapGestureDetectorImpl->SetTouchCount(count);
145 }
146
147 int
148 TouchTapGestureDetector::GetTouchCount(void) const
149 {
150         SysAssertf(__pTouchGestureDetectorImpl != null, "Not yet constructed. Construct() should be called before used.");
151
152         const _TouchTapGestureDetectorImpl* pTouchTapGestureDetectorImpl = _TouchTapGestureDetectorImpl::GetInstance(*this);
153         SysAssertf(pTouchTapGestureDetectorImpl != null, "Not yet constructed. Construct() should be called before used.");
154
155         return pTouchTapGestureDetectorImpl->GetTouchCount();
156 }
157
158 }} //Tizen::Ui