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