1 /*
2  * This file is part of gtkD.
3  *
4  * gtkD is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU Lesser General Public License
6  * as published by the Free Software Foundation; either version 3
7  * of the License, or (at your option) any later version, with
8  * some exceptions, please read the COPYING file.
9  *
10  * gtkD is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13  * GNU Lesser General Public License for more details.
14  *
15  * You should have received a copy of the GNU Lesser General Public License
16  * along with gtkD; if not, write to the Free Software
17  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110, USA
18  */
19  
20 // generated automatically - do not change
21 // find conversion definition on APILookup.txt
22 // implement new conversion functionalities on the wrap.utils pakage
23 
24 /*
25  * Conversion parameters:
26  * inFile  = GtkOffscreenWindow.html
27  * outPack = gtk
28  * outFile = OffscreenWindow
29  * strct   = GtkOffscreenWindow
30  * realStrct=
31  * ctorStrct=
32  * clss    = OffscreenWindow
33  * interf  = 
34  * class Code: No
35  * interface Code: No
36  * template for:
37  * extend  = 
38  * implements:
39  * prefixes:
40  * 	- gtk_offscreen_window_
41  * omit structs:
42  * omit prefixes:
43  * omit code:
44  * omit signals:
45  * imports:
46  * 	- cairo.Surface
47  * 	- gdk.Pixbuf
48  * structWrap:
49  * 	- GdkPixbuf* -> Pixbuf
50  * 	- cairo_surface_t* -> Surface
51  * module aliases:
52  * local aliases:
53  * overrides:
54  */
55 
56 module gtk.OffscreenWindow;
57 
58 public  import gtkc.gtktypes;
59 
60 private import gtkc.gtk;
61 private import glib.ConstructionException;
62 private import gobject.ObjectG;
63 
64 private import cairo.Surface;
65 private import gdk.Pixbuf;
66 
67 
68 private import gtk.Window;
69 
70 /**
71  * GtkOffscreenWindow is strictly intended to be used for obtaining
72  * snapshots of widgets that are not part of a normal widget hierarchy.
73  * Since GtkOffscreenWindow is a toplevel widget you cannot obtain
74  * snapshots of a full window with it since you cannot pack a toplevel
75  * widget in another toplevel.
76  *
77  * The idea is to take a widget and manually set the state of it,
78  * add it to a GtkOffscreenWindow and then retrieve the snapshot
79  * as a cairo_surface_t or GdkPixbuf.
80  *
81  * GtkOffscreenWindow derives from GtkWindow only as an implementation
82  * detail. Applications should not use any API specific to GtkWindow
83  * to operate on this object. It should be treated as a GtkBin that
84  * has no parent widget.
85  *
86  * When contained offscreen widgets are redrawn, GtkOffscreenWindow
87  * will emit a "damage-event" signal.
88  */
89 public class OffscreenWindow : Window
90 {
91 	
92 	/** the main Gtk struct */
93 	protected GtkOffscreenWindow* gtkOffscreenWindow;
94 	
95 	
96 	/** Get the main Gtk struct */
97 	public GtkOffscreenWindow* getOffscreenWindowStruct()
98 	{
99 		return gtkOffscreenWindow;
100 	}
101 	
102 	
103 	/** the main Gtk struct as a void* */
104 	protected override void* getStruct()
105 	{
106 		return cast(void*)gtkOffscreenWindow;
107 	}
108 	
109 	/**
110 	 * Sets our main struct and passes it to the parent class
111 	 */
112 	public this (GtkOffscreenWindow* gtkOffscreenWindow)
113 	{
114 		super(cast(GtkWindow*)gtkOffscreenWindow);
115 		this.gtkOffscreenWindow = gtkOffscreenWindow;
116 	}
117 	
118 	protected override void setStruct(GObject* obj)
119 	{
120 		super.setStruct(obj);
121 		gtkOffscreenWindow = cast(GtkOffscreenWindow*)obj;
122 	}
123 	
124 	/**
125 	 */
126 	
127 	/**
128 	 * Creates a toplevel container widget that is used to retrieve
129 	 * snapshots of widgets without showing them on the screen.
130 	 * Since 2.20
131 	 * Throws: ConstructionException GTK+ fails to create the object.
132 	 */
133 	public this ()
134 	{
135 		// GtkWidget * gtk_offscreen_window_new (void);
136 		auto p = gtk_offscreen_window_new();
137 		if(p is null)
138 		{
139 			throw new ConstructionException("null returned by gtk_offscreen_window_new()");
140 		}
141 		this(cast(GtkOffscreenWindow*) p);
142 	}
143 	
144 	/**
145 	 * Retrieves a snapshot of the contained widget in the form of
146 	 * a cairo_surface_t. If you need to keep this around over window
147 	 * resizes then you should add a reference to it.
148 	 * Since 2.20
149 	 * Returns: A cairo_surface_t pointer to the offscreen surface, or NULL. [transfer none]
150 	 */
151 	public Surface getSurface()
152 	{
153 		// cairo_surface_t * gtk_offscreen_window_get_surface (GtkOffscreenWindow *offscreen);
154 		auto p = gtk_offscreen_window_get_surface(gtkOffscreenWindow);
155 		
156 		if(p is null)
157 		{
158 			return null;
159 		}
160 		
161 		return ObjectG.getDObject!(Surface)(cast(cairo_surface_t*) p);
162 	}
163 	
164 	/**
165 	 * Retrieves a snapshot of the contained widget in the form of
166 	 * a GdkPixbuf. This is a new pixbuf with a reference count of 1,
167 	 * and the application should unreference it once it is no longer
168 	 * needed.
169 	 * Since 2.20
170 	 * Returns: A GdkPixbuf pointer, or NULL. [transfer full]
171 	 */
172 	public Pixbuf getPixbuf()
173 	{
174 		// GdkPixbuf * gtk_offscreen_window_get_pixbuf (GtkOffscreenWindow *offscreen);
175 		auto p = gtk_offscreen_window_get_pixbuf(gtkOffscreenWindow);
176 		
177 		if(p is null)
178 		{
179 			return null;
180 		}
181 		
182 		return ObjectG.getDObject!(Pixbuf)(cast(GdkPixbuf*) p);
183 	}
184 }