Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(7)

Side by Side Diff: ui/events/event_handler.h

Issue 2805793002: ozone: evdev: Add gamepad support (Closed)
Patch Set: Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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_EVENTS_EVENT_HANDLER_H_ 5 #ifndef UI_EVENTS_EVENT_HANDLER_H_
6 #define UI_EVENTS_EVENT_HANDLER_H_ 6 #define UI_EVENTS_EVENT_HANDLER_H_
7 7
8 #include <stack> 8 #include <stack>
9 #include <vector> 9 #include <vector>
10 10
11 #include "base/macros.h" 11 #include "base/macros.h"
12 #include "ui/events/event_constants.h" 12 #include "ui/events/event_constants.h"
13 #include "ui/events/events_export.h" 13 #include "ui/events/events_export.h"
14 14
15 namespace ui { 15 namespace ui {
16 16
17 class GamepadEvent;
17 class CancelModeEvent; 18 class CancelModeEvent;
18 class Event; 19 class Event;
19 class EventDispatcher; 20 class EventDispatcher;
20 class GestureEvent; 21 class GestureEvent;
21 class KeyEvent; 22 class KeyEvent;
22 class MouseEvent; 23 class MouseEvent;
23 class ScrollEvent; 24 class ScrollEvent;
24 class TouchEvent; 25 class TouchEvent;
25 26
26 // Dispatches events to appropriate targets. The default implementations of 27 // Dispatches events to appropriate targets. The default implementations of
27 // all of the specific handlers (e.g. OnKeyEvent, OnMouseEvent) do nothing. 28 // all of the specific handlers (e.g. OnKeyEvent, OnMouseEvent) do nothing.
28 class EVENTS_EXPORT EventHandler { 29 class EVENTS_EXPORT EventHandler {
29 public: 30 public:
30 EventHandler(); 31 EventHandler();
31 virtual ~EventHandler(); 32 virtual ~EventHandler();
32 33
33 // This is called for all events. The default implementation routes the event 34 // This is called for all events. The default implementation routes the event
34 // to one of the event-specific callbacks (OnKeyEvent, OnMouseEvent etc.). If 35 // to one of the event-specific callbacks (OnKeyEvent, OnMouseEvent etc.). If
35 // this is overridden, then normally, the override should chain into the 36 // this is overridden, then normally, the override should chain into the
36 // default implementation for un-handled events. 37 // default implementation for un-handled events.
37 virtual void OnEvent(Event* event); 38 virtual void OnEvent(Event* event);
38 39
40 virtual void OnGamepadEvent(GamepadEvent* event);
41
39 virtual void OnKeyEvent(KeyEvent* event); 42 virtual void OnKeyEvent(KeyEvent* event);
40 43
41 virtual void OnMouseEvent(MouseEvent* event); 44 virtual void OnMouseEvent(MouseEvent* event);
42 45
43 virtual void OnScrollEvent(ScrollEvent* event); 46 virtual void OnScrollEvent(ScrollEvent* event);
44 47
45 virtual void OnTouchEvent(TouchEvent* event); 48 virtual void OnTouchEvent(TouchEvent* event);
46 49
47 virtual void OnGestureEvent(GestureEvent* event); 50 virtual void OnGestureEvent(GestureEvent* event);
48 51
49 virtual void OnCancelMode(CancelModeEvent* event); 52 virtual void OnCancelMode(CancelModeEvent* event);
50 53
51 private: 54 private:
52 friend class EventDispatcher; 55 friend class EventDispatcher;
53 56
54 // EventDispatcher pushes itself on the top of this stack while dispatching 57 // EventDispatcher pushes itself on the top of this stack while dispatching
55 // events to this then pops itself off when done. 58 // events to this then pops itself off when done.
56 std::stack<EventDispatcher*> dispatchers_; 59 std::stack<EventDispatcher*> dispatchers_;
57 60
58 DISALLOW_COPY_AND_ASSIGN(EventHandler); 61 DISALLOW_COPY_AND_ASSIGN(EventHandler);
59 }; 62 };
60 63
61 typedef std::vector<EventHandler*> EventHandlerList; 64 typedef std::vector<EventHandler*> EventHandlerList;
62 65
63 } // namespace ui 66 } // namespace ui
64 67
65 #endif // UI_EVENTS_EVENT_HANDLER_H_ 68 #endif // UI_EVENTS_EVENT_HANDLER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698