If the parent is intercepted, the child is informed that it is INTERRUPTED.
[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 #include <dali/public-api/events/point-state.h>
25
26 namespace Dali
27 {
28 class Actor;
29 struct Vector2;
30 struct Vector4;
31
32 namespace Integration
33 {
34 struct TouchEvent;
35 }
36
37 namespace Internal
38 {
39 class Actor;
40 class Scene;
41 struct ActorObserver;
42
43 /**
44  * <h3>Multi-Touch Event Processing:</h3>
45  *
46  * The TouchEventProcessor processes touch events and emits the Touched signal on the hit actor (and
47  * its parents).
48  *
49  * - Hit Testing & Touch Event Delivery are described in Dali::Actor.
50  */
51 class TouchEventProcessor
52 {
53 public:
54   /**
55    * Create an event processor.
56    * @param[in] scene The scene the event processor belongs to.
57    */
58   TouchEventProcessor(Scene& scene);
59
60   /**
61    * Non-virtual destructor; TouchEventProcessor is not a base class
62    */
63   ~TouchEventProcessor();
64
65   /**
66    * This function is called by the event processor whenever a touch event occurs.
67    * @param[in] event The touch event that has occurred.
68    * @return true if consumed
69    */
70   bool ProcessTouchEvent(const Integration::TouchEvent& event);
71
72 private:
73   // Undefined
74   TouchEventProcessor(const TouchEventProcessor&);
75
76   // Undefined
77   TouchEventProcessor& operator=(const TouchEventProcessor& rhs);
78
79 private:
80   Scene& mScene; ///< Used to deliver touch events
81
82   /**
83    * Called by some actor-observers when the observed actor is disconnected.
84    *
85    * @param[in]  actor  The actor that has been disconnected.
86    */
87   void OnObservedActorDisconnected(Actor* actor);
88
89   ActorObserver    mLastPrimaryHitActor;    ///< Stores the last primary point hit actor
90   ActorObserver    mLastConsumedActor;      ///< Stores the last consumed actor
91   ActorObserver    mCapturingTouchActor;    ///< Stored the actor that captures touch
92   ActorObserver    mTouchDownConsumedActor; ///< Stores the touch-down consumed actor
93   RenderTaskPtr    mLastRenderTask;         ///< The RenderTask used for the last hit actor
94   PointState::Type mLastPrimaryPointState;  ///< Stores the last primary point state
95 };
96
97 } // namespace Internal
98
99 } // namespace Dali
100
101 #endif // DALI_INTERNAL_TOUCH_EVENT_PROCESSOR_H