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 Flora License, Version 1.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://floralicense.org/license/
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.
21 #include <dali/public-api/actors/actor.h>
22 #include <dali/internal/event/events/gesture-detector-impl.h>
23 #include <dali/internal/event/events/long-press-gesture-processor.h>
24 #include <dali/internal/event/events/pan-gesture-processor.h>
25 #include <dali/internal/event/events/pinch-gesture-processor.h>
26 #include <dali/internal/event/events/tap-gesture-processor.h>
37 class RenderController;
46 * Gesture Event Processing:
48 * The GestureEventProcessor determines what type of gesture event we have received and sends it to
49 * the appropriate gesture processor for processing.
51 class GestureEventProcessor
56 * Create a gesture event processor.
57 * @param[in] stage The stage.
58 * @param[in] gestureManager The gesture manager
59 * @param[in] renderController The render controller
61 GestureEventProcessor(Stage& stage, Integration::GestureManager& gestureManager, Integration::RenderController& renderController);
64 * Non-virtual destructor; GestureProcessor is not a base class
66 ~GestureEventProcessor();
68 public: // To be called by EventProcessor
71 * This function is called by Core whenever a gesture event occurs.
72 * @param[in] event The event that has occurred.
74 void ProcessGestureEvent(const Integration::GestureEvent& event);
76 public: // To be called by gesture detectors
79 * This method adds the specified gesture detector to the relevant gesture processor.
80 * @param[in] gestureDetector The gesture detector to add
82 void AddGestureDetector(GestureDetector* gestureDetector);
85 * This method removes the specified gesture detector from the relevant gesture processor.
86 * @param[in] gestureDetector The gesture detector to remove.
88 void RemoveGestureDetector(GestureDetector* gestureDetector);
91 * This method informs the appropriate processor that the gesture detector has been updated.
92 * @param[in] gestureDetector The gesture detector that has been updated.
94 void GestureDetectorUpdated(GestureDetector* gestureDetector);
97 * This method is called by GestureDetectors on Started or Continue state events.
98 * Status is queried and reset by Core in ProcessEvents
100 void SetUpdateRequired();
103 * Called by GestureDetectors to set the gesture properties in the update thread.
104 * @param[in] gesture The gesture whose values will be used in the Update object.
105 * @note If we are in the middle of processing the gesture being set, then this call is ignored.
107 void SetGestureProperties( const Gesture& gesture );
109 public: // Called by Core
112 * Returns true if any GestureDetector requires a Core::Update. Clears
113 * the state flag after reading.
115 * @return true if any GestureDetector requires a Core::Update
120 * Called to provide pan-gesture profiling information.
122 void EnablePanGestureProfiling();
127 GestureEventProcessor(const GestureEventProcessor&);
128 GestureEventProcessor& operator=(const GestureEventProcessor& rhs);
133 Integration::GestureManager& mGestureManager;
135 LongPressGestureProcessor mLongPressGestureProcessor;
136 PanGestureProcessor mPanGestureProcessor;
137 PinchGestureProcessor mPinchGestureProcessor;
138 TapGestureProcessor mTapGestureProcessor;
139 Integration::RenderController& mRenderController;
141 bool mUpdateRequired; ///< set to true by gesture detectors if they require a Core::Update
144 } // namespace Internal
148 #endif // __DALI_INTERNAL_GESTURE_EVENT_PROCESSOR_H__