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 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
103 // accessed from the main thread. | 103 // accessed from the main thread. |
104 // | 104 // |
105 ///////////////////////////////////////////////////////////////////////////// | 105 ///////////////////////////////////////////////////////////////////////////// |
106 class VIEWS_EXPORT View : public ui::LayerDelegate, | 106 class VIEWS_EXPORT View : public ui::LayerDelegate, |
107 public ui::LayerOwner, | 107 public ui::LayerOwner, |
108 public ui::AcceleratorTarget, | 108 public ui::AcceleratorTarget, |
109 public ui::EventTarget { | 109 public ui::EventTarget { |
110 public: | 110 public: |
111 typedef std::vector<View*> Views; | 111 typedef std::vector<View*> Views; |
112 | 112 |
113 // TODO(tdanderson): Becomes obsolete with the refactoring of the event | |
114 // targeting logic for views and windows. See | |
115 // crbug.com/355425. | |
116 // Specifies the source of the region used in a hit test. | |
117 // HIT_TEST_SOURCE_MOUSE indicates the hit test is being performed with a | |
118 // single point and HIT_TEST_SOURCE_TOUCH indicates the hit test is being | |
119 // performed with a rect larger than a single point. This value can be used, | |
120 // for example, to add extra padding or change the shape of the hit test mask. | |
121 enum HitTestSource { | |
122 HIT_TEST_SOURCE_MOUSE, | |
123 HIT_TEST_SOURCE_TOUCH | |
124 }; | |
125 | |
126 struct ViewHierarchyChangedDetails { | 113 struct ViewHierarchyChangedDetails { |
127 ViewHierarchyChangedDetails() | 114 ViewHierarchyChangedDetails() |
128 : is_add(false), | 115 : is_add(false), |
129 parent(NULL), | 116 parent(NULL), |
130 child(NULL), | 117 child(NULL), |
131 move_view(NULL) {} | 118 move_view(NULL) {} |
132 | 119 |
133 ViewHierarchyChangedDetails(bool is_add, | 120 ViewHierarchyChangedDetails(bool is_add, |
134 View* parent, | 121 View* parent, |
135 View* child, | 122 View* child, |
(...skipping 1003 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1139 // This reorders the immediate children of |*parent_layer| to match the | 1126 // This reorders the immediate children of |*parent_layer| to match the |
1140 // order of the view tree. Child layers which are owned by a view are | 1127 // order of the view tree. Child layers which are owned by a view are |
1141 // reordered so that they are below any child layers not owned by a view. | 1128 // reordered so that they are below any child layers not owned by a view. |
1142 // Widget::ReorderNativeViews() should be called to reorder any child layers | 1129 // Widget::ReorderNativeViews() should be called to reorder any child layers |
1143 // with an associated view. Widget::ReorderNativeViews() may reorder layers | 1130 // with an associated view. Widget::ReorderNativeViews() may reorder layers |
1144 // below layers owned by a view. | 1131 // below layers owned by a view. |
1145 virtual void ReorderChildLayers(ui::Layer* parent_layer); | 1132 virtual void ReorderChildLayers(ui::Layer* parent_layer); |
1146 | 1133 |
1147 // Input --------------------------------------------------------------------- | 1134 // Input --------------------------------------------------------------------- |
1148 | 1135 |
1149 // Called by HitTestRect() to see if this View has a custom hit test mask. If | |
1150 // the return value is true, GetHitTestMask() will be called to obtain the | |
1151 // mask. Default value is false, in which case the View will hit-test against | |
1152 // its bounds. | |
1153 virtual bool HasHitTestMask() const; | |
1154 | |
1155 // Called by HitTestRect() to retrieve a mask for hit-testing against. | |
1156 // Subclasses override to provide custom shaped hit test regions. | |
1157 // TODO(tdanderson): Remove this method once Tab, TabCloseButton, | |
1158 // NewTabButton, and MicButton all implement | |
1159 // MaskedViewTargeter. | |
1160 virtual void GetHitTestMaskDeprecated(HitTestSource source, | |
1161 gfx::Path* mask) const; | |
1162 | |
1163 virtual DragInfo* GetDragInfo(); | 1136 virtual DragInfo* GetDragInfo(); |
1164 | 1137 |
1165 // Focus --------------------------------------------------------------------- | 1138 // Focus --------------------------------------------------------------------- |
1166 | 1139 |
1167 // Returns last value passed to SetFocusable(). Use IsFocusable() to determine | 1140 // Returns last value passed to SetFocusable(). Use IsFocusable() to determine |
1168 // if a view can take focus right now. | 1141 // if a view can take focus right now. |
1169 bool focusable() const { return focusable_; } | 1142 bool focusable() const { return focusable_; } |
1170 | 1143 |
1171 // Override to be notified when focus has changed either to or from this View. | 1144 // Override to be notified when focus has changed either to or from this View. |
1172 virtual void OnFocus(); | 1145 virtual void OnFocus(); |
(...skipping 443 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1616 // Belongs to this view, but it's reference-counted on some platforms | 1589 // Belongs to this view, but it's reference-counted on some platforms |
1617 // so we can't use a scoped_ptr. It's dereferenced in the destructor. | 1590 // so we can't use a scoped_ptr. It's dereferenced in the destructor. |
1618 NativeViewAccessibility* native_view_accessibility_; | 1591 NativeViewAccessibility* native_view_accessibility_; |
1619 | 1592 |
1620 DISALLOW_COPY_AND_ASSIGN(View); | 1593 DISALLOW_COPY_AND_ASSIGN(View); |
1621 }; | 1594 }; |
1622 | 1595 |
1623 } // namespace views | 1596 } // namespace views |
1624 | 1597 |
1625 #endif // UI_VIEWS_VIEW_H_ | 1598 #endif // UI_VIEWS_VIEW_H_ |
OLD | NEW |