| 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 #ifndef UI_GFX_ICON_UTIL_H_ | 5 #ifndef UI_GFX_ICON_UTIL_H_ |
| 6 #define UI_GFX_ICON_UTIL_H_ | 6 #define UI_GFX_ICON_UTIL_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <windows.h> | 9 #include <windows.h> |
| 10 #include <string> | 10 #include <string> |
| 11 #include <vector> | 11 #include <vector> |
| 12 |
| 12 #include "base/basictypes.h" | 13 #include "base/basictypes.h" |
| 14 #include "ui/ui_api.h" |
| 13 | 15 |
| 14 namespace gfx { | 16 namespace gfx { |
| 15 class Size; | 17 class Size; |
| 16 } | 18 } |
| 17 class FilePath; | 19 class FilePath; |
| 18 class SkBitmap; | 20 class SkBitmap; |
| 19 | 21 |
| 20 /////////////////////////////////////////////////////////////////////////////// | 22 /////////////////////////////////////////////////////////////////////////////// |
| 21 // | 23 // |
| 22 // The IconUtil class contains helper functions for manipulating Windows icons. | 24 // The IconUtil class contains helper functions for manipulating Windows icons. |
| (...skipping 18 matching lines...) Expand all Loading... |
| 41 // } | 43 // } |
| 42 // | 44 // |
| 43 // // Use the icon with a WM_SETICON message | 45 // // Use the icon with a WM_SETICON message |
| 44 // ::SendMessage(hwnd, WM_SETICON, static_cast<WPARAM>(ICON_BIG), | 46 // ::SendMessage(hwnd, WM_SETICON, static_cast<WPARAM>(ICON_BIG), |
| 45 // reinterpret_cast<LPARAM>(icon)); | 47 // reinterpret_cast<LPARAM>(icon)); |
| 46 // | 48 // |
| 47 // // Destroy the icon when we are done | 49 // // Destroy the icon when we are done |
| 48 // ::DestroyIcon(icon); | 50 // ::DestroyIcon(icon); |
| 49 // | 51 // |
| 50 /////////////////////////////////////////////////////////////////////////////// | 52 /////////////////////////////////////////////////////////////////////////////// |
| 51 class IconUtil { | 53 class UI_API IconUtil { |
| 52 public: | 54 public: |
| 53 // Given an SkBitmap object, the function converts the bitmap to a Windows | 55 // Given an SkBitmap object, the function converts the bitmap to a Windows |
| 54 // icon and returns the corresponding HICON handle. If the function cannot | 56 // icon and returns the corresponding HICON handle. If the function cannot |
| 55 // convert the bitmap, NULL is returned. | 57 // convert the bitmap, NULL is returned. |
| 56 // | 58 // |
| 57 // The client is responsible for destroying the icon when it is no longer | 59 // The client is responsible for destroying the icon when it is no longer |
| 58 // needed by calling ::DestroyIcon(). | 60 // needed by calling ::DestroyIcon(). |
| 59 static HICON CreateHICONFromSkBitmap(const SkBitmap& bitmap); | 61 static HICON CreateHICONFromSkBitmap(const SkBitmap& bitmap); |
| 60 | 62 |
| 61 // Given a valid HICON handle representing an icon, this function converts | 63 // Given a valid HICON handle representing an icon, this function converts |
| (...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 185 static void ComputeBitmapSizeComponents(const SkBitmap& bitmap, | 187 static void ComputeBitmapSizeComponents(const SkBitmap& bitmap, |
| 186 size_t* xor_mask_size, | 188 size_t* xor_mask_size, |
| 187 size_t* bytes_in_resource); | 189 size_t* bytes_in_resource); |
| 188 | 190 |
| 189 // Prevent clients from instantiating objects of that class by declaring the | 191 // Prevent clients from instantiating objects of that class by declaring the |
| 190 // ctor/dtor as private. | 192 // ctor/dtor as private. |
| 191 DISALLOW_IMPLICIT_CONSTRUCTORS(IconUtil); | 193 DISALLOW_IMPLICIT_CONSTRUCTORS(IconUtil); |
| 192 }; | 194 }; |
| 193 | 195 |
| 194 #endif // UI_GFX_ICON_UTIL_H_ | 196 #endif // UI_GFX_ICON_UTIL_H_ |
| OLD | NEW |