OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 |
13 #include "base/basictypes.h" | 13 #include "base/basictypes.h" |
14 #include "ui/ui_api.h" | 14 #include "ui/base/ui_export.h" |
15 | 15 |
16 namespace gfx { | 16 namespace gfx { |
17 class Size; | 17 class Size; |
18 } | 18 } |
19 class FilePath; | 19 class FilePath; |
20 class SkBitmap; | 20 class SkBitmap; |
21 | 21 |
22 /////////////////////////////////////////////////////////////////////////////// | 22 /////////////////////////////////////////////////////////////////////////////// |
23 // | 23 // |
24 // 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... |
43 // } | 43 // } |
44 // | 44 // |
45 // // Use the icon with a WM_SETICON message | 45 // // Use the icon with a WM_SETICON message |
46 // ::SendMessage(hwnd, WM_SETICON, static_cast<WPARAM>(ICON_BIG), | 46 // ::SendMessage(hwnd, WM_SETICON, static_cast<WPARAM>(ICON_BIG), |
47 // reinterpret_cast<LPARAM>(icon)); | 47 // reinterpret_cast<LPARAM>(icon)); |
48 // | 48 // |
49 // // Destroy the icon when we are done | 49 // // Destroy the icon when we are done |
50 // ::DestroyIcon(icon); | 50 // ::DestroyIcon(icon); |
51 // | 51 // |
52 /////////////////////////////////////////////////////////////////////////////// | 52 /////////////////////////////////////////////////////////////////////////////// |
53 class UI_API IconUtil { | 53 class UI_EXPORT IconUtil { |
54 public: | 54 public: |
55 // 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 |
56 // icon and returns the corresponding HICON handle. If the function cannot | 56 // icon and returns the corresponding HICON handle. If the function cannot |
57 // convert the bitmap, NULL is returned. | 57 // convert the bitmap, NULL is returned. |
58 // | 58 // |
59 // 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 |
60 // needed by calling ::DestroyIcon(). | 60 // needed by calling ::DestroyIcon(). |
61 static HICON CreateHICONFromSkBitmap(const SkBitmap& bitmap); | 61 static HICON CreateHICONFromSkBitmap(const SkBitmap& bitmap); |
62 | 62 |
63 // 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... |
187 static void ComputeBitmapSizeComponents(const SkBitmap& bitmap, | 187 static void ComputeBitmapSizeComponents(const SkBitmap& bitmap, |
188 size_t* xor_mask_size, | 188 size_t* xor_mask_size, |
189 size_t* bytes_in_resource); | 189 size_t* bytes_in_resource); |
190 | 190 |
191 // Prevent clients from instantiating objects of that class by declaring the | 191 // Prevent clients from instantiating objects of that class by declaring the |
192 // ctor/dtor as private. | 192 // ctor/dtor as private. |
193 DISALLOW_IMPLICIT_CONSTRUCTORS(IconUtil); | 193 DISALLOW_IMPLICIT_CONSTRUCTORS(IconUtil); |
194 }; | 194 }; |
195 | 195 |
196 #endif // UI_GFX_ICON_UTIL_H_ | 196 #endif // UI_GFX_ICON_UTIL_H_ |
OLD | NEW |