Tizen 2.1 base
[framework/osp/uifw.git] / src / ui / FUiTouchPanningGestureDetector.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                        FUiTouchPanningGestureDetector.cpp
19  * @brief               This is the implementation file for %TouchPanningGestureDetector class
20  * @version     2.0
21  *
22  * This file contains the implementation of %TouchPanningGestureDetector class.
23  *
24  */
25
26 #include <FUiITouchPanningGestureEventListener.h>
27 #include <FBaseSysLog.h>
28 #include "FUi_TouchPanningGestureDetectorImpl.h"
29
30 using namespace Tizen::Base::Collection;
31
32 namespace Tizen { namespace Ui
33 {
34 TouchPanningGestureDetector::TouchPanningGestureDetector(void)
35 {
36 }
37
38 TouchPanningGestureDetector::~TouchPanningGestureDetector(void)
39 {
40 }
41
42 result
43 TouchPanningGestureDetector::Construct(void)
44 {
45         SysAssertf(__pTouchGestureDetectorImpl == null, "Already constructed. Calling Construct() twice or more on a same instance is not allowed for this class.");
46
47         _TouchGestureDetectorImpl* pImpl =  _TouchPanningGestureDetectorImpl::CreateInstanceN(this);
48         result r = GetLastResult();
49         SysTryReturn(NID_UI, pImpl, r, r, "[%s] Propagatin.", GetErrorMessage(r));
50
51         __pTouchGestureDetectorImpl = pImpl;
52
53         return E_SUCCESS;
54 }
55
56 result
57 TouchPanningGestureDetector::AddPanningGestureEventListener(ITouchPanningGestureEventListener& listener)
58 {
59         SysAssertf(__pTouchGestureDetectorImpl != null, "Not yet constructed. Construct() should be called before used.");
60
61         return __pTouchGestureDetectorImpl->AddGestureEventListener(listener);
62 }
63
64 result
65 TouchPanningGestureDetector::RemovePanningGestureEventListener(ITouchPanningGestureEventListener& listener)
66 {
67         SysAssertf(__pTouchGestureDetectorImpl != null, "Not yet constructed. Construct() should be called before used.");
68
69         return __pTouchGestureDetectorImpl->RemoveGestureEventListener(listener);
70 }
71
72 IList*
73 TouchPanningGestureDetector::GetTouchInfoListN(void) const
74 {
75         SysAssertf(__pTouchGestureDetectorImpl != null, "Not yet constructed. Construct() should be called before used.");
76
77         const _TouchPanningGestureDetectorImpl* pTouchPanningGestureDetectorImpl = _TouchPanningGestureDetectorImpl::GetInstance(*this);
78         SysAssertf(pTouchPanningGestureDetectorImpl != null, "Not yet constructed. Construct() should be called before used.");
79
80         return pTouchPanningGestureDetectorImpl->GetTouchInfoListN();
81 }
82
83 result
84 TouchPanningGestureDetector::SetTouchCount(int count)
85 {
86         SysAssertf(__pTouchGestureDetectorImpl != null, "Not yet constructed. Construct() should be called before used.");
87
88         _TouchPanningGestureDetectorImpl* pTouchPanningGestureDetectorImpl = _TouchPanningGestureDetectorImpl::GetInstance(*this);
89         SysAssertf(pTouchPanningGestureDetectorImpl != null, "Not yet constructed. Construct() should be called before used.");
90
91         return pTouchPanningGestureDetectorImpl->SetTouchCount(count);
92 }
93
94 int
95 TouchPanningGestureDetector::GetTouchCount(void) const
96 {
97         SysAssertf(__pTouchGestureDetectorImpl != null, "Not yet constructed. Construct() should be called before used.");
98
99         const _TouchPanningGestureDetectorImpl* pTouchPanningGestureDetectorImpl = _TouchPanningGestureDetectorImpl::GetInstance(*this);
100         SysAssertf(pTouchPanningGestureDetectorImpl != null, "Not yet constructed. Construct() should be called before used.");
101
102         return pTouchPanningGestureDetectorImpl->GetTouchCount();
103 }
104
105 }} //Tizen::Ui