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/gfx/canvas.h" | 12 #include "app/gfx/canvas.h" |
13 #include "app/gfx/font.h" | 13 #include "app/gfx/font.h" |
14 #include "app/l10n_util.h" | 14 #include "app/l10n_util.h" |
15 #include "app/l10n_util_win.h" | 15 #include "app/l10n_util_win.h" |
16 #include "app/resource_bundle.h" | 16 #include "app/resource_bundle.h" |
17 #include "app/table_model.h" | 17 #include "app/table_model.h" |
| 18 #include "base/i18n/rtl.h" |
18 #include "base/string_util.h" | 19 #include "base/string_util.h" |
19 #include "base/win_util.h" | 20 #include "base/win_util.h" |
20 #include "gfx/favicon_size.h" | 21 #include "gfx/favicon_size.h" |
21 #include "gfx/icon_util.h" | 22 #include "gfx/icon_util.h" |
22 #include "skia/ext/skia_utils_win.h" | 23 #include "skia/ext/skia_utils_win.h" |
23 #include "third_party/skia/include/core/SkBitmap.h" | 24 #include "third_party/skia/include/core/SkBitmap.h" |
24 #include "third_party/skia/include/core/SkColorFilter.h" | 25 #include "third_party/skia/include/core/SkColorFilter.h" |
25 #include "views/controls/native/native_view_host.h" | 26 #include "views/controls/native/native_view_host.h" |
26 #include "views/controls/table/table_view_observer.h" | 27 #include "views/controls/table/table_view_observer.h" |
27 | 28 |
(...skipping 1096 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1124 if (alt_text_.empty()) | 1125 if (alt_text_.empty()) |
1125 return; | 1126 return; |
1126 | 1127 |
1127 HDC dc = GetDC(GetNativeControlHWND()); | 1128 HDC dc = GetDC(GetNativeControlHWND()); |
1128 gfx::Font font = GetAltTextFont(); | 1129 gfx::Font font = GetAltTextFont(); |
1129 gfx::Rect bounds = GetAltTextBounds(); | 1130 gfx::Rect bounds = GetAltTextBounds(); |
1130 gfx::Canvas canvas(bounds.width(), bounds.height(), false); | 1131 gfx::Canvas canvas(bounds.width(), bounds.height(), false); |
1131 // Pad by 1 for halo. | 1132 // Pad by 1 for halo. |
1132 canvas.DrawStringWithHalo(alt_text_, font, SK_ColorDKGRAY, SK_ColorWHITE, 1, | 1133 canvas.DrawStringWithHalo(alt_text_, font, SK_ColorDKGRAY, SK_ColorWHITE, 1, |
1133 1, bounds.width() - 2, bounds.height() - 2, | 1134 1, bounds.width() - 2, bounds.height() - 2, |
1134 l10n_util::DefaultCanvasTextAlignment()); | 1135 gfx::Canvas::DefaultCanvasTextAlignment()); |
1135 canvas.getTopPlatformDevice().drawToHDC(dc, bounds.x(), bounds.y(), NULL); | 1136 canvas.getTopPlatformDevice().drawToHDC(dc, bounds.x(), bounds.y(), NULL); |
1136 ReleaseDC(GetNativeControlHWND(), dc); | 1137 ReleaseDC(GetNativeControlHWND(), dc); |
1137 } | 1138 } |
1138 | 1139 |
1139 LRESULT TableView::OnCustomDraw(NMLVCUSTOMDRAW* draw_info) { | 1140 LRESULT TableView::OnCustomDraw(NMLVCUSTOMDRAW* draw_info) { |
1140 switch (draw_info->nmcd.dwDrawStage) { | 1141 switch (draw_info->nmcd.dwDrawStage) { |
1141 case CDDS_PREPAINT: { | 1142 case CDDS_PREPAINT: { |
1142 return CDRF_NOTIFYITEMDRAW; | 1143 return CDRF_NOTIFYITEMDRAW; |
1143 } | 1144 } |
1144 case CDDS_ITEMPREPAINT: { | 1145 case CDDS_ITEMPREPAINT: { |
(...skipping 430 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1575 } | 1576 } |
1576 | 1577 |
1577 void TableSelectionIterator::UpdateModelIndexFromViewIndex() { | 1578 void TableSelectionIterator::UpdateModelIndexFromViewIndex() { |
1578 if (view_index_ == -1) | 1579 if (view_index_ == -1) |
1579 model_index_ = -1; | 1580 model_index_ = -1; |
1580 else | 1581 else |
1581 model_index_ = table_view_->view_to_model(view_index_); | 1582 model_index_ = table_view_->view_to_model(view_index_); |
1582 } | 1583 } |
1583 | 1584 |
1584 } // namespace views | 1585 } // namespace views |
OLD | NEW |