File: GLWindow.d

package info (click to toggle)
gtk-d 3.10.0-2
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 20,152 kB
  • sloc: javascript: 565; sh: 71; makefile: 25
file content (186 lines) | stat: -rw-r--r-- 5,025 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
/*
 * This file is part of gtkD.
 *
 * gtkD is free software; you can redistribute it and/or modify
 * it under the terms of the GNU Lesser General Public License
 * as published by the Free Software Foundation; either version 3
 * of the License, or (at your option) any later version, with
 * some exceptions, please read the COPYING file.
 *
 * gtkD is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public License
 * along with gtkD; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110, USA
 */

// generated automatically - do not change
// find conversion definition on APILookup.txt
// implement new conversion functionalities on the wrap.utils pakage


module glgdk.GLWindow;

private import gdk.Window;
private import glgdk.GLConfig;
private import glgdk.GLDrawableIF;
private import glgdk.GLDrawableT;
private import glib.ConstructionException;
private import gobject.ObjectG;
private import gtkglc.glgdk;
public  import gtkglc.glgdktypes;


/** */
public class GLWindow : ObjectG, GLDrawableIF
{
	/** the main Gtk struct */
	protected GdkGLWindow* gdkGLWindow;

	/** Get the main Gtk struct */
	public GdkGLWindow* getGLWindowStruct()
	{
		return gdkGLWindow;
	}

	/** the main Gtk struct as a void* */
	protected override void* getStruct()
	{
		return cast(void*)gdkGLWindow;
	}

	/**
	 * Sets our main struct and passes it to the parent class.
	 */
	public this (GdkGLWindow* gdkGLWindow, bool ownedRef = false)
	{
		this.gdkGLWindow = gdkGLWindow;
		super(cast(GObject*)gdkGLWindow, ownedRef);
	}

	// add the GLDrawable capabilities
	mixin GLDrawableT!(GdkGLWindow);


	/** */
	public static GType getType()
	{
		return gdk_gl_window_get_type();
	}

	/**
	 * Creates an on-screen rendering area.
	 * attrib_list is currently unused. This must be set to NULL or empty
	 * (first attribute of None). See GLX 1.3 spec.
	 *
	 * Params:
	 *     glconfig = a #GdkGLConfig.
	 *     window = the #GdkWindow to be used as the rendering area.
	 *     attribList = this must be set to NULL or empty (first attribute of None).
	 *
	 * Return: the new #GdkGLWindow.
	 *
	 * Throws: ConstructionException GTK+ fails to create the object.
	 */
	public this(GLConfig glconfig, Window window, int* attribList)
	{
		auto p = gdk_gl_window_new((glconfig is null) ? null : glconfig.getGLConfigStruct(), (window is null) ? null : window.getWindowStruct(), attribList);
		
		if(p is null)
		{
			throw new ConstructionException("null returned by new");
		}
		
		this(cast(GdkGLWindow*) p, true);
	}

	/**
	 * Returns the #GdkGLWindow held by the @window.
	 *
	 * Params:
	 *     window = a #GdkWindow.
	 *
	 * Return: the #GdkGLWindow.
	 */
	public static GLWindow getGlWindow(Window window)
	{
		auto p = gdk_window_get_gl_window((window is null) ? null : window.getWindowStruct());
		
		if(p is null)
		{
			return null;
		}
		
		return ObjectG.getDObject!(GLWindow)(cast(GdkGLWindow*) p);
	}

	/**
	 * Returns whether the @window is OpenGL-capable.
	 *
	 * Params:
	 *     window = a #GdkWindow.
	 *
	 * Return: TRUE if the @window is OpenGL-capable, FALSE otherwise.
	 */
	public static bool isGlCapable(Window window)
	{
		return gdk_window_is_gl_capable((window is null) ? null : window.getWindowStruct()) != 0;
	}

	/**
	 * Set the OpenGL-capability to the @window.
	 * This function creates a new #GdkGLWindow held by the @window.
	 * attrib_list is currently unused. This must be set to NULL or empty
	 * (first attribute of None).
	 *
	 * Params:
	 *     window = the #GdkWindow to be used as the rendering area.
	 *     glconfig = a #GdkGLConfig.
	 *     attribList = this must be set to NULL or empty (first attribute of None).
	 *
	 * Return: the #GdkGLWindow used by the @window if it is successful, NULL otherwise.
	 */
	public static GLWindow setGlCapability(Window window, GLConfig glconfig, int* attribList)
	{
		auto p = gdk_window_set_gl_capability((window is null) ? null : window.getWindowStruct(), (glconfig is null) ? null : glconfig.getGLConfigStruct(), attribList);
		
		if(p is null)
		{
			return null;
		}
		
		return ObjectG.getDObject!(GLWindow)(cast(GdkGLWindow*) p);
	}

	/**
	 * Unset the OpenGL-capability of the @window.
	 * This function destroys the #GdkGLWindow held by the @window.
	 *
	 * Params:
	 *     window = a #GdkWindow.
	 */
	public static void unsetGlCapability(Window window)
	{
		gdk_window_unset_gl_capability((window is null) ? null : window.getWindowStruct());
	}

	/**
	 * Returns the #GdkWindow associated with @glwindow.
	 *
	 * Return: the #GdkWindow associated with @glwindow.
	 */
	public Window getWindow()
	{
		auto p = gdk_gl_window_get_window(gdkGLWindow);
		
		if(p is null)
		{
			return null;
		}
		
		return ObjectG.getDObject!(Window)(cast(GdkWindow*) p);
	}
}