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_EVENTS_EVENT_TARGET_H_ | 5 #ifndef UI_EVENTS_EVENT_TARGET_H_ |
6 #define UI_EVENTS_EVENT_TARGET_H_ | 6 #define UI_EVENTS_EVENT_TARGET_H_ |
7 | 7 |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
(...skipping 20 matching lines...) Expand all Loading... |
31 } | 31 } |
32 | 32 |
33 private: | 33 private: |
34 DispatcherApi(); | 34 DispatcherApi(); |
35 EventTarget* target_; | 35 EventTarget* target_; |
36 | 36 |
37 DISALLOW_COPY_AND_ASSIGN(DispatcherApi); | 37 DISALLOW_COPY_AND_ASSIGN(DispatcherApi); |
38 }; | 38 }; |
39 | 39 |
40 EventTarget(); | 40 EventTarget(); |
41 virtual ~EventTarget(); | 41 ~EventTarget() override; |
42 | 42 |
43 virtual bool CanAcceptEvent(const Event& event) = 0; | 43 virtual bool CanAcceptEvent(const Event& event) = 0; |
44 | 44 |
45 // Returns the parent EventTarget in the event-target tree. | 45 // Returns the parent EventTarget in the event-target tree. |
46 virtual EventTarget* GetParentTarget() = 0; | 46 virtual EventTarget* GetParentTarget() = 0; |
47 | 47 |
48 // Returns an iterator an EventTargeter can use to iterate over the list of | 48 // Returns an iterator an EventTargeter can use to iterate over the list of |
49 // child EventTargets. | 49 // child EventTargets. |
50 virtual scoped_ptr<EventTargetIterator> GetChildIterator() const = 0; | 50 virtual scoped_ptr<EventTargetIterator> GetChildIterator() const = 0; |
51 | 51 |
(...skipping 26 matching lines...) Expand all Loading... |
78 bool IsPreTargetListEmpty() const; | 78 bool IsPreTargetListEmpty() const; |
79 | 79 |
80 void set_target_handler(EventHandler* handler) { | 80 void set_target_handler(EventHandler* handler) { |
81 target_handler_ = handler; | 81 target_handler_ = handler; |
82 } | 82 } |
83 | 83 |
84 protected: | 84 protected: |
85 EventHandler* target_handler() { return target_handler_; } | 85 EventHandler* target_handler() { return target_handler_; } |
86 | 86 |
87 // Overridden from EventHandler: | 87 // Overridden from EventHandler: |
88 virtual void OnEvent(Event* event) override; | 88 void OnEvent(Event* event) override; |
89 virtual void OnKeyEvent(KeyEvent* event) override; | 89 void OnKeyEvent(KeyEvent* event) override; |
90 virtual void OnMouseEvent(MouseEvent* event) override; | 90 void OnMouseEvent(MouseEvent* event) override; |
91 virtual void OnScrollEvent(ScrollEvent* event) override; | 91 void OnScrollEvent(ScrollEvent* event) override; |
92 virtual void OnTouchEvent(TouchEvent* event) override; | 92 void OnTouchEvent(TouchEvent* event) override; |
93 virtual void OnGestureEvent(GestureEvent* event) override; | 93 void OnGestureEvent(GestureEvent* event) override; |
94 | 94 |
95 private: | 95 private: |
96 friend class EventDispatcher; | 96 friend class EventDispatcher; |
97 friend class EventTargetTestApi; | 97 friend class EventTargetTestApi; |
98 | 98 |
99 // Returns the list of handlers that should receive the event before the | 99 // Returns the list of handlers that should receive the event before the |
100 // target. The handlers from the outermost target are first in the list, and | 100 // target. The handlers from the outermost target are first in the list, and |
101 // the handlers on |this| are the last in the list. | 101 // the handlers on |this| are the last in the list. |
102 void GetPreTargetHandlers(EventHandlerList* list); | 102 void GetPreTargetHandlers(EventHandlerList* list); |
103 | 103 |
104 // Returns the list of handlers that should receive the event after the | 104 // Returns the list of handlers that should receive the event after the |
105 // target. The handlers from the outermost target are last in the list, and | 105 // target. The handlers from the outermost target are last in the list, and |
106 // the handlers on |this| are the first in the list. | 106 // the handlers on |this| are the first in the list. |
107 void GetPostTargetHandlers(EventHandlerList* list); | 107 void GetPostTargetHandlers(EventHandlerList* list); |
108 | 108 |
109 EventHandlerList pre_target_list_; | 109 EventHandlerList pre_target_list_; |
110 EventHandlerList post_target_list_; | 110 EventHandlerList post_target_list_; |
111 EventHandler* target_handler_; | 111 EventHandler* target_handler_; |
112 | 112 |
113 DISALLOW_COPY_AND_ASSIGN(EventTarget); | 113 DISALLOW_COPY_AND_ASSIGN(EventTarget); |
114 }; | 114 }; |
115 | 115 |
116 } // namespace ui | 116 } // namespace ui |
117 | 117 |
118 #endif // UI_EVENTS_EVENT_TARGET_H_ | 118 #endif // UI_EVENTS_EVENT_TARGET_H_ |
OLD | NEW |