| 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 "base/basictypes.h" | 8 #include "base/basictypes.h" |
| 9 #include "base/compiler_specific.h" | 9 #include "base/compiler_specific.h" |
| 10 #include "ui/events/event_handler.h" | 10 #include "ui/events/event_handler.h" |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 63 // of the list so it is the first one to receive events. | 63 // of the list so it is the first one to receive events. |
| 64 void PrependPreTargetHandler(EventHandler* handler); | 64 void PrependPreTargetHandler(EventHandler* handler); |
| 65 void RemovePreTargetHandler(EventHandler* handler); | 65 void RemovePreTargetHandler(EventHandler* handler); |
| 66 | 66 |
| 67 // Adds a handler to receive events after the target. The handler must be | 67 // Adds a handler to receive events after the target. The handler must be |
| 68 // explicitly removed from the target before the handler is destroyed. The | 68 // explicitly removed from the target before the handler is destroyed. The |
| 69 // EventTarget does not take ownership of the handler. | 69 // EventTarget does not take ownership of the handler. |
| 70 void AddPostTargetHandler(EventHandler* handler); | 70 void AddPostTargetHandler(EventHandler* handler); |
| 71 void RemovePostTargetHandler(EventHandler* handler); | 71 void RemovePostTargetHandler(EventHandler* handler); |
| 72 | 72 |
| 73 // Returns true if the event pre target list is empty. |
| 74 bool IsPreTargetListEmpty() const; |
| 75 |
| 73 protected: | 76 protected: |
| 74 void set_target_handler(EventHandler* handler) { | 77 void set_target_handler(EventHandler* handler) { |
| 75 target_handler_ = handler; | 78 target_handler_ = handler; |
| 76 } | 79 } |
| 77 | 80 |
| 78 // Overridden from EventHandler: | 81 // Overridden from EventHandler: |
| 79 virtual void OnEvent(Event* event) OVERRIDE; | 82 virtual void OnEvent(Event* event) OVERRIDE; |
| 80 virtual void OnKeyEvent(KeyEvent* event) OVERRIDE; | 83 virtual void OnKeyEvent(KeyEvent* event) OVERRIDE; |
| 81 virtual void OnMouseEvent(MouseEvent* event) OVERRIDE; | 84 virtual void OnMouseEvent(MouseEvent* event) OVERRIDE; |
| 82 virtual void OnScrollEvent(ScrollEvent* event) OVERRIDE; | 85 virtual void OnScrollEvent(ScrollEvent* event) OVERRIDE; |
| (...skipping 16 matching lines...) Expand all Loading... |
| 99 EventHandlerList pre_target_list_; | 102 EventHandlerList pre_target_list_; |
| 100 EventHandlerList post_target_list_; | 103 EventHandlerList post_target_list_; |
| 101 EventHandler* target_handler_; | 104 EventHandler* target_handler_; |
| 102 | 105 |
| 103 DISALLOW_COPY_AND_ASSIGN(EventTarget); | 106 DISALLOW_COPY_AND_ASSIGN(EventTarget); |
| 104 }; | 107 }; |
| 105 | 108 |
| 106 } // namespace ui | 109 } // namespace ui |
| 107 | 110 |
| 108 #endif // UI_EVENTS_EVENT_TARGET_H_ | 111 #endif // UI_EVENTS_EVENT_TARGET_H_ |
| OLD | NEW |