Fix cookie searchbox bug.
[chromium-blink-merge.git] / ui / views / layout / box_layout.h
blobb592cc6a33c3f84b17b9a5835452f81e4bc0034d
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
3 // found in the LICENSE file.
5 #ifndef UI_VIEWS_LAYOUT_BOX_LAYOUT_H_
6 #define UI_VIEWS_LAYOUT_BOX_LAYOUT_H_
8 #include "base/basictypes.h"
9 #include "base/compiler_specific.h"
10 #include "ui/views/layout/layout_manager.h"
12 namespace gfx {
13 class Size;
16 namespace views {
18 class View;
20 // A Layout manager that arranges child views vertically or horizontally in a
21 // side-by-side fashion with spacing around and between the child views. The
22 // child views are always sized according to their preferred size. If the
23 // host's bounds provide insufficient space, child views will be clamped.
24 // Excess space will not be distributed.
25 class VIEWS_EXPORT BoxLayout : public LayoutManager {
26 public:
27 enum Orientation {
28 kHorizontal,
29 kVertical,
32 // Use |inside_border_horizontal_spacing| and
33 // |inside_border_vertical_spacing| to add additional space between the child
34 // view area and the host view border. |between_child_spacing| controls the
35 // space in between child views.
36 BoxLayout(Orientation orientation,
37 int inside_border_horizontal_spacing,
38 int inside_border_vertical_spacing,
39 int between_child_spacing);
40 virtual ~BoxLayout();
42 void set_spread_blank_space(bool spread) {
43 spread_blank_space_ = spread;
46 // Overridden from views::LayoutManager:
47 virtual void Layout(View* host) OVERRIDE;
48 virtual gfx::Size GetPreferredSize(View* host) OVERRIDE;
50 private:
51 const Orientation orientation_;
53 // Spacing between child views and host view border.
54 const int inside_border_horizontal_spacing_;
55 const int inside_border_vertical_spacing_;
57 // Spacing to put in between child views.
58 const int between_child_spacing_;
60 // Whether the available extra space should be distributed among the child
61 // views.
62 bool spread_blank_space_;
64 DISALLOW_IMPLICIT_CONSTRUCTORS(BoxLayout);
67 } // namespace views
69 #endif // UI_VIEWS_LAYOUT_BOX_LAYOUT_H_