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

Unified Diff: ui/views/layout/align_layout.h

Issue 2230913003: Experimental alignment layout manager using a property on the views Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Renamed AlignAttribute and associated types to FillAttribute Created 4 years, 2 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ui/views/fill_attribute.cc ('k') | ui/views/layout/align_layout.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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_
« no previous file with comments | « ui/views/fill_attribute.cc ('k') | ui/views/layout/align_layout.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698