| 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 "views/controls/table/table_view.h" | 5 #include "views/controls/table/table_view.h" |
| 6 | 6 |
| 7 #include <windowsx.h> | 7 #include <windowsx.h> |
| 8 #include <atlbase.h> | 8 #include <atlbase.h> |
| 9 #include <atlapp.h> | 9 #include <atlapp.h> |
| 10 #include <atlmisc.h> | 10 #include <atlmisc.h> |
| 11 | 11 |
| 12 #include <algorithm> | 12 #include <algorithm> |
| 13 | 13 |
| 14 #include "app/gfx/chrome_canvas.h" | 14 #include "app/gfx/canvas.h" |
| 15 #include "app/gfx/favicon_size.h" | 15 #include "app/gfx/favicon_size.h" |
| 16 #include "app/gfx/icon_util.h" | 16 #include "app/gfx/icon_util.h" |
| 17 #include "app/l10n_util_win.h" | 17 #include "app/l10n_util_win.h" |
| 18 #include "app/resource_bundle.h" | 18 #include "app/resource_bundle.h" |
| 19 #include "base/string_util.h" | 19 #include "base/string_util.h" |
| 20 #include "base/win_util.h" | 20 #include "base/win_util.h" |
| 21 #include "skia/ext/skia_utils_win.h" | 21 #include "skia/ext/skia_utils_win.h" |
| 22 #include "third_party/skia/include/core/SkBitmap.h" | 22 #include "third_party/skia/include/core/SkBitmap.h" |
| 23 #include "third_party/skia/include/core/SkColorFilter.h" | 23 #include "third_party/skia/include/core/SkColorFilter.h" |
| 24 #include "views/controls/hwnd_view.h" | 24 #include "views/controls/hwnd_view.h" |
| (...skipping 834 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 859 // Set the # of rows. | 859 // Set the # of rows. |
| 860 if (model_) | 860 if (model_) |
| 861 UpdateListViewCache(0, model_->RowCount(), true); | 861 UpdateListViewCache(0, model_->RowCount(), true); |
| 862 | 862 |
| 863 if (table_type_ == ICON_AND_TEXT) { | 863 if (table_type_ == ICON_AND_TEXT) { |
| 864 HIMAGELIST image_list = | 864 HIMAGELIST image_list = |
| 865 ImageList_Create(kImageSize, kImageSize, ILC_COLOR32, 2, 2); | 865 ImageList_Create(kImageSize, kImageSize, ILC_COLOR32, 2, 2); |
| 866 // We create 2 phony images because we are going to switch images at every | 866 // We create 2 phony images because we are going to switch images at every |
| 867 // refresh in order to force a refresh of the icon area (somehow the clip | 867 // refresh in order to force a refresh of the icon area (somehow the clip |
| 868 // rect does not include the icon). | 868 // rect does not include the icon). |
| 869 ChromeCanvas canvas(kImageSize, kImageSize, false); | 869 gfx::Canvas canvas(kImageSize, kImageSize, false); |
| 870 // Make the background completely transparent. | 870 // Make the background completely transparent. |
| 871 canvas.drawColor(SK_ColorBLACK, SkPorterDuff::kClear_Mode); | 871 canvas.drawColor(SK_ColorBLACK, SkPorterDuff::kClear_Mode); |
| 872 HICON empty_icon = | 872 HICON empty_icon = |
| 873 IconUtil::CreateHICONFromSkBitmap(canvas.ExtractBitmap()); | 873 IconUtil::CreateHICONFromSkBitmap(canvas.ExtractBitmap()); |
| 874 ImageList_AddIcon(image_list, empty_icon); | 874 ImageList_AddIcon(image_list, empty_icon); |
| 875 ImageList_AddIcon(image_list, empty_icon); | 875 ImageList_AddIcon(image_list, empty_icon); |
| 876 DeleteObject(empty_icon); | 876 DeleteObject(empty_icon); |
| 877 ListView_SetImageList(list_view_, image_list, LVSIL_SMALL); | 877 ListView_SetImageList(list_view_, image_list, LVSIL_SMALL); |
| 878 } | 878 } |
| 879 | 879 |
| (...skipping 358 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1238 WTL::CRect icon_rect, client_rect; | 1238 WTL::CRect icon_rect, client_rect; |
| 1239 if (ListView_GetItemRect(list_view_, view_index, &icon_rect, | 1239 if (ListView_GetItemRect(list_view_, view_index, &icon_rect, |
| 1240 LVIR_ICON) && | 1240 LVIR_ICON) && |
| 1241 GetClientRect(list_view_, &client_rect)) { | 1241 GetClientRect(list_view_, &client_rect)) { |
| 1242 WTL::CRect intersection; | 1242 WTL::CRect intersection; |
| 1243 // Client rect includes the header but we need to make sure we don't | 1243 // Client rect includes the header but we need to make sure we don't |
| 1244 // paint into it. | 1244 // paint into it. |
| 1245 client_rect.top += content_offset_; | 1245 client_rect.top += content_offset_; |
| 1246 // Make sure the region need to paint is visible. | 1246 // Make sure the region need to paint is visible. |
| 1247 if (intersection.IntersectRect(&icon_rect, &client_rect)) { | 1247 if (intersection.IntersectRect(&icon_rect, &client_rect)) { |
| 1248 ChromeCanvas canvas(icon_rect.Width(), icon_rect.Height(), false); | 1248 gfx::Canvas canvas(icon_rect.Width(), icon_rect.Height(), false); |
| 1249 | 1249 |
| 1250 // It seems the state in nmcd.uItemState is not correct. | 1250 // It seems the state in nmcd.uItemState is not correct. |
| 1251 // We'll retrieve it explicitly. | 1251 // We'll retrieve it explicitly. |
| 1252 int selected = ListView_GetItemState( | 1252 int selected = ListView_GetItemState( |
| 1253 list_view_, view_index, LVIS_SELECTED | LVIS_DROPHILITED); | 1253 list_view_, view_index, LVIS_SELECTED | LVIS_DROPHILITED); |
| 1254 bool drop_highlight = ((selected & LVIS_DROPHILITED) != 0); | 1254 bool drop_highlight = ((selected & LVIS_DROPHILITED) != 0); |
| 1255 int bg_color_index; | 1255 int bg_color_index; |
| 1256 if (!IsEnabled()) | 1256 if (!IsEnabled()) |
| 1257 bg_color_index = COLOR_3DFACE; | 1257 bg_color_index = COLOR_3DFACE; |
| 1258 else if (drop_highlight) | 1258 else if (drop_highlight) |
| (...skipping 312 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1571 } | 1571 } |
| 1572 | 1572 |
| 1573 void TableSelectionIterator::UpdateModelIndexFromViewIndex() { | 1573 void TableSelectionIterator::UpdateModelIndexFromViewIndex() { |
| 1574 if (view_index_ == -1) | 1574 if (view_index_ == -1) |
| 1575 model_index_ = -1; | 1575 model_index_ = -1; |
| 1576 else | 1576 else |
| 1577 model_index_ = table_view_->view_to_model(view_index_); | 1577 model_index_ = table_view_->view_to_model(view_index_); |
| 1578 } | 1578 } |
| 1579 | 1579 |
| 1580 } // namespace views | 1580 } // namespace views |
| OLD | NEW |