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_VIEW_H_ | 5 #ifndef UI_VIEWS_VIEW_H_ |
6 #define UI_VIEWS_VIEW_H_ | 6 #define UI_VIEWS_VIEW_H_ |
7 | 7 |
8 #include <algorithm> | 8 #include <algorithm> |
9 #include <map> | 9 #include <map> |
10 #include <set> | 10 #include <set> |
(...skipping 490 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
501 // view's coordinates, except for a RootView. | 501 // view's coordinates, except for a RootView. |
502 | 502 |
503 // Returns the deepest visible descendant that contains the specified point. | 503 // Returns the deepest visible descendant that contains the specified point. |
504 virtual View* GetEventHandlerForPoint(const gfx::Point& point); | 504 virtual View* GetEventHandlerForPoint(const gfx::Point& point); |
505 | 505 |
506 // Return the cursor that should be used for this view or the default cursor. | 506 // Return the cursor that should be used for this view or the default cursor. |
507 // The event location is in the receiver's coordinate system. The caller is | 507 // The event location is in the receiver's coordinate system. The caller is |
508 // responsible for managing the lifetime of the returned object, though that | 508 // responsible for managing the lifetime of the returned object, though that |
509 // lifetime may vary from platform to platform. On Windows and Aura, | 509 // lifetime may vary from platform to platform. On Windows and Aura, |
510 // the cursor is a shared resource. | 510 // the cursor is a shared resource. |
511 virtual gfx::NativeCursor GetCursor(const MouseEvent& event); | 511 virtual gfx::NativeCursor GetCursor(const ui::MouseEvent& event); |
512 | 512 |
513 // A convenience function which calls HitTestRect() with a rect of size | 513 // A convenience function which calls HitTestRect() with a rect of size |
514 // 1x1 and an origin of |point|. | 514 // 1x1 and an origin of |point|. |
515 bool HitTestPoint(const gfx::Point& point) const; | 515 bool HitTestPoint(const gfx::Point& point) const; |
516 | 516 |
517 // Tests whether |rect| intersects this view's bounds. | 517 // Tests whether |rect| intersects this view's bounds. |
518 virtual bool HitTestRect(const gfx::Rect& rect) const; | 518 virtual bool HitTestRect(const gfx::Rect& rect) const; |
519 | 519 |
520 // This method is invoked when the user clicks on this view. | 520 // This method is invoked when the user clicks on this view. |
521 // The provided event is in the receiver's coordinate system. | 521 // The provided event is in the receiver's coordinate system. |
522 // | 522 // |
523 // Return true if you processed the event and want to receive subsequent | 523 // Return true if you processed the event and want to receive subsequent |
524 // MouseDraggged and MouseReleased events. This also stops the event from | 524 // MouseDraggged and MouseReleased events. This also stops the event from |
525 // bubbling. If you return false, the event will bubble through parent | 525 // bubbling. If you return false, the event will bubble through parent |
526 // views. | 526 // views. |
527 // | 527 // |
528 // If you remove yourself from the tree while processing this, event bubbling | 528 // If you remove yourself from the tree while processing this, event bubbling |
529 // stops as if you returned true, but you will not receive future events. | 529 // stops as if you returned true, but you will not receive future events. |
530 // The return value is ignored in this case. | 530 // The return value is ignored in this case. |
531 // | 531 // |
532 // Default implementation returns true if a ContextMenuController has been | 532 // Default implementation returns true if a ContextMenuController has been |
533 // set, false otherwise. Override as needed. | 533 // set, false otherwise. Override as needed. |
534 // | 534 // |
535 virtual bool OnMousePressed(const MouseEvent& event); | 535 virtual bool OnMousePressed(const ui::MouseEvent& event); |
536 | 536 |
537 // This method is invoked when the user clicked on this control. | 537 // This method is invoked when the user clicked on this control. |
538 // and is still moving the mouse with a button pressed. | 538 // and is still moving the mouse with a button pressed. |
539 // The provided event is in the receiver's coordinate system. | 539 // The provided event is in the receiver's coordinate system. |
540 // | 540 // |
541 // Return true if you processed the event and want to receive | 541 // Return true if you processed the event and want to receive |
542 // subsequent MouseDragged and MouseReleased events. | 542 // subsequent MouseDragged and MouseReleased events. |
543 // | 543 // |
544 // Default implementation returns true if a ContextMenuController has been | 544 // Default implementation returns true if a ContextMenuController has been |
545 // set, false otherwise. Override as needed. | 545 // set, false otherwise. Override as needed. |
546 // | 546 // |
547 virtual bool OnMouseDragged(const MouseEvent& event); | 547 virtual bool OnMouseDragged(const ui::MouseEvent& event); |
548 | 548 |
549 // This method is invoked when the user releases the mouse | 549 // This method is invoked when the user releases the mouse |
550 // button. The event is in the receiver's coordinate system. | 550 // button. The event is in the receiver's coordinate system. |
551 // | 551 // |
552 // Default implementation notifies the ContextMenuController is appropriate. | 552 // Default implementation notifies the ContextMenuController is appropriate. |
553 // Subclasses that wish to honor the ContextMenuController should invoke | 553 // Subclasses that wish to honor the ContextMenuController should invoke |
554 // super. | 554 // super. |
555 virtual void OnMouseReleased(const MouseEvent& event); | 555 virtual void OnMouseReleased(const ui::MouseEvent& event); |
556 | 556 |
557 // This method is invoked when the mouse press/drag was canceled by a | 557 // This method is invoked when the mouse press/drag was canceled by a |
558 // system/user gesture. | 558 // system/user gesture. |
559 virtual void OnMouseCaptureLost(); | 559 virtual void OnMouseCaptureLost(); |
560 | 560 |
561 // This method is invoked when the mouse is above this control | 561 // This method is invoked when the mouse is above this control |
562 // The event is in the receiver's coordinate system. | 562 // The event is in the receiver's coordinate system. |
563 // | 563 // |
564 // Default implementation does nothing. Override as needed. | 564 // Default implementation does nothing. Override as needed. |
565 virtual void OnMouseMoved(const MouseEvent& event); | 565 virtual void OnMouseMoved(const ui::MouseEvent& event); |
566 | 566 |
567 // This method is invoked when the mouse enters this control. | 567 // This method is invoked when the mouse enters this control. |
568 // | 568 // |
569 // Default implementation does nothing. Override as needed. | 569 // Default implementation does nothing. Override as needed. |
570 virtual void OnMouseEntered(const MouseEvent& event); | 570 virtual void OnMouseEntered(const ui::MouseEvent& event); |
571 | 571 |
572 // This method is invoked when the mouse exits this control | 572 // This method is invoked when the mouse exits this control |
573 // The provided event location is always (0, 0) | 573 // The provided event location is always (0, 0) |
574 // Default implementation does nothing. Override as needed. | 574 // Default implementation does nothing. Override as needed. |
575 virtual void OnMouseExited(const MouseEvent& event); | 575 virtual void OnMouseExited(const ui::MouseEvent& event); |
576 | 576 |
577 // This method is invoked for each touch event. Default implementation | 577 // This method is invoked for each touch event. Default implementation |
578 // does nothing. Override as needed. | 578 // does nothing. Override as needed. |
579 virtual ui::TouchStatus OnTouchEvent(const TouchEvent& event); | 579 virtual ui::TouchStatus OnTouchEvent(const TouchEvent& event); |
580 | 580 |
581 // This method is invoked for each GestureEvent created by GestureRecognizer. | 581 // This method is invoked for each GestureEvent created by GestureRecognizer. |
582 // Default implementation does nothing. Override as needed. | 582 // Default implementation does nothing. Override as needed. |
583 // If a View returns ui::GESTURE_STATUS_CONSUMED from OnGestureEvent, then | 583 // If a View returns ui::GESTURE_STATUS_CONSUMED from OnGestureEvent, then |
584 // subsequent gestures will be dispatched to the same View, until the gesture | 584 // subsequent gestures will be dispatched to the same View, until the gesture |
585 // ends (i.e. all touch-points are released). | 585 // ends (i.e. all touch-points are released). |
(...skipping 684 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1270 void OrphanLayers(); | 1270 void OrphanLayers(); |
1271 | 1271 |
1272 // Destroys the layer associated with this view, and reparents any descendants | 1272 // Destroys the layer associated with this view, and reparents any descendants |
1273 // to the destroyed layer's parent. | 1273 // to the destroyed layer's parent. |
1274 void DestroyLayer(); | 1274 void DestroyLayer(); |
1275 | 1275 |
1276 // Input --------------------------------------------------------------------- | 1276 // Input --------------------------------------------------------------------- |
1277 | 1277 |
1278 // RootView invokes these. These in turn invoke the appropriate OnMouseXXX | 1278 // RootView invokes these. These in turn invoke the appropriate OnMouseXXX |
1279 // method. If a drag is detected, DoDrag is invoked. | 1279 // method. If a drag is detected, DoDrag is invoked. |
1280 bool ProcessMousePressed(const MouseEvent& event, DragInfo* drop_info); | 1280 bool ProcessMousePressed(const ui::MouseEvent& event, DragInfo* drop_info); |
1281 bool ProcessMouseDragged(const MouseEvent& event, DragInfo* drop_info); | 1281 bool ProcessMouseDragged(const ui::MouseEvent& event, DragInfo* drop_info); |
1282 void ProcessMouseReleased(const MouseEvent& event); | 1282 void ProcessMouseReleased(const ui::MouseEvent& event); |
1283 | 1283 |
1284 // RootView will invoke this with incoming TouchEvents. Returns the result | 1284 // RootView will invoke this with incoming TouchEvents. Returns the result |
1285 // of OnTouchEvent. | 1285 // of OnTouchEvent. |
1286 ui::TouchStatus ProcessTouchEvent(const TouchEvent& event); | 1286 ui::TouchStatus ProcessTouchEvent(const TouchEvent& event); |
1287 | 1287 |
1288 // RootView will invoke this with incoming GestureEvents. This will invoke | 1288 // RootView will invoke this with incoming GestureEvents. This will invoke |
1289 // OnGestureEvent and return the result. | 1289 // OnGestureEvent and return the result. |
1290 ui::GestureStatus ProcessGestureEvent(const GestureEvent& event); | 1290 ui::GestureStatus ProcessGestureEvent(const GestureEvent& event); |
1291 | 1291 |
1292 // Accelerators -------------------------------------------------------------- | 1292 // Accelerators -------------------------------------------------------------- |
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1473 base::win::ScopedComPtr<NativeViewAccessibilityWin> | 1473 base::win::ScopedComPtr<NativeViewAccessibilityWin> |
1474 native_view_accessibility_win_; | 1474 native_view_accessibility_win_; |
1475 #endif | 1475 #endif |
1476 | 1476 |
1477 DISALLOW_COPY_AND_ASSIGN(View); | 1477 DISALLOW_COPY_AND_ASSIGN(View); |
1478 }; | 1478 }; |
1479 | 1479 |
1480 } // namespace views | 1480 } // namespace views |
1481 | 1481 |
1482 #endif // UI_VIEWS_VIEW_H_ | 1482 #endif // UI_VIEWS_VIEW_H_ |
OLD | NEW |