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

Side by Side Diff: ui/views/view.h

Issue 273223002: views: Make view::Views::GetPreferredSize() const. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase to ToT Created 6 years, 7 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) 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 <algorithm> 8 #include <algorithm>
9 #include <map> 9 #include <map>
10 #include <set> 10 #include <set>
(...skipping 247 matching lines...) Expand 10 before | Expand all | Expand 10 after
258 gfx::Rect GetVisibleBounds() const; 258 gfx::Rect GetVisibleBounds() const;
259 259
260 // Return the bounds of the View in screen coordinate system. 260 // Return the bounds of the View in screen coordinate system.
261 gfx::Rect GetBoundsInScreen() const; 261 gfx::Rect GetBoundsInScreen() const;
262 262
263 // Returns the baseline of this view, or -1 if this view has no baseline. The 263 // Returns the baseline of this view, or -1 if this view has no baseline. The
264 // return value is relative to the preferred height. 264 // return value is relative to the preferred height.
265 virtual int GetBaseline() const; 265 virtual int GetBaseline() const;
266 266
267 // Get the size the View would like to be, if enough space were available. 267 // Get the size the View would like to be, if enough space were available.
268 virtual gfx::Size GetPreferredSize(); 268 virtual gfx::Size GetPreferredSize() const;
269 269
270 // Convenience method that sizes this view to its preferred size. 270 // Convenience method that sizes this view to its preferred size.
271 void SizeToPreferredSize(); 271 void SizeToPreferredSize();
272 272
273 // Gets the minimum size of the view. View's implementation invokes 273 // Gets the minimum size of the view. View's implementation invokes
274 // GetPreferredSize. 274 // GetPreferredSize.
275 virtual gfx::Size GetMinimumSize(); 275 virtual gfx::Size GetMinimumSize() const;
276 276
277 // Gets the maximum size of the view. Currently only used for sizing shell 277 // Gets the maximum size of the view. Currently only used for sizing shell
278 // windows. 278 // windows.
279 virtual gfx::Size GetMaximumSize(); 279 virtual gfx::Size GetMaximumSize();
sky 2014/05/13 16:06:08 Are you going to make this const at a later date?
Elliot Glaysher 2014/05/14 00:48:58 I do intend to. However, this patch now touches 39
280 280
281 // Return the height necessary to display this view with the provided width. 281 // Return the height necessary to display this view with the provided width.
282 // View's implementation returns the value from getPreferredSize.cy. 282 // View's implementation returns the value from getPreferredSize.cy.
283 // Override if your View's preferred height depends upon the width (such 283 // Override if your View's preferred height depends upon the width (such
284 // as with Labels). 284 // as with Labels).
285 virtual int GetHeightForWidth(int w); 285 virtual int GetHeightForWidth(int w) const;
286 286
287 // Set whether this view is visible. Painting is scheduled as needed. 287 // Set whether this view is visible. Painting is scheduled as needed.
288 virtual void SetVisible(bool visible); 288 virtual void SetVisible(bool visible);
289 289
290 // Return whether a view is visible 290 // Return whether a view is visible
291 bool visible() const { return visible_; } 291 bool visible() const { return visible_; }
292 292
293 // Returns true if this view is drawn on screen. 293 // Returns true if this view is drawn on screen.
294 virtual bool IsDrawn() const; 294 virtual bool IsDrawn() const;
295 295
(...skipping 1310 matching lines...) Expand 10 before | Expand all | Expand 10 after
1606 // Belongs to this view, but it's reference-counted on some platforms 1606 // Belongs to this view, but it's reference-counted on some platforms
1607 // so we can't use a scoped_ptr. It's dereferenced in the destructor. 1607 // so we can't use a scoped_ptr. It's dereferenced in the destructor.
1608 NativeViewAccessibility* native_view_accessibility_; 1608 NativeViewAccessibility* native_view_accessibility_;
1609 1609
1610 DISALLOW_COPY_AND_ASSIGN(View); 1610 DISALLOW_COPY_AND_ASSIGN(View);
1611 }; 1611 };
1612 1612
1613 } // namespace views 1613 } // namespace views
1614 1614
1615 #endif // UI_VIEWS_VIEW_H_ 1615 #endif // UI_VIEWS_VIEW_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698