Dali 3D User Interface Engine
gesture-event-processor.cpp
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2014 Samsung Electronics Co., Ltd.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  *
16  */
17 
18 // CLASS HEADER
20 
21 // INTERNAL INCLUDES
33 
34 namespace Dali
35 {
36 
37 namespace Internal
38 {
39 
41 : mStage(stage),
42  mGestureManager(gestureManager),
43  mLongPressGestureProcessor(stage, gestureManager),
44  mPanGestureProcessor(stage, gestureManager),
45  mPinchGestureProcessor(stage, gestureManager),
46  mTapGestureProcessor(stage, gestureManager),
47  mRenderController(renderController),
48  mUpdateRequired( false )
49 {
50 }
51 
53 {
54 }
55 
56 void GestureEventProcessor::ProcessGestureEvent(const Integration::GestureEvent& event)
57 {
58  if( Gesture::Started == event.state || Gesture::Continuing == event.state )
59  {
61  }
62 
63  switch(event.gestureType)
64  {
65  case Gesture::LongPress:
66  mLongPressGestureProcessor.Process(static_cast<const Integration::LongPressGestureEvent&>(event));
67  break;
68 
69  case Gesture::Pan:
70  mPanGestureProcessor.Process(static_cast<const Integration::PanGestureEvent&>(event));
71  break;
72 
73  case Gesture::Pinch:
74  mPinchGestureProcessor.Process(static_cast<const Integration::PinchGestureEvent&>(event));
75  break;
76 
77  case Gesture::Tap:
78  mTapGestureProcessor.Process(static_cast<const Integration::TapGestureEvent&>(event));
79  break;
80  }
81 }
82 
84 {
85  switch (gestureDetector->GetType())
86  {
87  case Gesture::LongPress:
88  {
89  LongPressGestureDetector* longPress = static_cast<LongPressGestureDetector*>(gestureDetector);
91  break;
92  }
93 
94  case Gesture::Pan:
95  {
96  PanGestureDetector* pan = static_cast<PanGestureDetector*>(gestureDetector);
98  break;
99  }
100 
101  case Gesture::Pinch:
102  {
103  PinchGestureDetector* pinch = static_cast<PinchGestureDetector*>(gestureDetector);
105  break;
106  }
107 
108  case Gesture::Tap:
109  {
110  TapGestureDetector* tap = static_cast<TapGestureDetector*>(gestureDetector);
112  break;
113  }
114  }
115 }
116 
118 {
119  switch (gestureDetector->GetType())
120  {
121  case Gesture::LongPress:
122  {
123  LongPressGestureDetector* longPress = static_cast<LongPressGestureDetector*>(gestureDetector);
125  break;
126  }
127 
128  case Gesture::Pan:
129  {
130  PanGestureDetector* pan = static_cast<PanGestureDetector*>(gestureDetector);
132  break;
133  }
134 
135  case Gesture::Pinch:
136  {
137  PinchGestureDetector* pinch = static_cast<PinchGestureDetector*>(gestureDetector);
139  break;
140  }
141 
142  case Gesture::Tap:
143  {
144  TapGestureDetector* tap = static_cast<TapGestureDetector*>(gestureDetector);
146  break;
147  }
148  }
149 }
150 
152 {
153  switch (gestureDetector->GetType())
154  {
155  case Gesture::LongPress:
156  {
157  LongPressGestureDetector* longPress = static_cast<LongPressGestureDetector*>(gestureDetector);
159  break;
160  }
161 
162  case Gesture::Pan:
163  {
164  PanGestureDetector* pan = static_cast<PanGestureDetector*>(gestureDetector);
166  break;
167  }
168 
169  case Gesture::Pinch:
170  {
171  PinchGestureDetector* pinch = static_cast<PinchGestureDetector*>(gestureDetector);
173  break;
174  }
175 
176  case Gesture::Tap:
177  {
178  TapGestureDetector* tap = static_cast<TapGestureDetector*>(gestureDetector);
180  break;
181  }
182  }
183 }
184 
186 {
187  mUpdateRequired = true;
188 }
189 
191 {
192  if( Gesture::Started == gesture.state || Gesture::Continuing == gesture.state )
193  {
195 
196  // We may not be updating so we need to ask the render controller for an update.
198  }
199 
200  switch ( gesture.type )
201  {
202  case Gesture::Pan:
203  {
204  const PanGesture& pan = static_cast< const PanGesture& >( gesture );
206  break;
207  }
208 
209  case Gesture::LongPress:
210  case Gesture::Pinch:
211  case Gesture::Tap:
212  {
213  DALI_ASSERT_DEBUG( false && "Gesture type does not have scene object\n" );
214  break;
215  }
216  }
217 }
218 
220 {
221  bool updateRequired( mUpdateRequired );
222 
223  mUpdateRequired = false;
224 
225  return updateRequired;
226 }
227 
229 {
231 }
232 
234 {
236 }
237 
239 {
241 }
242 
244 {
246 }
247 
249 {
251 }
252 
254 {
256 }
257 
259 {
261 }
262 
264 {
266 }
267 
268 } // namespace Internal
269 
270 } // namespace Dali
Dali Docs Home
Read more about Dali