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 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
70 | 70 |
71 // Adds a handler to receive events after the target. The handler must be | 71 // Adds a handler to receive events after the target. The handler must be |
72 // explicitly removed from the target before the handler is destroyed. The | 72 // explicitly removed from the target before the handler is destroyed. The |
73 // EventTarget does not take ownership of the handler. | 73 // EventTarget does not take ownership of the handler. |
74 void AddPostTargetHandler(EventHandler* handler); | 74 void AddPostTargetHandler(EventHandler* handler); |
75 void RemovePostTargetHandler(EventHandler* handler); | 75 void RemovePostTargetHandler(EventHandler* handler); |
76 | 76 |
77 // Returns true if the event pre target list is empty. | 77 // Returns true if the event pre target list is empty. |
78 bool IsPreTargetListEmpty() const; | 78 bool IsPreTargetListEmpty() const; |
79 | 79 |
80 void set_target_handler(EventHandler* handler) { | 80 // Sets |target_handler| as |target_handler_| and returns its original value. |
81 target_handler_ = handler; | 81 EventHandler* SetTargetHandler(EventHandler* target_handler); |
82 } | |
83 | 82 |
84 protected: | 83 protected: |
85 EventHandler* target_handler() { return target_handler_; } | 84 EventHandler* target_handler() { return target_handler_; } |
86 | 85 |
87 // Overridden from EventHandler: | 86 // Overridden from EventHandler: |
88 void OnEvent(Event* event) override; | 87 void OnEvent(Event* event) override; |
89 void OnKeyEvent(KeyEvent* event) override; | 88 void OnKeyEvent(KeyEvent* event) override; |
90 void OnMouseEvent(MouseEvent* event) override; | 89 void OnMouseEvent(MouseEvent* event) override; |
91 void OnScrollEvent(ScrollEvent* event) override; | 90 void OnScrollEvent(ScrollEvent* event) override; |
92 void OnTouchEvent(TouchEvent* event) override; | 91 void OnTouchEvent(TouchEvent* event) override; |
(...skipping 16 matching lines...) Expand all Loading... |
109 EventHandlerList pre_target_list_; | 108 EventHandlerList pre_target_list_; |
110 EventHandlerList post_target_list_; | 109 EventHandlerList post_target_list_; |
111 EventHandler* target_handler_; | 110 EventHandler* target_handler_; |
112 | 111 |
113 DISALLOW_COPY_AND_ASSIGN(EventTarget); | 112 DISALLOW_COPY_AND_ASSIGN(EventTarget); |
114 }; | 113 }; |
115 | 114 |
116 } // namespace ui | 115 } // namespace ui |
117 | 116 |
118 #endif // UI_EVENTS_EVENT_TARGET_H_ | 117 #endif // UI_EVENTS_EVENT_TARGET_H_ |
OLD | NEW |