Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 UI_VIEWS_VIEW_H_ | 5 #ifndef UI_VIEWS_VIEW_H_ |
| 6 #define UI_VIEWS_VIEW_H_ | 6 #define UI_VIEWS_VIEW_H_ |
| 7 | 7 |
| 8 #include <stddef.h> | 8 #include <stddef.h> |
| 9 | 9 |
| 10 #include <algorithm> | 10 #include <algorithm> |
| (...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 183 // the view at the end. | 183 // the view at the end. |
| 184 void ReorderChildView(View* view, int index); | 184 void ReorderChildView(View* view, int index); |
| 185 | 185 |
| 186 // Removes |view| from this view. The view's parent will change to NULL. | 186 // Removes |view| from this view. The view's parent will change to NULL. |
| 187 void RemoveChildView(View* view); | 187 void RemoveChildView(View* view); |
| 188 | 188 |
| 189 // Removes all the children from this view. If |delete_children| is true, | 189 // Removes all the children from this view. If |delete_children| is true, |
| 190 // the views are deleted, unless marked as not parent owned. | 190 // the views are deleted, unless marked as not parent owned. |
| 191 void RemoveAllChildViews(bool delete_children); | 191 void RemoveAllChildViews(bool delete_children); |
| 192 | 192 |
| 193 int child_count() const { return static_cast<int>(children_.size()); } | 193 int child_count() const { return static_cast<int>(children_.size()); } |
|
sky
2016/12/13 23:40:56
Please add a comment here about GetChildrenOrdered
varkha
2016/12/19 20:35:44
Done.
| |
| 194 bool has_children() const { return !children_.empty(); } | 194 bool has_children() const { return !children_.empty(); } |
| 195 | 195 |
| 196 // Returns the child view at |index|. | 196 // Returns the child view at |index|. |
| 197 const View* child_at(int index) const { | 197 const View* child_at(int index) const { |
| 198 DCHECK_GE(index, 0); | 198 DCHECK_GE(index, 0); |
| 199 DCHECK_LT(index, child_count()); | 199 DCHECK_LT(index, child_count()); |
| 200 return children_[index]; | 200 return children_[index]; |
| 201 } | 201 } |
| 202 View* child_at(int index) { | 202 View* child_at(int index) { |
| 203 return const_cast<View*>(const_cast<const View*>(this)->child_at(index)); | 203 return const_cast<View*>(const_cast<const View*>(this)->child_at(index)); |
| (...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 300 virtual bool IsDrawn() const; | 300 virtual bool IsDrawn() const; |
| 301 | 301 |
| 302 // Set whether this view is enabled. A disabled view does not receive keyboard | 302 // Set whether this view is enabled. A disabled view does not receive keyboard |
| 303 // or mouse inputs. If |enabled| differs from the current value, SchedulePaint | 303 // or mouse inputs. If |enabled| differs from the current value, SchedulePaint |
| 304 // is invoked. Also, clears focus if the focused view is disabled. | 304 // is invoked. Also, clears focus if the focused view is disabled. |
| 305 void SetEnabled(bool enabled); | 305 void SetEnabled(bool enabled); |
| 306 | 306 |
| 307 // Returns whether the view is enabled. | 307 // Returns whether the view is enabled. |
| 308 bool enabled() const { return enabled_; } | 308 bool enabled() const { return enabled_; } |
| 309 | 309 |
| 310 // Get a container of |children_| arranged according to the stacking order. | |
|
sky
2016/12/13 23:40:56
How about:
Returns the child views ordered in reve
varkha
2016/12/14 17:51:38
I will look into the rest of the comments but maki
varkha
2016/12/19 20:35:44
Done (edited the comment).
| |
| 311 // This defaults to returning |children_| but can be overridden to implement | |
| 312 // a different stacking order. This order is taken into account by painting | |
| 313 // and targeting implementations. | |
| 314 virtual View::Views GetChildrenOrderedByVisualOrder(); | |
| 315 | |
| 310 // Transformations ----------------------------------------------------------- | 316 // Transformations ----------------------------------------------------------- |
| 311 | 317 |
| 312 // Methods for setting transformations for a view (e.g. rotation, scaling). | 318 // Methods for setting transformations for a view (e.g. rotation, scaling). |
| 313 | 319 |
| 314 gfx::Transform GetTransform() const; | 320 gfx::Transform GetTransform() const; |
| 315 | 321 |
| 316 // Clipping is done relative to the view's local bounds. | 322 // Clipping is done relative to the view's local bounds. |
| 317 void set_clip_path(const gfx::Path& path) { clip_path_ = path; } | 323 void set_clip_path(const gfx::Path& path) { clip_path_ = path; } |
| 318 | 324 |
| 319 // Sets the transform to the supplied transform. | 325 // Sets the transform to the supplied transform. |
| (...skipping 1263 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1583 // Observers ------------------------------------------------------------- | 1589 // Observers ------------------------------------------------------------- |
| 1584 | 1590 |
| 1585 base::ObserverList<ViewObserver> observers_; | 1591 base::ObserverList<ViewObserver> observers_; |
| 1586 | 1592 |
| 1587 DISALLOW_COPY_AND_ASSIGN(View); | 1593 DISALLOW_COPY_AND_ASSIGN(View); |
| 1588 }; | 1594 }; |
| 1589 | 1595 |
| 1590 } // namespace views | 1596 } // namespace views |
| 1591 | 1597 |
| 1592 #endif // UI_VIEWS_VIEW_H_ | 1598 #endif // UI_VIEWS_VIEW_H_ |
| OLD | NEW |