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

Side by Side 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef UI_VIEWS_VIEW_H_ 5 #ifndef UI_VIEWS_VIEW_H_
6 #define UI_VIEWS_VIEW_H_ 6 #define UI_VIEWS_VIEW_H_
7 7
8 #include <stddef.h> 8 #include <stddef.h>
9 9
10 #include <algorithm> 10 #include <algorithm>
(...skipping 18 matching lines...) Expand all
29 #include "ui/compositor/layer_owner.h" 29 #include "ui/compositor/layer_owner.h"
30 #include "ui/compositor/paint_cache.h" 30 #include "ui/compositor/paint_cache.h"
31 #include "ui/events/event.h" 31 #include "ui/events/event.h"
32 #include "ui/events/event_target.h" 32 #include "ui/events/event_target.h"
33 #include "ui/gfx/geometry/insets.h" 33 #include "ui/gfx/geometry/insets.h"
34 #include "ui/gfx/geometry/point.h" 34 #include "ui/gfx/geometry/point.h"
35 #include "ui/gfx/geometry/rect.h" 35 #include "ui/gfx/geometry/rect.h"
36 #include "ui/gfx/geometry/vector2d.h" 36 #include "ui/gfx/geometry/vector2d.h"
37 #include "ui/gfx/native_widget_types.h" 37 #include "ui/gfx/native_widget_types.h"
38 #include "ui/gfx/path.h" 38 #include "ui/gfx/path.h"
39 #include "ui/views/layout/layout_delegate.h"
39 #include "ui/views/view_targeter.h" 40 #include "ui/views/view_targeter.h"
40 #include "ui/views/views_export.h" 41 #include "ui/views/views_export.h"
41 42
42 #if defined(OS_WIN) 43 #if defined(OS_WIN)
43 #include "base/win/scoped_comptr.h" 44 #include "base/win/scoped_comptr.h"
44 #endif 45 #endif
45 46
46 using ui::OSExchangeData; 47 using ui::OSExchangeData;
47 48
48 namespace gfx { 49 namespace gfx {
(...skipping 17 matching lines...) Expand all
66 } 67 }
67 68
68 namespace views { 69 namespace views {
69 70
70 class Background; 71 class Background;
71 class Border; 72 class Border;
72 class ContextMenuController; 73 class ContextMenuController;
73 class DragController; 74 class DragController;
74 class FocusManager; 75 class FocusManager;
75 class FocusTraversable; 76 class FocusTraversable;
77 class LayoutDelegate;
76 class LayoutManager; 78 class LayoutManager;
77 class NativeViewAccessibility; 79 class NativeViewAccessibility;
78 class ScrollView; 80 class ScrollView;
79 class Widget; 81 class Widget;
80 class WordLookupClient; 82 class WordLookupClient;
81 83
82 namespace internal { 84 namespace internal {
83 class PreEventDispatchHandler; 85 class PreEventDispatchHandler;
84 class PostEventDispatchHandler; 86 class PostEventDispatchHandler;
85 class RootView; 87 class RootView;
(...skipping 303 matching lines...) Expand 10 before | Expand all | Expand 10 after
389 // parent views do not change. 391 // parent views do not change.
390 void InvalidateLayout(); 392 void InvalidateLayout();
391 393
392 // Gets/Sets the Layout Manager used by this view to size and place its 394 // Gets/Sets the Layout Manager used by this view to size and place its
393 // children. 395 // children.
394 // The LayoutManager is owned by the View and is deleted when the view is 396 // The LayoutManager is owned by the View and is deleted when the view is
395 // deleted, or when a new LayoutManager is installed. 397 // deleted, or when a new LayoutManager is installed.
396 LayoutManager* GetLayoutManager() const; 398 LayoutManager* GetLayoutManager() const;
397 void SetLayoutManager(LayoutManager* layout); 399 void SetLayoutManager(LayoutManager* layout);
398 400
401 // Gets/Sets the Layout Delegate used by this view and its children / related
402 // views to compute spacing between and around elements. The LayoutDelegate is
403 // not owned by the View and should not be deleted.
404 LayoutDelegate* GetLayoutDelegate() const;
405 void SetLayoutDelegate(LayoutDelegate* delegate);
406
399 // Adjust the layer's offset so that it snaps to the physical pixel boundary. 407 // Adjust the layer's offset so that it snaps to the physical pixel boundary.
400 // This has no effect if the view does not have an associated layer. 408 // This has no effect if the view does not have an associated layer.
401 void SnapLayerToPixelBoundary(); 409 void SnapLayerToPixelBoundary();
402 410
403 // Attributes ---------------------------------------------------------------- 411 // Attributes ----------------------------------------------------------------
404 412
405 // The view class name. 413 // The view class name.
406 static const char kViewClassName[]; 414 static const char kViewClassName[];
407 415
408 // Return the receiving view's class name. A view class is a string which 416 // Return the receiving view's class name. A view class is a string which
(...skipping 1095 matching lines...) Expand 10 before | Expand all | Expand 10 after
1504 1512
1505 // Layout -------------------------------------------------------------------- 1513 // Layout --------------------------------------------------------------------
1506 1514
1507 // Whether the view needs to be laid out. 1515 // Whether the view needs to be laid out.
1508 bool needs_layout_; 1516 bool needs_layout_;
1509 1517
1510 // The View's LayoutManager defines the sizing heuristics applied to child 1518 // The View's LayoutManager defines the sizing heuristics applied to child
1511 // Views. The default is absolute positioning according to bounds_. 1519 // Views. The default is absolute positioning according to bounds_.
1512 std::unique_ptr<LayoutManager> layout_manager_; 1520 std::unique_ptr<LayoutManager> layout_manager_;
1513 1521
1522 // The View's LayoutDelegate, if it has one.
1523 LayoutDelegate* layout_delegate_ = nullptr;
1524
1514 // Whether this View's layer should be snapped to the pixel boundary. 1525 // Whether this View's layer should be snapped to the pixel boundary.
1515 bool snap_layer_to_pixel_boundary_; 1526 bool snap_layer_to_pixel_boundary_;
1516 1527
1517 // Painting ------------------------------------------------------------------ 1528 // Painting ------------------------------------------------------------------
1518 1529
1519 // Background 1530 // Background
1520 std::unique_ptr<Background> background_; 1531 std::unique_ptr<Background> background_;
1521 1532
1522 // Border. 1533 // Border.
1523 std::unique_ptr<Border> border_; 1534 std::unique_ptr<Border> border_;
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
1576 // Belongs to this view, but it's reference-counted on some platforms 1587 // Belongs to this view, but it's reference-counted on some platforms
1577 // so we can't use a scoped_ptr. It's dereferenced in the destructor. 1588 // so we can't use a scoped_ptr. It's dereferenced in the destructor.
1578 NativeViewAccessibility* native_view_accessibility_; 1589 NativeViewAccessibility* native_view_accessibility_;
1579 1590
1580 DISALLOW_COPY_AND_ASSIGN(View); 1591 DISALLOW_COPY_AND_ASSIGN(View);
1581 }; 1592 };
1582 1593
1583 } // namespace views 1594 } // namespace views
1584 1595
1585 #endif // UI_VIEWS_VIEW_H_ 1596 #endif // UI_VIEWS_VIEW_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698