| 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 "base/basictypes.h" | 8 #include "base/basictypes.h" |
| 9 #include "base/compiler_specific.h" | 9 #include "base/compiler_specific.h" |
| 10 #include "ui/gfx/insets.h" | 10 #include "ui/gfx/insets.h" |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 59 int inside_border_vertical_spacing, | 59 int inside_border_vertical_spacing, |
| 60 int between_child_spacing); | 60 int between_child_spacing); |
| 61 virtual ~BoxLayout(); | 61 virtual ~BoxLayout(); |
| 62 | 62 |
| 63 void set_main_axis_alignment(MainAxisAlignment main_axis_alignment) { | 63 void set_main_axis_alignment(MainAxisAlignment main_axis_alignment) { |
| 64 main_axis_alignment_ = main_axis_alignment; | 64 main_axis_alignment_ = main_axis_alignment; |
| 65 } | 65 } |
| 66 | 66 |
| 67 // Overridden from views::LayoutManager: | 67 // Overridden from views::LayoutManager: |
| 68 virtual void Layout(View* host) OVERRIDE; | 68 virtual void Layout(View* host) OVERRIDE; |
| 69 virtual gfx::Size GetPreferredSize(View* host) OVERRIDE; | 69 virtual gfx::Size GetPreferredSize(const View* host) const OVERRIDE; |
| 70 virtual int GetPreferredHeightForWidth(View* host, int width) OVERRIDE; | 70 virtual int GetPreferredHeightForWidth(const View* host, |
| 71 int width) const OVERRIDE; |
| 71 | 72 |
| 72 private: | 73 private: |
| 73 // Returns the size and position along the main axis of |child_area|. | 74 // Returns the size and position along the main axis of |child_area|. |
| 74 int MainAxisSize(const gfx::Rect& child_area) const; | 75 int MainAxisSize(const gfx::Rect& child_area) const; |
| 75 int MainAxisPosition(const gfx::Rect& child_area) const; | 76 int MainAxisPosition(const gfx::Rect& child_area) const; |
| 76 | 77 |
| 77 // Sets the size and position along the main axis of |child_area|. | 78 // Sets the size and position along the main axis of |child_area|. |
| 78 void SetMainAxisSize(int size, gfx::Rect* child_area) const; | 79 void SetMainAxisSize(int size, gfx::Rect* child_area) const; |
| 79 void SetMainAxisPosition(int position, gfx::Rect* child_area) const; | 80 void SetMainAxisPosition(int position, gfx::Rect* child_area) const; |
| 80 | 81 |
| 81 // The preferred size for the dialog given the width of the child area. | 82 // The preferred size for the dialog given the width of the child area. |
| 82 gfx::Size GetPreferredSizeForChildWidth(View* host, int child_area_width); | 83 gfx::Size GetPreferredSizeForChildWidth(const View* host, |
| 84 int child_area_width) const; |
| 83 | 85 |
| 84 // The amount of space the layout requires in addition to any space for the | 86 // The amount of space the layout requires in addition to any space for the |
| 85 // child views. | 87 // child views. |
| 86 gfx::Size NonChildSize(View* host); | 88 gfx::Size NonChildSize(const View* host) const; |
| 87 | 89 |
| 88 const Orientation orientation_; | 90 const Orientation orientation_; |
| 89 | 91 |
| 90 // Spacing between child views and host view border. | 92 // Spacing between child views and host view border. |
| 91 gfx::Insets inside_border_insets_; | 93 gfx::Insets inside_border_insets_; |
| 92 | 94 |
| 93 // Spacing to put in between child views. | 95 // Spacing to put in between child views. |
| 94 const int between_child_spacing_; | 96 const int between_child_spacing_; |
| 95 | 97 |
| 96 // The alignment of children in the main axis. This is | 98 // The alignment of children in the main axis. This is |
| 97 // MAIN_AXIS_ALIGNMENT_START by default. | 99 // MAIN_AXIS_ALIGNMENT_START by default. |
| 98 MainAxisAlignment main_axis_alignment_; | 100 MainAxisAlignment main_axis_alignment_; |
| 99 | 101 |
| 100 DISALLOW_IMPLICIT_CONSTRUCTORS(BoxLayout); | 102 DISALLOW_IMPLICIT_CONSTRUCTORS(BoxLayout); |
| 101 }; | 103 }; |
| 102 | 104 |
| 103 } // namespace views | 105 } // namespace views |
| 104 | 106 |
| 105 #endif // UI_VIEWS_LAYOUT_BOX_LAYOUT_H_ | 107 #endif // UI_VIEWS_LAYOUT_BOX_LAYOUT_H_ |
| OLD | NEW |