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 #include "chrome/views/controls/table/table_view.h" | 5 #include "chrome/views/controls/table/table_view.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <windowsx.h> | 8 #include <windowsx.h> |
9 | 9 |
10 #include "base/string_util.h" | 10 #include "base/string_util.h" |
11 #include "base/win_util.h" | 11 #include "base/win_util.h" |
12 #include "chrome/common/gfx/chrome_canvas.h" | 12 #include "chrome/common/gfx/chrome_canvas.h" |
13 #include "chrome/common/gfx/favicon_size.h" | 13 #include "chrome/common/gfx/favicon_size.h" |
14 #include "chrome/common/gfx/icon_util.h" | 14 #include "chrome/common/gfx/icon_util.h" |
| 15 #include "chrome/common/l10n_util_win.h" |
15 #include "chrome/common/resource_bundle.h" | 16 #include "chrome/common/resource_bundle.h" |
16 #include "chrome/common/win_util.h" | 17 #include "chrome/common/win_util.h" |
17 #include "chrome/views/controls/hwnd_view.h" | 18 #include "chrome/views/controls/hwnd_view.h" |
18 #include "SkBitmap.h" | 19 #include "SkBitmap.h" |
19 #include "SkColorFilter.h" | 20 #include "SkColorFilter.h" |
20 #include "skia/ext/skia_utils_win.h" | 21 #include "skia/ext/skia_utils_win.h" |
21 | 22 |
22 namespace views { | 23 namespace views { |
23 | 24 |
24 // Added to column width to prevent truncation. | 25 // Added to column width to prevent truncation. |
(...skipping 791 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
816 | 817 |
817 // Make the selection extend across the row. | 818 // Make the selection extend across the row. |
818 // Reduce overdraw/flicker artifacts by double buffering. | 819 // Reduce overdraw/flicker artifacts by double buffering. |
819 DWORD list_view_style = LVS_EX_FULLROWSELECT; | 820 DWORD list_view_style = LVS_EX_FULLROWSELECT; |
820 if (win_util::GetWinVersion() > win_util::WINVERSION_2000) { | 821 if (win_util::GetWinVersion() > win_util::WINVERSION_2000) { |
821 list_view_style |= LVS_EX_DOUBLEBUFFER; | 822 list_view_style |= LVS_EX_DOUBLEBUFFER; |
822 } | 823 } |
823 if (table_type_ == CHECK_BOX_AND_TEXT) | 824 if (table_type_ == CHECK_BOX_AND_TEXT) |
824 list_view_style |= LVS_EX_CHECKBOXES; | 825 list_view_style |= LVS_EX_CHECKBOXES; |
825 ListView_SetExtendedListViewStyleEx(list_view_, 0, list_view_style); | 826 ListView_SetExtendedListViewStyleEx(list_view_, 0, list_view_style); |
| 827 l10n_util::AdjustUIFontForWindow(list_view_); |
826 | 828 |
827 // Add the columns. | 829 // Add the columns. |
828 for (std::vector<int>::iterator i = visible_columns_.begin(); | 830 for (std::vector<int>::iterator i = visible_columns_.begin(); |
829 i != visible_columns_.end(); ++i) { | 831 i != visible_columns_.end(); ++i) { |
830 InsertColumn(all_columns_[*i], | 832 InsertColumn(all_columns_[*i], |
831 static_cast<int>(i - visible_columns_.begin())); | 833 static_cast<int>(i - visible_columns_.begin())); |
832 } | 834 } |
833 | 835 |
834 if (model_) | 836 if (model_) |
835 model_->SetObserver(this); | 837 model_->SetObserver(this); |
(...skipping 360 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1196 static_cast<int>(draw_info->nmcd.dwItemSpec)), | 1198 static_cast<int>(draw_info->nmcd.dwItemSpec)), |
1197 draw_info->iSubItem, | 1199 draw_info->iSubItem, |
1198 &foreground, | 1200 &foreground, |
1199 &background, | 1201 &background, |
1200 &logfont)) { | 1202 &logfont)) { |
1201 // TODO(tc): Creating/deleting a font for every cell seems like a | 1203 // TODO(tc): Creating/deleting a font for every cell seems like a |
1202 // waste if the font hasn't changed. Maybe we should use a struct | 1204 // waste if the font hasn't changed. Maybe we should use a struct |
1203 // with a bool like we do with colors? | 1205 // with a bool like we do with colors? |
1204 if (custom_cell_font_) | 1206 if (custom_cell_font_) |
1205 DeleteObject(custom_cell_font_); | 1207 DeleteObject(custom_cell_font_); |
| 1208 l10n_util::AdjustUIFont(&logfont); |
1206 custom_cell_font_ = CreateFontIndirect(&logfont); | 1209 custom_cell_font_ = CreateFontIndirect(&logfont); |
1207 SelectObject(draw_info->nmcd.hdc, custom_cell_font_); | 1210 SelectObject(draw_info->nmcd.hdc, custom_cell_font_); |
1208 draw_info->clrText = foreground.color_is_set | 1211 draw_info->clrText = foreground.color_is_set |
1209 ? skia::SkColorToCOLORREF(foreground.color) | 1212 ? skia::SkColorToCOLORREF(foreground.color) |
1210 : CLR_DEFAULT; | 1213 : CLR_DEFAULT; |
1211 draw_info->clrTextBk = background.color_is_set | 1214 draw_info->clrTextBk = background.color_is_set |
1212 ? skia::SkColorToCOLORREF(background.color) | 1215 ? skia::SkColorToCOLORREF(background.color) |
1213 : CLR_DEFAULT; | 1216 : CLR_DEFAULT; |
1214 return CDRF_NEWFONT; | 1217 return CDRF_NEWFONT; |
1215 } | 1218 } |
(...skipping 343 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1559 } | 1562 } |
1560 | 1563 |
1561 void TableSelectionIterator::UpdateModelIndexFromViewIndex() { | 1564 void TableSelectionIterator::UpdateModelIndexFromViewIndex() { |
1562 if (view_index_ == -1) | 1565 if (view_index_ == -1) |
1563 model_index_ = -1; | 1566 model_index_ = -1; |
1564 else | 1567 else |
1565 model_index_ = table_view_->view_to_model(view_index_); | 1568 model_index_ = table_view_->view_to_model(view_index_); |
1566 } | 1569 } |
1567 | 1570 |
1568 } // namespace views | 1571 } // namespace views |
OLD | NEW |