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 1058 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1069 // |texture| cannot be NULL. | 1069 // |texture| cannot be NULL. |
1070 // | 1070 // |
1071 // Returns false if it cannot create a layer to which to assign the texture. | 1071 // Returns false if it cannot create a layer to which to assign the texture. |
1072 bool SetExternalTexture(ui::Texture* texture); | 1072 bool SetExternalTexture(ui::Texture* texture); |
1073 | 1073 |
1074 // Returns the offset from this view to the nearest ancestor with a layer. If | 1074 // Returns the offset from this view to the nearest ancestor with a layer. If |
1075 // |layer_parent| is non-NULL it is set to the nearest ancestor with a layer. | 1075 // |layer_parent| is non-NULL it is set to the nearest ancestor with a layer. |
1076 virtual gfx::Vector2d CalculateOffsetToAncestorWithLayer( | 1076 virtual gfx::Vector2d CalculateOffsetToAncestorWithLayer( |
1077 ui::Layer** layer_parent); | 1077 ui::Layer** layer_parent); |
1078 | 1078 |
| 1079 // Updates the view's layer's parent. Called when a view is added to a view |
| 1080 // hierarchy, responsible for parenting the view's layer to the enclosing |
| 1081 // layer in the hierarchy. |
| 1082 virtual void UpdateParentLayer(); |
| 1083 |
1079 // If this view has a layer, the layer is reparented to |parent_layer| and its | 1084 // If this view has a layer, the layer is reparented to |parent_layer| and its |
1080 // bounds is set based on |point|. If this view does not have a layer, then | 1085 // bounds is set based on |point|. If this view does not have a layer, then |
1081 // recurses through all children. This is used when adding a layer to an | 1086 // recurses through all children. This is used when adding a layer to an |
1082 // existing view to make sure all descendants that have layers are parented to | 1087 // existing view to make sure all descendants that have layers are parented to |
1083 // the right layer. | 1088 // the right layer. |
1084 virtual void MoveLayerToParent(ui::Layer* parent_layer, | 1089 virtual void MoveLayerToParent(ui::Layer* parent_layer, |
1085 const gfx::Point& point); | 1090 const gfx::Point& point); |
1086 | 1091 |
1087 // Called to update the bounds of any child layers within this View's | 1092 // Called to update the bounds of any child layers within this View's |
1088 // hierarchy when something happens to the hierarchy. | 1093 // hierarchy when something happens to the hierarchy. |
(...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1310 | 1315 |
1311 // Accelerated painting ------------------------------------------------------ | 1316 // Accelerated painting ------------------------------------------------------ |
1312 | 1317 |
1313 // Creates the layer and related fields for this view. | 1318 // Creates the layer and related fields for this view. |
1314 void CreateLayer(); | 1319 void CreateLayer(); |
1315 | 1320 |
1316 // Parents all un-parented layers within this view's hierarchy to this view's | 1321 // Parents all un-parented layers within this view's hierarchy to this view's |
1317 // layer. | 1322 // layer. |
1318 void UpdateParentLayers(); | 1323 void UpdateParentLayers(); |
1319 | 1324 |
1320 // Updates the view's layer's parent. Called when a view is added to a view | |
1321 // hierarchy, responsible for parenting the view's layer to the enclosing | |
1322 // layer in the hierarchy. | |
1323 void UpdateParentLayer(); | |
1324 | |
1325 // Parents this view's layer to |parent_layer|, and sets its bounds and other | 1325 // Parents this view's layer to |parent_layer|, and sets its bounds and other |
1326 // properties in accordance to |offset|, the view's offset from the | 1326 // properties in accordance to |offset|, the view's offset from the |
1327 // |parent_layer|. | 1327 // |parent_layer|. |
1328 void ReparentLayer(const gfx::Vector2d& offset, ui::Layer* parent_layer); | 1328 void ReparentLayer(const gfx::Vector2d& offset, ui::Layer* parent_layer); |
1329 | 1329 |
1330 // Called to update the layer visibility. The layer will be visible if the | 1330 // Called to update the layer visibility. The layer will be visible if the |
1331 // View itself, and all its parent Views are visible. This also updates | 1331 // View itself, and all its parent Views are visible. This also updates |
1332 // visibility of the child layers. | 1332 // visibility of the child layers. |
1333 void UpdateLayerVisibility(); | 1333 void UpdateLayerVisibility(); |
1334 void UpdateChildLayerVisibility(bool visible); | 1334 void UpdateChildLayerVisibility(bool visible); |
(...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1538 // Belongs to this view, but it's reference-counted on some platforms | 1538 // Belongs to this view, but it's reference-counted on some platforms |
1539 // so we can't use a scoped_ptr. It's dereferenced in the destructor. | 1539 // so we can't use a scoped_ptr. It's dereferenced in the destructor. |
1540 NativeViewAccessibility* native_view_accessibility_; | 1540 NativeViewAccessibility* native_view_accessibility_; |
1541 | 1541 |
1542 DISALLOW_COPY_AND_ASSIGN(View); | 1542 DISALLOW_COPY_AND_ASSIGN(View); |
1543 }; | 1543 }; |
1544 | 1544 |
1545 } // namespace views | 1545 } // namespace views |
1546 | 1546 |
1547 #endif // UI_VIEWS_VIEW_H_ | 1547 #endif // UI_VIEWS_VIEW_H_ |
OLD | NEW |