OLD | NEW |
(Empty) | |
| 1 // Copyright (c) 2010 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. |
| 4 |
| 5 #ifndef VIEWS_EXAMPLES_BOX_LAYOUT_H_ |
| 6 #define VIEWS_EXAMPLES_BOX_LAYOUT_H_ |
| 7 |
| 8 #include "views/layout_manager.h" |
| 9 |
| 10 namespace examples { |
| 11 |
| 12 // A layout manager that layouts child views vertically or horizontally. |
| 13 class BoxLayout : public views::LayoutManager { |
| 14 public: |
| 15 enum Orientation { |
| 16 kHorizontal, |
| 17 kVertical, |
| 18 }; |
| 19 |
| 20 BoxLayout(Orientation orientation, int margin); |
| 21 |
| 22 virtual ~BoxLayout() {} |
| 23 |
| 24 // Overridden from views::LayoutManager: |
| 25 virtual void Layout(views::View* host); |
| 26 |
| 27 virtual gfx::Size GetPreferredSize(views::View* host); |
| 28 |
| 29 private: |
| 30 const Orientation orientation_; |
| 31 |
| 32 // The pixel distance between children. |
| 33 const int margin_; |
| 34 |
| 35 DISALLOW_COPY_AND_ASSIGN(BoxLayout); |
| 36 }; |
| 37 |
| 38 } // namespace examples |
| 39 |
| 40 #endif // VIEWS_EXAMPLES_BOX_LAYOUT_H_ |
OLD | NEW |