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