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

Side by Side Diff: ui/v2/public/view.h

Issue 682713003: Update a bunch of OWNERS files. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 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
(Empty)
1 // Copyright (c) 2013 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_V2_PUBLIC_VIEW_H_
6 #define UI_V2_PUBLIC_VIEW_H_
7
8 #include <vector>
9
10 #include "base/memory/scoped_ptr.h"
11 #include "base/observer_list.h"
12 #include "ui/compositor/layer_type.h"
13 #include "ui/gfx/rect.h"
14 #include "ui/v2/public/layout.h"
15 #include "ui/v2/public/painter.h"
16 #include "ui/v2/public/v2_export.h"
17
18 namespace ui {
19 class Layer;
20 }
21
22 namespace v2 {
23
24 class Layout;
25 class Painter;
26 class ViewObserver;
27 class ViewLayerOwner;
28
29 class V2_EXPORT View /* : public EventTarget */ {
30 public:
31 typedef std::vector<View*> Children;
32
33 View();
34 virtual ~View();
35
36 // Configuration.
37
38 void set_owned_by_parent(bool owned_by_parent) {
39 owned_by_parent_ = owned_by_parent;
40 }
41
42 // View takes ownership.
43 void SetPainter(Painter* painter);
44
45 // See documentation in layout.h. A layout manager's rules apply to this
46 // View's children.
47 // View takes ownership.
48 void SetLayout(Layout* layout);
49
50 // Observation.
51
52 void AddObserver(ViewObserver* observer);
53 void RemoveObserver(ViewObserver* observer);
54
55 // Disposition.
56
57 void SetBounds(const gfx::Rect& bounds);
58 gfx::Rect bounds() const { return bounds_; }
59
60 void SetVisible(bool visible);
61 bool visible() const { return visible_; }
62
63 // Tree.
64
65 View* parent() { return parent_; }
66 const View* parent() const { return parent_; }
67 const Children& children() const { return children_; }
68
69 void AddChild(View* child);
70 void RemoveChild(View* child);
71
72 bool Contains(View* child) const;
73
74 void StackChildAtTop(View* child);
75 void StackChildAtBottom(View* child);
76 void StackChildAbove(View* child, View* other);
77 void StackChildBelow(View* child, View* other);
78
79 // Layer.
80
81 inline const ui::Layer* layer() const;
82 inline ui::Layer* layer();
83 bool HasLayer() const;
84 void CreateLayer(ui::LayerType layer_type);
85 void DestroyLayer();
86 ui::Layer* AcquireLayer();
87
88 private:
89 friend class ViewPrivate;
90
91 // Disposition attributes.
92 gfx::Rect bounds_;
93 bool visible_;
94
95 scoped_ptr<Painter> painter_;
96 scoped_ptr<Layout> layout_;
97
98 // Tree.
99 bool owned_by_parent_;
100 View* parent_;
101 Children children_;
102
103 // Layer.
104 scoped_ptr<ViewLayerOwner> layer_owner_;
105
106 ObserverList<ViewObserver> observers_;
107
108 DISALLOW_COPY_AND_ASSIGN(View);
109 };
110
111 } // namespace v2
112
113 #endif // UI_V2_PUBLIC_VIEW_H_
OLDNEW
« OWNERS ('K') | « ui/v2/public/v2_export.h ('k') | ui/v2/public/view_observer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698