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  = gtkglext-gdkglpixmap.html
27  * outPack = glgdk
28  * outFile = GLPixmap
29  * strct   = GdkGLPixmap
30  * realStrct=
31  * ctorStrct=
32  * clss    = GLPixmap
33  * interf  = 
34  * class Code: No
35  * interface Code: No
36  * template for:
37  * extend  = 
38  * implements:
39  * prefixes:
40  * 	- gdk_gl_pixmap_
41  * 	- gdk_
42  * omit structs:
43  * omit prefixes:
44  * omit code:
45  * omit signals:
46  * imports:
47  * 	- glgdk.GLConfig
48  * 	- gdk.Pixmap
49  * structWrap:
50  * 	- GdkGLConfig* -> GLConfig
51  * 	- GdkGLPixmap* -> GLPixmap
52  * 	- GdkPixmap* -> Pixmap
53  * module aliases:
54  * local aliases:
55  * overrides:
56  */
57 
58 module glgdk.GLPixmap;
59 
60 public  import gtkglc.glgdktypes;
61 
62 private import gtkglc.glgdk;
63 private import glib.ConstructionException;
64 private import gobject.ObjectG;
65 
66 
67 private import glgdk.GLConfig;
68 private import gdk.Pixmap;
69 
70 
71 
72 private import gdk.Drawable;
73 
74 /**
75  * Description
76  */
77 public class GLPixmap : Drawable
78 {
79 	
80 	/** the main Gtk struct */
81 	protected GdkGLPixmap* gdkGLPixmap;
82 	
83 	
84 	public GdkGLPixmap* getGLPixmapStruct()
85 	{
86 		return gdkGLPixmap;
87 	}
88 	
89 	
90 	/** the main Gtk struct as a void* */
91 	protected override void* getStruct()
92 	{
93 		return cast(void*)gdkGLPixmap;
94 	}
95 	
96 	/**
97 	 * Sets our main struct and passes it to the parent class
98 	 */
99 	public this (GdkGLPixmap* gdkGLPixmap)
100 	{
101 		super(cast(GdkDrawable*)gdkGLPixmap);
102 		this.gdkGLPixmap = gdkGLPixmap;
103 	}
104 	
105 	protected override void setStruct(GObject* obj)
106 	{
107 		super.setStruct(obj);
108 		gdkGLPixmap = cast(GdkGLPixmap*)obj;
109 	}
110 	
111 	/**
112 	 */
113 	
114 	/**
115 	 * Creates an off-screen rendering area.
116 	 * attrib_list is currently unused. This must be set to NULL or empty
117 	 * (first attribute of None). See GLX 1.3 spec.
118 	 * Params:
119 	 * glconfig = a GdkGLConfig.
120 	 * pixmap = the GdkPixmap to be used as the rendering area.
121 	 * attribList = this must be set to NULL or empty (first attribute of None).
122 	 * Throws: ConstructionException GTK+ fails to create the object.
123 	 */
124 	public this (GLConfig glconfig, Pixmap pixmap, int* attribList)
125 	{
126 		// GdkGLPixmap* gdk_gl_pixmap_new (GdkGLConfig *glconfig,  GdkPixmap *pixmap,  const int *attrib_list);
127 		auto p = gdk_gl_pixmap_new((glconfig is null) ? null : glconfig.getGLConfigStruct(), (pixmap is null) ? null : pixmap.getPixmapStruct(), attribList);
128 		if(p is null)
129 		{
130 			throw new ConstructionException("null returned by gdk_gl_pixmap_new((glconfig is null) ? null : glconfig.getGLConfigStruct(), (pixmap is null) ? null : pixmap.getPixmapStruct(), attribList)");
131 		}
132 		this(cast(GdkGLPixmap*) p);
133 	}
134 	
135 	/**
136 	 * Destroys the OpenGL resources associated with glpixmap and
137 	 * decrements glpixmap's reference count.
138 	 */
139 	public void destroy()
140 	{
141 		// void gdk_gl_pixmap_destroy (GdkGLPixmap *glpixmap);
142 		gdk_gl_pixmap_destroy(gdkGLPixmap);
143 	}
144 	
145 	/**
146 	 * Returns the GdkPixmap associated with glpixmap.
147 	 * Notice that GdkGLPixmap is not GdkPixmap, but another
148 	 * GdkDrawable which have an associated GdkPixmap.
149 	 * Returns: the GdkPixmap associated with glpixmap.
150 	 */
151 	public Pixmap getPixmap()
152 	{
153 		// GdkPixmap* gdk_gl_pixmap_get_pixmap (GdkGLPixmap *glpixmap);
154 		auto p = gdk_gl_pixmap_get_pixmap(gdkGLPixmap);
155 		
156 		if(p is null)
157 		{
158 			return null;
159 		}
160 		
161 		return ObjectG.getDObject!(Pixmap)(cast(GdkPixmap*) p);
162 	}
163 	
164 	/**
165 	 * Set the OpenGL-capability to the pixmap.
166 	 * This function creates a new GdkGLPixmap held by the pixmap.
167 	 * attrib_list is currently unused. This must be set to NULL or empty
168 	 * (first attribute of None).
169 	 * Params:
170 	 * pixmap = the GdkPixmap to be used as the rendering area.
171 	 * glconfig = a GdkGLConfig.
172 	 * attribList = this must be set to NULL or empty (first attribute of None).
173 	 * Returns: the GdkGLPixmap used by the pixmap if it is successful, NULL otherwise.
174 	 */
175 	public static GLPixmap pixmapSetGLCapability(Pixmap pixmap, GLConfig glconfig, int* attribList)
176 	{
177 		// GdkGLPixmap* gdk_pixmap_set_gl_capability (GdkPixmap *pixmap,  GdkGLConfig *glconfig,  const int *attrib_list);
178 		auto p = gdk_pixmap_set_gl_capability((pixmap is null) ? null : pixmap.getPixmapStruct(), (glconfig is null) ? null : glconfig.getGLConfigStruct(), attribList);
179 		
180 		if(p is null)
181 		{
182 			return null;
183 		}
184 		
185 		return ObjectG.getDObject!(GLPixmap)(cast(GdkGLPixmap*) p);
186 	}
187 	
188 	/**
189 	 * Unset the OpenGL-capability of the pixmap.
190 	 * This function destroys the GdkGLPixmap held by the pixmap.
191 	 * Params:
192 	 * pixmap = a GdkPixmap.
193 	 */
194 	public static void pixmapUnsetGLCapability(Pixmap pixmap)
195 	{
196 		// void gdk_pixmap_unset_gl_capability (GdkPixmap *pixmap);
197 		gdk_pixmap_unset_gl_capability((pixmap is null) ? null : pixmap.getPixmapStruct());
198 	}
199 	
200 	/**
201 	 * Returns whether the pixmap is OpenGL-capable.
202 	 * Params:
203 	 * pixmap = a GdkPixmap.
204 	 * Returns: TRUE if the pixmap is OpenGL-capable, FALSE otherwise.
205 	 */
206 	public static int pixmapIsGLCapable(Pixmap pixmap)
207 	{
208 		// gboolean gdk_pixmap_is_gl_capable (GdkPixmap *pixmap);
209 		return gdk_pixmap_is_gl_capable((pixmap is null) ? null : pixmap.getPixmapStruct());
210 	}
211 	
212 	/**
213 	 * Returns the GdkGLPixmap held by the pixmap.
214 	 * Params:
215 	 * pixmap = a GdkPixmap.
216 	 * Returns: the GdkGLPixmap.
217 	 */
218 	public static GLPixmap pixmapGetGLPixmap(Pixmap pixmap)
219 	{
220 		// GdkGLPixmap* gdk_pixmap_get_gl_pixmap (GdkPixmap *pixmap);
221 		auto p = gdk_pixmap_get_gl_pixmap((pixmap is null) ? null : pixmap.getPixmapStruct());
222 		
223 		if(p is null)
224 		{
225 			return null;
226 		}
227 		
228 		return ObjectG.getDObject!(GLPixmap)(cast(GdkGLPixmap*) p);
229 	}
230 }