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-gdkgldrawable.html
27  * outPack = glgdk
28  * outFile = GLDrawable
29  * strct   = GdkGLDrawable
30  * realStrct=
31  * ctorStrct=
32  * clss    = GLDrawable
33  * interf  = 
34  * class Code: No
35  * interface Code: No
36  * template for:
37  * extend  = 
38  * implements:
39  * prefixes:
40  * 	- gdk_gl_drawable_
41  * omit structs:
42  * omit prefixes:
43  * omit code:
44  * omit signals:
45  * imports:
46  * 	- glgdk.GLContext
47  * 	- glgdk.GLConfig
48  * structWrap:
49  * 	- GdkGLConfig* -> GLConfig
50  * 	- GdkGLContext* -> GLContext
51  * 	- GdkGLDrawable* -> GLDrawable
52  * module aliases:
53  * local aliases:
54  * overrides:
55  */
56 
57 module glgdk.GLDrawable;
58 
59 public  import gtkglc.glgdktypes;
60 
61 private import gtkglc.glgdk;
62 private import glib.ConstructionException;
63 private import gobject.ObjectG;
64 
65 
66 private import glgdk.GLContext;
67 private import glgdk.GLConfig;
68 
69 
70 
71 
72 /**
73  * Description
74  */
75 public class GLDrawable
76 {
77 	
78 	/** the main Gtk struct */
79 	protected GdkGLDrawable* gdkGLDrawable;
80 	
81 	
82 	public GdkGLDrawable* getGLDrawableStruct()
83 	{
84 		return gdkGLDrawable;
85 	}
86 	
87 	
88 	/** the main Gtk struct as a void* */
89 	protected void* getStruct()
90 	{
91 		return cast(void*)gdkGLDrawable;
92 	}
93 	
94 	/**
95 	 * Sets our main struct and passes it to the parent class
96 	 */
97 	public this (GdkGLDrawable* gdkGLDrawable)
98 	{
99 		this.gdkGLDrawable = gdkGLDrawable;
100 	}
101 	
102 	/**
103 	 */
104 	
105 	/**
106 	 * Attach an OpenGL rendering context to a gldrawable.
107 	 * Params:
108 	 * glcontext = a GdkGLContext.
109 	 * Returns: TRUE if it is successful, FALSE otherwise.
110 	 */
111 	public int makeCurrent(GLContext glcontext)
112 	{
113 		// gboolean gdk_gl_drawable_make_current (GdkGLDrawable *gldrawable,  GdkGLContext *glcontext);
114 		return gdk_gl_drawable_make_current(gdkGLDrawable, (glcontext is null) ? null : glcontext.getGLContextStruct());
115 	}
116 	
117 	/**
118 	 * Returns whether the gldrawable supports the double-buffered visual.
119 	 * Returns: TRUE if the double-buffered visual is supported, FALSE otherwise.
120 	 */
121 	public int isDoubleBuffered()
122 	{
123 		// gboolean gdk_gl_drawable_is_double_buffered  (GdkGLDrawable *gldrawable);
124 		return gdk_gl_drawable_is_double_buffered(gdkGLDrawable);
125 	}
126 	
127 	/**
128 	 * Exchange front and back buffers.
129 	 */
130 	public void swapBuffers()
131 	{
132 		// void gdk_gl_drawable_swap_buffers (GdkGLDrawable *gldrawable);
133 		gdk_gl_drawable_swap_buffers(gdkGLDrawable);
134 	}
135 	
136 	/**
137 	 * Complete OpenGL execution prior to subsequent GDK drawing calls.
138 	 */
139 	public void waitGl()
140 	{
141 		// void gdk_gl_drawable_wait_gl (GdkGLDrawable *gldrawable);
142 		gdk_gl_drawable_wait_gl(gdkGLDrawable);
143 	}
144 	
145 	/**
146 	 * Complete GDK drawing execution prior to subsequent OpenGL calls.
147 	 */
148 	public void waitGdk()
149 	{
150 		// void gdk_gl_drawable_wait_gdk (GdkGLDrawable *gldrawable);
151 		gdk_gl_drawable_wait_gdk(gdkGLDrawable);
152 	}
153 	
154 	/**
155 	 * Delimits the begining of the OpenGL execution.
156 	 * Params:
157 	 * glcontext = a GdkGLContext.
158 	 * Returns: TRUE if it is successful, FALSE otherwise.
159 	 */
160 	public int glBegin(GLContext glcontext)
161 	{
162 		// gboolean gdk_gl_drawable_gl_begin (GdkGLDrawable *gldrawable,  GdkGLContext *glcontext);
163 		return gdk_gl_drawable_gl_begin(gdkGLDrawable, (glcontext is null) ? null : glcontext.getGLContextStruct());
164 	}
165 	
166 	/**
167 	 * Delimits the end of the OpenGL execution.
168 	 */
169 	public void glEnd()
170 	{
171 		// void gdk_gl_drawable_gl_end (GdkGLDrawable *gldrawable);
172 		gdk_gl_drawable_gl_end(gdkGLDrawable);
173 	}
174 	
175 	/**
176 	 * Gets GdkGLConfig with which the gldrawable is configured.
177 	 * Returns: the GdkGLConfig.
178 	 */
179 	public GLConfig getGLConfig()
180 	{
181 		// GdkGLConfig* gdk_gl_drawable_get_gl_config (GdkGLDrawable *gldrawable);
182 		auto p = gdk_gl_drawable_get_gl_config(gdkGLDrawable);
183 		
184 		if(p is null)
185 		{
186 			return null;
187 		}
188 		
189 		return ObjectG.getDObject!(GLConfig)(cast(GdkGLConfig*) p);
190 	}
191 	
192 	/**
193 	 * Fills *width and *height with the size of GL drawable.
194 	 * width or height can be NULL if you only want the other one.
195 	 * Params:
196 	 * width = location to store drawable's width, or NULL.
197 	 * height = location to store drawable's height, or NULL.
198 	 */
199 	public void getSize(out int width, out int height)
200 	{
201 		// void gdk_gl_drawable_get_size (GdkGLDrawable *gldrawable,  gint *width,  gint *height);
202 		gdk_gl_drawable_get_size(gdkGLDrawable, &width, &height);
203 	}
204 	
205 	/**
206 	 * Returns the current GdkGLDrawable.
207 	 * Returns: the current GdkGLDrawable or NULL if there is no current drawable. <<Rendering Context OpenGL Pixmap>>
208 	 */
209 	public static GLDrawable getCurrent()
210 	{
211 		// GdkGLDrawable* gdk_gl_drawable_get_current (void);
212 		auto p = gdk_gl_drawable_get_current();
213 		
214 		if(p is null)
215 		{
216 			return null;
217 		}
218 		
219 		return ObjectG.getDObject!(GLDrawable)(cast(GdkGLDrawable*) p);
220 	}
221 }