OLD | NEW |
| (Empty) |
1 // Copyright 2014 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 MOJO_SERVICES_PUBLIC_CPP_VIEW_MANAGER_LIB_VIEW_PRIVATE_H_ | |
6 #define MOJO_SERVICES_PUBLIC_CPP_VIEW_MANAGER_LIB_VIEW_PRIVATE_H_ | |
7 | |
8 #include "base/basictypes.h" | |
9 | |
10 #include "mojo/services/public/cpp/view_manager/view.h" | |
11 | |
12 namespace mojo { | |
13 | |
14 // This class is a friend of a View and contains functions to mutate internal | |
15 // state of View. | |
16 class ViewPrivate { | |
17 public: | |
18 explicit ViewPrivate(View* view); | |
19 ~ViewPrivate(); | |
20 | |
21 // Creates and returns a new View. Caller owns the return value. | |
22 static View* LocalCreate(); | |
23 | |
24 ObserverList<ViewObserver>* observers() { return &view_->observers_; } | |
25 | |
26 void ClearParent() { view_->parent_ = NULL; } | |
27 | |
28 void set_visible(bool visible) { view_->visible_ = visible; } | |
29 | |
30 void set_drawn(bool drawn) { view_->drawn_ = drawn; } | |
31 | |
32 void set_id(Id id) { view_->id_ = id; } | |
33 | |
34 ViewManager* view_manager() { return view_->manager_; } | |
35 void set_view_manager(ViewManager* manager) { | |
36 view_->manager_ = manager; | |
37 } | |
38 | |
39 void set_properties(const std::map<std::string, std::vector<uint8_t>>& data) { | |
40 view_->properties_ = data; | |
41 } | |
42 | |
43 void LocalDestroy() { | |
44 view_->LocalDestroy(); | |
45 } | |
46 void LocalAddChild(View* child) { | |
47 view_->LocalAddChild(child); | |
48 } | |
49 void LocalRemoveChild(View* child) { | |
50 view_->LocalRemoveChild(child); | |
51 } | |
52 void LocalReorder(View* relative, OrderDirection direction) { | |
53 view_->LocalReorder(relative, direction); | |
54 } | |
55 void LocalSetBounds(const Rect& old_bounds, | |
56 const Rect& new_bounds) { | |
57 view_->LocalSetBounds(old_bounds, new_bounds); | |
58 } | |
59 void LocalSetDrawn(bool drawn) { view_->LocalSetDrawn(drawn); } | |
60 | |
61 private: | |
62 View* view_; | |
63 | |
64 DISALLOW_COPY_AND_ASSIGN(ViewPrivate); | |
65 }; | |
66 | |
67 } // namespace mojo | |
68 | |
69 #endif // MOJO_SERVICES_PUBLIC_CPP_VIEW_MANAGER_LIB_VIEW_PRIVATE_H_ | |
OLD | NEW |