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