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 module glgtk.GLWidget;
26 
27 private import glgdk.GLConfig;
28 private import glgdk.GLContext;
29 private import glgdk.GLWindow;
30 private import gobject.ObjectG;
31 private import gtk.Widget;
32 private import gtkglc.glgtk;
33 public  import gtkglc.glgtktypes;
34 
35 
36 /** */
37 
38 /** */
39 public bool beginGl(Widget widget)
40 {
41 	return gtk_widget_begin_gl((widget is null) ? null : widget.getWidgetStruct()) != 0;
42 }
43 
44 /**
45  * Creates a new #GdkGLContext with the appropriate #GdkGLDrawable
46  * for this widget. The GL context must be freed when you're
47  * finished with it. See also gtk_widget_get_gl_context().
48  *
49  * Params:
50  *     widget = a #GtkWidget.
51  *     shareList = the #GdkGLContext with which to share display lists and texture objects. NULL indicates that no sharing is to take place.
52  *     direct = whether rendering is to be done with a direct connection to the graphics system.
53  *     renderType = GDK_GL_RGBA_TYPE.
54  *
55  * Return: the new #GdkGLContext.
56  */
57 public GLContext createGlContext(Widget widget, GLContext shareList, bool direct, int renderType)
58 {
59 	auto p = gtk_widget_create_gl_context((widget is null) ? null : widget.getWidgetStruct(), (shareList is null) ? null : shareList.getGLContextStruct(), direct, renderType);
60 	
61 	if(p is null)
62 	{
63 		return null;
64 	}
65 	
66 	return ObjectG.getDObject!(GLContext)(cast(GdkGLContext*) p);
67 }
68 
69 /** */
70 public void widgetEndGl(Widget widget, bool doSwap)
71 {
72 	gtk_widget_end_gl((widget is null) ? null : widget.getWidgetStruct(), doSwap);
73 }
74 
75 /**
76  * Returns the #GdkGLConfig referred by the @widget.
77  *
78  * Params:
79  *     widget = a #GtkWidget.
80  *
81  * Return: the #GdkGLConfig.
82  */
83 public GLConfig getGlConfig(Widget widget)
84 {
85 	auto p = gtk_widget_get_gl_config((widget is null) ? null : widget.getWidgetStruct());
86 	
87 	if(p is null)
88 	{
89 		return null;
90 	}
91 	
92 	return ObjectG.getDObject!(GLConfig)(cast(GdkGLConfig*) p);
93 }
94 
95 /**
96  * Returns the #GdkGLContext with the appropriate #GdkGLDrawable
97  * for this widget. Unlike the GL context returned by
98  * gtk_widget_create_gl_context(),  this context is owned by the widget.
99  *
100  * #GdkGLContext is needed for the function gdk_gl_drawable_begin,
101  * or for sharing display lists (see gtk_widget_set_gl_capability()).
102  *
103  * Params:
104  *     widget = a #GtkWidget.
105  *
106  * Return: the #GdkGLContext.
107  */
108 public GLContext getGlContext(Widget widget)
109 {
110 	auto p = gtk_widget_get_gl_context((widget is null) ? null : widget.getWidgetStruct());
111 	
112 	if(p is null)
113 	{
114 		return null;
115 	}
116 	
117 	return ObjectG.getDObject!(GLContext)(cast(GdkGLContext*) p);
118 }
119 
120 /**
121  * Returns the #GdkGLWindow owned by the @widget.
122  *
123  * Params:
124  *     widget = a #GtkWidget.
125  *
126  * Return: the #GdkGLWindow.
127  */
128 public GLWindow getGlWindow(Widget widget)
129 {
130 	auto p = gtk_widget_get_gl_window((widget is null) ? null : widget.getWidgetStruct());
131 	
132 	if(p is null)
133 	{
134 		return null;
135 	}
136 	
137 	return ObjectG.getDObject!(GLWindow)(cast(GdkGLWindow*) p);
138 }
139 
140 /**
141  * Returns whether the @widget is OpenGL-capable.
142  *
143  * Params:
144  *     widget = a #GtkWidget.
145  *
146  * Return: TRUE if the @widget is OpenGL-capable, FALSE otherwise.
147  */
148 public bool isGlCapable(Widget widget)
149 {
150 	return gtk_widget_is_gl_capable((widget is null) ? null : widget.getWidgetStruct()) != 0;
151 }
152 
153 /**
154  * Set the OpenGL-capability to the @widget.
155  * This function prepares the widget for its use with OpenGL.
156  *
157  * Params:
158  *     widget = the #GtkWidget to be used as the rendering area.
159  *     glconfig = a #GdkGLConfig.
160  *     shareList = the #GdkGLContext with which to share display lists and texture objects. NULL indicates that no sharing is to take place.
161  *     direct = whether rendering is to be done with a direct connection to the graphics system.
162  *     renderType = GDK_GL_RGBA_TYPE.
163  *
164  * Return: TRUE if it is successful, FALSE otherwise.
165  */
166 public bool setGlCapability(Widget widget, GLConfig glconfig, GLContext shareList, bool direct, int renderType)
167 {
168 	return gtk_widget_set_gl_capability((widget is null) ? null : widget.getWidgetStruct(), (glconfig is null) ? null : glconfig.getGLConfigStruct(), (shareList is null) ? null : shareList.getGLContextStruct(), direct, renderType) != 0;
169 }