Index: ui/views/layout/align_layout.h |
diff --git a/ui/views/layout/align_layout.h b/ui/views/layout/align_layout.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..a08f1e2e8f4233256a8894635107003ad19c273e |
--- /dev/null |
+++ b/ui/views/layout/align_layout.h |
@@ -0,0 +1,50 @@ |
+// Copyright (c) 2011 The Chromium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+#ifndef UI_VIEWS_LAYOUT_ALIGN_LAYOUT_H_ |
+#define UI_VIEWS_LAYOUT_ALIGN_LAYOUT_H_ |
+ |
+#include <stddef.h> |
+ |
+#include <algorithm> |
+#include <vector> |
+ |
+#include "base/compiler_specific.h" |
+#include "base/macros.h" |
+#include "ui/gfx/geometry/rect.h" |
+#include "ui/views/fill_attribute.h" |
+#include "ui/views/layout/layout_manager.h" |
+#include "ui/views/view.h" |
+ |
+namespace views { |
+ |
+/////////////////////////////////////////////////////////////////////////////// |
+// |
+// AlignLayout |
+// A LayoutManager that causes the associated view's children to be aligned |
+// and/or anchored within the bounds of their parent based on the value of the |
+// views' align or anchor attributes. |
+// |
+/////////////////////////////////////////////////////////////////////////////// |
+class VIEWS_EXPORT AlignLayout : public LayoutManager { |
+ public: |
+ AlignLayout(); |
+ ~AlignLayout() override; |
+ |
+ // Overridden from LayoutManager: |
+ void Layout(View* host) override; |
+ gfx::Size GetPreferredSize(const View* host) const override; |
+ int GetPreferredHeightForWidth(const View* host, int width) const override; |
+ |
+ private: |
+ void AlignViews(View* host, views::Fill fill, gfx::Rect& contents); |
+ void PlaceView(View* view, views::Fill fill, gfx::Rect& contents); |
+ bool ShouldAlign(View* host); |
+ bool ShouldInsert(View* child1, View* child2, views::Fill fill); |
+ DISALLOW_COPY_AND_ASSIGN(AlignLayout); |
+}; |
+ |
+} // namespace views |
+ |
+#endif // UI_VIEWS_LAYOUT_FILL_LAYOUT_H_ |