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

Side by Side 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 unified diff | 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 »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(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_
OLDNEW
« 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