Chromium Code Reviews| 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 APP_GTK_UTIL_H_ | 5 #ifndef APP_GTK_UTIL_H_ |
| 6 #define APP_GTK_UTIL_H_ | 6 #define APP_GTK_UTIL_H_ |
| 7 | 7 |
| 8 #include <stdint.h> | |
| 8 typedef struct _GtkWidget GtkWidget; | 9 typedef struct _GtkWidget GtkWidget; |
| 9 | 10 |
| 10 namespace gtk_util { | 11 namespace gtk_util { |
| 11 | 12 |
| 12 // Calculates the size of given widget based on the size specified in | 13 // Calculates the size of given widget based on the size specified in |
| 13 // number of characters/lines (in locale specific resource file) and | 14 // number of characters/lines (in locale specific resource file) and |
| 14 // font metrics. | 15 // font metrics. |
| 15 // NOTE: Make sure to realize |widget| before using this method, or a | 16 // NOTE: Make sure to realize |widget| before using this method, or a |
| 16 // default font size will be used instead of the actual font size. | 17 // default font size will be used instead of the actual font size. |
| 17 void GetWidgetSizeFromResources( | 18 void GetWidgetSizeFromResources( |
| 18 GtkWidget* widget, int width_chars, int height_lines, | 19 GtkWidget* widget, int width_chars, int height_lines, |
| 19 int* width, int* height); | 20 int* width, int* height); |
| 20 | 21 |
| 21 // As above, but uses number of characters/lines directly rather than looking | 22 // As above, but uses number of characters/lines directly rather than looking |
| 22 // up a resource. | 23 // up a resource. |
| 23 void GetWidgetSizeFromCharacters( | 24 void GetWidgetSizeFromCharacters( |
| 24 GtkWidget* widget, double width_chars, double height_lines, | 25 GtkWidget* widget, double width_chars, double height_lines, |
| 25 int* width, int* height); | 26 int* width, int* height); |
| 26 | 27 |
| 27 // A helper function for gtk_message_dialog_new() to work around a KDE 3 | 28 // A helper function for gtk_message_dialog_new() to work around a KDE 3 |
| 28 // window manager bugs. You should always call it after creating a dialog | 29 // window manager bugs. You should always call it after creating a dialog |
| 29 // with gtk_message_dialog_new. | 30 // with gtk_message_dialog_new. |
| 30 void ApplyMessageDialogQuirks(GtkWidget* dialog); | 31 void ApplyMessageDialogQuirks(GtkWidget* dialog); |
| 31 | 32 |
| 33 // Makes a copy of |pixels| with the ordering changed from BGRA to RGBA. | |
| 34 // The caller is responsible for free()ing the data. If |stride| is 0, | |
| 35 // it's assumed to be 4 * |width|. | |
| 36 uint8_t* BGRAToRGBA(const uint8_t* pixels, int width, int height, int stride); | |
|
Evan Martin
2010/05/12 10:20:47
This is a sorta strange place for it, but the old
Peter Valchev
2010/05/12 23:05:13
Yeah, dunno what's a better place..
| |
| 37 | |
| 32 } // namespace gtk_util | 38 } // namespace gtk_util |
| 33 | 39 |
| 34 #endif // APP_GTK_UTIL_H_ | 40 #endif // APP_GTK_UTIL_H_ |
| OLD | NEW |