OLD | NEW |
(Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef UI_VIEWS_LAYOUT_ALIGN_LAYOUT_H_ |
| 6 #define UI_VIEWS_LAYOUT_ALIGN_LAYOUT_H_ |
| 7 |
| 8 #include <stddef.h> |
| 9 |
| 10 #include <algorithm> |
| 11 #include <vector> |
| 12 |
| 13 #include "base/compiler_specific.h" |
| 14 #include "base/macros.h" |
| 15 #include "ui/gfx/geometry/rect.h" |
| 16 #include "ui/views/fill_attribute.h" |
| 17 #include "ui/views/layout/layout_manager.h" |
| 18 #include "ui/views/view.h" |
| 19 |
| 20 namespace views { |
| 21 |
| 22 /////////////////////////////////////////////////////////////////////////////// |
| 23 // |
| 24 // AlignLayout |
| 25 // A LayoutManager that causes the associated view's children to be aligned |
| 26 // and/or anchored within the bounds of their parent based on the value of the |
| 27 // views' align or anchor attributes. |
| 28 // |
| 29 /////////////////////////////////////////////////////////////////////////////// |
| 30 class VIEWS_EXPORT AlignLayout : public LayoutManager { |
| 31 public: |
| 32 AlignLayout(); |
| 33 ~AlignLayout() override; |
| 34 |
| 35 // Overridden from LayoutManager: |
| 36 void Layout(View* host) override; |
| 37 gfx::Size GetPreferredSize(const View* host) const override; |
| 38 int GetPreferredHeightForWidth(const View* host, int width) const override; |
| 39 |
| 40 private: |
| 41 void AlignViews(View* host, views::Fill fill, gfx::Rect& contents); |
| 42 void PlaceView(View* view, views::Fill fill, gfx::Rect& contents); |
| 43 bool ShouldAlign(View* host); |
| 44 bool ShouldInsert(View* child1, View* child2, views::Fill fill); |
| 45 DISALLOW_COPY_AND_ASSIGN(AlignLayout); |
| 46 }; |
| 47 |
| 48 } // namespace views |
| 49 |
| 50 #endif // UI_VIEWS_LAYOUT_FILL_LAYOUT_H_ |
OLD | NEW |