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_GTK_UTIL_H_ | 5 #ifndef UI_GFX_GTK_UTIL_H_ |
6 #define UI_GFX_GTK_UTIL_H_ | 6 #define UI_GFX_GTK_UTIL_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <glib-object.h> | 9 #include <glib-object.h> |
10 #include <stdint.h> | 10 #include <stdint.h> |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
59 const std::string& label); | 59 const std::string& label); |
60 | 60 |
61 // Removes the "&" accelerators from a Windows label. | 61 // Removes the "&" accelerators from a Windows label. |
62 UI_EXPORT std::string RemoveWindowsStyleAccelerators(const std::string& label); | 62 UI_EXPORT std::string RemoveWindowsStyleAccelerators(const std::string& label); |
63 | 63 |
64 // Makes a copy of |pixels| with the ordering changed from BGRA to RGBA. | 64 // Makes a copy of |pixels| with the ordering changed from BGRA to RGBA. |
65 // The caller is responsible for free()ing the data. If |stride| is 0, it's | 65 // The caller is responsible for free()ing the data. If |stride| is 0, it's |
66 // assumed to be 4 * |width|. | 66 // assumed to be 4 * |width|. |
67 uint8_t* BGRAToRGBA(const uint8_t* pixels, int width, int height, int stride); | 67 uint8_t* BGRAToRGBA(const uint8_t* pixels, int width, int height, int stride); |
68 | 68 |
| 69 // Initialize some GTK settings so that our dialogs are consistent. |
| 70 void InitRCStyles(); |
| 71 |
69 } // namespace gfx | 72 } // namespace gfx |
70 | 73 |
71 // It's not legal C++ to have a templatized typedefs, so we wrap it in a | 74 // It's not legal C++ to have a templatized typedefs, so we wrap it in a |
72 // struct. When using this, you need to include ::Type. E.g., | 75 // struct. When using this, you need to include ::Type. E.g., |
73 // ScopedGObject<GdkPixbufLoader>::Type loader(gdk_pixbuf_loader_new()); | 76 // ScopedGObject<GdkPixbufLoader>::Type loader(gdk_pixbuf_loader_new()); |
74 template<class T> | 77 template<class T> |
75 struct ScopedGObject { | 78 struct ScopedGObject { |
76 // A helper class that will g_object_unref |p| when it goes out of scope. | 79 // A helper class that will g_object_unref |p| when it goes out of scope. |
77 // This never adds a ref, it only unrefs. | 80 // This never adds a ref, it only unrefs. |
78 template<class U> | 81 template<class U> |
79 struct GObjectUnrefer { | 82 struct GObjectUnrefer { |
80 void operator()(U* ptr) const { | 83 void operator()(U* ptr) const { |
81 if (ptr) | 84 if (ptr) |
82 g_object_unref(ptr); | 85 g_object_unref(ptr); |
83 } | 86 } |
84 }; | 87 }; |
85 | 88 |
86 typedef scoped_ptr_malloc<T, GObjectUnrefer<T> > Type; | 89 typedef scoped_ptr_malloc<T, GObjectUnrefer<T> > Type; |
87 }; | 90 }; |
88 | 91 |
89 #endif // UI_GFX_GTK_UTIL_H_ | 92 #endif // UI_GFX_GTK_UTIL_H_ |
OLD | NEW |