Merge "DALi Version 2.0.49" into devel/master
[platform/core/uifw/dali-core.git] / dali / internal / event / events / touch-event-processor.h
1 #ifndef DALI_INTERNAL_TOUCH_EVENT_PROCESSOR_H
2 #define DALI_INTERNAL_TOUCH_EVENT_PROCESSOR_H
3
4 /*
5  * Copyright (c) 2021 Samsung Electronics Co., Ltd.
6  *
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
10  *
11  * http://www.apache.org/licenses/LICENSE-2.0
12  *
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.
18  *
19  */
20
21 // INTERNAL INCLUDES
22 #include <dali/internal/event/events/actor-observer.h>
23 #include <dali/internal/event/render-tasks/render-task-impl.h>
24
25 namespace Dali
26 {
27 class Actor;
28 struct Vector2;
29 struct Vector4;
30
31 namespace Integration
32 {
33 struct TouchEvent;
34 }
35
36 namespace Internal
37 {
38 class Actor;
39 class Scene;
40 struct ActorObserver;
41
42 /**
43  * <h3>Multi-Touch Event Processing:</h3>
44  *
45  * The TouchEventProcessor processes touch events and emits the Touched signal on the hit actor (and
46  * its parents).
47  *
48  * - Hit Testing & Touch Event Delivery are described in Dali::Actor.
49  */
50 class TouchEventProcessor
51 {
52 public:
53   /**
54    * Create an event processor.
55    * @param[in] scene The scene the event processor belongs to.
56    */
57   TouchEventProcessor(Scene& scene);
58
59   /**
60    * Non-virtual destructor; TouchEventProcessor is not a base class
61    */
62   ~TouchEventProcessor();
63
64   /**
65    * This function is called by the event processor whenever a touch event occurs.
66    * @param[in] event The touch event that has occurred.
67    * @return true if consumed
68    */
69   bool ProcessTouchEvent(const Integration::TouchEvent& event);
70
71 private:
72   // Undefined
73   TouchEventProcessor(const TouchEventProcessor&);
74
75   // Undefined
76   TouchEventProcessor& operator=(const TouchEventProcessor& rhs);
77
78 private:
79   Scene& mScene; ///< Used to deliver touch events
80
81   /**
82    * Called by some actor-observers when the observed actor is disconnected.
83    *
84    * @param[in]  actor  The actor that has been disconnected.
85    */
86   void OnObservedActorDisconnected(Actor* actor);
87
88   ActorObserver mLastPrimaryHitActor;    ///< Stores the last primary point hit actor
89   ActorObserver mLastConsumedActor;      ///< Stores the last consumed actor
90   ActorObserver mCapturingTouchActor;    ///< Stored the actor that captures touch
91   ActorObserver mTouchDownConsumedActor; ///< Stores the touch-down consumed actor
92   RenderTaskPtr mLastRenderTask;         ///< The RenderTask used for the last hit actor
93 };
94
95 } // namespace Internal
96
97 } // namespace Dali
98
99 #endif // DALI_INTERNAL_TOUCH_EVENT_PROCESSOR_H