modify license, permission and remove ^M char
[platform/framework/native/uifw.git] / src / ui / FUiTouchPinchGestureDetector.cpp
1 //
2 // Open Service Platform
3 // Copyright (c) 2012-2013 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  * @file                        FUiTouchPinchGestureDetector.cpp
19  * @brief               This is the implementation file for %TouchPinchGestureDetector class
20  * @version     2.0
21  *
22  * This file contains the implementation of %TouchPinchGestureDetector class.
23  *
24  */
25
26 #include <FUiITouchPinchGestureEventListener.h>
27 #include <FBaseSysLog.h>
28 #include "FUi_TouchPinchGestureDetectorImpl.h"
29
30 namespace Tizen { namespace Ui
31 {
32 TouchPinchGestureDetector::TouchPinchGestureDetector(void)
33 {
34 }
35
36 TouchPinchGestureDetector::~TouchPinchGestureDetector(void)
37 {
38 }
39
40 result
41 TouchPinchGestureDetector::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 =  _TouchPinchGestureDetectorImpl::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 TouchPinchGestureDetector::AddPinchGestureEventListener(ITouchPinchGestureEventListener& 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 TouchPinchGestureDetector::RemovePinchGestureEventListener(ITouchPinchGestureEventListener& listener)
64 {
65         SysAssertf(__pTouchGestureDetectorImpl != null, "Not yet constructed. Construct() should be called before used.");
66
67         return __pTouchGestureDetectorImpl->RemoveGestureEventListener(listener);
68 }
69
70 Tizen::Graphics::Point
71 TouchPinchGestureDetector::GetCenterPoint(void) const
72 {
73         SysAssertf(__pTouchGestureDetectorImpl != null, "Not yet constructed. Construct() should be called before used.");
74
75         const _TouchPinchGestureDetectorImpl* pTouchPinchGestureDetectorImpl = _TouchPinchGestureDetectorImpl::GetInstance(*this);
76         SysAssertf(pTouchPinchGestureDetectorImpl != null, "Not yet constructed. Construct() should be called before used.");
77
78         return pTouchPinchGestureDetectorImpl->GetCenterPoint();
79 }
80
81 Tizen::Graphics::FloatPoint
82 TouchPinchGestureDetector::GetCenterPointF(void) const
83 {
84         SysAssertf(__pTouchGestureDetectorImpl != null, "Not yet constructed. Construct() should be called before used.");
85
86         const _TouchPinchGestureDetectorImpl* pTouchPinchGestureDetectorImpl = _TouchPinchGestureDetectorImpl::GetInstance(*this);
87         SysAssertf(pTouchPinchGestureDetectorImpl != null, "Not yet constructed. Construct() should be called before used.");
88
89         return pTouchPinchGestureDetectorImpl->GetCenterPointF();
90 }
91
92 int
93 TouchPinchGestureDetector::GetScale(void) const
94 {
95         SysAssertf(__pTouchGestureDetectorImpl != null, "Not yet constructed. Construct() should be called before used.");
96
97         const _TouchPinchGestureDetectorImpl* pTouchPinchGestureDetectorImpl = _TouchPinchGestureDetectorImpl::GetInstance(*this);
98         SysAssertf(pTouchPinchGestureDetectorImpl != null, "Not yet constructed. Construct() should be called before used.");
99
100         return pTouchPinchGestureDetectorImpl->GetScale();
101 }
102
103 float
104 TouchPinchGestureDetector::GetScaleF(void) const
105 {
106         SysAssertf(__pTouchGestureDetectorImpl != null, "Not yet constructed. Construct() should be called before used.");
107
108         const _TouchPinchGestureDetectorImpl* pTouchPinchGestureDetectorImpl = _TouchPinchGestureDetectorImpl::GetInstance(*this);
109         SysAssertf(pTouchPinchGestureDetectorImpl != null, "Not yet constructed. Construct() should be called before used.");
110
111         return pTouchPinchGestureDetectorImpl->GetScaleF();
112 }
113
114 } }  //Tizen::Ui