Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(268)

Side by Side Diff: views/layout/box_layout.h

Issue 6332013: views: Forward declare "class View;" in layout_manager.h (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome/browser/ui/views/frame/browser_view_layout.cc ('k') | views/layout/box_layout.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 VIEWS_LAYOUT_BOX_LAYOUT_H_ 5 #ifndef VIEWS_LAYOUT_BOX_LAYOUT_H_
6 #define VIEWS_LAYOUT_BOX_LAYOUT_H_ 6 #define VIEWS_LAYOUT_BOX_LAYOUT_H_
7 #pragma once 7 #pragma once
8 8
9 #include "base/basictypes.h" 9 #include "base/basictypes.h"
10 #include "base/compiler_specific.h"
10 #include "views/layout/layout_manager.h" 11 #include "views/layout/layout_manager.h"
11 12
13 namespace gfx {
14 class Size;
15 }
16
12 namespace views { 17 namespace views {
13 18
19 class View;
20
14 // A Layout manager that arranges child views vertically or horizontally in a 21 // A Layout manager that arranges child views vertically or horizontally in a
15 // side-by-side fashion with spacing around and between the child views. The 22 // side-by-side fashion with spacing around and between the child views. The
16 // child views are always sized according to their preferred size. If the 23 // child views are always sized according to their preferred size. If the
17 // host's bounds provide insufficient space, child views will be clamped. 24 // host's bounds provide insufficient space, child views will be clamped.
18 // Excess space will not be distributed. 25 // Excess space will not be distributed.
19 class BoxLayout : public LayoutManager { 26 class BoxLayout : public LayoutManager {
20 public: 27 public:
21 enum Orientation { 28 enum Orientation {
22 kHorizontal, 29 kHorizontal,
23 kVertical, 30 kVertical,
24 }; 31 };
25 32
26 // Use |inside_border_horizontal_spacing| and 33 // Use |inside_border_horizontal_spacing| and
27 // |inside_border_vertical_spacing| to add additional space between the child 34 // |inside_border_vertical_spacing| to add additional space between the child
28 // view area and the host view border. |between_child_spacing| controls the 35 // view area and the host view border. |between_child_spacing| controls the
29 // space in between child views. 36 // space in between child views.
30 BoxLayout(Orientation orientation, 37 BoxLayout(Orientation orientation,
31 int inside_border_horizontal_spacing, 38 int inside_border_horizontal_spacing,
32 int inside_border_vertical_spacing, 39 int inside_border_vertical_spacing,
33 int between_child_spacing); 40 int between_child_spacing);
34 virtual ~BoxLayout() {} 41 virtual ~BoxLayout();
35 42
36 // Overridden from views::LayoutManager: 43 // Overridden from views::LayoutManager:
37 virtual void Layout(View* host); 44 virtual void Layout(View* host) OVERRIDE;
38 virtual gfx::Size GetPreferredSize(View* host); 45 virtual gfx::Size GetPreferredSize(View* host) OVERRIDE;
39 46
40 private: 47 private:
41 const Orientation orientation_; 48 const Orientation orientation_;
42 49
43 // Spacing between child views and host view border. 50 // Spacing between child views and host view border.
44 const int inside_border_horizontal_spacing_; 51 const int inside_border_horizontal_spacing_;
45 const int inside_border_vertical_spacing_; 52 const int inside_border_vertical_spacing_;
46 53
47 // Spacing to put in between child views. 54 // Spacing to put in between child views.
48 const int between_child_spacing_; 55 const int between_child_spacing_;
49 56
50 DISALLOW_IMPLICIT_CONSTRUCTORS(BoxLayout); 57 DISALLOW_IMPLICIT_CONSTRUCTORS(BoxLayout);
51 }; 58 };
52 59
53 } // namespace views 60 } // namespace views
54 61
55 #endif // VIEWS_LAYOUT_BOX_LAYOUT_H_ 62 #endif // VIEWS_LAYOUT_BOX_LAYOUT_H_
OLDNEW
« no previous file with comments | « chrome/browser/ui/views/frame/browser_view_layout.cc ('k') | views/layout/box_layout.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698