| 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_VIEW_H_ | 5 #ifndef MOJO_SERVICES_PUBLIC_CPP_VIEW_MANAGER_VIEW_H_ |
| 6 #define MOJO_SERVICES_PUBLIC_CPP_VIEW_MANAGER_VIEW_H_ | 6 #define MOJO_SERVICES_PUBLIC_CPP_VIEW_MANAGER_VIEW_H_ |
| 7 | 7 |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
| (...skipping 28 matching lines...) Expand all Loading... |
| 39 | 39 |
| 40 // Destroys this view and all its children. | 40 // Destroys this view and all its children. |
| 41 void Destroy(); | 41 void Destroy(); |
| 42 | 42 |
| 43 ViewManager* view_manager() { return manager_; } | 43 ViewManager* view_manager() { return manager_; } |
| 44 | 44 |
| 45 // Configuration. | 45 // Configuration. |
| 46 Id id() const { return id_; } | 46 Id id() const { return id_; } |
| 47 | 47 |
| 48 // Geometric disposition. | 48 // Geometric disposition. |
| 49 const gfx::Rect& bounds() { return bounds_; } | 49 const gfx::Rect& bounds() const { return bounds_; } |
| 50 void SetBounds(const gfx::Rect& bounds); | 50 void SetBounds(const gfx::Rect& bounds); |
| 51 | 51 |
| 52 // Visibility. | 52 // Visibility (also see IsDrawn()). |
| 53 bool visible() const { return visible_; } |
| 53 void SetVisible(bool value); | 54 void SetVisible(bool value); |
| 54 // TODO(sky): add accessor. | 55 |
| 56 // A View is drawn if the View and all its ancestors are visible and the |
| 57 // View is attached to the root. |
| 58 bool IsDrawn() const; |
| 55 | 59 |
| 56 // Observation. | 60 // Observation. |
| 57 void AddObserver(ViewObserver* observer); | 61 void AddObserver(ViewObserver* observer); |
| 58 void RemoveObserver(ViewObserver* observer); | 62 void RemoveObserver(ViewObserver* observer); |
| 59 | 63 |
| 60 // Tree. | 64 // Tree. |
| 61 View* parent() { return parent_; } | 65 View* parent() { return parent_; } |
| 62 const View* parent() const { return parent_; } | 66 const View* parent() const { return parent_; } |
| 63 const Children& children() const { return children_; } | 67 const Children& children() const { return children_; } |
| 64 | 68 |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 98 friend class ViewManagerClientImpl; | 102 friend class ViewManagerClientImpl; |
| 99 | 103 |
| 100 explicit View(ViewManager* manager); | 104 explicit View(ViewManager* manager); |
| 101 | 105 |
| 102 void LocalDestroy(); | 106 void LocalDestroy(); |
| 103 void LocalAddChild(View* child); | 107 void LocalAddChild(View* child); |
| 104 void LocalRemoveChild(View* child); | 108 void LocalRemoveChild(View* child); |
| 105 // Returns true if the order actually changed. | 109 // Returns true if the order actually changed. |
| 106 bool LocalReorder(View* relative, OrderDirection direction); | 110 bool LocalReorder(View* relative, OrderDirection direction); |
| 107 void LocalSetBounds(const gfx::Rect& old_bounds, const gfx::Rect& new_bounds); | 111 void LocalSetBounds(const gfx::Rect& old_bounds, const gfx::Rect& new_bounds); |
| 112 void LocalSetDrawn(bool drawn); |
| 108 void CreateBitmapUploader(); | 113 void CreateBitmapUploader(); |
| 109 | 114 |
| 110 ViewManager* manager_; | 115 ViewManager* manager_; |
| 111 Id id_; | 116 Id id_; |
| 112 View* parent_; | 117 View* parent_; |
| 113 Children children_; | 118 Children children_; |
| 114 | 119 |
| 115 ObserverList<ViewObserver> observers_; | 120 ObserverList<ViewObserver> observers_; |
| 116 | 121 |
| 117 gfx::Rect bounds_; | 122 gfx::Rect bounds_; |
| 123 |
| 124 bool visible_; |
| 125 |
| 126 // Drawn state is derived from the visible state and the parent's visible |
| 127 // state. This field is only used if the view has no parent (eg it's a root). |
| 128 bool drawn_; |
| 129 |
| 118 // TODO(jamesr): Temporary, remove when all clients are using surfaces | 130 // TODO(jamesr): Temporary, remove when all clients are using surfaces |
| 119 // directly. | 131 // directly. |
| 120 scoped_ptr<BitmapUploader> bitmap_uploader_; | 132 scoped_ptr<BitmapUploader> bitmap_uploader_; |
| 121 | 133 |
| 122 DISALLOW_COPY_AND_ASSIGN(View); | 134 DISALLOW_COPY_AND_ASSIGN(View); |
| 123 }; | 135 }; |
| 124 | 136 |
| 125 } // namespace mojo | 137 } // namespace mojo |
| 126 | 138 |
| 127 #endif // MOJO_SERVICES_PUBLIC_CPP_VIEW_MANAGER_VIEW_H_ | 139 #endif // MOJO_SERVICES_PUBLIC_CPP_VIEW_MANAGER_VIEW_H_ |
| OLD | NEW |