| 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. |
| 31 virtual EventResult OnEvent(Event* event); | 35 virtual EventResult OnEvent(Event* event); |
| 32 | 36 |
| 33 virtual EventResult OnKeyEvent(KeyEvent* event); | 37 virtual EventResult OnKeyEvent(KeyEvent* event); |
| 34 | 38 |
| 35 virtual EventResult OnMouseEvent(MouseEvent* event); | 39 virtual EventResult OnMouseEvent(MouseEvent* event); |
| 36 | 40 |
| 37 virtual EventResult OnScrollEvent(ScrollEvent* event); | 41 virtual EventResult OnScrollEvent(ScrollEvent* event); |
| 38 | 42 |
| 39 virtual EventResult OnTouchEvent(TouchEvent* event); | 43 virtual EventResult OnTouchEvent(TouchEvent* event); |
| 40 | 44 |
| 41 virtual EventResult OnGestureEvent(GestureEvent* event); | 45 virtual EventResult OnGestureEvent(GestureEvent* event); |
| 42 }; | 46 }; |
| 43 | 47 |
| 44 typedef std::vector<EventHandler*> EventHandlerList; | 48 typedef std::vector<EventHandler*> EventHandlerList; |
| 45 | 49 |
| 46 } // namespace ui | 50 } // namespace ui |
| 47 | 51 |
| 48 #endif // UI_BASE_EVENTS_EVENT_HANDLER_H_ | 52 #endif // UI_BASE_EVENTS_EVENT_HANDLER_H_ |
| OLD | NEW |