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/basictypes.h" | 10 #include "base/basictypes.h" |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
56 }; | 56 }; |
57 | 57 |
58 // Use |inside_border_horizontal_spacing| and | 58 // Use |inside_border_horizontal_spacing| and |
59 // |inside_border_vertical_spacing| to add additional space between the child | 59 // |inside_border_vertical_spacing| to add additional space between the child |
60 // view area and the host view border. |between_child_spacing| controls the | 60 // view area and the host view border. |between_child_spacing| controls the |
61 // space in between child views. | 61 // space in between child views. |
62 BoxLayout(Orientation orientation, | 62 BoxLayout(Orientation orientation, |
63 int inside_border_horizontal_spacing, | 63 int inside_border_horizontal_spacing, |
64 int inside_border_vertical_spacing, | 64 int inside_border_vertical_spacing, |
65 int between_child_spacing); | 65 int between_child_spacing); |
66 virtual ~BoxLayout(); | 66 ~BoxLayout() override; |
67 | 67 |
68 void set_main_axis_alignment(MainAxisAlignment main_axis_alignment) { | 68 void set_main_axis_alignment(MainAxisAlignment main_axis_alignment) { |
69 main_axis_alignment_ = main_axis_alignment; | 69 main_axis_alignment_ = main_axis_alignment; |
70 } | 70 } |
71 | 71 |
72 void set_cross_axis_alignment(CrossAxisAlignment cross_axis_alignment) { | 72 void set_cross_axis_alignment(CrossAxisAlignment cross_axis_alignment) { |
73 cross_axis_alignment_ = cross_axis_alignment; | 73 cross_axis_alignment_ = cross_axis_alignment; |
74 } | 74 } |
75 | 75 |
76 void set_inside_border_insets(const gfx::Insets& insets) { | 76 void set_inside_border_insets(const gfx::Insets& insets) { |
(...skipping 14 matching lines...) Expand all Loading... |
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 // Overridden from views::LayoutManager: | 100 // Overridden from views::LayoutManager: |
101 virtual void Installed(View* host) override; | 101 void Installed(View* host) override; |
102 virtual void Uninstalled(View* host) override; | 102 void Uninstalled(View* host) override; |
103 virtual void ViewRemoved(View* host, View* view) override; | 103 void ViewRemoved(View* host, View* view) override; |
104 virtual void Layout(View* host) override; | 104 void Layout(View* host) override; |
105 virtual gfx::Size GetPreferredSize(const View* host) const override; | 105 gfx::Size GetPreferredSize(const View* host) const override; |
106 virtual int GetPreferredHeightForWidth(const View* host, | 106 int GetPreferredHeightForWidth(const View* host, int width) const override; |
107 int width) const override; | |
108 | 107 |
109 private: | 108 private: |
110 // Returns the flex for the specified |view|. | 109 // Returns the flex for the specified |view|. |
111 int GetFlexForView(const View* view) const; | 110 int GetFlexForView(const View* view) const; |
112 | 111 |
113 // Returns the size and position along the main axis of |rect|. | 112 // Returns the size and position along the main axis of |rect|. |
114 int MainAxisSize(const gfx::Rect& rect) const; | 113 int MainAxisSize(const gfx::Rect& rect) const; |
115 int MainAxisPosition(const gfx::Rect& rect) const; | 114 int MainAxisPosition(const gfx::Rect& rect) const; |
116 | 115 |
117 // Sets the size and position along the main axis of |rect|. | 116 // Sets the size and position along the main axis of |rect|. |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
168 | 167 |
169 // The view that this BoxLayout is managing the layout for. | 168 // The view that this BoxLayout is managing the layout for. |
170 views::View* host_; | 169 views::View* host_; |
171 | 170 |
172 DISALLOW_IMPLICIT_CONSTRUCTORS(BoxLayout); | 171 DISALLOW_IMPLICIT_CONSTRUCTORS(BoxLayout); |
173 }; | 172 }; |
174 | 173 |
175 } // namespace views | 174 } // namespace views |
176 | 175 |
177 #endif // UI_VIEWS_LAYOUT_BOX_LAYOUT_H_ | 176 #endif // UI_VIEWS_LAYOUT_BOX_LAYOUT_H_ |
OLD | NEW |