OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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> |
(...skipping 1140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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::CanvasSkia::DefaultCanvasTextAlignment()); |
1161 canvas.getTopPlatformDevice().drawToHDC(dc, bounds.x(), bounds.y(), NULL); | 1161 skia::DrawToNativeContext(&canvas, 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: { |
1171 // The list-view is about to paint an item, tell it we want to | 1171 // The list-view is about to paint an item, tell it we want to |
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1266 1, 1, kFaviconSize, kFaviconSize, true); | 1266 1, 1, kFaviconSize, kFaviconSize, true); |
1267 | 1267 |
1268 // Only paint the visible region of the icon. | 1268 // Only paint the visible region of the icon. |
1269 RECT to_draw = { intersection.left - icon_rect.left, | 1269 RECT to_draw = { intersection.left - icon_rect.left, |
1270 intersection.top - icon_rect.top, | 1270 intersection.top - icon_rect.top, |
1271 0, 0 }; | 1271 0, 0 }; |
1272 to_draw.right = to_draw.left + | 1272 to_draw.right = to_draw.left + |
1273 (intersection.right - intersection.left); | 1273 (intersection.right - intersection.left); |
1274 to_draw.bottom = to_draw.top + | 1274 to_draw.bottom = to_draw.top + |
1275 (intersection.bottom - intersection.top); | 1275 (intersection.bottom - intersection.top); |
1276 canvas.getTopPlatformDevice().drawToHDC(draw_info->nmcd.hdc, | 1276 skia::DrawToNativeContext(&canvas, draw_info->nmcd.hdc, |
1277 intersection.left, | 1277 intersection.left, intersection.top, |
1278 intersection.top, | 1278 &to_draw); |
1279 &to_draw); | |
1280 r = CDRF_SKIPDEFAULT; | 1279 r = CDRF_SKIPDEFAULT; |
1281 } | 1280 } |
1282 } | 1281 } |
1283 } | 1282 } |
1284 } | 1283 } |
1285 if (ImplementPostPaint()) { | 1284 if (ImplementPostPaint()) { |
1286 RECT cell_rect; | 1285 RECT cell_rect; |
1287 if (ListView_GetItemRect(list_view_, view_index, &cell_rect, | 1286 if (ListView_GetItemRect(list_view_, view_index, &cell_rect, |
1288 LVIR_BOUNDS)) { | 1287 LVIR_BOUNDS)) { |
1289 PostPaint(model_index, 0, false, gfx::Rect(cell_rect), | 1288 PostPaint(model_index, 0, false, gfx::Rect(cell_rect), |
(...skipping 346 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1636 } | 1635 } |
1637 | 1636 |
1638 void TableSelectionIterator::UpdateModelIndexFromViewIndex() { | 1637 void TableSelectionIterator::UpdateModelIndexFromViewIndex() { |
1639 if (view_index_ == -1) | 1638 if (view_index_ == -1) |
1640 model_index_ = -1; | 1639 model_index_ = -1; |
1641 else | 1640 else |
1642 model_index_ = table_view_->ViewToModel(view_index_); | 1641 model_index_ = table_view_->ViewToModel(view_index_); |
1643 } | 1642 } |
1644 | 1643 |
1645 } // namespace views | 1644 } // namespace views |
OLD | NEW |