Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(601)

Side by Side Diff: views/view.h

Issue 7349021: Convert some more view methods to the ui/views style. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 9 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 VIEWS_VIEW_H_ 5 #ifndef VIEWS_VIEW_H_
6 #define VIEWS_VIEW_H_ 6 #define VIEWS_VIEW_H_
7 #pragma once 7 #pragma once
8 8
9 #include <algorithm> 9 #include <algorithm>
10 #include <map> 10 #include <map>
11 #include <set> 11 #include <set>
12 #include <string> 12 #include <string>
13 #include <vector> 13 #include <vector>
14 14
15 #include "base/i18n/rtl.h" 15 #include "base/i18n/rtl.h"
16 #include "base/logging.h"
16 #include "base/memory/scoped_ptr.h" 17 #include "base/memory/scoped_ptr.h"
17 #include "build/build_config.h" 18 #include "build/build_config.h"
18 #include "ui/base/dragdrop/os_exchange_data.h" 19 #include "ui/base/dragdrop/os_exchange_data.h"
19 #include "ui/gfx/native_widget_types.h" 20 #include "ui/gfx/native_widget_types.h"
20 #include "ui/gfx/rect.h" 21 #include "ui/gfx/rect.h"
21 #include "views/accelerator.h" 22 #include "views/accelerator.h"
22 #include "views/background.h" 23 #include "views/background.h"
23 #include "views/border.h" 24 #include "views/border.h"
24 #include "views/layer_helper.h" 25 #include "views/layer_helper.h"
25 26
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
129 // the view at the end. 130 // the view at the end.
130 void ReorderChildView(View* view, int index); 131 void ReorderChildView(View* view, int index);
131 132
132 // Removes |view| from this view. The view's parent will change to NULL. 133 // Removes |view| from this view. The view's parent will change to NULL.
133 void RemoveChildView(View* view); 134 void RemoveChildView(View* view);
134 135
135 // Removes all the children from this view. If |delete_children| is true, 136 // Removes all the children from this view. If |delete_children| is true,
136 // the views are deleted, unless marked as not parent owned. 137 // the views are deleted, unless marked as not parent owned.
137 void RemoveAllChildViews(bool delete_children); 138 void RemoveAllChildViews(bool delete_children);
138 139
139 // Returns the child view at |index|. 140 // STL-style accessors.
140 const View* GetChildViewAt(int index) const; 141 Views::const_iterator children_begin() { return children_.begin(); }
sky 2011/07/13 23:54:52 can these 4 be const?
141 View* GetChildViewAt(int index); 142 Views::const_iterator children_end() { return children_.end(); }
142 143 Views::const_reverse_iterator children_rbegin() { return children_.rbegin(); }
143 // Returns the number of child views. 144 Views::const_reverse_iterator children_rend() { return children_.rend(); }
144 int child_count() const { return static_cast<int>(children_.size()); } 145 int child_count() const { return static_cast<int>(children_.size()); }
145 bool has_children() const { return !children_.empty(); } 146 bool has_children() const { return !children_.empty(); }
147 View* child_at(int index) {
148 DCHECK_LT(index, child_count());
149 return children_[index];
150 }
151 const View* child_at(int index) const {
152 return const_cast<View*>(const_cast<const View*>(this))->child_at(index);
153 }
146 154
147 // Returns the parent view. 155 // Returns the parent view.
148 const View* parent() const { return parent_; } 156 const View* parent() const { return parent_; }
149 View* parent() { return parent_; } 157 View* parent() { return parent_; }
150 158
151 // Returns true if |view| is contained within this View's hierarchy, even as 159 // Returns true if |view| is contained within this View's hierarchy, even as
152 // an indirect descendant. Will return true if child is also this view. 160 // an indirect descendant. Will return true if child is also this view.
153 bool Contains(const View* view) const; 161 bool Contains(const View* view) const;
154 162
155 // Returns the index of |view|, or -1 if |view| is not a child of this view. 163 // Returns the index of |view|, or -1 if |view| is not a child of this view.
(...skipping 1267 matching lines...) Expand 10 before | Expand all | Expand 10 after
1423 #if defined(OS_WIN) 1431 #if defined(OS_WIN)
1424 scoped_refptr<NativeViewAccessibilityWin> native_view_accessibility_win_; 1432 scoped_refptr<NativeViewAccessibilityWin> native_view_accessibility_win_;
1425 #endif 1433 #endif
1426 1434
1427 DISALLOW_COPY_AND_ASSIGN(View); 1435 DISALLOW_COPY_AND_ASSIGN(View);
1428 }; 1436 };
1429 1437
1430 } // namespace views 1438 } // namespace views
1431 1439
1432 #endif // VIEWS_VIEW_H_ 1440 #endif // VIEWS_VIEW_H_
OLDNEW
« no previous file with comments | « views/layout/grid_layout_unittest.cc ('k') | views/view.cc » ('j') | views/view.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698