| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 ASH_COMMON_SYSTEM_TRAY_TRI_VIEW_H_ | 5 #ifndef ASH_COMMON_SYSTEM_TRAY_TRI_VIEW_H_ |
| 6 #define ASH_COMMON_SYSTEM_TRAY_TRI_VIEW_H_ | 6 #define ASH_COMMON_SYSTEM_TRAY_TRI_VIEW_H_ |
| 7 | 7 |
| 8 #include <memory> | 8 #include <memory> |
| 9 | 9 |
| 10 #include "ash/ash_export.h" | 10 #include "ash/ash_export.h" |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 63 // Creates |this| with the specified orientation and 0 padding between | 63 // Creates |this| with the specified orientation and 0 padding between |
| 64 // containers. | 64 // containers. |
| 65 explicit TriView(Orientation orientation); | 65 explicit TriView(Orientation orientation); |
| 66 | 66 |
| 67 // Creates this with the specified |orientation| and | 67 // Creates this with the specified |orientation| and |
| 68 // |padding_between_containers|. | 68 // |padding_between_containers|. |
| 69 TriView(Orientation orientation, int padding_between_containers); | 69 TriView(Orientation orientation, int padding_between_containers); |
| 70 | 70 |
| 71 ~TriView() override; | 71 ~TriView() override; |
| 72 | 72 |
| 73 // Set the minimum cross axis size, i.e. the minimum height for a horizontal | |
| 74 // orientation. | |
| 75 void SetMinCrossAxisSize(int min_size); | |
| 76 | |
| 77 // Set the minimum size for the given |container|. | 73 // Set the minimum size for the given |container|. |
| 78 void SetMinSize(Container container, const gfx::Size& size); | 74 void SetMinSize(Container container, const gfx::Size& size); |
| 79 | 75 |
| 80 // Set the maximum size for the given |container|. | 76 // Set the maximum size for the given |container|. |
| 81 void SetMaxSize(Container container, const gfx::Size& size); | 77 void SetMaxSize(Container container, const gfx::Size& size); |
| 82 | 78 |
| 83 // Adds the child |view| to the specified |container|. | 79 // Adds the child |view| to the specified |container|. |
| 84 void AddView(Container container, views::View* view); | 80 void AddView(Container container, views::View* view); |
| 85 | 81 |
| 86 // Removes all the children from the specified |container|. If | 82 // Removes all the children from the specified |container|. If |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 119 std::unique_ptr<views::LayoutManager> layout_manager); | 115 std::unique_ptr<views::LayoutManager> layout_manager); |
| 120 | 116 |
| 121 protected: | 117 protected: |
| 122 // View: | 118 // View: |
| 123 void ViewHierarchyChanged( | 119 void ViewHierarchyChanged( |
| 124 const views::View::ViewHierarchyChangedDetails& details) override; | 120 const views::View::ViewHierarchyChangedDetails& details) override; |
| 125 | 121 |
| 126 private: | 122 private: |
| 127 friend class TriViewTest; | 123 friend class TriViewTest; |
| 128 | 124 |
| 129 // Creates a default LayoutManager for the given |orientation|. | |
| 130 std::unique_ptr<views::LayoutManager> CreateDefaultLayoutManager( | |
| 131 Orientation orientation) const; | |
| 132 | |
| 133 // Returns the View for the given |container|. | 125 // Returns the View for the given |container|. |
| 134 views::View* GetContainer(Container container) const; | 126 views::View* GetContainer(Container container); |
| 135 | 127 |
| 136 // Returns the layout manager for the given |container|. | 128 // Returns the layout manager for the given |container|. |
| 137 SizeRangeLayout* GetLayoutManager(Container container) const; | 129 SizeRangeLayout* GetLayoutManager(Container container); |
| 138 | 130 |
| 139 // Type spcific layout manager installed on |this|. Responsible for laying out | 131 // Type spcific layout manager installed on |this|. Responsible for laying out |
| 140 // the container Views. | 132 // the container Views. |
| 141 views::BoxLayout* box_layout_; | 133 views::BoxLayout* box_layout_; |
| 142 | 134 |
| 143 SizeRangeLayout* start_container_layout_manager_; | 135 SizeRangeLayout* start_container_layout_manager_; |
| 144 SizeRangeLayout* center_container_layout_manager_; | 136 SizeRangeLayout* center_container_layout_manager_; |
| 145 SizeRangeLayout* end_container_layout_manager_; | 137 SizeRangeLayout* end_container_layout_manager_; |
| 146 | 138 |
| 147 // In order to detect direct manipulation of child views the | 139 // In order to detect direct manipulation of child views the |
| 148 // ViewHierarchyChanged() event override fails on a DCHECK. However, we need | 140 // ViewHierarchyChanged() event override fails on a DCHECK. However, we need |
| 149 // to manipulate the child views during construction/destruction so this flag | 141 // to manipulate the child views during construction/destruction so this flag |
| 150 // is used to disable the DCHECK during construction/destruction. | 142 // is used to disable the DCHECK during construction/destruction. |
| 151 bool enable_hierarchy_changed_dcheck_ = false; | 143 bool enable_hierarchy_changed_dcheck_ = false; |
| 152 | 144 |
| 153 DISALLOW_COPY_AND_ASSIGN(TriView); | 145 DISALLOW_COPY_AND_ASSIGN(TriView); |
| 154 }; | 146 }; |
| 155 | 147 |
| 156 } // namespace ash | 148 } // namespace ash |
| 157 | 149 |
| 158 #endif // ASH_COMMON_SYSTEM_TRAY_TRI_VIEW_H_ | 150 #endif // ASH_COMMON_SYSTEM_TRAY_TRI_VIEW_H_ |
| OLD | NEW |