| 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_VIEWS_WIDGET_ROOT_VIEW_H_ | 5 #ifndef UI_VIEWS_WIDGET_ROOT_VIEW_H_ |
| 6 #define UI_VIEWS_WIDGET_ROOT_VIEW_H_ | 6 #define UI_VIEWS_WIDGET_ROOT_VIEW_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/macros.h" | 10 #include "base/macros.h" |
| (...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 152 | 152 |
| 153 // |view| is the view receiving |event|. This function sends the event to all | 153 // |view| is the view receiving |event|. This function sends the event to all |
| 154 // the Views up the hierarchy that has |notify_enter_exit_on_child_| flag | 154 // the Views up the hierarchy that has |notify_enter_exit_on_child_| flag |
| 155 // turned on, but does not contain |sibling|. | 155 // turned on, but does not contain |sibling|. |
| 156 ui::EventDispatchDetails NotifyEnterExitOfDescendant( | 156 ui::EventDispatchDetails NotifyEnterExitOfDescendant( |
| 157 const ui::MouseEvent& event, | 157 const ui::MouseEvent& event, |
| 158 ui::EventType type, | 158 ui::EventType type, |
| 159 View* view, | 159 View* view, |
| 160 View* sibling) WARN_UNUSED_RESULT; | 160 View* sibling) WARN_UNUSED_RESULT; |
| 161 | 161 |
| 162 // Specialized version of SetMouseHandler(). If |clear_on_release| is true the | |
| 163 // mouse handler will be cleared on mouse release, which is the common case | |
| 164 // and used for drags. If |clear_on_release| is false then the mouse handler | |
| 165 // must be explicitly by calling SetMouseHandler() with null. | |
| 166 void SetMouseHandler(View* view, bool clear_on_release); | |
| 167 | |
| 168 // Overridden from ui::EventDispatcherDelegate: | 162 // Overridden from ui::EventDispatcherDelegate: |
| 169 bool CanDispatchToTarget(ui::EventTarget* target) override; | 163 bool CanDispatchToTarget(ui::EventTarget* target) override; |
| 170 ui::EventDispatchDetails PreDispatchEvent(ui::EventTarget* target, | 164 ui::EventDispatchDetails PreDispatchEvent(ui::EventTarget* target, |
| 171 ui::Event* event) override; | 165 ui::Event* event) override; |
| 172 ui::EventDispatchDetails PostDispatchEvent(ui::EventTarget* target, | 166 ui::EventDispatchDetails PostDispatchEvent(ui::EventTarget* target, |
| 173 const ui::Event& event) override; | 167 const ui::Event& event) override; |
| 174 | 168 |
| 175 ////////////////////////////////////////////////////////////////////////////// | 169 ////////////////////////////////////////////////////////////////////////////// |
| 176 // Tree operations ----------------------------------------------------------- | 170 // Tree operations ----------------------------------------------------------- |
| 177 | 171 |
| 178 // The host Widget | 172 // The host Widget |
| 179 Widget* widget_; | 173 Widget* widget_; |
| 180 | 174 |
| 181 // Input --------------------------------------------------------------------- | 175 // Input --------------------------------------------------------------------- |
| 182 | 176 |
| 183 // TODO(tdanderson): Consider moving the input-related members into | 177 // TODO(tdanderson): Consider moving the input-related members into |
| 184 // ViewTargeter / RootViewTargeter. | 178 // ViewTargeter / RootViewTargeter. |
| 185 | 179 |
| 186 // The view currently handing down - drag - up | 180 // The view currently handing down - drag - up |
| 187 View* mouse_pressed_handler_; | 181 View* mouse_pressed_handler_; |
| 188 | 182 |
| 189 // The view currently handling enter / exit | 183 // The view currently handling enter / exit |
| 190 View* mouse_move_handler_; | 184 View* mouse_move_handler_; |
| 191 | 185 |
| 192 // The last view to handle a mouse click, so that we can determine if | 186 // The last view to handle a mouse click, so that we can determine if |
| 193 // a double-click lands on the same view as its single-click part. | 187 // a double-click lands on the same view as its single-click part. |
| 194 View* last_click_handler_; | 188 View* last_click_handler_; |
| 195 | 189 |
| 196 // True if mouse_pressed_handler_ has been explicitly set. | 190 // true if mouse_pressed_handler_ has been explicitly set |
| 197 bool explicit_mouse_handler_; | 191 bool explicit_mouse_handler_; |
| 198 | 192 |
| 199 // True if mouse_pressed_handler_ should be automatically cleared on mouse | |
| 200 // release, as is common during drags. | |
| 201 bool clear_mouse_handler_on_release_; | |
| 202 | |
| 203 // Last position/flag of a mouse press/drag. Used if capture stops and we need | 193 // Last position/flag of a mouse press/drag. Used if capture stops and we need |
| 204 // to synthesize a release. | 194 // to synthesize a release. |
| 205 int last_mouse_event_flags_; | 195 int last_mouse_event_flags_; |
| 206 int last_mouse_event_x_; | 196 int last_mouse_event_x_; |
| 207 int last_mouse_event_y_; | 197 int last_mouse_event_y_; |
| 208 | 198 |
| 209 // The View currently handling gesture events. | 199 // The View currently handling gesture events. |
| 210 View* gesture_handler_; | 200 View* gesture_handler_; |
| 211 | 201 |
| 212 // Used to indicate if the |gesture_handler_| member was set prior to the | 202 // Used to indicate if the |gesture_handler_| member was set prior to the |
| (...skipping 30 matching lines...) Expand all Loading... |
| 243 // Tracks drag state for a view. | 233 // Tracks drag state for a view. |
| 244 View::DragInfo drag_info_; | 234 View::DragInfo drag_info_; |
| 245 | 235 |
| 246 DISALLOW_IMPLICIT_CONSTRUCTORS(RootView); | 236 DISALLOW_IMPLICIT_CONSTRUCTORS(RootView); |
| 247 }; | 237 }; |
| 248 | 238 |
| 249 } // namespace internal | 239 } // namespace internal |
| 250 } // namespace views | 240 } // namespace views |
| 251 | 241 |
| 252 #endif // UI_VIEWS_WIDGET_ROOT_VIEW_H_ | 242 #endif // UI_VIEWS_WIDGET_ROOT_VIEW_H_ |
| OLD | NEW |