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 952 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
963 // to scroll. ScrollView interprets a return value of 0 (or negative) | 963 // to scroll. ScrollView interprets a return value of 0 (or negative) |
964 // to scroll by a default amount. | 964 // to scroll by a default amount. |
965 // | 965 // |
966 // See VariableRowHeightScrollHelper and FixedRowHeightScrollHelper for | 966 // See VariableRowHeightScrollHelper and FixedRowHeightScrollHelper for |
967 // implementations of common cases. | 967 // implementations of common cases. |
968 virtual int GetPageScrollIncrement(ScrollView* scroll_view, | 968 virtual int GetPageScrollIncrement(ScrollView* scroll_view, |
969 bool is_horizontal, bool is_positive); | 969 bool is_horizontal, bool is_positive); |
970 virtual int GetLineScrollIncrement(ScrollView* scroll_view, | 970 virtual int GetLineScrollIncrement(ScrollView* scroll_view, |
971 bool is_horizontal, bool is_positive); | 971 bool is_horizontal, bool is_positive); |
972 | 972 |
973 // Specifies the source of the region used in a hit test. | |
974 // HIT_TEST_SOURCE_MOUSE indicates the hit test is being performed with a | |
975 // single point and HIT_TEST_SOURCE_TOUCH indicates the hit test is being | |
976 // performed with a rect larger than a single point. This value can be used, | |
977 // for example, to add extra padding or change the shape of the hit test mask. | |
978 enum HitTestSource { | |
tdanderson
2013/10/24 20:56:24
Is there a better place for this enum? I needed to
sky
2013/10/24 22:13:38
I think this is the best place, but move it above
tdanderson
2013/10/25 00:10:52
Done. And yes, as far as I know this is all we nee
| |
979 HIT_TEST_SOURCE_MOUSE, | |
980 HIT_TEST_SOURCE_TOUCH | |
981 }; | |
982 | |
973 protected: | 983 protected: |
974 // Used to track a drag. RootView passes this into | 984 // Used to track a drag. RootView passes this into |
975 // ProcessMousePressed/Dragged. | 985 // ProcessMousePressed/Dragged. |
976 struct DragInfo { | 986 struct DragInfo { |
977 // Sets possible_drag to false and start_x/y to 0. This is invoked by | 987 // Sets possible_drag to false and start_x/y to 0. This is invoked by |
978 // RootView prior to invoke ProcessMousePressed. | 988 // RootView prior to invoke ProcessMousePressed. |
979 void Reset(); | 989 void Reset(); |
980 | 990 |
981 // Sets possible_drag to true and start_pt to the specified point. | 991 // Sets possible_drag to true and start_pt to the specified point. |
982 // This is invoked by the target view if it detects the press may generate | 992 // This is invoked by the target view if it detects the press may generate |
(...skipping 136 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(gfx::Path* mask, |
1140 HitTestSource source = HIT_TEST_SOURCE_MOUSE) const; | |
1130 | 1141 |
1131 virtual DragInfo* GetDragInfo(); | 1142 virtual DragInfo* GetDragInfo(); |
1132 | 1143 |
1133 // Focus --------------------------------------------------------------------- | 1144 // Focus --------------------------------------------------------------------- |
1134 | 1145 |
1135 // Override to be notified when focus has changed either to or from this View. | 1146 // Override to be notified when focus has changed either to or from this View. |
1136 virtual void OnFocus(); | 1147 virtual void OnFocus(); |
1137 virtual void OnBlur(); | 1148 virtual void OnBlur(); |
1138 | 1149 |
1139 // Handle view focus/blur events for this view. | 1150 // 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 | 1563 // 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. | 1564 // so we can't use a scoped_ptr. It's dereferenced in the destructor. |
1554 NativeViewAccessibility* native_view_accessibility_; | 1565 NativeViewAccessibility* native_view_accessibility_; |
1555 | 1566 |
1556 DISALLOW_COPY_AND_ASSIGN(View); | 1567 DISALLOW_COPY_AND_ASSIGN(View); |
1557 }; | 1568 }; |
1558 | 1569 |
1559 } // namespace views | 1570 } // namespace views |
1560 | 1571 |
1561 #endif // UI_VIEWS_VIEW_H_ | 1572 #endif // UI_VIEWS_VIEW_H_ |
OLD | NEW |