1 #ifndef __DALI_INTERNAL_GESTURE_EVENT_PROCESSOR_H__
2 #define __DALI_INTERNAL_GESTURE_EVENT_PROCESSOR_H__
5 * Copyright (c) 2014 Samsung Electronics Co., Ltd.
7 * Licensed under the Apache License, Version 2.0 (the "License");
8 * you may not use this file except in compliance with the License.
9 * You may obtain a copy of the License at
11 * http://www.apache.org/licenses/LICENSE-2.0
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
22 #include <dali/public-api/actors/actor.h>
23 #include <dali/internal/event/events/gesture-detector-impl.h>
24 #include <dali/internal/event/events/long-press-gesture-processor.h>
25 #include <dali/internal/event/events/pan-gesture-processor.h>
26 #include <dali/internal/event/events/pinch-gesture-processor.h>
27 #include <dali/internal/event/events/tap-gesture-processor.h>
38 class RenderController;
47 * Gesture Event Processing:
49 * The GestureEventProcessor determines what type of gesture event we have received and sends it to
50 * the appropriate gesture processor for processing.
52 class GestureEventProcessor
57 * Create a gesture event processor.
58 * @param[in] stage The stage.
59 * @param[in] gestureManager The gesture manager
60 * @param[in] renderController The render controller
62 GestureEventProcessor(Stage& stage, Integration::GestureManager& gestureManager, Integration::RenderController& renderController);
65 * Non-virtual destructor; GestureProcessor is not a base class
67 ~GestureEventProcessor();
69 public: // To be called by EventProcessor
72 * This function is called by Core whenever a gesture event occurs.
73 * @param[in] event The event that has occurred.
75 void ProcessGestureEvent(const Integration::GestureEvent& event);
77 public: // To be called by gesture detectors
80 * This method adds the specified gesture detector to the relevant gesture processor.
81 * @param[in] gestureDetector The gesture detector to add
83 void AddGestureDetector(GestureDetector* gestureDetector);
86 * This method removes the specified gesture detector from the relevant gesture processor.
87 * @param[in] gestureDetector The gesture detector to remove.
89 void RemoveGestureDetector(GestureDetector* gestureDetector);
92 * This method informs the appropriate processor that the gesture detector has been updated.
93 * @param[in] gestureDetector The gesture detector that has been updated.
95 void GestureDetectorUpdated(GestureDetector* gestureDetector);
98 * This method is called by GestureDetectors on Started or Continue state events.
99 * Status is queried and reset by Core in ProcessEvents
101 void SetUpdateRequired();
104 * Called by GestureDetectors to set the gesture properties in the update thread.
105 * @param[in] gesture The gesture whose values will be used in the Update object.
106 * @note If we are in the middle of processing the gesture being set, then this call is ignored.
108 void SetGestureProperties( const Gesture& gesture );
110 public: // Called by Core
113 * Returns true if any GestureDetector requires a Core::Update. Clears
114 * the state flag after reading.
116 * @return true if any GestureDetector requires a Core::Update
121 * Called to provide pan-gesture profiling information.
123 void EnablePanGestureProfiling();
126 * @brief Called to set how pan gestures predict and smooth input
128 * @param[in] mode The prediction mode to use
130 void SetPanGesturePredictionMode( int mode );
133 * @brief Sets the prediction amount of the pan gesture
135 * @param[in] amount The prediction amount in milliseconds
137 void SetPanGesturePredictionAmount( unsigned int amount );
142 GestureEventProcessor(const GestureEventProcessor&);
143 GestureEventProcessor& operator=(const GestureEventProcessor& rhs);
148 Integration::GestureManager& mGestureManager;
150 LongPressGestureProcessor mLongPressGestureProcessor;
151 PanGestureProcessor mPanGestureProcessor;
152 PinchGestureProcessor mPinchGestureProcessor;
153 TapGestureProcessor mTapGestureProcessor;
154 Integration::RenderController& mRenderController;
156 bool mUpdateRequired; ///< set to true by gesture detectors if they require a Core::Update
159 } // namespace Internal
163 #endif // __DALI_INTERNAL_GESTURE_EVENT_PROCESSOR_H__