| 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 <stack> | 8 #include <stack> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 20 matching lines...) Expand all Loading... |
| 31 virtual ~EventHandler(); | 31 virtual ~EventHandler(); |
| 32 | 32 |
| 33 // This is called for all events. The default implementation routes the event | 33 // This is called for all events. The default implementation routes the event |
| 34 // to one of the event-specific callbacks (OnKeyEvent, OnMouseEvent etc.). If | 34 // to one of the event-specific callbacks (OnKeyEvent, OnMouseEvent etc.). If |
| 35 // this is overridden, then normally, the override should chain into the | 35 // this is overridden, then normally, the override should chain into the |
| 36 // default implementation for un-handled events. | 36 // default implementation for un-handled events. |
| 37 virtual void OnEvent(Event* event); | 37 virtual void OnEvent(Event* event); |
| 38 | 38 |
| 39 virtual void OnKeyEvent(KeyEvent* event); | 39 virtual void OnKeyEvent(KeyEvent* event); |
| 40 | 40 |
| 41 virtual EventResult OnMouseEvent(MouseEvent* event); | 41 virtual void OnMouseEvent(MouseEvent* event); |
| 42 | 42 |
| 43 virtual void OnScrollEvent(ScrollEvent* event); | 43 virtual void OnScrollEvent(ScrollEvent* event); |
| 44 | 44 |
| 45 virtual void OnTouchEvent(TouchEvent* event); | 45 virtual void OnTouchEvent(TouchEvent* event); |
| 46 | 46 |
| 47 virtual void OnGestureEvent(GestureEvent* event); | 47 virtual void OnGestureEvent(GestureEvent* event); |
| 48 | 48 |
| 49 private: | 49 private: |
| 50 friend class EventDispatcher; | 50 friend class EventDispatcher; |
| 51 | 51 |
| 52 // EventDispatcher pushes itself on the top of this stack while dispatching | 52 // EventDispatcher pushes itself on the top of this stack while dispatching |
| 53 // events to this then pops itself off when done. | 53 // events to this then pops itself off when done. |
| 54 std::stack<EventDispatcher*> dispatchers_; | 54 std::stack<EventDispatcher*> dispatchers_; |
| 55 | 55 |
| 56 DISALLOW_COPY_AND_ASSIGN(EventHandler); | 56 DISALLOW_COPY_AND_ASSIGN(EventHandler); |
| 57 }; | 57 }; |
| 58 | 58 |
| 59 typedef std::vector<EventHandler*> EventHandlerList; | 59 typedef std::vector<EventHandler*> EventHandlerList; |
| 60 | 60 |
| 61 } // namespace ui | 61 } // namespace ui |
| 62 | 62 |
| 63 #endif // UI_BASE_EVENTS_EVENT_HANDLER_H_ | 63 #endif // UI_BASE_EVENTS_EVENT_HANDLER_H_ |
| OLD | NEW |