| 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   // Please refer to the comments above the DestroyLayerImpl() function for | 343   // Destroys the layer associated with this view, and reparents any descendants | 
| 344   // details. | 344   // to the destroyed layer's parent. If the view does not currently have a | 
|  | 345   // layer, this has no effect. | 
| 345   void DestroyLayer(); | 346   void DestroyLayer(); | 
| 346 | 347 | 
| 347   // Overridden from ui::LayerOwner: | 348   // Overridden from ui::LayerOwner: | 
| 348   std::unique_ptr<ui::Layer> RecreateLayer() override; | 349   std::unique_ptr<ui::Layer> RecreateLayer() override; | 
| 349 | 350 | 
| 350   // RTL positioning ----------------------------------------------------------- | 351   // RTL positioning ----------------------------------------------------------- | 
| 351 | 352 | 
| 352   // Methods for accessing the bounds and position of the view, relative to its | 353   // Methods for accessing the bounds and position of the view, relative to its | 
| 353   // parent. The position returned is mirrored if the parent view is using a RTL | 354   // parent. The position returned is mirrored if the parent view is using a RTL | 
| 354   // layout. | 355   // layout. | 
| (...skipping 826 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 1181   virtual void ReorderLayers(); | 1182   virtual void ReorderLayers(); | 
| 1182 | 1183 | 
| 1183   // This reorders the immediate children of |*parent_layer| to match the | 1184   // This reorders the immediate children of |*parent_layer| to match the | 
| 1184   // order of the view tree. Child layers which are owned by a view are | 1185   // order of the view tree. Child layers which are owned by a view are | 
| 1185   // reordered so that they are below any child layers not owned by a view. | 1186   // reordered so that they are below any child layers not owned by a view. | 
| 1186   // Widget::ReorderNativeViews() should be called to reorder any child layers | 1187   // Widget::ReorderNativeViews() should be called to reorder any child layers | 
| 1187   // with an associated view. Widget::ReorderNativeViews() may reorder layers | 1188   // with an associated view. Widget::ReorderNativeViews() may reorder layers | 
| 1188   // below layers owned by a view. | 1189   // below layers owned by a view. | 
| 1189   virtual void ReorderChildLayers(ui::Layer* parent_layer); | 1190   virtual void ReorderChildLayers(ui::Layer* parent_layer); | 
| 1190 | 1191 | 
| 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 |  | 
| 1196   // Input --------------------------------------------------------------------- | 1192   // Input --------------------------------------------------------------------- | 
| 1197 | 1193 | 
| 1198   virtual DragInfo* GetDragInfo(); | 1194   virtual DragInfo* GetDragInfo(); | 
| 1199 | 1195 | 
| 1200   // Focus --------------------------------------------------------------------- | 1196   // Focus --------------------------------------------------------------------- | 
| 1201 | 1197 | 
| 1202   // Returns last set focus behavior. | 1198   // Returns last set focus behavior. | 
| 1203   FocusBehavior focus_behavior() const { return focus_behavior_; } | 1199   FocusBehavior focus_behavior() const { return focus_behavior_; } | 
| 1204 | 1200 | 
| 1205   // Override to be notified when focus has changed either to or from this View. | 1201   // 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... | 
| 1445   // properties in accordance to |offset|, the view's offset from the | 1441   // properties in accordance to |offset|, the view's offset from the | 
| 1446   // |parent_layer|. | 1442   // |parent_layer|. | 
| 1447   void ReparentLayer(const gfx::Vector2d& offset, ui::Layer* parent_layer); | 1443   void ReparentLayer(const gfx::Vector2d& offset, ui::Layer* parent_layer); | 
| 1448 | 1444 | 
| 1449   // Called to update the layer visibility. The layer will be visible if the | 1445   // Called to update the layer visibility. The layer will be visible if the | 
| 1450   // View itself, and all its parent Views are visible. This also updates | 1446   // View itself, and all its parent Views are visible. This also updates | 
| 1451   // visibility of the child layers. | 1447   // visibility of the child layers. | 
| 1452   void UpdateLayerVisibility(); | 1448   void UpdateLayerVisibility(); | 
| 1453   void UpdateChildLayerVisibility(bool visible); | 1449   void UpdateChildLayerVisibility(bool visible); | 
| 1454 | 1450 | 
| 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 |  | 
| 1474   // Orphans the layers in this subtree that are parented to layers outside of | 1451   // Orphans the layers in this subtree that are parented to layers outside of | 
| 1475   // this subtree. | 1452   // this subtree. | 
| 1476   void OrphanLayers(); | 1453   void OrphanLayers(); | 
| 1477 | 1454 | 
| 1478   // Input --------------------------------------------------------------------- | 1455   // Input --------------------------------------------------------------------- | 
| 1479 | 1456 | 
| 1480   bool ProcessMousePressed(const ui::MouseEvent& event); | 1457   bool ProcessMousePressed(const ui::MouseEvent& event); | 
| 1481   bool ProcessMouseDragged(const ui::MouseEvent& event); | 1458   bool ProcessMouseDragged(const ui::MouseEvent& event); | 
| 1482   void ProcessMouseReleased(const ui::MouseEvent& event); | 1459   void ProcessMouseReleased(const ui::MouseEvent& event); | 
| 1483 | 1460 | 
| (...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 1693   // Observers ------------------------------------------------------------- | 1670   // Observers ------------------------------------------------------------- | 
| 1694 | 1671 | 
| 1695   base::ObserverList<ViewObserver> observers_; | 1672   base::ObserverList<ViewObserver> observers_; | 
| 1696 | 1673 | 
| 1697   DISALLOW_COPY_AND_ASSIGN(View); | 1674   DISALLOW_COPY_AND_ASSIGN(View); | 
| 1698 }; | 1675 }; | 
| 1699 | 1676 | 
| 1700 }  // namespace views | 1677 }  // namespace views | 
| 1701 | 1678 | 
| 1702 #endif  // UI_VIEWS_VIEW_H_ | 1679 #endif  // UI_VIEWS_VIEW_H_ | 
| OLD | NEW | 
|---|