gtk_util.h 978 B

123456789101112131415161718192021222324252627282930
  1. // Copyright (c) 2019 GitHub, Inc.
  2. // Use of this source code is governed by the MIT license that can be
  3. // found in the LICENSE file.
  4. #ifndef SHELL_BROWSER_UI_GTK_UTIL_H_
  5. #define SHELL_BROWSER_UI_GTK_UTIL_H_
  6. #include <gtk/gtk.h>
  7. class SkBitmap;
  8. namespace gtk_util {
  9. /* These are `const char*` rather than the project-preferred `const char[]`
  10. because they must fit the type of an external dependency */
  11. extern const char* const kCancelLabel;
  12. extern const char* const kNoLabel;
  13. extern const char* const kOkLabel;
  14. extern const char* const kOpenLabel;
  15. extern const char* const kSaveLabel;
  16. extern const char* const kYesLabel;
  17. // Convert and copy a SkBitmap to a GdkPixbuf. NOTE: this uses BGRAToRGBA, so
  18. // it is an expensive operation. The returned GdkPixbuf will have a refcount of
  19. // 1, and the caller is responsible for unrefing it when done.
  20. GdkPixbuf* GdkPixbufFromSkBitmap(const SkBitmap& bitmap);
  21. } // namespace gtk_util
  22. #endif // SHELL_BROWSER_UI_GTK_UTIL_H_