2 // Open Service Platform
3 // Copyright (c) 2012-2013 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.
18 * @file FUiTouchLongPressGestureDetector.cpp
19 * @brief This is the implementation file for %TouchLongPressGestureDetector class
22 * This file contains the implementation of %TouchLongPressGestureDetector class.
26 #include <FBaseSysLog.h>
27 #include <FGrpPoint.h>
28 #include <FUiITouchLongPressGestureEventListener.h>
29 #include "FUi_TouchLongPressGestureDetectorImpl.h"
31 namespace Tizen { namespace Ui
33 TouchLongPressGestureDetector::TouchLongPressGestureDetector(void)
37 TouchLongPressGestureDetector::~TouchLongPressGestureDetector(void)
42 TouchLongPressGestureDetector::Construct(void)
44 SysAssertf(__pTouchGestureDetectorImpl == null, "Already constructed. Calling Construct() twice or more on a same instance is not allowed for this class.");
46 _TouchGestureDetectorImpl* pImpl = _TouchLongPressGestureDetectorImpl::CreateInstanceN(this);
47 result r = GetLastResult();
48 SysTryReturn(NID_UI, pImpl, r, r, "[%s] Propagating.", GetErrorMessage(r));
50 __pTouchGestureDetectorImpl = pImpl;
56 TouchLongPressGestureDetector::AddLongPressGestureEventListener(ITouchLongPressGestureEventListener& listener)
58 SysAssertf(__pTouchGestureDetectorImpl != null, "Not yet constructed. Construct() should be called before used.");
60 return __pTouchGestureDetectorImpl->AddGestureEventListener(listener);
64 TouchLongPressGestureDetector::RemoveLongPressGestureEventListener(ITouchLongPressGestureEventListener& listener)
66 SysAssertf(__pTouchGestureDetectorImpl != null, "Not yet constructed. Construct() should be called before used.");
68 return __pTouchGestureDetectorImpl->RemoveGestureEventListener(listener);
72 TouchLongPressGestureDetector::SetDuration(int duration)
74 SysAssertf(__pTouchGestureDetectorImpl != null, "Not yet constructed. Construct() should be called before used.");
76 _TouchLongPressGestureDetectorImpl* pTouchLongPressGestureDetectorImpl = _TouchLongPressGestureDetectorImpl::GetInstance(*this);
77 SysAssertf(pTouchLongPressGestureDetectorImpl != null, "Not yet constructed. Construct() should be called before used.");
79 return pTouchLongPressGestureDetectorImpl->SetDuration(duration);
83 TouchLongPressGestureDetector::GetDuration(void) const
85 SysAssertf(__pTouchGestureDetectorImpl != null, "Not yet constructed. Construct() should be called before used.");
87 const _TouchLongPressGestureDetectorImpl* pTouchLongPressGestureDetectorImpl = _TouchLongPressGestureDetectorImpl::GetInstance(*this);
88 SysAssertf(pTouchLongPressGestureDetectorImpl != null, "Not yet constructed. Construct() should be called before used.");
90 return pTouchLongPressGestureDetectorImpl->GetDuration();
94 TouchLongPressGestureDetector::SetMoveAllowance(int allowance)
96 SysAssertf(__pTouchGestureDetectorImpl != null, "Not yet constructed. Construct() should be called before used.");
98 _TouchLongPressGestureDetectorImpl* pTouchLongPressGestureDetectorImpl = _TouchLongPressGestureDetectorImpl::GetInstance(*this);
99 SysAssertf(pTouchLongPressGestureDetectorImpl != null, "Not yet constructed. Construct() should be called before used.");
101 return pTouchLongPressGestureDetectorImpl->SetMoveAllowance(allowance);
105 TouchLongPressGestureDetector::SetMoveAllowance(float allowance)
107 SysAssertf(__pTouchGestureDetectorImpl != null, "Not yet constructed. Construct() should be called before used.");
109 _TouchLongPressGestureDetectorImpl* pTouchLongPressGestureDetectorImpl = _TouchLongPressGestureDetectorImpl::GetInstance(*this);
110 SysAssertf(pTouchLongPressGestureDetectorImpl != null, "Not yet constructed. Construct() should be called before used.");
112 return pTouchLongPressGestureDetectorImpl->SetMoveAllowance(allowance);
116 TouchLongPressGestureDetector::GetMoveAllowance(void) const
118 SysAssertf(__pTouchGestureDetectorImpl != null, "Not yet constructed. Construct() should be called before used.");
120 const _TouchLongPressGestureDetectorImpl* pTouchLongPressGestureDetectorImpl = _TouchLongPressGestureDetectorImpl::GetInstance(*this);
121 SysAssertf(pTouchLongPressGestureDetectorImpl != null, "Not yet constructed. Construct() should be called before used.");
123 return pTouchLongPressGestureDetectorImpl->GetMoveAllowance();
127 TouchLongPressGestureDetector::GetMoveAllowanceF(void) const
129 SysAssertf(__pTouchGestureDetectorImpl != null, "Not yet constructed. Construct() should be called before used.");
131 const _TouchLongPressGestureDetectorImpl* pTouchLongPressGestureDetectorImpl = _TouchLongPressGestureDetectorImpl::GetInstance(*this);
132 SysAssertf(pTouchLongPressGestureDetectorImpl != null, "Not yet constructed. Construct() should be called before used.");
134 return pTouchLongPressGestureDetectorImpl->GetMoveAllowanceF();
138 TouchLongPressGestureDetector::SetTouchCount(int count)
140 SysAssertf(__pTouchGestureDetectorImpl != null, "Not yet constructed. Construct() should be called before used.");
142 _TouchLongPressGestureDetectorImpl* pTouchLongPressGestureDetectorImpl = _TouchLongPressGestureDetectorImpl::GetInstance(*this);
143 SysAssertf(pTouchLongPressGestureDetectorImpl != null, "Not yet constructed. Construct() should be called before used.");
145 return pTouchLongPressGestureDetectorImpl->SetTouchCount(count);
149 TouchLongPressGestureDetector::GetTouchCount(void) const
151 SysAssertf(__pTouchGestureDetectorImpl != null, "Not yet constructed. Construct() should be called before used.");
153 const _TouchLongPressGestureDetectorImpl* pTouchLongPressGestureDetectorImpl = _TouchLongPressGestureDetectorImpl::GetInstance(*this);
154 SysAssertf(pTouchLongPressGestureDetectorImpl != null, "Not yet constructed. Construct() should be called before used.");
156 return pTouchLongPressGestureDetectorImpl->GetTouchCount();