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 // TODO(tdanderson,sadrul): Becomes obsolete with the refactoring of the |
| 112 // event targeting logic for views and windows. |
| 113 // Specifies the source of the region used in a hit test. |
| 114 // HIT_TEST_SOURCE_MOUSE indicates the hit test is being performed with a |
| 115 // single point and HIT_TEST_SOURCE_TOUCH indicates the hit test is being |
| 116 // performed with a rect larger than a single point. This value can be used, |
| 117 // for example, to add extra padding or change the shape of the hit test mask. |
| 118 enum HitTestSource { |
| 119 HIT_TEST_SOURCE_MOUSE, |
| 120 HIT_TEST_SOURCE_TOUCH |
| 121 }; |
| 122 |
111 struct ViewHierarchyChangedDetails { | 123 struct ViewHierarchyChangedDetails { |
112 ViewHierarchyChangedDetails() | 124 ViewHierarchyChangedDetails() |
113 : is_add(false), | 125 : is_add(false), |
114 parent(NULL), | 126 parent(NULL), |
115 child(NULL), | 127 child(NULL), |
116 move_view(NULL) {} | 128 move_view(NULL) {} |
117 | 129 |
118 ViewHierarchyChangedDetails(bool is_add, | 130 ViewHierarchyChangedDetails(bool is_add, |
119 View* parent, | 131 View* parent, |
120 View* child, | 132 View* child, |
(...skipping 998 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1119 // Input --------------------------------------------------------------------- | 1131 // Input --------------------------------------------------------------------- |
1120 | 1132 |
1121 // Called by HitTestRect() to see if this View has a custom hit test mask. If | 1133 // 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 | 1134 // 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 | 1135 // mask. Default value is false, in which case the View will hit-test against |
1124 // its bounds. | 1136 // its bounds. |
1125 virtual bool HasHitTestMask() const; | 1137 virtual bool HasHitTestMask() const; |
1126 | 1138 |
1127 // Called by HitTestRect() to retrieve a mask for hit-testing against. | 1139 // Called by HitTestRect() to retrieve a mask for hit-testing against. |
1128 // Subclasses override to provide custom shaped hit test regions. | 1140 // Subclasses override to provide custom shaped hit test regions. |
1129 virtual void GetHitTestMask(gfx::Path* mask) const; | 1141 virtual void GetHitTestMask(HitTestSource source, gfx::Path* mask) const; |
1130 | 1142 |
1131 virtual DragInfo* GetDragInfo(); | 1143 virtual DragInfo* GetDragInfo(); |
1132 | 1144 |
1133 // Focus --------------------------------------------------------------------- | 1145 // Focus --------------------------------------------------------------------- |
1134 | 1146 |
1135 // Override to be notified when focus has changed either to or from this View. | 1147 // Override to be notified when focus has changed either to or from this View. |
1136 virtual void OnFocus(); | 1148 virtual void OnFocus(); |
1137 virtual void OnBlur(); | 1149 virtual void OnBlur(); |
1138 | 1150 |
1139 // Handle view focus/blur events for this view. | 1151 // 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 | 1564 // 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. | 1565 // so we can't use a scoped_ptr. It's dereferenced in the destructor. |
1554 NativeViewAccessibility* native_view_accessibility_; | 1566 NativeViewAccessibility* native_view_accessibility_; |
1555 | 1567 |
1556 DISALLOW_COPY_AND_ASSIGN(View); | 1568 DISALLOW_COPY_AND_ASSIGN(View); |
1557 }; | 1569 }; |
1558 | 1570 |
1559 } // namespace views | 1571 } // namespace views |
1560 | 1572 |
1561 #endif // UI_VIEWS_VIEW_H_ | 1573 #endif // UI_VIEWS_VIEW_H_ |
OLD | NEW |