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

Unified Diff: ui/views/view.h

Issue 2485083003: views: add layout delegates (Closed)
Patch Set: Created 4 years, 1 month 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
Index: ui/views/view.h
diff --git a/ui/views/view.h b/ui/views/view.h
index 050548f0120ac7c90a3e5630966e5177208db8cf..8a32eccaf018e363ac63ebc1760c74d10e55863c 100644
--- a/ui/views/view.h
+++ b/ui/views/view.h
@@ -36,6 +36,7 @@
#include "ui/gfx/geometry/vector2d.h"
#include "ui/gfx/native_widget_types.h"
#include "ui/gfx/path.h"
+#include "ui/views/layout/layout_delegate.h"
#include "ui/views/view_targeter.h"
#include "ui/views/views_export.h"
@@ -73,6 +74,7 @@ class ContextMenuController;
class DragController;
class FocusManager;
class FocusTraversable;
+class LayoutDelegate;
class LayoutManager;
class NativeViewAccessibility;
class ScrollView;
@@ -396,6 +398,12 @@ class VIEWS_EXPORT View : public ui::LayerDelegate,
LayoutManager* GetLayoutManager() const;
void SetLayoutManager(LayoutManager* layout);
+ // Gets/Sets the Layout Delegate used by this view and its children / related
+ // views to compute spacing between and around elements. The LayoutDelegate is
+ // not owned by the View and should not be deleted.
+ LayoutDelegate* GetLayoutDelegate() const;
+ void SetLayoutDelegate(LayoutDelegate* delegate);
+
// Adjust the layer's offset so that it snaps to the physical pixel boundary.
// This has no effect if the view does not have an associated layer.
void SnapLayerToPixelBoundary();
@@ -1511,6 +1519,9 @@ class VIEWS_EXPORT View : public ui::LayerDelegate,
// Views. The default is absolute positioning according to bounds_.
std::unique_ptr<LayoutManager> layout_manager_;
+ // The View's LayoutDelegate, if it has one.
+ LayoutDelegate* layout_delegate_ = nullptr;
+
// Whether this View's layer should be snapped to the pixel boundary.
bool snap_layer_to_pixel_boundary_;

Powered by Google App Engine
This is Rietveld 408576698