File: GLConfig.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 (402 lines) | stat: -rw-r--r-- 10,603 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
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
/*
 * 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.GLConfig;

private import gdk.Display;
private import gdk.Screen;
private import gdk.Visual;
private import glib.ConstructionException;
private import gobject.ObjectG;
private import gtkglc.glgdk;
public  import gtkglc.glgdktypes;


/** */
public class GLConfig : ObjectG
{
	/** the main Gtk struct */
	protected GdkGLConfig* gdkGLConfig;

	/** Get the main Gtk struct */
	public GdkGLConfig* getGLConfigStruct()
	{
		return gdkGLConfig;
	}

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

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

	/**
	 * Creates a mew OpenGL frame buffer configuration that match the specified display mode,
	 * or the fallback mode.
	 * Params:
	 *  mode = display mode bit mask.
	 *  fallback = Try this mode if first fails.
	 * Throws: ConstructionException if configuring GL fails
	 */
	this(GdkGLConfigMode mode, GdkGLConfigMode fallback)
	{
		gdkGLConfig = cast(GdkGLConfig*)gdk_gl_config_new_by_mode(mode);
		
		if ( gdkGLConfig is null )
		{
			gdkGLConfig = cast(GdkGLConfig*)gdk_gl_config_new_by_mode(fallback);
		}
		if ( gdkGLConfig is null )
		{
			throw new ConstructionException("GL configure failed");
		}
		
		this(gdkGLConfig);
	}

	/**
	 */

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

	/**
	 * Returns an OpenGL frame buffer configuration that match the specified
	 * attributes.
	 *
	 * attrib_list is a int array that contains the attribute/value pairs.
	 * Available attributes are:
	 * GDK_GL_USE_GL, GDK_GL_BUFFER_SIZE, GDK_GL_LEVEL, GDK_GL_RGBA,
	 * GDK_GL_DOUBLEBUFFER, GDK_GL_STEREO, GDK_GL_AUX_BUFFERS,
	 * GDK_GL_RED_SIZE, GDK_GL_GREEN_SIZE, GDK_GL_BLUE_SIZE, GDK_GL_ALPHA_SIZE,
	 * GDK_GL_DEPTH_SIZE, GDK_GL_STENCIL_SIZE, GDK_GL_ACCUM_RED_SIZE,
	 * GDK_GL_ACCUM_GREEN_SIZE, GDK_GL_ACCUM_BLUE_SIZE, GDK_GL_ACCUM_ALPHA_SIZE.
	 *
	 * Params:
	 *     attribList = a list of attribute/value pairs.
	 *     nAttribs = the number of attributes and values in attrib_list.
	 *
	 * Return: the new #GdkGLConfig.
	 *
	 * Throws: ConstructionException GTK+ fails to create the object.
	 */
	public this(int[] attribList)
	{
		auto p = gdk_gl_config_new(attribList.ptr, cast(size_t)attribList.length);
		
		if(p is null)
		{
			throw new ConstructionException("null returned by new");
		}
		
		this(cast(GdkGLConfig*) p, true);
	}

	/**
	 * Returns an OpenGL frame buffer configuration that match the specified
	 * display mode.
	 *
	 * Params:
	 *     mode = display mode bit mask.
	 *
	 * Return: the new #GdkGLConfig.
	 *
	 * Throws: ConstructionException GTK+ fails to create the object.
	 */
	public this(GdkGLConfigMode mode)
	{
		auto p = gdk_gl_config_new_by_mode(mode);
		
		if(p is null)
		{
			throw new ConstructionException("null returned by new_by_mode");
		}
		
		this(cast(GdkGLConfig*) p, true);
	}

	/**
	 * Returns an OpenGL frame buffer configuration that match the specified
	 * display mode.
	 *
	 * Params:
	 *     screen = target screen.
	 *     mode = display mode bit mask.
	 *
	 * Return: the new #GdkGLConfig.
	 *
	 * Throws: ConstructionException GTK+ fails to create the object.
	 */
	public this(Screen screen, GdkGLConfigMode mode)
	{
		auto p = gdk_gl_config_new_by_mode_for_screen((screen is null) ? null : screen.getScreenStruct(), mode);
		
		if(p is null)
		{
			throw new ConstructionException("null returned by new_by_mode_for_screen");
		}
		
		this(cast(GdkGLConfig*) p, true);
	}

	/**
	 * Returns an OpenGL frame buffer configuration that match the specified
	 * attributes.
	 *
	 * attrib_list is a int array that contains the attribute/value pairs.
	 * Available attributes are:
	 * GDK_GL_USE_GL, GDK_GL_BUFFER_SIZE, GDK_GL_LEVEL, GDK_GL_RGBA,
	 * GDK_GL_DOUBLEBUFFER, GDK_GL_STEREO, GDK_GL_AUX_BUFFERS,
	 * GDK_GL_RED_SIZE, GDK_GL_GREEN_SIZE, GDK_GL_BLUE_SIZE, GDK_GL_ALPHA_SIZE,
	 * GDK_GL_DEPTH_SIZE, GDK_GL_STENCIL_SIZE, GDK_GL_ACCUM_RED_SIZE,
	 * GDK_GL_ACCUM_GREEN_SIZE, GDK_GL_ACCUM_BLUE_SIZE, GDK_GL_ACCUM_ALPHA_SIZE.
	 *
	 * Params:
	 *     attribList = a list of attribute/value pairs.
	 *     nAttribs = the number of attributes and values in attrib_list.
	 *
	 * Return: the new #GdkGLConfig.
	 *
	 * Throws: ConstructionException GTK+ fails to create the object.
	 */
	public this(Display display, int[] attribList)
	{
		auto p = gdk_gl_config_new_for_display((display is null) ? null : display.getDisplayStruct(), attribList.ptr, cast(size_t)attribList.length);
		
		if(p is null)
		{
			throw new ConstructionException("null returned by new_for_display");
		}
		
		this(cast(GdkGLConfig*) p, true);
	}

	/**
	 * Returns an OpenGL frame buffer configuration that match the specified
	 * attributes.
	 *
	 * attrib_list is a int array that contains the attribute/value pairs.
	 * Available attributes are:
	 * GDK_GL_USE_GL, GDK_GL_BUFFER_SIZE, GDK_GL_LEVEL, GDK_GL_RGBA,
	 * GDK_GL_DOUBLEBUFFER, GDK_GL_STEREO, GDK_GL_AUX_BUFFERS,
	 * GDK_GL_RED_SIZE, GDK_GL_GREEN_SIZE, GDK_GL_BLUE_SIZE, GDK_GL_ALPHA_SIZE,
	 * GDK_GL_DEPTH_SIZE, GDK_GL_STENCIL_SIZE, GDK_GL_ACCUM_RED_SIZE,
	 * GDK_GL_ACCUM_GREEN_SIZE, GDK_GL_ACCUM_BLUE_SIZE, GDK_GL_ACCUM_ALPHA_SIZE.
	 *
	 * Params:
	 *     screen = target screen.
	 *     attribList = a list of attribute/value pairs.
	 *     nAttribs = the number of attributes and values in attrib_list.
	 *
	 * Return: the new #GdkGLConfig.
	 *
	 * Throws: ConstructionException GTK+ fails to create the object.
	 */
	public this(Screen screen, int[] attribList)
	{
		auto p = gdk_gl_config_new_for_screen((screen is null) ? null : screen.getScreenStruct(), attribList.ptr, cast(size_t)attribList.length);
		
		if(p is null)
		{
			throw new ConstructionException("null returned by new_for_screen");
		}
		
		this(cast(GdkGLConfig*) p, true);
	}

	/**
	 * Gets information about a OpenGL frame buffer configuration.
	 *
	 * Params:
	 *     attribute = the attribute to be returned.
	 *     value = returns the requested value.
	 *
	 * Return: TRUE if it succeeded, FALSE otherwise.
	 */
	public bool getAttrib(int attribute, out int value)
	{
		return gdk_gl_config_get_attrib(gdkGLConfig, attribute, &value) != 0;
	}

	/**
	 * Gets the color depth of the OpenGL-capable visual.
	 *
	 * Return: number of bits per pixel
	 */
	public int getDepth()
	{
		return gdk_gl_config_get_depth(gdkGLConfig);
	}

	/**
	 * Gets the layer plane (level) of the frame buffer.
	 * Zero is the default frame buffer.
	 * Positive layer planes correspond to frame buffers that overlay the default
	 * buffer, and negative layer planes correspond to frame buffers that underlie
	 * the default frame buffer.
	 *
	 * Return: layer plane.
	 */
	public int getLayerPlane()
	{
		return gdk_gl_config_get_layer_plane(gdkGLConfig);
	}

	/**
	 * Gets the number of auxiliary color buffers.
	 *
	 * Return: number of auxiliary color buffers.
	 */
	public int getNAuxBuffers()
	{
		return gdk_gl_config_get_n_aux_buffers(gdkGLConfig);
	}

	/**
	 * Gets the number of multisample buffers.
	 *
	 * Return: number of multisample buffers.
	 */
	public int getNSampleBuffers()
	{
		return gdk_gl_config_get_n_sample_buffers(gdkGLConfig);
	}

	/**
	 * Gets #GdkScreen.
	 *
	 * Return: the #GdkScreen.
	 */
	public Screen getScreen()
	{
		auto p = gdk_gl_config_get_screen(gdkGLConfig);
		
		if(p is null)
		{
			return null;
		}
		
		return ObjectG.getDObject!(Screen)(cast(GdkScreen*) p);
	}

	/**
	 * Gets the #GdkVisual that is appropriate for the OpenGL frame buffer
	 * configuration.
	 *
	 * Return: the appropriate #GdkVisual.
	 */
	public Visual getVisual()
	{
		auto p = gdk_gl_config_get_visual(gdkGLConfig);
		
		if(p is null)
		{
			return null;
		}
		
		return ObjectG.getDObject!(Visual)(cast(GdkVisual*) p);
	}

	/**
	 * Returns whether the configured frame buffer has accumulation buffer.
	 *
	 * Return: TRUE if the frame buffer has accumulation buffer, FALSE otherwise.
	 */
	public bool hasAccumBuffer()
	{
		return gdk_gl_config_has_accum_buffer(gdkGLConfig) != 0;
	}

	/**
	 * Returns whether the configured color buffer has alpha bits.
	 *
	 * Return: TRUE if the color buffer has alpha bits, FALSE otherwise.
	 */
	public bool hasAlpha()
	{
		return gdk_gl_config_has_alpha(gdkGLConfig) != 0;
	}

	/**
	 * Returns whether the configured frame buffer has depth buffer.
	 *
	 * Return: TRUE if the frame buffer has depth buffer, FALSE otherwise.
	 */
	public bool hasDepthBuffer()
	{
		return gdk_gl_config_has_depth_buffer(gdkGLConfig) != 0;
	}

	/**
	 * Returns whether the configured frame buffer has stencil buffer.
	 *
	 * Return: TRUE if the frame buffer has stencil buffer, FALSE otherwise.
	 */
	public bool hasStencilBuffer()
	{
		return gdk_gl_config_has_stencil_buffer(gdkGLConfig) != 0;
	}

	/**
	 * Returns whether the configuration supports the double-buffered visual.
	 *
	 * Return: TRUE if the double-buffered visual is supported, FALSE otherwise.
	 */
	public bool isDoubleBuffered()
	{
		return gdk_gl_config_is_double_buffered(gdkGLConfig) != 0;
	}

	/**
	 * Returns whether the configured frame buffer is RGBA mode.
	 *
	 * Return: TRUE if the configured frame buffer is RGBA mode, FALSE otherwise.
	 */
	public bool isRgba()
	{
		return gdk_gl_config_is_rgba(gdkGLConfig) != 0;
	}

	/**
	 * Returns whether the configuration supports the stereo visual.
	 *
	 * Return: TRUE if the stereo visual is supported, FALSE otherwise.
	 */
	public bool isStereo()
	{
		return gdk_gl_config_is_stereo(gdkGLConfig) != 0;
	}
}