OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 VIEWS_VIEW_H_ | 5 #ifndef VIEWS_VIEW_H_ |
6 #define VIEWS_VIEW_H_ | 6 #define VIEWS_VIEW_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <algorithm> | 9 #include <algorithm> |
10 #include <map> | 10 #include <map> |
(...skipping 1086 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1097 // used by the public static method ExceededDragThreshold(). | 1097 // used by the public static method ExceededDragThreshold(). |
1098 static int GetHorizontalDragThreshold(); | 1098 static int GetHorizontalDragThreshold(); |
1099 static int GetVerticalDragThreshold(); | 1099 static int GetVerticalDragThreshold(); |
1100 | 1100 |
1101 private: | 1101 private: |
1102 friend class internal::NativeWidgetView; | 1102 friend class internal::NativeWidgetView; |
1103 friend class internal::RootView; | 1103 friend class internal::RootView; |
1104 friend class FocusManager; | 1104 friend class FocusManager; |
1105 friend class ViewStorage; | 1105 friend class ViewStorage; |
1106 friend class Widget; | 1106 friend class Widget; |
| 1107 friend class PaintLock; |
1107 | 1108 |
1108 // Used to track a drag. RootView passes this into | 1109 // Used to track a drag. RootView passes this into |
1109 // ProcessMousePressed/Dragged. | 1110 // ProcessMousePressed/Dragged. |
1110 struct DragInfo { | 1111 struct DragInfo { |
1111 // Sets possible_drag to false and start_x/y to 0. This is invoked by | 1112 // Sets possible_drag to false and start_x/y to 0. This is invoked by |
1112 // RootView prior to invoke ProcessMousePressed. | 1113 // RootView prior to invoke ProcessMousePressed. |
1113 void Reset(); | 1114 void Reset(); |
1114 | 1115 |
1115 // Sets possible_drag to true and start_pt to the specified point. | 1116 // Sets possible_drag to true and start_pt to the specified point. |
1116 // This is invoked by the target view if it detects the press may generate | 1117 // This is invoked by the target view if it detects the press may generate |
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1222 bool ConvertPointForAncestor(const View* ancestor, gfx::Point* point) const; | 1223 bool ConvertPointForAncestor(const View* ancestor, gfx::Point* point) const; |
1223 | 1224 |
1224 // Convert a point in the ancestor's coordinate system to the view's | 1225 // Convert a point in the ancestor's coordinate system to the view's |
1225 // coordinate system using necessary transformations. Returns whether the | 1226 // coordinate system using necessary transformations. Returns whether the |
1226 // point was successfully from the ancestor's coordinate system to the view's | 1227 // point was successfully from the ancestor's coordinate system to the view's |
1227 // coordinate system. | 1228 // coordinate system. |
1228 bool ConvertPointFromAncestor(const View* ancestor, gfx::Point* point) const; | 1229 bool ConvertPointFromAncestor(const View* ancestor, gfx::Point* point) const; |
1229 | 1230 |
1230 // Accelerated painting ------------------------------------------------------ | 1231 // Accelerated painting ------------------------------------------------------ |
1231 | 1232 |
| 1233 // Disables painting during time critical operations. Used by PaintLock. |
| 1234 // TODO(vollick) Ideally, the widget would not dispatch paints into the |
| 1235 // hierarchy during time critical operations and this would not be needed. |
| 1236 void set_painting_enabled(bool enabled) { painting_enabled_ = enabled; } |
| 1237 |
1232 // Returns true if this view should paint to layer. | 1238 // Returns true if this view should paint to layer. |
1233 bool ShouldPaintToLayer() const; | 1239 bool ShouldPaintToLayer() const; |
1234 | 1240 |
1235 // Creates the layer and related fields for this view. | 1241 // Creates the layer and related fields for this view. |
1236 void CreateLayer(); | 1242 void CreateLayer(); |
1237 | 1243 |
1238 // Reparents any descendant layer to our current layer parent and destroys | 1244 // Reparents any descendant layer to our current layer parent and destroys |
1239 // this views layer. | 1245 // this views layer. |
1240 void DestroyLayerAndReparent(); | 1246 void DestroyLayerAndReparent(); |
1241 | 1247 |
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1346 | 1352 |
1347 // This View's bounds in the parent coordinate system. | 1353 // This View's bounds in the parent coordinate system. |
1348 gfx::Rect bounds_; | 1354 gfx::Rect bounds_; |
1349 | 1355 |
1350 // Whether this view is visible. | 1356 // Whether this view is visible. |
1351 bool visible_; | 1357 bool visible_; |
1352 | 1358 |
1353 // Whether this view is enabled. | 1359 // Whether this view is enabled. |
1354 bool enabled_; | 1360 bool enabled_; |
1355 | 1361 |
| 1362 // Whether this view is painting. |
| 1363 bool painting_enabled_; |
| 1364 |
1356 // Whether or not RegisterViewForVisibleBoundsNotification on the RootView | 1365 // Whether or not RegisterViewForVisibleBoundsNotification on the RootView |
1357 // has been invoked. | 1366 // has been invoked. |
1358 bool registered_for_visible_bounds_notification_; | 1367 bool registered_for_visible_bounds_notification_; |
1359 | 1368 |
1360 // List of descendants wanting notification when their visible bounds change. | 1369 // List of descendants wanting notification when their visible bounds change. |
1361 scoped_ptr<Views> descendants_to_notify_; | 1370 scoped_ptr<Views> descendants_to_notify_; |
1362 | 1371 |
1363 // Transformations ----------------------------------------------------------- | 1372 // Transformations ----------------------------------------------------------- |
1364 | 1373 |
1365 // Clipping parameters. skia transformation matrix does not give us clipping. | 1374 // Clipping parameters. skia transformation matrix does not give us clipping. |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1440 #if defined(OS_WIN) | 1449 #if defined(OS_WIN) |
1441 scoped_refptr<NativeViewAccessibilityWin> native_view_accessibility_win_; | 1450 scoped_refptr<NativeViewAccessibilityWin> native_view_accessibility_win_; |
1442 #endif | 1451 #endif |
1443 | 1452 |
1444 DISALLOW_COPY_AND_ASSIGN(View); | 1453 DISALLOW_COPY_AND_ASSIGN(View); |
1445 }; | 1454 }; |
1446 | 1455 |
1447 } // namespace views | 1456 } // namespace views |
1448 | 1457 |
1449 #endif // VIEWS_VIEW_H_ | 1458 #endif // VIEWS_VIEW_H_ |
OLD | NEW |