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 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
101 // accessed from the main thread. | 101 // accessed from the main thread. |
102 // | 102 // |
103 ///////////////////////////////////////////////////////////////////////////// | 103 ///////////////////////////////////////////////////////////////////////////// |
104 class VIEWS_EXPORT View : public ui::LayerDelegate, | 104 class VIEWS_EXPORT View : public ui::LayerDelegate, |
105 public ui::LayerOwner, | 105 public ui::LayerOwner, |
106 public ui::AcceleratorTarget, | 106 public ui::AcceleratorTarget, |
107 public ui::EventTarget { | 107 public ui::EventTarget { |
108 public: | 108 public: |
109 typedef std::vector<View*> Views; | 109 typedef std::vector<View*> Views; |
110 | 110 |
111 // Specifies the source of the region used in a hit test. | |
112 // HIT_TEST_SOURCE_MOUSE indicates the hit test is being performed with a | |
113 // single point and HIT_TEST_SOURCE_TOUCH indicates the hit test is being | |
114 // performed with a rect larger than a single point. This value can be used, | |
115 // for example, to add extra padding or change the shape of the hit test mask. | |
116 enum HitTestSource { | |
Ben Goodger (Google)
2013/10/28 20:23:29
let's not add this to views. Instead we should del
tdanderson
2013/10/29 17:30:01
I moved this to ui/views/rect_based_targeting_util
| |
117 HIT_TEST_SOURCE_MOUSE, | |
118 HIT_TEST_SOURCE_TOUCH | |
119 }; | |
120 | |
111 struct ViewHierarchyChangedDetails { | 121 struct ViewHierarchyChangedDetails { |
112 ViewHierarchyChangedDetails() | 122 ViewHierarchyChangedDetails() |
113 : is_add(false), | 123 : is_add(false), |
114 parent(NULL), | 124 parent(NULL), |
115 child(NULL), | 125 child(NULL), |
116 move_view(NULL) {} | 126 move_view(NULL) {} |
117 | 127 |
118 ViewHierarchyChangedDetails(bool is_add, | 128 ViewHierarchyChangedDetails(bool is_add, |
119 View* parent, | 129 View* parent, |
120 View* child, | 130 View* child, |
(...skipping 998 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1119 // Input --------------------------------------------------------------------- | 1129 // Input --------------------------------------------------------------------- |
1120 | 1130 |
1121 // Called by HitTestRect() to see if this View has a custom hit test mask. If | 1131 // Called by HitTestRect() to see if this View has a custom hit test mask. If |
1122 // the return value is true, GetHitTestMask() will be called to obtain the | 1132 // the return value is true, GetHitTestMask() will be called to obtain the |
1123 // mask. Default value is false, in which case the View will hit-test against | 1133 // mask. Default value is false, in which case the View will hit-test against |
1124 // its bounds. | 1134 // its bounds. |
1125 virtual bool HasHitTestMask() const; | 1135 virtual bool HasHitTestMask() const; |
1126 | 1136 |
1127 // Called by HitTestRect() to retrieve a mask for hit-testing against. | 1137 // Called by HitTestRect() to retrieve a mask for hit-testing against. |
1128 // Subclasses override to provide custom shaped hit test regions. | 1138 // Subclasses override to provide custom shaped hit test regions. |
1129 virtual void GetHitTestMask(gfx::Path* mask) const; | 1139 virtual void GetHitTestMask(HitTestSource source, gfx::Path* mask) const; |
1130 | 1140 |
1131 virtual DragInfo* GetDragInfo(); | 1141 virtual DragInfo* GetDragInfo(); |
1132 | 1142 |
1133 // Focus --------------------------------------------------------------------- | 1143 // Focus --------------------------------------------------------------------- |
1134 | 1144 |
1135 // Override to be notified when focus has changed either to or from this View. | 1145 // Override to be notified when focus has changed either to or from this View. |
1136 virtual void OnFocus(); | 1146 virtual void OnFocus(); |
1137 virtual void OnBlur(); | 1147 virtual void OnBlur(); |
1138 | 1148 |
1139 // Handle view focus/blur events for this view. | 1149 // Handle view focus/blur events for this view. |
(...skipping 412 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1552 // Belongs to this view, but it's reference-counted on some platforms | 1562 // Belongs to this view, but it's reference-counted on some platforms |
1553 // so we can't use a scoped_ptr. It's dereferenced in the destructor. | 1563 // so we can't use a scoped_ptr. It's dereferenced in the destructor. |
1554 NativeViewAccessibility* native_view_accessibility_; | 1564 NativeViewAccessibility* native_view_accessibility_; |
1555 | 1565 |
1556 DISALLOW_COPY_AND_ASSIGN(View); | 1566 DISALLOW_COPY_AND_ASSIGN(View); |
1557 }; | 1567 }; |
1558 | 1568 |
1559 } // namespace views | 1569 } // namespace views |
1560 | 1570 |
1561 #endif // UI_VIEWS_VIEW_H_ | 1571 #endif // UI_VIEWS_VIEW_H_ |
OLD | NEW |