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 #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 Loading... |
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 Loading... |
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 |
OLD | NEW |