OLD | NEW |
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 CHROME_VIEWS_VIEW_H_ | 5 #ifndef CHROME_VIEWS_VIEW_H_ |
6 #define CHROME_VIEWS_VIEW_H_ | 6 #define CHROME_VIEWS_VIEW_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
151 // View bounds. | 151 // View bounds. |
152 // | 152 // |
153 // NOTE: in the vast majority of the cases, the mirroring implementation is | 153 // NOTE: in the vast majority of the cases, the mirroring implementation is |
154 // transparent to the View subclasses and therefore you should use the | 154 // transparent to the View subclasses and therefore you should use the |
155 // version of GetBounds() which does not take a transformation settings | 155 // version of GetBounds() which does not take a transformation settings |
156 // parameter. | 156 // parameter. |
157 gfx::Rect GetBounds(PositionMirroringSettings settings) const; | 157 gfx::Rect GetBounds(PositionMirroringSettings settings) const; |
158 | 158 |
159 // Set the bounds in the parent's coordinate system. | 159 // Set the bounds in the parent's coordinate system. |
160 void SetBounds(const CRect& bounds); | 160 void SetBounds(const CRect& bounds); |
| 161 void SetBounds(const gfx::Point& origin, const gfx::Size& size); |
161 void SetBounds(int x, int y, int width, int height); | 162 void SetBounds(int x, int y, int width, int height); |
162 void SetX(int x) { SetBounds(x, y(), width(), height()); } | 163 void SetX(int x) { SetBounds(x, y(), width(), height()); } |
163 void SetY(int y) { SetBounds(x(), y, width(), height()); } | 164 void SetY(int y) { SetBounds(x(), y, width(), height()); } |
164 | 165 |
165 // Returns the left coordinate of the View, relative to the parent View, | 166 // Returns the left coordinate of the View, relative to the parent View, |
166 // which is the value of bounds_.left. | 167 // which is the value of bounds_.left. |
167 // | 168 // |
168 // This is the function subclasses should use whenever they need to obtain | 169 // This is the function subclasses should use whenever they need to obtain |
169 // the left position of one of their child views (for example, when | 170 // the left position of one of their child views (for example, when |
170 // implementing View::Layout()). | 171 // implementing View::Layout()). |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
205 void GetSize(CSize* out) const; | 206 void GetSize(CSize* out) const; |
206 | 207 |
207 // Get the position of the View, relative to the parent. | 208 // Get the position of the View, relative to the parent. |
208 // | 209 // |
209 // Note that if the parent uses right-to-left UI layout, then the mirrored | 210 // Note that if the parent uses right-to-left UI layout, then the mirrored |
210 // position of this View is returned. Use x()/y() if you want to ignore | 211 // position of this View is returned. Use x()/y() if you want to ignore |
211 // mirroring. | 212 // mirroring. |
212 void GetPosition(CPoint* out) const; | 213 void GetPosition(CPoint* out) const; |
213 | 214 |
214 // Get the size the View would like to be, if enough space were available. | 215 // Get the size the View would like to be, if enough space were available. |
215 virtual void GetPreferredSize(CSize* out); | 216 virtual gfx::Size GetPreferredSize(); |
216 | 217 |
217 // Convenience method that sizes this view to its preferred size. | 218 // Convenience method that sizes this view to its preferred size. |
218 void SizeToPreferredSize(); | 219 void SizeToPreferredSize(); |
219 | 220 |
220 // Gets the minimum size of the view. View's implementation invokes | 221 // Gets the minimum size of the view. View's implementation invokes |
221 // GetPreferredSize. | 222 // GetPreferredSize. |
222 virtual void GetMinimumSize(CSize* out); | 223 virtual gfx::Size GetMinimumSize(); |
223 | 224 |
224 // Return the height necessary to display this view with the provided width. | 225 // Return the height necessary to display this view with the provided width. |
225 // View's implementation returns the value from getPreferredSize.cy. | 226 // View's implementation returns the value from getPreferredSize.cy. |
226 // Override if your View's preferred height depends upon the width (such | 227 // Override if your View's preferred height depends upon the width (such |
227 // as with Labels). | 228 // as with Labels). |
228 virtual int GetHeightForWidth(int w); | 229 virtual int GetHeightForWidth(int w); |
229 | 230 |
230 // This method is invoked when this object size or position changes. | 231 // This method is invoked when this object size or position changes. |
231 // The default implementation does nothing. | 232 // The default implementation does nothing. |
232 virtual void DidChangeBounds(const CRect& previous, const CRect& current); | 233 virtual void DidChangeBounds(const CRect& previous, const CRect& current); |
(...skipping 1063 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1296 // right-to-left locales for this View. | 1297 // right-to-left locales for this View. |
1297 bool flip_canvas_on_paint_for_rtl_ui_; | 1298 bool flip_canvas_on_paint_for_rtl_ui_; |
1298 | 1299 |
1299 DISALLOW_COPY_AND_ASSIGN(View); | 1300 DISALLOW_COPY_AND_ASSIGN(View); |
1300 }; | 1301 }; |
1301 | 1302 |
1302 } // namespace ChromeViews | 1303 } // namespace ChromeViews |
1303 | 1304 |
1304 #endif // CHROME_VIEWS_VIEW_H_ | 1305 #endif // CHROME_VIEWS_VIEW_H_ |
1305 | 1306 |
OLD | NEW |