| 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::platform_util::DrawToHDC(&canvas.getTopDevice(), dc, bounds.x(), |
| 1162 bounds.y(), NULL); |
| 1162 ReleaseDC(GetNativeControlHWND(), dc); | 1163 ReleaseDC(GetNativeControlHWND(), dc); |
| 1163 } | 1164 } |
| 1164 | 1165 |
| 1165 LRESULT TableView::OnCustomDraw(NMLVCUSTOMDRAW* draw_info) { | 1166 LRESULT TableView::OnCustomDraw(NMLVCUSTOMDRAW* draw_info) { |
| 1166 switch (draw_info->nmcd.dwDrawStage) { | 1167 switch (draw_info->nmcd.dwDrawStage) { |
| 1167 case CDDS_PREPAINT: { | 1168 case CDDS_PREPAINT: { |
| 1168 return CDRF_NOTIFYITEMDRAW; | 1169 return CDRF_NOTIFYITEMDRAW; |
| 1169 } | 1170 } |
| 1170 case CDDS_ITEMPREPAINT: { | 1171 case CDDS_ITEMPREPAINT: { |
| 1171 // The list-view is about to paint an item, tell it we want to | 1172 // 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); | 1267 1, 1, kFaviconSize, kFaviconSize, true); |
| 1267 | 1268 |
| 1268 // Only paint the visible region of the icon. | 1269 // Only paint the visible region of the icon. |
| 1269 RECT to_draw = { intersection.left - icon_rect.left, | 1270 RECT to_draw = { intersection.left - icon_rect.left, |
| 1270 intersection.top - icon_rect.top, | 1271 intersection.top - icon_rect.top, |
| 1271 0, 0 }; | 1272 0, 0 }; |
| 1272 to_draw.right = to_draw.left + | 1273 to_draw.right = to_draw.left + |
| 1273 (intersection.right - intersection.left); | 1274 (intersection.right - intersection.left); |
| 1274 to_draw.bottom = to_draw.top + | 1275 to_draw.bottom = to_draw.top + |
| 1275 (intersection.bottom - intersection.top); | 1276 (intersection.bottom - intersection.top); |
| 1276 canvas.getTopPlatformDevice().drawToHDC(draw_info->nmcd.hdc, | 1277 skia::platform_util::DrawToHDC(&canvas.getTopDevice(), |
| 1277 intersection.left, | 1278 draw_info->nmcd.hdc, |
| 1278 intersection.top, | 1279 intersection.left, |
| 1279 &to_draw); | 1280 intersection.top, &to_draw); |
| 1280 r = CDRF_SKIPDEFAULT; | 1281 r = CDRF_SKIPDEFAULT; |
| 1281 } | 1282 } |
| 1282 } | 1283 } |
| 1283 } | 1284 } |
| 1284 } | 1285 } |
| 1285 if (ImplementPostPaint()) { | 1286 if (ImplementPostPaint()) { |
| 1286 RECT cell_rect; | 1287 RECT cell_rect; |
| 1287 if (ListView_GetItemRect(list_view_, view_index, &cell_rect, | 1288 if (ListView_GetItemRect(list_view_, view_index, &cell_rect, |
| 1288 LVIR_BOUNDS)) { | 1289 LVIR_BOUNDS)) { |
| 1289 PostPaint(model_index, 0, false, gfx::Rect(cell_rect), | 1290 PostPaint(model_index, 0, false, gfx::Rect(cell_rect), |
| (...skipping 346 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1636 } | 1637 } |
| 1637 | 1638 |
| 1638 void TableSelectionIterator::UpdateModelIndexFromViewIndex() { | 1639 void TableSelectionIterator::UpdateModelIndexFromViewIndex() { |
| 1639 if (view_index_ == -1) | 1640 if (view_index_ == -1) |
| 1640 model_index_ = -1; | 1641 model_index_ = -1; |
| 1641 else | 1642 else |
| 1642 model_index_ = table_view_->ViewToModel(view_index_); | 1643 model_index_ = table_view_->ViewToModel(view_index_); |
| 1643 } | 1644 } |
| 1644 | 1645 |
| 1645 } // namespace views | 1646 } // namespace views |
| OLD | NEW |