Fork for IVI: mesa fixing
[profile/ivi/uifw.git] / src / ui / FUi_TouchEventInfoImpl.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         FUi_TouchEventInfoImpl.cpp
19 * @brief        This is the implementation for the _TouchEventInfoImpl class.
20 * @version      2.0
21 */
22
23 // includes
24 #include <new>
25 #include <FBaseDataType.h>
26 #include <FBaseErrors.h>
27 #include <FBaseSysLog.h>
28 #include "FUi_TouchEventInfoImpl.h"
29 #include "FUi_UiTouchEvent.h"
30
31 using namespace Tizen::Graphics;
32
33 namespace Tizen { namespace Ui
34 {
35
36 _TouchEventInfoImpl*
37 _TouchEventInfoImpl::CreateInstanceN(TouchEventInfo* pPublic)
38 {
39         ClearLastResult();
40
41         _TouchEventInfoImpl* pImpl = new (std::nothrow) _TouchEventInfoImpl(pPublic);
42         SysTryReturn(NID_UI, pImpl, null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.");
43
44         return pImpl;
45 }
46
47 _TouchEventInfoImpl::_TouchEventInfoImpl(TouchEventInfo* pPublic)
48         : __pPublic(pPublic)
49         , __pointId(0)
50         , __touchStatus(_TOUCH_PRESSED)
51         , __startPosition(0, 0)
52         , __currentPosition(0, 0)
53         , __isFlicked(false)
54 {
55 }
56
57 _TouchEventInfoImpl::~_TouchEventInfoImpl(void)
58 {
59 }
60
61 void
62 _TouchEventInfoImpl::SetTouchEventInfo(const _TouchInfo& touchInfo, const Point startPosition)
63 {
64         __pointId = touchInfo.GetPointId();
65         __startPosition.x = startPosition.x;
66         __startPosition.y = startPosition.y;
67         __currentPosition.x = touchInfo.GetCurrentPosition().x;
68         __currentPosition.y = touchInfo.GetCurrentPosition().y;
69         __isFlicked = touchInfo.IsFlicked();
70         __touchStatus = touchInfo.GetTouchStatus();
71 }
72
73 unsigned long
74 _TouchEventInfoImpl::GetPointId(void) const
75 {
76         return __pointId;
77 }
78
79 Point
80 _TouchEventInfoImpl::GetStartPosition(void) const
81 {
82         return __startPosition;
83 }
84
85 Point
86 _TouchEventInfoImpl::GetCurrentPosition(void) const
87 {
88         return __currentPosition;
89 }
90
91 _TouchStatus
92 _TouchEventInfoImpl::GetTouchStatus(void) const
93 {
94         return __touchStatus;
95 }
96
97 bool
98 _TouchEventInfoImpl::IsFlicked(void) const
99 {
100         return __isFlicked;
101 }
102
103 } } // Tizen::Ui