OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 "views/controls/table/table_view.h" | 5 #include "views/controls/table/table_view.h" |
6 | 6 |
7 #include <commctrl.h> | 7 #include <commctrl.h> |
8 #include <windowsx.h> | 8 #include <windowsx.h> |
9 | 9 |
10 #include <algorithm> | 10 #include <algorithm> |
11 | 11 |
12 #include "app/l10n_util.h" | 12 #include "app/l10n_util.h" |
13 #include "app/l10n_util_win.h" | 13 #include "app/l10n_util_win.h" |
14 #include "app/resource_bundle.h" | 14 #include "app/resource_bundle.h" |
15 #include "app/table_model.h" | 15 #include "app/table_model.h" |
16 #include "base/i18n/rtl.h" | 16 #include "base/i18n/rtl.h" |
17 #include "base/string_util.h" | 17 #include "base/string_util.h" |
18 #include "base/win_util.h" | 18 #include "base/win_util.h" |
19 #include "gfx/canvas_skia.h" | 19 #include "gfx/canvas.h" |
20 #include "gfx/favicon_size.h" | 20 #include "gfx/favicon_size.h" |
21 #include "gfx/font.h" | 21 #include "gfx/font.h" |
22 #include "gfx/icon_util.h" | 22 #include "gfx/icon_util.h" |
23 #include "skia/ext/skia_utils_win.h" | 23 #include "skia/ext/skia_utils_win.h" |
24 #include "third_party/skia/include/core/SkBitmap.h" | 24 #include "third_party/skia/include/core/SkBitmap.h" |
25 #include "third_party/skia/include/core/SkColorFilter.h" | 25 #include "third_party/skia/include/core/SkColorFilter.h" |
26 #include "views/controls/native/native_view_host.h" | 26 #include "views/controls/native/native_view_host.h" |
27 #include "views/controls/table/table_view_observer.h" | 27 #include "views/controls/table/table_view_observer.h" |
28 | 28 |
29 namespace { | 29 namespace { |
(...skipping 1120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1150 if (alt_text_.empty()) | 1150 if (alt_text_.empty()) |
1151 return; | 1151 return; |
1152 | 1152 |
1153 HDC dc = GetDC(GetNativeControlHWND()); | 1153 HDC dc = GetDC(GetNativeControlHWND()); |
1154 gfx::Font font = GetAltTextFont(); | 1154 gfx::Font font = GetAltTextFont(); |
1155 gfx::Rect bounds = GetAltTextBounds(); | 1155 gfx::Rect bounds = GetAltTextBounds(); |
1156 gfx::CanvasSkia canvas(bounds.width(), bounds.height(), false); | 1156 gfx::CanvasSkia canvas(bounds.width(), bounds.height(), false); |
1157 // Pad by 1 for halo. | 1157 // Pad by 1 for halo. |
1158 canvas.DrawStringWithHalo(alt_text_, font, SK_ColorDKGRAY, SK_ColorWHITE, 1, | 1158 canvas.DrawStringWithHalo(alt_text_, font, SK_ColorDKGRAY, SK_ColorWHITE, 1, |
1159 1, bounds.width() - 2, bounds.height() - 2, | 1159 1, bounds.width() - 2, bounds.height() - 2, |
1160 gfx::CanvasSkia::DefaultCanvasTextAlignment()); | 1160 gfx::Canvas::DefaultCanvasTextAlignment()); |
1161 canvas.getTopPlatformDevice().drawToHDC(dc, bounds.x(), bounds.y(), NULL); | 1161 canvas.getTopPlatformDevice().drawToHDC(dc, bounds.x(), bounds.y(), NULL); |
1162 ReleaseDC(GetNativeControlHWND(), dc); | 1162 ReleaseDC(GetNativeControlHWND(), dc); |
1163 } | 1163 } |
1164 | 1164 |
1165 LRESULT TableView::OnCustomDraw(NMLVCUSTOMDRAW* draw_info) { | 1165 LRESULT TableView::OnCustomDraw(NMLVCUSTOMDRAW* draw_info) { |
1166 switch (draw_info->nmcd.dwDrawStage) { | 1166 switch (draw_info->nmcd.dwDrawStage) { |
1167 case CDDS_PREPAINT: { | 1167 case CDDS_PREPAINT: { |
1168 return CDRF_NOTIFYITEMDRAW; | 1168 return CDRF_NOTIFYITEMDRAW; |
1169 } | 1169 } |
1170 case CDDS_ITEMPREPAINT: { | 1170 case CDDS_ITEMPREPAINT: { |
(...skipping 417 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1588 } | 1588 } |
1589 | 1589 |
1590 void TableSelectionIterator::UpdateModelIndexFromViewIndex() { | 1590 void TableSelectionIterator::UpdateModelIndexFromViewIndex() { |
1591 if (view_index_ == -1) | 1591 if (view_index_ == -1) |
1592 model_index_ = -1; | 1592 model_index_ = -1; |
1593 else | 1593 else |
1594 model_index_ = table_view_->ViewToModel(view_index_); | 1594 model_index_ = table_view_->ViewToModel(view_index_); |
1595 } | 1595 } |
1596 | 1596 |
1597 } // namespace views | 1597 } // namespace views |
OLD | NEW |