Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(533)

Side by Side Diff: ui/views/view.h

Issue 10827198: Change View::HitTest to View::HitTestRect (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Fixed errors reported by trybots Created 8 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « ui/views/controls/link.cc ('k') | ui/views/view.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 491 matching lines...) Expand 10 before | Expand all | Expand 10 after
502 // Returns the deepest visible descendant that contains the specified point. 502 // Returns the deepest visible descendant that contains the specified point.
503 virtual View* GetEventHandlerForPoint(const gfx::Point& point); 503 virtual View* GetEventHandlerForPoint(const gfx::Point& point);
504 504
505 // Return the cursor that should be used for this view or the default cursor. 505 // Return the cursor that should be used for this view or the default cursor.
506 // The event location is in the receiver's coordinate system. The caller is 506 // The event location is in the receiver's coordinate system. The caller is
507 // responsible for managing the lifetime of the returned object, though that 507 // responsible for managing the lifetime of the returned object, though that
508 // lifetime may vary from platform to platform. On Windows and Aura, 508 // lifetime may vary from platform to platform. On Windows and Aura,
509 // the cursor is a shared resource. 509 // the cursor is a shared resource.
510 virtual gfx::NativeCursor GetCursor(const MouseEvent& event); 510 virtual gfx::NativeCursor GetCursor(const MouseEvent& event);
511 511
512 // Convenience to test whether a point is within this view's bounds 512 // A convenience function which calls HitTestRect() with a rect of size
513 virtual bool HitTest(const gfx::Point& l) const; 513 // 1x1 and an origin of |point|.
514 bool HitTestPoint(const gfx::Point& point) const;
515
516 // Tests whether |rect| intersects this view's bounds.
517 virtual bool HitTestRect(const gfx::Rect& rect) const;
514 518
515 // This method is invoked when the user clicks on this view. 519 // This method is invoked when the user clicks on this view.
516 // The provided event is in the receiver's coordinate system. 520 // The provided event is in the receiver's coordinate system.
517 // 521 //
518 // Return true if you processed the event and want to receive subsequent 522 // Return true if you processed the event and want to receive subsequent
519 // MouseDraggged and MouseReleased events. This also stops the event from 523 // MouseDraggged and MouseReleased events. This also stops the event from
520 // bubbling. If you return false, the event will bubble through parent 524 // bubbling. If you return false, the event will bubble through parent
521 // views. 525 // views.
522 // 526 //
523 // If you remove yourself from the tree while processing this, event bubbling 527 // If you remove yourself from the tree while processing this, event bubbling
(...skipping 497 matching lines...) Expand 10 before | Expand all | Expand 10 after
1021 // view), then reorders the immediate children of that layer to match the 1025 // view), then reorders the immediate children of that layer to match the
1022 // order of the view tree. 1026 // order of the view tree.
1023 virtual void ReorderLayers(); 1027 virtual void ReorderLayers();
1024 1028
1025 // This reorders the immediate children of |*parent_layer| to match the 1029 // This reorders the immediate children of |*parent_layer| to match the
1026 // order of the view tree. 1030 // order of the view tree.
1027 virtual void ReorderChildLayers(ui::Layer* parent_layer); 1031 virtual void ReorderChildLayers(ui::Layer* parent_layer);
1028 1032
1029 // Input --------------------------------------------------------------------- 1033 // Input ---------------------------------------------------------------------
1030 1034
1031 // Called by HitTest to see if this View has a custom hit test mask. If the 1035 // Called by HitTestRect() to see if this View has a custom hit test mask. If
1032 // return value is true, GetHitTestMask will be called to obtain the mask. 1036 // the return value is true, GetHitTestMask() will be called to obtain the
1033 // Default value is false, in which case the View will hit-test against its 1037 // mask. Default value is false, in which case the View will hit-test against
1034 // bounds. 1038 // its bounds.
1035 virtual bool HasHitTestMask() const; 1039 virtual bool HasHitTestMask() const;
1036 1040
1037 // Called by HitTest to retrieve a mask for hit-testing against. Subclasses 1041 // Called by HitTestRect() to retrieve a mask for hit-testing against.
1038 // override to provide custom shaped hit test regions. 1042 // Subclasses override to provide custom shaped hit test regions.
1039 virtual void GetHitTestMask(gfx::Path* mask) const; 1043 virtual void GetHitTestMask(gfx::Path* mask) const;
1040 1044
1041 // Focus --------------------------------------------------------------------- 1045 // Focus ---------------------------------------------------------------------
1042 1046
1043 // Override to be notified when focus has changed either to or from this View. 1047 // Override to be notified when focus has changed either to or from this View.
1044 virtual void OnFocus(); 1048 virtual void OnFocus();
1045 virtual void OnBlur(); 1049 virtual void OnBlur();
1046 1050
1047 // Handle view focus/blur events for this view. 1051 // Handle view focus/blur events for this view.
1048 void Focus(); 1052 void Focus();
(...skipping 419 matching lines...) Expand 10 before | Expand all | Expand 10 after
1468 base::win::ScopedComPtr<NativeViewAccessibilityWin> 1472 base::win::ScopedComPtr<NativeViewAccessibilityWin>
1469 native_view_accessibility_win_; 1473 native_view_accessibility_win_;
1470 #endif 1474 #endif
1471 1475
1472 DISALLOW_COPY_AND_ASSIGN(View); 1476 DISALLOW_COPY_AND_ASSIGN(View);
1473 }; 1477 };
1474 1478
1475 } // namespace views 1479 } // namespace views
1476 1480
1477 #endif // UI_VIEWS_VIEW_H_ 1481 #endif // UI_VIEWS_VIEW_H_
OLDNEW
« no previous file with comments | « ui/views/controls/link.cc ('k') | ui/views/view.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698