Merge branch 'devel/master' into tizen
[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) 2014 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 struct GestureEvent;
35 }
36
37 namespace Internal
38 {
39
40 class Scene;
41 class GestureEventProcessor;
42 class NotificationManager;
43
44 /**
45  * The EventProcessor processes any events that are received by Dali.  Such events include
46  * touch events, key events, wheel events, and notification events.
47  *
48  * When the EventProcessor receives an event, it determines its type and passes it on to the
49  * appropriate processor.
50  */
51 class EventProcessor
52 {
53 public:
54
55   /**
56    * Constructor
57    * @param[in] scene                  The scene.
58    * @param[in] gestureEventProcessor  The gesture event processor.
59    */
60   EventProcessor( Scene& scene, GestureEventProcessor& gestureEventProcessor );
61
62   /**
63    * Destructor
64    */
65   virtual ~EventProcessor();
66
67 public:
68
69   /**
70    * This function is called when an event is queued.
71    * @param[in] event A event to queue.
72    */
73   void QueueEvent( const Integration::Event& event );
74
75   /**
76    * This function is called when events are processed.
77    */
78   void ProcessEvents();
79
80 private:
81
82   /**
83    * Helper for QueueEvent()
84    */
85   void QueueGestureEvent(const Integration::GestureEvent& event);
86
87 private:
88
89   Scene& mScene;                                        ///< The Scene events are processed for.
90   TouchEventProcessor      mTouchEventProcessor;        ///< Processes touch events.
91   HoverEventProcessor      mHoverEventProcessor;        ///< Processes hover events.
92   GestureEventProcessor&   mGestureEventProcessor;      ///< Processes gesture events.
93   KeyEventProcessor        mKeyEventProcessor;          ///< Processes key events.
94   WheelEventProcessor      mWheelEventProcessor;        ///< Processes wheel events.
95
96   // Allow messages to be added safely to one queue, while processing (iterating through) the second queue.
97   MessageBuffer mEventQueue0;        ///< An event queue.
98   MessageBuffer mEventQueue1;        ///< Another event queue.
99   MessageBuffer* mCurrentEventQueue; ///< QueueEvent() will queue here.
100 };
101
102 } // namespace Internal
103
104 } // namespace Dali
105
106 #endif // __DALI_INTERNAL_EVENT_PROCESSOR_H__
107