1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 2 // Use of this source code is governed by a BSD-style license that can be 3 // found in the LICENSE file. 4 5 #ifndef UI_GFX_GTK_PRESERVE_WINDOW_H_ 6 #define UI_GFX_GTK_PRESERVE_WINDOW_H_ 7 8 #include <atk/atk.h> 9 #include <gdk/gdk.h> 10 #include <gtk/gtk.h> 11 12 #include "ui/gfx/gfx_export.h" 13 14 // GtkFixed creates an X window when realized and destroys an X window 15 // when unrealized. GtkPreserveWindow allows overrides this 16 // behaviour. When preserve is set (via gtk_preserve_window_set_preserve), 17 // the X window is only destroyed when the widget is destroyed. 18 19 G_BEGIN_DECLS 20 21 #define GTK_TYPE_PRESERVE_WINDOW \ 22 (gtk_preserve_window_get_type()) 23 #define GTK_PRESERVE_WINDOW(obj) \ 24 (G_TYPE_CHECK_INSTANCE_CAST((obj), GTK_TYPE_PRESERVE_WINDOW, \ 25 GtkPreserveWindow)) 26 #define GTK_PRESERVE_WINDOW_CLASS(klass) \ 27 (G_TYPE_CHECK_CLASS_CAST((klass), GTK_TYPE_PRESERVE_WINDOW, \ 28 GtkPreserveWindowClass)) 29 #define GTK_IS_PRESERVE_WINDOW(obj) \ 30 (G_TYPE_CHECK_INSTANCE_TYPE((obj), GTK_TYPE_PRESERVE_WINDOW)) 31 #define GTK_IS_PRESERVE_WINDOW_CLASS(klass) \ 32 (G_TYPE_CHECK_CLASS_TYPE((klass), GTK_TYPE_PRESERVE_WINDOW)) 33 #define GTK_PRESERVE_WINDOW_GET_CLASS(obj) \ 34 (G_TYPE_INSTANCE_GET_CLASS((obj), GTK_TYPE_PRESERVE_WINDOW, \ 35 GtkPreserveWindowClass)) 36 37 typedef struct _GtkPreserveWindow GtkPreserveWindow; 38 typedef struct _GtkPreserveWindowClass GtkPreserveWindowClass; 39 40 struct _GtkPreserveWindow { 41 // Parent class. 42 GtkFixed fixed; 43 }; 44 45 struct _GtkPreserveWindowClass { 46 GtkFixedClass parent_class; 47 }; 48 49 GFX_EXPORT GType gtk_preserve_window_get_type() G_GNUC_CONST; 50 GFX_EXPORT GtkWidget* gtk_preserve_window_new(); 51 52 // Whether or not we should preserve associated windows as the widget 53 // is realized or unrealized. 54 GFX_EXPORT gboolean gtk_preserve_window_get_preserve(GtkPreserveWindow* widget); 55 GFX_EXPORT void gtk_preserve_window_set_preserve(GtkPreserveWindow* widget, 56 gboolean value); 57 58 // Whether or not someone else will gdk_window_resize the GdkWindow associated 59 // with this widget (needed by the GPU process to synchronize resizing 60 // with swapped between front and back buffer). 61 GFX_EXPORT void gtk_preserve_window_delegate_resize(GtkPreserveWindow* widget, 62 gboolean delegate); 63 64 // Provide a function to return an AtkObject* when calls to get_accessible 65 // are made on this widget. The parameter |userdata| will be passed to the 66 // factory function. 67 GFX_EXPORT void gtk_preserve_window_set_accessible_factory( 68 GtkPreserveWindow* widget, 69 AtkObject* (*factory)(void* userdata), 70 gpointer userdata); 71 72 G_END_DECLS 73 74 #endif // UI_GFX_GTK_PRESERVE_WINDOW_H_ 75