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_LAYOUT_BOX_LAYOUT_H_ | 5 #ifndef UI_VIEWS_LAYOUT_BOX_LAYOUT_H_ |
6 #define UI_VIEWS_LAYOUT_BOX_LAYOUT_H_ | 6 #define UI_VIEWS_LAYOUT_BOX_LAYOUT_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 | 9 |
10 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
90 // negative. | 90 // negative. |
91 void SetFlexForView(const View* view, int flex); | 91 void SetFlexForView(const View* view, int flex); |
92 | 92 |
93 // Clears the flex for the given |view|, causing it to use the default | 93 // Clears the flex for the given |view|, causing it to use the default |
94 // flex. | 94 // flex. |
95 void ClearFlexForView(const View* view); | 95 void ClearFlexForView(const View* view); |
96 | 96 |
97 // Sets the flex for views to use when none is specified. | 97 // Sets the flex for views to use when none is specified. |
98 void SetDefaultFlex(int default_flex); | 98 void SetDefaultFlex(int default_flex); |
99 | 99 |
| 100 // Positions individual child. |
| 101 void LayoutChild(View* child, |
| 102 const gfx::Rect& child_area, |
| 103 int main_free_space, |
| 104 int flex_sum, |
| 105 int* main_position, |
| 106 int* current_flex, |
| 107 int* total_padding); |
| 108 |
| 109 // Positions all children. Can be overridden to change the visible order. |
| 110 virtual void LayoutChildren(View* host, |
| 111 const gfx::Rect& child_area, |
| 112 int main_free_space, |
| 113 int flex_sum, |
| 114 int main_position, |
| 115 int current_flex, |
| 116 int* total_padding); |
| 117 |
100 // Overridden from views::LayoutManager: | 118 // Overridden from views::LayoutManager: |
101 void Installed(View* host) override; | 119 void Installed(View* host) override; |
102 void ViewRemoved(View* host, View* view) override; | 120 void ViewRemoved(View* host, View* view) override; |
103 void Layout(View* host) override; | 121 void Layout(View* host) override; |
104 gfx::Size GetPreferredSize(const View* host) const override; | 122 gfx::Size GetPreferredSize(const View* host) const override; |
105 int GetPreferredHeightForWidth(const View* host, int width) const override; | 123 int GetPreferredHeightForWidth(const View* host, int width) const override; |
106 | 124 |
107 private: | 125 private: |
108 // Returns the flex for the specified |view|. | 126 // Returns the flex for the specified |view|. |
109 int GetFlexForView(const View* view) const; | 127 int GetFlexForView(const View* view) const; |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
166 | 184 |
167 // The view that this BoxLayout is managing the layout for. | 185 // The view that this BoxLayout is managing the layout for. |
168 views::View* host_; | 186 views::View* host_; |
169 | 187 |
170 DISALLOW_IMPLICIT_CONSTRUCTORS(BoxLayout); | 188 DISALLOW_IMPLICIT_CONSTRUCTORS(BoxLayout); |
171 }; | 189 }; |
172 | 190 |
173 } // namespace views | 191 } // namespace views |
174 | 192 |
175 #endif // UI_VIEWS_LAYOUT_BOX_LAYOUT_H_ | 193 #endif // UI_VIEWS_LAYOUT_BOX_LAYOUT_H_ |
OLD | NEW |