OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef UI_BASE_EVENTS_EVENT_HANDLER_H_ | 5 #ifndef UI_BASE_EVENTS_EVENT_HANDLER_H_ |
6 #define UI_BASE_EVENTS_EVENT_HANDLER_H_ | 6 #define UI_BASE_EVENTS_EVENT_HANDLER_H_ |
7 | 7 |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "ui/base/events/event_constants.h" | 10 #include "ui/base/events/event_constants.h" |
(...skipping 10 matching lines...) Expand all Loading... |
21 | 21 |
22 class EventTarget; | 22 class EventTarget; |
23 | 23 |
24 // Dispatches events to appropriate targets. The default implementations return | 24 // Dispatches events to appropriate targets. The default implementations return |
25 // ER_UNHANDLED for all events. | 25 // ER_UNHANDLED for all events. |
26 class UI_EXPORT EventHandler { | 26 class UI_EXPORT EventHandler { |
27 public: | 27 public: |
28 EventHandler(); | 28 EventHandler(); |
29 virtual ~EventHandler(); | 29 virtual ~EventHandler(); |
30 | 30 |
31 // This is called for all events. The default implementation routes the event | |
32 // to one of the event-specific callbacks (OnKeyEvent, OnMouseEvent etc.). If | |
33 // this is overridden, then normally, the override should chain into the | |
34 // default implementation for un-handled events. | |
35 virtual EventResult OnEvent(Event* event); | 31 virtual EventResult OnEvent(Event* event); |
36 | 32 |
37 virtual EventResult OnKeyEvent(KeyEvent* event); | 33 virtual EventResult OnKeyEvent(KeyEvent* event); |
38 | 34 |
39 virtual EventResult OnMouseEvent(MouseEvent* event); | 35 virtual EventResult OnMouseEvent(MouseEvent* event); |
40 | 36 |
41 virtual EventResult OnScrollEvent(ScrollEvent* event); | 37 virtual EventResult OnScrollEvent(ScrollEvent* event); |
42 | 38 |
43 virtual EventResult OnTouchEvent(TouchEvent* event); | 39 virtual EventResult OnTouchEvent(TouchEvent* event); |
44 | 40 |
45 virtual EventResult OnGestureEvent(GestureEvent* event); | 41 virtual EventResult OnGestureEvent(GestureEvent* event); |
46 }; | 42 }; |
47 | 43 |
48 typedef std::vector<EventHandler*> EventHandlerList; | 44 typedef std::vector<EventHandler*> EventHandlerList; |
49 | 45 |
50 } // namespace ui | 46 } // namespace ui |
51 | 47 |
52 #endif // UI_BASE_EVENTS_EVENT_HANDLER_H_ | 48 #endif // UI_BASE_EVENTS_EVENT_HANDLER_H_ |
OLD | NEW |