Merge "Use touch consumed return to set whether we process a gesture or not" into...
[platform/core/uifw/dali-core.git] / dali / internal / event / events / event-processor.h
1 #ifndef DALI_INTERNAL_EVENT_PROCESSOR_H
2 #define DALI_INTERNAL_EVENT_PROCESSOR_H
3
4 /*
5  * Copyright (c) 2019 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/touch-event-processor.h>
23 #include <dali/internal/event/events/hover-event-processor.h>
24 #include <dali/internal/event/events/key-event-processor.h>
25 #include <dali/internal/event/events/wheel-event-processor.h>
26 #include <dali/internal/common/message-buffer.h>
27
28 namespace Dali
29 {
30
31 namespace Integration
32 {
33 struct Event;
34 }
35
36 namespace Internal
37 {
38
39 class Scene;
40 class GestureEventProcessor;
41 class NotificationManager;
42
43 /**
44  * The EventProcessor processes any events that are received by Dali.  Such events include
45  * touch events, key events, wheel events, and notification events.
46  *
47  * When the EventProcessor receives an event, it determines its type and passes it on to the
48  * appropriate processor.
49  */
50 class EventProcessor
51 {
52 public:
53
54   /**
55    * Constructor
56    * @param[in] scene                  The scene.
57    * @param[in] gestureEventProcessor  The gesture event processor.
58    */
59   EventProcessor( Scene& scene, GestureEventProcessor& gestureEventProcessor );
60
61   /**
62    * Destructor
63    */
64   virtual ~EventProcessor();
65
66 public:
67
68   /**
69    * This function is called when an event is queued.
70    * @param[in] event A event to queue.
71    */
72   void QueueEvent( const Integration::Event& event );
73
74   /**
75    * This function is called when events are processed.
76    */
77   void ProcessEvents();
78
79 private:
80
81   Scene& mScene;                                        ///< The Scene events are processed for.
82   TouchEventProcessor      mTouchEventProcessor;        ///< Processes touch events.
83   HoverEventProcessor      mHoverEventProcessor;        ///< Processes hover events.
84   GestureEventProcessor&   mGestureEventProcessor;      ///< Processes gesture events.
85   KeyEventProcessor        mKeyEventProcessor;          ///< Processes key events.
86   WheelEventProcessor      mWheelEventProcessor;        ///< Processes wheel events.
87
88   // Allow messages to be added safely to one queue, while processing (iterating through) the second queue.
89   MessageBuffer mEventQueue0;        ///< An event queue.
90   MessageBuffer mEventQueue1;        ///< Another event queue.
91   MessageBuffer* mCurrentEventQueue; ///< QueueEvent() will queue here.
92 };
93
94 } // namespace Internal
95
96 } // namespace Dali
97
98 #endif // DALI_INTERNAL_EVENT_PROCESSOR_H
99