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

Side by Side Diff: ui/views/controls/table/table_view.cc

Issue 273223002: views: Make view::Views::GetPreferredSize() const. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: More compile fix for 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
« no previous file with comments | « ui/views/controls/table/table_view.h ('k') | ui/views/controls/textfield/textfield.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 #include "ui/views/controls/table/table_view.h" 5 #include "ui/views/controls/table/table_view.h"
6 6
7 #include <map> 7 #include <map>
8 8
9 #include "base/auto_reset.h" 9 #include "base/auto_reset.h"
10 #include "base/i18n/rtl.h" 10 #include "base/i18n/rtl.h"
(...skipping 300 matching lines...) Expand 10 before | Expand all | Expand 10 after
311 gfx::Size pref = GetPreferredSize(); 311 gfx::Size pref = GetPreferredSize();
312 int width = pref.width(); 312 int width = pref.width();
313 int height = pref.height(); 313 int height = pref.height();
314 if (parent()) { 314 if (parent()) {
315 width = std::max(parent()->width(), width); 315 width = std::max(parent()->width(), width);
316 height = std::max(parent()->height(), height); 316 height = std::max(parent()->height(), height);
317 } 317 }
318 SetBounds(x(), y(), width, height); 318 SetBounds(x(), y(), width, height);
319 } 319 }
320 320
321 gfx::Size TableView::GetPreferredSize() { 321 gfx::Size TableView::GetPreferredSize() const {
322 int width = 50; 322 int width = 50;
323 if (header_ && !visible_columns_.empty()) 323 if (header_ && !visible_columns_.empty())
324 width = visible_columns_.back().x + visible_columns_.back().width; 324 width = visible_columns_.back().x + visible_columns_.back().width;
325 return gfx::Size(width, RowCount() * row_height_); 325 return gfx::Size(width, RowCount() * row_height_);
326 } 326 }
327 327
328 bool TableView::OnKeyPressed(const ui::KeyEvent& event) { 328 bool TableView::OnKeyPressed(const ui::KeyEvent& event) {
329 if (!HasFocus()) 329 if (!HasFocus())
330 return false; 330 return false;
331 331
(...skipping 567 matching lines...) Expand 10 before | Expand all | Expand 10 after
899 if (tooltip) 899 if (tooltip)
900 *tooltip = text; 900 *tooltip = text;
901 if (tooltip_origin) { 901 if (tooltip_origin) {
902 tooltip_origin->SetPoint(cell_bounds.x(), 902 tooltip_origin->SetPoint(cell_bounds.x(),
903 cell_bounds.y() + kTextVerticalPadding); 903 cell_bounds.y() + kTextVerticalPadding);
904 } 904 }
905 return true; 905 return true;
906 } 906 }
907 907
908 } // namespace views 908 } // namespace views
OLDNEW
« no previous file with comments | « ui/views/controls/table/table_view.h ('k') | ui/views/controls/textfield/textfield.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698