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 private import gtk.Widget;
69 private import glgdk.GLConfig;
70 private import glgdk.GLContext;
71 private import glgdk.GLWindow;
72 
73 
74 
75 /**
76  */
77 
78 /**
79  * Set the OpenGL-capability to the widget.
80  * This function prepares the widget for its use with OpenGL.
81  * Params:
82  * widget = the GtkWidget to be used as the rendering area.
83  * glconfig = a GdkGLConfig.
84  * shareList = the GdkGLContext with which to share display lists and texture
85  * objects. NULL indicates that no sharing is to take place. [allow-none]
86  * direct = whether rendering is to be done with a direct connection to
87  * the graphics system.
88  * renderType = GDK_GL_RGBA_TYPE.
89  * Returns: TRUE if it is successful, FALSE otherwise.
90  */
91 public static int setGLCapability(Widget widget, GLConfig glconfig, GLContext shareList, int direct, int renderType)
92 {
93 	// gboolean gtk_widget_set_gl_capability (GtkWidget *widget,  GdkGLConfig *glconfig,  GdkGLContext *share_list,  gboolean direct,  int render_type);
94 	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);
95 }
96 
97 /**
98  * Returns whether the widget is OpenGL-capable.
99  * Params:
100  * widget = a GtkWidget.
101  * Returns: TRUE if the widget is OpenGL-capable, FALSE otherwise.
102  */
103 public static int isGLCapable(Widget widget)
104 {
105 	// gboolean gtk_widget_is_gl_capable (GtkWidget *widget);
106 	return gtk_widget_is_gl_capable((widget is null) ? null : widget.getWidgetStruct());
107 }
108 
109 /**
110  * Returns the GdkGLConfig referred by the widget.
111  * Params:
112  * widget = a GtkWidget.
113  * Returns: the GdkGLConfig.
114  */
115 public static GLConfig getGLConfig(Widget widget)
116 {
117 	// GdkGLConfig * gtk_widget_get_gl_config (GtkWidget *widget);
118 	auto p = gtk_widget_get_gl_config((widget is null) ? null : widget.getWidgetStruct());
119 	
120 	if(p is null)
121 	{
122 		return null;
123 	}
124 	
125 	return ObjectG.getDObject!(GLConfig)(cast(GdkGLConfig*) p);
126 }
127 
128 /**
129  * Creates a new GdkGLContext with the appropriate GdkGLDrawable
130  * for this widget. The GL context must be freed when you're
131  * finished with it. See also gtk_widget_get_gl_context().
132  * Params:
133  * widget = a GtkWidget.
134  * shareList = the GdkGLContext with which to share display lists and texture
135  * objects. NULL indicates that no sharing is to take place. [allow-none]
136  * direct = whether rendering is to be done with a direct connection to
137  * the graphics system.
138  * renderType = GDK_GL_RGBA_TYPE.
139  * Returns: the new GdkGLContext.
140  */
141 public static GLContext createGLContext(Widget widget, GLContext shareList, int direct, int renderType)
142 {
143 	// GdkGLContext * gtk_widget_create_gl_context (GtkWidget *widget,  GdkGLContext *share_list,  gboolean direct,  int render_type);
144 	auto p = gtk_widget_create_gl_context((widget is null) ? null : widget.getWidgetStruct(), (shareList is null) ? null : shareList.getGLContextStruct(), direct, renderType);
145 	
146 	if(p is null)
147 	{
148 		return null;
149 	}
150 	
151 	return ObjectG.getDObject!(GLContext)(cast(GdkGLContext*) p);
152 }
153 
154 /**
155  * Returns the GdkGLContext with the appropriate GdkGLDrawable
156  * for this widget. Unlike the GL context returned by
157  * gtk_widget_create_gl_context(), this context is owned by the widget.
158  * GdkGLContext is needed for the function gdk_gl_drawable_begin,
159  * or for sharing display lists (see gtk_widget_set_gl_capability()).
160  * Params:
161  * widget = a GtkWidget.
162  * Returns: the GdkGLContext.
163  */
164 public static GLContext getGLContext(Widget widget)
165 {
166 	// GdkGLContext * gtk_widget_get_gl_context (GtkWidget *widget);
167 	auto p = gtk_widget_get_gl_context((widget is null) ? null : widget.getWidgetStruct());
168 	
169 	if(p is null)
170 	{
171 		return null;
172 	}
173 	
174 	return ObjectG.getDObject!(GLContext)(cast(GdkGLContext*) p);
175 }
176 
177 /**
178  * Returns the GdkGLWindow owned by the widget.
179  * Params:
180  * widget = a GtkWidget.
181  * Returns: the GdkGLWindow.
182  */
183 public static GLWindow getGLWindow(Widget widget)
184 {
185 	// GdkGLWindow * gtk_widget_get_gl_window (GtkWidget *widget);
186 	auto p = gtk_widget_get_gl_window((widget is null) ? null : widget.getWidgetStruct());
187 	
188 	if(p is null)
189 	{
190 		return null;
191 	}
192 	
193 	return ObjectG.getDObject!(GLWindow)(cast(GdkGLWindow*) p);
194 }
195