1 #ifndef DALI_INTERNAL_ROTATION_GESTURE_EVENT_PROCESSOR_H
2 #define DALI_INTERNAL_ROTATION_GESTURE_EVENT_PROCESSOR_H
5 * Copyright (c) 2019 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/internal/event/events/rotation-gesture/rotation-gesture-detector-impl.h>
23 #include <dali/internal/event/events/gesture-processor.h>
24 #include <dali/internal/event/render-tasks/render-task-impl.h>
35 struct RotationGestureEvent;
38 * Rotation Gesture Event Processing:
40 * When we receive a rotation gesture event, we do the following:
41 * - Find the hit actor that requires a rotation underneath the center-point of the rotation.
42 * - Emit the gesture if the event satisfies the detector conditions.
44 * The above is only checked when our gesture starts. We continue sending the rotation gesture to this
45 * detector until the rotation ends or is cancelled.
47 class RotationGestureProcessor : public GestureProcessor, public RecognizerObserver<RotationGestureEvent>
52 * Create a rotation gesture processor.
54 RotationGestureProcessor();
57 * Non-virtual destructor; RotationGestureProcessor is not a base class
59 ~RotationGestureProcessor() = default;
61 RotationGestureProcessor( const RotationGestureProcessor& ) = delete; ///< Deleted copy constructor.
62 RotationGestureProcessor& operator=( const RotationGestureProcessor& rhs ) = delete; ///< Deleted copy assignment operator.
64 public: // To be called by GestureEventProcessor
67 * This method is called whenever a rotation gesture event occurs.
68 * @param[in] scene The scene the rotation gesture event occurs in.
69 * @param[in] rotationEvent The event that has occurred.
71 void Process( Scene& scene, const RotationGestureEvent& rotationEvent );
74 * Adds a gesture detector to this gesture processor.
75 * If this is the first gesture detector being added, then this method registers the required
76 * gesture with the adaptor.
77 * @param[in] gestureDetector The gesture detector being added
78 * @param[in] scene The scene the rotation gesture occurred in
80 void AddGestureDetector( RotationGestureDetector* gestureDetector, Scene& scene );
83 * Removes the specified gesture detector from this gesture processor. If, after removing this
84 * gesture detector, there are no more gesture detectors registered, then this method unregisters
85 * the gesture from the adaptor.
86 * @param[in] gestureDetector The gesture detector being removed.
88 void RemoveGestureDetector( RotationGestureDetector* gestureDetector );
92 // GestureProcessor overrides
95 * @copydoc GestureProcessor::OnGesturedActorStageDisconnection()
97 void OnGesturedActorStageDisconnection();
100 * @copydoc GestureProcessor::CheckGestureDetector()
102 bool CheckGestureDetector( GestureDetector* detector, Actor* actor );
105 * @copydoc GestureProcessor::EmitGestureSignal()
107 void EmitGestureSignal( Actor* actor, const GestureDetectorContainer& gestureDetectors, Vector2 actorCoordinates );
111 RotationGestureDetectorContainer mRotationGestureDetectors;
112 GestureDetectorContainer mCurrentRotationEmitters;
113 RenderTaskPtr mCurrentRenderTask;
115 const RotationGestureEvent* mCurrentRotationEvent; ///< Pointer to current RotationEvent, used when calling ProcessAndEmit()
118 } // namespace Internal
122 #endif // DALI_INTERNAL_ROTATION_GESTURE_EVENT_PROCESSOR_H