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