| 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> |
| (...skipping 822 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 833 UpdateListViewCache(0, model_->RowCount(), true); | 833 UpdateListViewCache(0, model_->RowCount(), true); |
| 834 | 834 |
| 835 if (table_type_ == ICON_AND_TEXT) { | 835 if (table_type_ == ICON_AND_TEXT) { |
| 836 HIMAGELIST image_list = | 836 HIMAGELIST image_list = |
| 837 ImageList_Create(kImageSize, kImageSize, ILC_COLOR32, 2, 2); | 837 ImageList_Create(kImageSize, kImageSize, ILC_COLOR32, 2, 2); |
| 838 // We create 2 phony images because we are going to switch images at every | 838 // We create 2 phony images because we are going to switch images at every |
| 839 // refresh in order to force a refresh of the icon area (somehow the clip | 839 // refresh in order to force a refresh of the icon area (somehow the clip |
| 840 // rect does not include the icon). | 840 // rect does not include the icon). |
| 841 gfx::Canvas canvas(kImageSize, kImageSize, false); | 841 gfx::Canvas canvas(kImageSize, kImageSize, false); |
| 842 // Make the background completely transparent. | 842 // Make the background completely transparent. |
| 843 canvas.drawColor(SK_ColorBLACK, SkPorterDuff::kClear_Mode); | 843 canvas.drawColor(SK_ColorBLACK, SkXfermode::kClear_Mode); |
| 844 HICON empty_icon = | 844 HICON empty_icon = |
| 845 IconUtil::CreateHICONFromSkBitmap(canvas.ExtractBitmap()); | 845 IconUtil::CreateHICONFromSkBitmap(canvas.ExtractBitmap()); |
| 846 ImageList_AddIcon(image_list, empty_icon); | 846 ImageList_AddIcon(image_list, empty_icon); |
| 847 ImageList_AddIcon(image_list, empty_icon); | 847 ImageList_AddIcon(image_list, empty_icon); |
| 848 DeleteObject(empty_icon); | 848 DeleteObject(empty_icon); |
| 849 ListView_SetImageList(list_view_, image_list, LVSIL_SMALL); | 849 ListView_SetImageList(list_view_, image_list, LVSIL_SMALL); |
| 850 } | 850 } |
| 851 | 851 |
| 852 if (!resizable_columns_) { | 852 if (!resizable_columns_) { |
| 853 // To disable the resizing of columns we'll filter the events happening on | 853 // To disable the resizing of columns we'll filter the events happening on |
| (...skipping 373 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1227 bg_color_index = COLOR_HIGHLIGHT; | 1227 bg_color_index = COLOR_HIGHLIGHT; |
| 1228 else if (selected) | 1228 else if (selected) |
| 1229 bg_color_index = HasFocus() ? COLOR_HIGHLIGHT : COLOR_3DFACE; | 1229 bg_color_index = HasFocus() ? COLOR_HIGHLIGHT : COLOR_3DFACE; |
| 1230 else | 1230 else |
| 1231 bg_color_index = COLOR_WINDOW; | 1231 bg_color_index = COLOR_WINDOW; |
| 1232 // NOTE: This may be invoked without the ListView filling in the | 1232 // NOTE: This may be invoked without the ListView filling in the |
| 1233 // background (or rather windows paints background, then invokes | 1233 // background (or rather windows paints background, then invokes |
| 1234 // this twice). As such, we always fill in the background. | 1234 // this twice). As such, we always fill in the background. |
| 1235 canvas.drawColor( | 1235 canvas.drawColor( |
| 1236 skia::COLORREFToSkColor(GetSysColor(bg_color_index)), | 1236 skia::COLORREFToSkColor(GetSysColor(bg_color_index)), |
| 1237 SkPorterDuff::kSrc_Mode); | 1237 SkXfermode::kSrc_Mode); |
| 1238 // + 1 for padding (we declared the image as 18x18 in the list- | 1238 // + 1 for padding (we declared the image as 18x18 in the list- |
| 1239 // view when they are 16x16 so we get an extra pixel of padding). | 1239 // view when they are 16x16 so we get an extra pixel of padding). |
| 1240 canvas.DrawBitmapInt(image, 0, 0, | 1240 canvas.DrawBitmapInt(image, 0, 0, |
| 1241 image.width(), image.height(), | 1241 image.width(), image.height(), |
| 1242 1, 1, kFavIconSize, kFavIconSize, true); | 1242 1, 1, kFavIconSize, kFavIconSize, true); |
| 1243 | 1243 |
| 1244 // Only paint the visible region of the icon. | 1244 // Only paint the visible region of the icon. |
| 1245 RECT to_draw = { intersection.left - icon_rect.left, | 1245 RECT to_draw = { intersection.left - icon_rect.left, |
| 1246 intersection.top - icon_rect.top, | 1246 intersection.top - icon_rect.top, |
| 1247 0, 0 }; | 1247 0, 0 }; |
| (...skipping 296 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1544 } | 1544 } |
| 1545 | 1545 |
| 1546 void TableSelectionIterator::UpdateModelIndexFromViewIndex() { | 1546 void TableSelectionIterator::UpdateModelIndexFromViewIndex() { |
| 1547 if (view_index_ == -1) | 1547 if (view_index_ == -1) |
| 1548 model_index_ = -1; | 1548 model_index_ = -1; |
| 1549 else | 1549 else |
| 1550 model_index_ = table_view_->view_to_model(view_index_); | 1550 model_index_ = table_view_->view_to_model(view_index_); |
| 1551 } | 1551 } |
| 1552 | 1552 |
| 1553 } // namespace views | 1553 } // namespace views |
| OLD | NEW |