| 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_views.h" | 5 #include "ui/views/controls/table/table_view_views.h" |
| 6 | 6 |
| 7 #include "base/i18n/rtl.h" | 7 #include "base/i18n/rtl.h" |
| 8 #include "third_party/skia/include/core/SkBitmap.h" | 8 #include "third_party/skia/include/core/SkBitmap.h" |
| 9 #include "ui/base/models/table_model.h" | 9 #include "ui/base/models/table_model.h" |
| 10 #include "ui/base/native_theme/native_theme.h" | |
| 11 #include "ui/gfx/canvas.h" | 10 #include "ui/gfx/canvas.h" |
| 11 #include "ui/gfx/native_theme.h" |
| 12 #include "ui/gfx/skia_util.h" | 12 #include "ui/gfx/skia_util.h" |
| 13 #include "ui/views/border.h" | 13 #include "ui/views/border.h" |
| 14 #include "ui/views/controls/scroll_view.h" | 14 #include "ui/views/controls/scroll_view.h" |
| 15 #include "ui/views/controls/table/table_view_observer.h" | 15 #include "ui/views/controls/table/table_view_observer.h" |
| 16 | 16 |
| 17 // Padding around the text (on each side). | 17 // Padding around the text (on each side). |
| 18 static const int kTextVerticalPadding = 3; | 18 static const int kTextVerticalPadding = 3; |
| 19 static const int kTextHorizontalPadding = 2; | 19 static const int kTextHorizontalPadding = 2; |
| 20 | 20 |
| 21 // TODO: these should come from native theme or something. | 21 // TODO: these should come from native theme or something. |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 66 if (RowCount()) | 66 if (RowCount()) |
| 67 selected_row_ = 0; | 67 selected_row_ = 0; |
| 68 if (model_) | 68 if (model_) |
| 69 model_->SetObserver(this); | 69 model_->SetObserver(this); |
| 70 } | 70 } |
| 71 | 71 |
| 72 View* TableView::CreateParentIfNecessary() { | 72 View* TableView::CreateParentIfNecessary() { |
| 73 ScrollView* scroll_view = new ScrollView; | 73 ScrollView* scroll_view = new ScrollView; |
| 74 scroll_view->SetContents(this); | 74 scroll_view->SetContents(this); |
| 75 scroll_view->set_border(Border::CreateSolidBorder( | 75 scroll_view->set_border(Border::CreateSolidBorder( |
| 76 1, ui::NativeTheme::instance()->GetSystemColor( | 76 1, gfx::NativeTheme::instance()->GetSystemColor( |
| 77 ui::NativeTheme::kColorId_UnfocusedBorderColor))); | 77 gfx::NativeTheme::kColorId_UnfocusedBorderColor))); |
| 78 return scroll_view; | 78 return scroll_view; |
| 79 } | 79 } |
| 80 | 80 |
| 81 int TableView::RowCount() const { | 81 int TableView::RowCount() const { |
| 82 return model_ ? model_->RowCount() : 0; | 82 return model_ ? model_->RowCount() : 0; |
| 83 } | 83 } |
| 84 | 84 |
| 85 int TableView::SelectedRowCount() { | 85 int TableView::SelectedRowCount() { |
| 86 return selected_row_ != -1 ? 1 : 0; | 86 return selected_row_ != -1 ? 1 : 0; |
| 87 } | 87 } |
| (...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 281 void TableView::NumRowsChanged() { | 281 void TableView::NumRowsChanged() { |
| 282 PreferredSizeChanged(); | 282 PreferredSizeChanged(); |
| 283 SchedulePaint(); | 283 SchedulePaint(); |
| 284 } | 284 } |
| 285 | 285 |
| 286 gfx::Rect TableView::GetRowBounds(int row) { | 286 gfx::Rect TableView::GetRowBounds(int row) { |
| 287 return gfx::Rect(0, row * row_height_, width(), row_height_); | 287 return gfx::Rect(0, row * row_height_, width(), row_height_); |
| 288 } | 288 } |
| 289 | 289 |
| 290 } // namespace views | 290 } // namespace views |
| OLD | NEW |