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-gtkglwidget.html
27  * outPack = glgtk
28  * outFile = GLWidget
29  * strct   = 
30  * realStrct=
31  * ctorStrct=
32  * clss    = 
33  * interf  = 
34  * class Code: No
35  * interface Code: No
36  * template for:
37  * extend  = 
38  * implements:
39  * prefixes:
40  * 	- gtk_widget_
41  * omit structs:
42  * omit prefixes:
43  * omit code:
44  * omit signals:
45  * imports:
46  * 	- gtk.Widget
47  * 	- glgdk.GLConfig
48  * 	- glgdk.GLContext
49  * 	- glgdk.GLWindow
50  * structWrap:
51  * 	- GdkGLConfig* -> GLConfig
52  * 	- GdkGLContext* -> GLContext
53  * 	- GdkGLWindow* -> GLWindow
54  * 	- GtkWidget* -> Widget
55  * module aliases:
56  * local aliases:
57  * overrides:
58  */
59 
60 module glgtk.GLWidget;
61 
62 public  import gtkglc.glgtktypes;
63 
64 private import gtkglc.glgtk;
65 private import glib.ConstructionException;
66 private import gobject.ObjectG;
67 
68 
69 private import gtk.Widget;
70 private import glgdk.GLConfig;
71 private import glgdk.GLContext;
72 private import glgdk.GLWindow;
73 
74 
75 
76 
77 /**
78  */
79 
80 /**
81  * Set the OpenGL-capability to the widget.
82  * This function prepares the widget for its use with OpenGL.
83  * Params:
84  * widget = the GtkWidget to be used as the rendering area.
85  * glconfig = a GdkGLConfig.
86  * shareList = the GdkGLContext with which to share display lists and texture
87  * objects. NULL indicates that no sharing is to take place. [allow-none]
88  * direct = whether rendering is to be done with a direct connection to
89  * the graphics system.
90  * renderType = GDK_GL_RGBA_TYPE.
91  * Returns: TRUE if it is successful, FALSE otherwise.
92  */
93 public static int setGLCapability(Widget widget, GLConfig glconfig, GLContext shareList, int direct, int renderType)
94 {
95 	// gboolean gtk_widget_set_gl_capability (GtkWidget *widget,  GdkGLConfig *glconfig,  GdkGLContext *share_list,  gboolean direct,  int render_type);
96 	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);
97 }
98 
99 /**
100  * Returns whether the widget is OpenGL-capable.
101  * Params:
102  * widget = a GtkWidget.
103  * Returns: TRUE if the widget is OpenGL-capable, FALSE otherwise.
104  */
105 public static int isGLCapable(Widget widget)
106 {
107 	// gboolean gtk_widget_is_gl_capable (GtkWidget *widget);
108 	return gtk_widget_is_gl_capable((widget is null) ? null : widget.getWidgetStruct());
109 }
110 
111 /**
112  * Returns the GdkGLConfig referred by the widget.
113  * Params:
114  * widget = a GtkWidget.
115  * Returns: the GdkGLConfig.
116  */
117 public static GLConfig getGLConfig(Widget widget)
118 {
119 	// GdkGLConfig * gtk_widget_get_gl_config (GtkWidget *widget);
120 	auto p = gtk_widget_get_gl_config((widget is null) ? null : widget.getWidgetStruct());
121 	
122 	if(p is null)
123 	{
124 		return null;
125 	}
126 	
127 	return ObjectG.getDObject!(GLConfig)(cast(GdkGLConfig*) p);
128 }
129 
130 /**
131  * Creates a new GdkGLContext with the appropriate GdkGLDrawable
132  * for this widget. The GL context must be freed when you're
133  * finished with it. See also gtk_widget_get_gl_context().
134  * Params:
135  * widget = a GtkWidget.
136  * shareList = the GdkGLContext with which to share display lists and texture
137  * objects. NULL indicates that no sharing is to take place. [allow-none]
138  * direct = whether rendering is to be done with a direct connection to
139  * the graphics system.
140  * renderType = GDK_GL_RGBA_TYPE.
141  * Returns: the new GdkGLContext.
142  */
143 public static GLContext createGLContext(Widget widget, GLContext shareList, int direct, int renderType)
144 {
145 	// GdkGLContext * gtk_widget_create_gl_context (GtkWidget *widget,  GdkGLContext *share_list,  gboolean direct,  int render_type);
146 	auto p = gtk_widget_create_gl_context((widget is null) ? null : widget.getWidgetStruct(), (shareList is null) ? null : shareList.getGLContextStruct(), direct, renderType);
147 	
148 	if(p is null)
149 	{
150 		return null;
151 	}
152 	
153 	return ObjectG.getDObject!(GLContext)(cast(GdkGLContext*) p);
154 }
155 
156 /**
157  * Returns the GdkGLContext with the appropriate GdkGLDrawable
158  * for this widget. Unlike the GL context returned by
159  * gtk_widget_create_gl_context(), this context is owned by the widget.
160  * GdkGLContext is needed for the function gdk_gl_drawable_begin,
161  * or for sharing display lists (see gtk_widget_set_gl_capability()).
162  * Params:
163  * widget = a GtkWidget.
164  * Returns: the GdkGLContext.
165  */
166 public static GLContext getGLContext(Widget widget)
167 {
168 	// GdkGLContext * gtk_widget_get_gl_context (GtkWidget *widget);
169 	auto p = gtk_widget_get_gl_context((widget is null) ? null : widget.getWidgetStruct());
170 	
171 	if(p is null)
172 	{
173 		return null;
174 	}
175 	
176 	return ObjectG.getDObject!(GLContext)(cast(GdkGLContext*) p);
177 }
178 
179 /**
180  * Returns the GdkGLWindow owned by the widget.
181  * Params:
182  * widget = a GtkWidget.
183  * Returns: the GdkGLWindow.
184  */
185 public static GLWindow getGLWindow(Widget widget)
186 {
187 	// GdkGLWindow * gtk_widget_get_gl_window (GtkWidget *widget);
188 	auto p = gtk_widget_get_gl_window((widget is null) ? null : widget.getWidgetStruct());
189 	
190 	if(p is null)
191 	{
192 		return null;
193 	}
194 	
195 	return ObjectG.getDObject!(GLWindow)(cast(GdkGLWindow*) p);
196 }
197