Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(3)

Side by Side Diff: ui/views/controls/tree/tree_view_win.cc

Issue 10437006: Converts ui/views/controls, ui/views/examples, ui/base/models to ImageSkia (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebased Created 8 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "ui/views/controls/tree/tree_view_win.h" 5 #include "ui/views/controls/tree/tree_view_win.h"
6 6
7 #include <vector> 7 #include <vector>
8 8
9 #include "base/i18n/rtl.h" 9 #include "base/i18n/rtl.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 639 matching lines...) Expand 10 before | Expand all | Expand 10 after
650 DCHECK(tree_view_ && tree_item); 650 DCHECK(tree_view_ && tree_item);
651 TV_ITEM tv_item = {0}; 651 TV_ITEM tv_item = {0};
652 tv_item.hItem = tree_item; 652 tv_item.hItem = tree_item;
653 tv_item.mask = TVIF_PARAM; 653 tv_item.mask = TVIF_PARAM;
654 if (TreeView_GetItem(tree_view_, &tv_item)) 654 if (TreeView_GetItem(tree_view_, &tv_item))
655 return GetNodeDetailsByID(static_cast<int>(tv_item.lParam)); 655 return GetNodeDetailsByID(static_cast<int>(tv_item.lParam));
656 return NULL; 656 return NULL;
657 } 657 }
658 658
659 HIMAGELIST TreeView::CreateImageList() { 659 HIMAGELIST TreeView::CreateImageList() {
660 std::vector<SkBitmap> model_images; 660 std::vector<gfx::ImageSkia> model_images;
661 model_->GetIcons(&model_images); 661 model_->GetIcons(&model_images);
662 662
663 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); 663 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance();
664 bool rtl = base::i18n::IsRTL(); 664 bool rtl = base::i18n::IsRTL();
665 // Creates the default image list used for trees. 665 // Creates the default image list used for trees.
666 const SkBitmap* closed_icon = rb.GetImageNamed( 666 const gfx::ImageSkia* closed_icon = rb.GetImageNamed(
667 (rtl ? IDR_FOLDER_CLOSED_RTL : IDR_FOLDER_CLOSED)).ToSkBitmap(); 667 (rtl ? IDR_FOLDER_CLOSED_RTL : IDR_FOLDER_CLOSED)).ToImageSkia();
668 const SkBitmap* opened_icon = rb.GetImageNamed( 668 const gfx::ImageSkia* opened_icon = rb.GetImageNamed(
669 (rtl ? IDR_FOLDER_OPEN_RTL : IDR_FOLDER_OPEN)).ToSkBitmap(); 669 (rtl ? IDR_FOLDER_OPEN_RTL : IDR_FOLDER_OPEN)).ToImageSkia();
670 int width = closed_icon->width(); 670 int width = closed_icon->width();
671 int height = closed_icon->height(); 671 int height = closed_icon->height();
672 DCHECK(opened_icon->width() == width && opened_icon->height() == height); 672 DCHECK(opened_icon->width() == width && opened_icon->height() == height);
673 HIMAGELIST image_list = 673 HIMAGELIST image_list =
674 ImageList_Create(width, height, ILC_COLOR32, model_images.size() + 2, 674 ImageList_Create(width, height, ILC_COLOR32, model_images.size() + 2,
675 model_images.size() + 2); 675 model_images.size() + 2);
676 if (image_list) { 676 if (image_list) {
677 // NOTE: the order the images are added in effects the selected 677 // NOTE: the order the images are added in effects the selected
678 // image index when adding items to the tree. If you change the 678 // image index when adding items to the tree. If you change the
679 // order you'll undoubtedly need to update itemex.iSelectedImage 679 // order you'll undoubtedly need to update itemex.iSelectedImage
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
793 } 793 }
794 // Fall through and let the default handler process as well. 794 // Fall through and let the default handler process as well.
795 break; 795 break;
796 } 796 }
797 WNDPROC handler = tree->original_handler_; 797 WNDPROC handler = tree->original_handler_;
798 DCHECK(handler); 798 DCHECK(handler);
799 return CallWindowProc(handler, window, message, w_param, l_param); 799 return CallWindowProc(handler, window, message, w_param, l_param);
800 } 800 }
801 801
802 } // namespace views 802 } // namespace views
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698