| Index: ui/views/layout/box_layout.h
|
| diff --git a/ui/views/layout/box_layout.h b/ui/views/layout/box_layout.h
|
| index 7670d8cb05e7bd15b59771b2e95c3ade65aabf84..ce2cbd5c9378516259107e156c50fd5c69b19030 100644
|
| --- a/ui/views/layout/box_layout.h
|
| +++ b/ui/views/layout/box_layout.h
|
| @@ -11,6 +11,7 @@
|
| #include "ui/views/layout/layout_manager.h"
|
|
|
| namespace gfx {
|
| +class Rect;
|
| class Size;
|
| }
|
|
|
| @@ -30,6 +31,16 @@ class VIEWS_EXPORT BoxLayout : public LayoutManager {
|
| kVertical,
|
| };
|
|
|
| + enum BoxPack {
|
| + BOX_PACK_START,
|
| + BOX_PACK_CENTER,
|
| + BOX_PACK_END,
|
| + // TODO(calamity): Add BOX_PACK_JUSTIFY which spreads blank space in-
|
| + // between the child views.
|
| + };
|
| +
|
| + // TODO(calamity): Add BoxAlign property to allow cross axis alignment.
|
| +
|
| // Use |inside_border_horizontal_spacing| and
|
| // |inside_border_vertical_spacing| to add additional space between the child
|
| // view area and the host view border. |between_child_spacing| controls the
|
| @@ -44,12 +55,19 @@ class VIEWS_EXPORT BoxLayout : public LayoutManager {
|
| spread_blank_space_ = spread;
|
| }
|
|
|
| + void set_box_pack(BoxPack box_pack) { box_pack_ = box_pack; }
|
| +
|
| // Overridden from views::LayoutManager:
|
| virtual void Layout(View* host) OVERRIDE;
|
| virtual gfx::Size GetPreferredSize(View* host) OVERRIDE;
|
| virtual int GetPreferredHeightForWidth(View* host, int width) OVERRIDE;
|
|
|
| private:
|
| + int MainAxisSize(const gfx::Rect& child_area);
|
| + int MainAxisPosition(const gfx::Rect& child_area);
|
| + void SetMainAxisSize(gfx::Rect* child_area, int size);
|
| + void SetMainAxisPosition(gfx::Rect* child_area, int position);
|
| +
|
| // The preferred size for the dialog given the width of the child area.
|
| gfx::Size GetPreferredSizeForChildWidth(View* host, int child_area_width);
|
|
|
| @@ -66,9 +84,14 @@ class VIEWS_EXPORT BoxLayout : public LayoutManager {
|
| const int between_child_spacing_;
|
|
|
| // Whether the available extra space should be distributed among the child
|
| - // views.
|
| + // views. This increases the size of child views rather than the space
|
| + // between them.
|
| bool spread_blank_space_;
|
|
|
| + // The alignment of children in the main axis. This is BOX_PACK_START by
|
| + // default.
|
| + BoxPack box_pack_;
|
| +
|
| DISALLOW_IMPLICIT_CONSTRUCTORS(BoxLayout);
|
| };
|
|
|
|
|