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_BASE_RESOURCE_RESOURCE_BUNDLE_H_ | 5 #ifndef UI_BASE_RESOURCE_RESOURCE_BUNDLE_H_ |
6 #define UI_BASE_RESOURCE_RESOURCE_BUNDLE_H_ | 6 #define UI_BASE_RESOURCE_RESOURCE_BUNDLE_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include "build/build_config.h" | 9 #include "build/build_config.h" |
10 | 10 |
11 #if defined(OS_WIN) | 11 #if defined(OS_WIN) |
12 #include <windows.h> | 12 #include <windows.h> |
13 #endif | 13 #endif |
14 | 14 |
15 #include <map> | 15 #include <map> |
16 #include <string> | 16 #include <string> |
17 #include <vector> | 17 #include <vector> |
18 | 18 |
19 #include "base/basictypes.h" | 19 #include "base/basictypes.h" |
20 #include "base/file_path.h" | 20 #include "base/file_path.h" |
21 #include "base/gtest_prod_util.h" | 21 #include "base/gtest_prod_util.h" |
22 #include "base/memory/ref_counted_memory.h" | 22 #include "base/memory/ref_counted_memory.h" |
23 #include "base/memory/scoped_ptr.h" | 23 #include "base/memory/scoped_ptr.h" |
24 #include "base/string16.h" | 24 #include "base/string16.h" |
25 #include "ui/gfx/native_widget_types.h" | 25 #include "ui/gfx/native_widget_types.h" |
| 26 #include "ui/ui_api.h" |
26 | 27 |
27 class SkBitmap; | 28 class SkBitmap; |
28 typedef uint32 SkColor; | 29 typedef uint32 SkColor; |
29 | 30 |
30 namespace base { | 31 namespace base { |
31 class Lock; | 32 class Lock; |
32 class StringPiece; | 33 class StringPiece; |
33 } | 34 } |
34 | 35 |
35 namespace gfx { | 36 namespace gfx { |
(...skipping 13 matching lines...) Expand all Loading... |
49 typedef struct _GdkPixbuf GdkPixbuf; | 50 typedef struct _GdkPixbuf GdkPixbuf; |
50 #endif | 51 #endif |
51 | 52 |
52 namespace ui { | 53 namespace ui { |
53 | 54 |
54 class DataPack; | 55 class DataPack; |
55 | 56 |
56 // ResourceBundle is a central facility to load images and other resources, | 57 // ResourceBundle is a central facility to load images and other resources, |
57 // such as theme graphics. | 58 // such as theme graphics. |
58 // Every resource is loaded only once. | 59 // Every resource is loaded only once. |
59 class ResourceBundle { | 60 class UI_API ResourceBundle { |
60 public: | 61 public: |
61 // An enumeration of the various font styles used throughout Chrome. | 62 // An enumeration of the various font styles used throughout Chrome. |
62 // The following holds true for the font sizes: | 63 // The following holds true for the font sizes: |
63 // Small <= Base <= Bold <= Medium <= MediumBold <= Large. | 64 // Small <= Base <= Bold <= Medium <= MediumBold <= Large. |
64 enum FontStyle { | 65 enum FontStyle { |
65 SmallFont, | 66 SmallFont, |
66 BaseFont, | 67 BaseFont, |
67 BoldFont, | 68 BoldFont, |
68 MediumFont, | 69 MediumFont, |
69 // NOTE: depending upon the locale, this may *not* result in a bold font. | 70 // NOTE: depending upon the locale, this may *not* result in a bold font. |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
135 string16 GetLocalizedString(int message_id); | 136 string16 GetLocalizedString(int message_id); |
136 | 137 |
137 // Returns the font for the specified style. | 138 // Returns the font for the specified style. |
138 const gfx::Font& GetFont(FontStyle style); | 139 const gfx::Font& GetFont(FontStyle style); |
139 | 140 |
140 // Resets and reloads the cached fonts. This is useful when the fonts of the | 141 // Resets and reloads the cached fonts. This is useful when the fonts of the |
141 // system have changed, for example, when the locale has changed. | 142 // system have changed, for example, when the locale has changed. |
142 void ReloadFonts(); | 143 void ReloadFonts(); |
143 | 144 |
144 #if defined(OS_WIN) | 145 #if defined(OS_WIN) |
| 146 // NOTE: This needs to be called before initializing the shared instance if |
| 147 // your resources are not stored in the executable. |
| 148 static void SetResourcesDataDLL(HINSTANCE handle); |
| 149 |
145 // Loads and returns an icon from the app module. | 150 // Loads and returns an icon from the app module. |
146 HICON LoadThemeIcon(int icon_id); | 151 HICON LoadThemeIcon(int icon_id); |
147 | 152 |
148 // Loads and returns a cursor from the app module. | 153 // Loads and returns a cursor from the app module. |
149 HCURSOR LoadCursor(int cursor_id); | 154 HCURSOR LoadCursor(int cursor_id); |
150 #elif defined(USE_X11) | 155 #elif defined(USE_X11) |
151 // Gets the GdkPixbuf with the specified resource_id from the main data pak | 156 // Gets the GdkPixbuf with the specified resource_id from the main data pak |
152 // file. Returns a pointer to a shared instance of the GdkPixbuf. This | 157 // file. Returns a pointer to a shared instance of the GdkPixbuf. This |
153 // shared GdkPixbuf is owned by the resource bundle and should not be freed. | 158 // shared GdkPixbuf is owned by the resource bundle and should not be freed. |
154 // | 159 // |
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
290 | 295 |
291 DISALLOW_COPY_AND_ASSIGN(ResourceBundle); | 296 DISALLOW_COPY_AND_ASSIGN(ResourceBundle); |
292 }; | 297 }; |
293 | 298 |
294 } // namespace ui | 299 } // namespace ui |
295 | 300 |
296 // TODO(beng): Someday, maybe, get rid of this. | 301 // TODO(beng): Someday, maybe, get rid of this. |
297 using ui::ResourceBundle; | 302 using ui::ResourceBundle; |
298 | 303 |
299 #endif // UI_BASE_RESOURCE_RESOURCE_BUNDLE_H_ | 304 #endif // UI_BASE_RESOURCE_RESOURCE_BUNDLE_H_ |
OLD | NEW |