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