| 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 <stddef.h> | 8 #include <stddef.h> |
| 9 | 9 |
| 10 #include <algorithm> | 10 #include <algorithm> |
| (...skipping 322 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 333 void SetTransform(const gfx::Transform& transform); | 333 void SetTransform(const gfx::Transform& transform); |
| 334 | 334 |
| 335 // Sets whether this view paints to a layer. A view paints to a layer if | 335 // Sets whether this view paints to a layer. A view paints to a layer if |
| 336 // either of the following are true: | 336 // either of the following are true: |
| 337 // . the view has a non-identity transform. | 337 // . the view has a non-identity transform. |
| 338 // . SetPaintToLayer(ui::LayerType) has been invoked. | 338 // . SetPaintToLayer(ui::LayerType) has been invoked. |
| 339 // View creates the Layer only when it exists in a Widget with a non-NULL | 339 // View creates the Layer only when it exists in a Widget with a non-NULL |
| 340 // Compositor. | 340 // Compositor. |
| 341 void SetPaintToLayer(ui::LayerType layer_type = ui::LAYER_TEXTURED); | 341 void SetPaintToLayer(ui::LayerType layer_type = ui::LAYER_TEXTURED); |
| 342 | 342 |
| 343 // Destroys the layer associated with this view, and reparents any descendants | 343 // Please refer to the comments above the DestroyLayerImpl() function for |
| 344 // to the destroyed layer's parent. If the view does not currently have a | 344 // details. |
| 345 // layer, this has no effect. | |
| 346 void DestroyLayer(); | 345 void DestroyLayer(); |
| 347 | 346 |
| 348 // Overridden from ui::LayerOwner: | 347 // Overridden from ui::LayerOwner: |
| 349 std::unique_ptr<ui::Layer> RecreateLayer() override; | 348 std::unique_ptr<ui::Layer> RecreateLayer() override; |
| 350 | 349 |
| 351 // RTL positioning ----------------------------------------------------------- | 350 // RTL positioning ----------------------------------------------------------- |
| 352 | 351 |
| 353 // Methods for accessing the bounds and position of the view, relative to its | 352 // Methods for accessing the bounds and position of the view, relative to its |
| 354 // parent. The position returned is mirrored if the parent view is using a RTL | 353 // parent. The position returned is mirrored if the parent view is using a RTL |
| 355 // layout. | 354 // layout. |
| (...skipping 826 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1182 virtual void ReorderLayers(); | 1181 virtual void ReorderLayers(); |
| 1183 | 1182 |
| 1184 // This reorders the immediate children of |*parent_layer| to match the | 1183 // This reorders the immediate children of |*parent_layer| to match the |
| 1185 // order of the view tree. Child layers which are owned by a view are | 1184 // order of the view tree. Child layers which are owned by a view are |
| 1186 // reordered so that they are below any child layers not owned by a view. | 1185 // reordered so that they are below any child layers not owned by a view. |
| 1187 // Widget::ReorderNativeViews() should be called to reorder any child layers | 1186 // Widget::ReorderNativeViews() should be called to reorder any child layers |
| 1188 // with an associated view. Widget::ReorderNativeViews() may reorder layers | 1187 // with an associated view. Widget::ReorderNativeViews() may reorder layers |
| 1189 // below layers owned by a view. | 1188 // below layers owned by a view. |
| 1190 virtual void ReorderChildLayers(ui::Layer* parent_layer); | 1189 virtual void ReorderChildLayers(ui::Layer* parent_layer); |
| 1191 | 1190 |
| 1191 // Notifies parents about a layer being created or destroyed in a child. An |
| 1192 // example where a subclass may override this method is when it wants to clip |
| 1193 // the child by adding its own layer. |
| 1194 virtual void OnChildLayerChanged(View* child); |
| 1195 |
| 1192 // Input --------------------------------------------------------------------- | 1196 // Input --------------------------------------------------------------------- |
| 1193 | 1197 |
| 1194 virtual DragInfo* GetDragInfo(); | 1198 virtual DragInfo* GetDragInfo(); |
| 1195 | 1199 |
| 1196 // Focus --------------------------------------------------------------------- | 1200 // Focus --------------------------------------------------------------------- |
| 1197 | 1201 |
| 1198 // Returns last set focus behavior. | 1202 // Returns last set focus behavior. |
| 1199 FocusBehavior focus_behavior() const { return focus_behavior_; } | 1203 FocusBehavior focus_behavior() const { return focus_behavior_; } |
| 1200 | 1204 |
| 1201 // Override to be notified when focus has changed either to or from this View. | 1205 // Override to be notified when focus has changed either to or from this View. |
| (...skipping 239 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1441 // properties in accordance to |offset|, the view's offset from the | 1445 // properties in accordance to |offset|, the view's offset from the |
| 1442 // |parent_layer|. | 1446 // |parent_layer|. |
| 1443 void ReparentLayer(const gfx::Vector2d& offset, ui::Layer* parent_layer); | 1447 void ReparentLayer(const gfx::Vector2d& offset, ui::Layer* parent_layer); |
| 1444 | 1448 |
| 1445 // Called to update the layer visibility. The layer will be visible if the | 1449 // Called to update the layer visibility. The layer will be visible if the |
| 1446 // View itself, and all its parent Views are visible. This also updates | 1450 // View itself, and all its parent Views are visible. This also updates |
| 1447 // visibility of the child layers. | 1451 // visibility of the child layers. |
| 1448 void UpdateLayerVisibility(); | 1452 void UpdateLayerVisibility(); |
| 1449 void UpdateChildLayerVisibility(bool visible); | 1453 void UpdateChildLayerVisibility(bool visible); |
| 1450 | 1454 |
| 1455 enum class LayerChangeNotifyBehavior { |
| 1456 // Notify the parent chain about the layer change. |
| 1457 NOTIFY, |
| 1458 // Don't notify the parent chain about the layer change. |
| 1459 DONT_NOTIFY |
| 1460 }; |
| 1461 |
| 1462 // Destroys the layer associated with this view, and reparents any descendants |
| 1463 // to the destroyed layer's parent. If the view does not currently have a |
| 1464 // layer, this has no effect. |
| 1465 // The |notify_parents| enum controls whether a notification about the layer |
| 1466 // change is sent to the parents. |
| 1467 void DestroyLayerImpl(LayerChangeNotifyBehavior notify_parents); |
| 1468 |
| 1469 // Notifies parents about layering changes in the view. This includes layer |
| 1470 // creation and destruction. |
| 1471 void NotifyParentsOfLayerChange(); |
| 1472 |
| 1473 |
| 1451 // Orphans the layers in this subtree that are parented to layers outside of | 1474 // Orphans the layers in this subtree that are parented to layers outside of |
| 1452 // this subtree. | 1475 // this subtree. |
| 1453 void OrphanLayers(); | 1476 void OrphanLayers(); |
| 1454 | 1477 |
| 1455 // Input --------------------------------------------------------------------- | 1478 // Input --------------------------------------------------------------------- |
| 1456 | 1479 |
| 1457 bool ProcessMousePressed(const ui::MouseEvent& event); | 1480 bool ProcessMousePressed(const ui::MouseEvent& event); |
| 1458 bool ProcessMouseDragged(const ui::MouseEvent& event); | 1481 bool ProcessMouseDragged(const ui::MouseEvent& event); |
| 1459 void ProcessMouseReleased(const ui::MouseEvent& event); | 1482 void ProcessMouseReleased(const ui::MouseEvent& event); |
| 1460 | 1483 |
| (...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1670 // Observers ------------------------------------------------------------- | 1693 // Observers ------------------------------------------------------------- |
| 1671 | 1694 |
| 1672 base::ObserverList<ViewObserver> observers_; | 1695 base::ObserverList<ViewObserver> observers_; |
| 1673 | 1696 |
| 1674 DISALLOW_COPY_AND_ASSIGN(View); | 1697 DISALLOW_COPY_AND_ASSIGN(View); |
| 1675 }; | 1698 }; |
| 1676 | 1699 |
| 1677 } // namespace views | 1700 } // namespace views |
| 1678 | 1701 |
| 1679 #endif // UI_VIEWS_VIEW_H_ | 1702 #endif // UI_VIEWS_VIEW_H_ |
| OLD | NEW |