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 FUiTouchFlickGestureDetector.cpp
19 * @brief This is the implementation file for %TouchFlickGestureDetector class
22 * This file contains the implementation of %TouchFlickGestureDetector class.
26 #include <FUiITouchFlickGestureEventListener.h>
27 #include <FBaseSysLog.h>
28 #include "FUi_TouchFlickGestureDetectorImpl.h"
30 namespace Tizen { namespace Ui
32 TouchFlickGestureDetector::TouchFlickGestureDetector(void)
36 TouchFlickGestureDetector::~TouchFlickGestureDetector(void)
41 TouchFlickGestureDetector::Construct(void)
43 SysAssertf(__pTouchGestureDetectorImpl == null, "Already constructed. Calling Construct() twice or more on a same instance is not allowed for this class.");
45 _TouchGestureDetectorImpl* pImpl = _TouchFlickGestureDetectorImpl::CreateInstanceN(this);
46 result r = GetLastResult();
47 SysTryReturn(NID_UI, pImpl, r, r, "[%s] Propagating.", GetErrorMessage(r));
49 __pTouchGestureDetectorImpl = pImpl;
55 TouchFlickGestureDetector::AddFlickGestureEventListener(ITouchFlickGestureEventListener& listener)
57 SysAssertf(__pTouchGestureDetectorImpl != null, "Not yet constructed. Construct() should be called before used.");
59 result r = __pTouchGestureDetectorImpl->AddGestureEventListener(listener);
60 SysTryReturn(NID_UI, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
66 TouchFlickGestureDetector::RemoveFlickGestureEventListener(ITouchFlickGestureEventListener& listener)
68 SysAssertf(__pTouchGestureDetectorImpl != null, "Not yet constructed. Construct() should be called before used.");
70 result r = __pTouchGestureDetectorImpl->RemoveGestureEventListener(listener);
71 SysTryReturn(NID_UI, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
77 TouchFlickGestureDetector::GetDistance(int& xDistance, int& yDistance) const
79 const _TouchFlickGestureDetectorImpl* pTouchFlickGestureDetectorImpl = _TouchFlickGestureDetectorImpl::GetInstance(*this);
80 SysAssertf(pTouchFlickGestureDetectorImpl != null, "Not yet constructed. Construct() should be called before used.");
82 return pTouchFlickGestureDetectorImpl->GetDistance(xDistance, yDistance);
86 TouchFlickGestureDetector::GetDistance(float& xDistance, float& yDistance) const
88 const _TouchFlickGestureDetectorImpl* pTouchFlickGestureDetectorImpl = _TouchFlickGestureDetectorImpl::GetInstance(*this);
89 SysAssertf(pTouchFlickGestureDetectorImpl != null, "Not yet constructed. Construct() should be called before used.");
91 return pTouchFlickGestureDetectorImpl->GetDistance(xDistance, yDistance);
95 TouchFlickGestureDetector::GetDuration(void) const
97 const _TouchFlickGestureDetectorImpl* pTouchFlickGestureDetectorImpl = _TouchFlickGestureDetectorImpl::GetInstance(*this);
98 SysAssertf(pTouchFlickGestureDetectorImpl != null, "Not yet constructed. Construct() should be called before used.");
100 return pTouchFlickGestureDetectorImpl->GetDuration();
104 TouchFlickGestureDetector::GetDirection(void) const
106 const _TouchFlickGestureDetectorImpl* pTouchFlickGestureDetectorImpl = _TouchFlickGestureDetectorImpl::GetInstance(*this);
107 SysAssertf(pTouchFlickGestureDetectorImpl != null, "Not yet constructed. Construct() should be called before used.");
109 return pTouchFlickGestureDetectorImpl->GetDirection();