| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 VIEWS_WIDGET_ROOT_VIEW_H_ | 5 #ifndef VIEWS_WIDGET_ROOT_VIEW_H_ |
| 6 #define VIEWS_WIDGET_ROOT_VIEW_H_ | 6 #define VIEWS_WIDGET_ROOT_VIEW_H_ |
| 7 | 7 |
| 8 #include <set> |
| 8 #include <string> | 9 #include <string> |
| 9 | 10 |
| 10 #include "base/ref_counted.h" | 11 #include "base/ref_counted.h" |
| 11 #include "views/focus/focus_manager.h" | 12 #include "views/focus/focus_manager.h" |
| 12 #include "views/view.h" | 13 #include "views/view.h" |
| 13 | 14 |
| 14 #if defined(OS_LINUX) | 15 #if defined(OS_LINUX) |
| 15 typedef struct _GdkEventExpose GdkEventExpose; | 16 typedef struct _GdkEventExpose GdkEventExpose; |
| 16 #endif | 17 #endif |
| 17 | 18 |
| (...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 210 | 211 |
| 211 // Notification that size and/or position of a view has changed. This | 212 // Notification that size and/or position of a view has changed. This |
| 212 // notifies the appropriate views. | 213 // notifies the appropriate views. |
| 213 void ViewBoundsChanged(View* view, bool size_changed, bool position_changed); | 214 void ViewBoundsChanged(View* view, bool size_changed, bool position_changed); |
| 214 | 215 |
| 215 // Registers a view for notification when the visible bounds relative to the | 216 // Registers a view for notification when the visible bounds relative to the |
| 216 // root of a view changes. | 217 // root of a view changes. |
| 217 void RegisterViewForVisibleBoundsNotification(View* view); | 218 void RegisterViewForVisibleBoundsNotification(View* view); |
| 218 void UnregisterViewForVisibleBoundsNotification(View* view); | 219 void UnregisterViewForVisibleBoundsNotification(View* view); |
| 219 | 220 |
| 221 // Registers/unregisters the View for mouse near events. |
| 222 void RegisterViewForNearNotification(View* view); |
| 223 void UnregisterViewForNearNotification(View* view); |
| 224 |
| 220 // Returns the next focusable view or view containing a FocusTraversable (NULL | 225 // Returns the next focusable view or view containing a FocusTraversable (NULL |
| 221 // if none was found), starting at the starting_view. | 226 // if none was found), starting at the starting_view. |
| 222 // check_starting_view, can_go_up and can_go_down controls the traversal of | 227 // check_starting_view, can_go_up and can_go_down controls the traversal of |
| 223 // the views hierarchy. | 228 // the views hierarchy. |
| 224 // skip_group_id specifies a group_id, -1 means no group. All views from a | 229 // skip_group_id specifies a group_id, -1 means no group. All views from a |
| 225 // group are traversed in one pass. | 230 // group are traversed in one pass. |
| 226 View* FindNextFocusableViewImpl(View* starting_view, | 231 View* FindNextFocusableViewImpl(View* starting_view, |
| 227 bool check_starting_view, | 232 bool check_starting_view, |
| 228 bool can_go_up, | 233 bool can_go_up, |
| 229 bool can_go_down, | 234 bool can_go_down, |
| (...skipping 21 matching lines...) Expand all Loading... |
| 251 | 256 |
| 252 // Updates the last_mouse_* fields from e. | 257 // Updates the last_mouse_* fields from e. |
| 253 void SetMouseLocationAndFlags(const MouseEvent& e); | 258 void SetMouseLocationAndFlags(const MouseEvent& e); |
| 254 | 259 |
| 255 // If a view is dragging, this returns it. Otherwise returns NULL. | 260 // If a view is dragging, this returns it. Otherwise returns NULL. |
| 256 View* GetDragView(); | 261 View* GetDragView(); |
| 257 | 262 |
| 258 // Sets the current cursor, or resets it to the last one if NULL is provided. | 263 // Sets the current cursor, or resets it to the last one if NULL is provided. |
| 259 void SetActiveCursor(gfx::NativeCursor cursor); | 264 void SetActiveCursor(gfx::NativeCursor cursor); |
| 260 | 265 |
| 266 // Returns in |near_views| the set of views registered for mouse near events |
| 267 // that overlap with the location of the specified event. |
| 268 void GetViewsRegisteredForNearNotification(const MouseEvent& e, |
| 269 std::set<View*>* near_views); |
| 270 |
| 271 // Sends OnMouseExitedNear to the set of views the mouse is near and empties |
| 272 // the set. |
| 273 void SendMouseExitedNear(); |
| 274 |
| 261 // The view currently handing down - drag - up | 275 // The view currently handing down - drag - up |
| 262 View* mouse_pressed_handler_; | 276 View* mouse_pressed_handler_; |
| 263 | 277 |
| 264 // The view currently handling enter / exit | 278 // The view currently handling enter / exit |
| 265 View* mouse_move_handler_; | 279 View* mouse_move_handler_; |
| 266 | 280 |
| 267 // The last view to handle a mouse click, so that we can determine if | 281 // The last view to handle a mouse click, so that we can determine if |
| 268 // a double-click lands on the same view as its single-click part. | 282 // a double-click lands on the same view as its single-click part. |
| 269 View* last_click_handler_; | 283 View* last_click_handler_; |
| 270 | 284 |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 323 | 337 |
| 324 // Valid for the lifetime of StartDragForViewFromMouseEvent, indicates the | 338 // Valid for the lifetime of StartDragForViewFromMouseEvent, indicates the |
| 325 // view the drag started from. | 339 // view the drag started from. |
| 326 View* drag_view_; | 340 View* drag_view_; |
| 327 | 341 |
| 328 #ifndef NDEBUG | 342 #ifndef NDEBUG |
| 329 // True if we're currently processing paint. | 343 // True if we're currently processing paint. |
| 330 bool is_processing_paint_; | 344 bool is_processing_paint_; |
| 331 #endif | 345 #endif |
| 332 | 346 |
| 347 // Set of views registered for mouse near events. |
| 348 // NOTE: because views registered for near mouse events can overlap other |
| 349 // views and extend outside the bounds of themselves and ancestors we store |
| 350 // the registered views here and treat them separately. This is generally ok |
| 351 // as there are a small set of views registered for near notification. |
| 352 std::set<View*> registered_near_views_; |
| 353 |
| 354 // Set of views the mouse is currently near. |
| 355 std::set<View*> near_views_; |
| 356 |
| 333 DISALLOW_COPY_AND_ASSIGN(RootView); | 357 DISALLOW_COPY_AND_ASSIGN(RootView); |
| 334 }; | 358 }; |
| 335 | 359 |
| 336 } // namespace views | 360 } // namespace views |
| 337 | 361 |
| 338 #endif // VIEWS_WIDGET_ROOT_VIEW_H_ | 362 #endif // VIEWS_WIDGET_ROOT_VIEW_H_ |
| OLD | NEW |