alternative to assert
[gtkD.git] / gtkD / srcgl / glgtk / GLWidget.d
blob792b14eeb471a9b92f91168aca439b4e708241f6
1 /*
2 * This file is part of gtkD.
4 * gtkD is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU Lesser General Public License as published by
6 * the Free Software Foundation; either version 2.1 of the License, or
7 * (at your option) any later version.
9 * gtkD is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU Lesser General Public License for more details.
14 * You should have received a copy of the GNU Lesser General Public License
15 * along with gtkD; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 // generated automatically - do not change
20 // find conversion definition on APILookup.txt
21 // implement new conversion functionalities on the wrap.utils pakage
24 * Conversion parameters:
25 * inFile = gtkglext-gtkglwidget.html
26 * outPack = glgtk
27 * outFile = GLWidget
28 * strct =
29 * realStrct=
30 * ctorStrct=
31 * clss = GLWidget
32 * interf =
33 * class Code: Yes
34 * interface Code: No
35 * template for:
36 * extend =
37 * implements:
38 * prefixes:
39 * - gtk_widget_
40 * omit structs:
41 * omit prefixes:
42 * omit code:
43 * imports:
44 * - gtk.Widget
45 * - glgdk.GLDrawable
46 * - glgdk.GLConfig
47 * - glgdk.GLContext
48 * - glgdk.GLWindow
49 * structWrap:
50 * - GdkGLConfig* -> GLConfig
51 * - GdkGLContext* -> GLContext
52 * - GdkGLDrawable* -> Drawable
53 * - GdkGLWindow* -> GLWindow
54 * - GtkWidget* -> Widget
55 * module aliases:
56 * local aliases:
59 module glgtk.GLWidget;
61 version(noAssert)
63 version(Tango)
65 import tango.io.Stdout; // use the tango loging?
69 private import gtkglc.glgtktypes;
71 private import gtkglc.glgtk;
74 private import gtk.Widget;
75 private import glgdk.GLDrawable;
76 private import glgdk.GLConfig;
77 private import glgdk.GLContext;
78 private import glgdk.GLWindow;
83 /**
84 * Description
85 * GtkGLExt is an extension to GTK which adds OpenGL capabilities to
86 * GtkWidget. Its use is quite simple: use gtk_widget_set_gl_capability
87 * to add OpenGL support to a widget, it will create a OpenGL drawable
88 * (GdkGLDrawable) for the widget, which can be obtained via
89 * gtk_widget_get_gl_drawable. OpenGL rendering context (GdkGLContext)
90 * can also be obtained via gtk_widget_get_gl_context.
91 * With GdkGLDrawable and GdkGLContext, gdk_gl_drawable_gl_begin and
92 * gdk_gl_drawable_gl_end can be called, and OpenGL function calls can
93 * be made between those two functions.
95 public class GLWidget
98 /**
99 * Gets the GL Frawable for (from???) the widget
100 * @param widget
101 * @return a new GLDrawable
103 static GLDrawable getGLDrawable(Widget widget)
105 return new GLDrawable(cast(GdkGLDrawable*)gtk_widget_get_gl_window((widget is null) ? null : widget.getWidgetStruct()));
112 * Set the OpenGL-capability to the widget.
113 * This function prepares the widget for its use with OpenGL.
114 * widget:
115 * the GtkWidget to be used as the rendering area.
116 * glconfig:
117 * a GdkGLConfig.
118 * share_list:
119 * the GdkGLContext with which to share display lists and texture
120 * objects. NULL indicates that no sharing is to take place.
121 * direct:
122 * whether rendering is to be done with a direct connection to
123 * the graphics system.
124 * render_type:
125 * GDK_GL_RGBA_TYPE or GDK_GL_COLOR_INDEX_TYPE (currently not
126 * used).
127 * Returns:
128 * TRUE if it is successful, FALSE otherwise.
130 public static int setGLCapability(Widget widget, GLConfig glconfig, GLContext shareList, int direct, int renderType)
132 // gboolean gtk_widget_set_gl_capability (GtkWidget *widget, GdkGLConfig *glconfig, GdkGLContext *share_list, gboolean direct, int render_type);
133 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);
137 * Returns whether the widget is OpenGL-capable.
138 * widget:
139 * a GtkWidget.
140 * Returns:
141 * TRUE if the widget is OpenGL-capable, FALSE otherwise.
143 public static int isGLCapable(Widget widget)
145 // gboolean gtk_widget_is_gl_capable (GtkWidget *widget);
146 return gtk_widget_is_gl_capable((widget is null) ? null : widget.getWidgetStruct());
150 * Returns the GdkGLConfig referred by the widget.
151 * widget:
152 * a GtkWidget.
153 * Returns:
154 * the GdkGLConfig.
156 public static GLConfig getGLConfig(Widget widget)
158 // GdkGLConfig* gtk_widget_get_gl_config (GtkWidget *widget);
159 return new GLConfig( gtk_widget_get_gl_config((widget is null) ? null : widget.getWidgetStruct()) );
163 * Creates a new GdkGLContext with the appropriate GdkGLDrawable
164 * for this widget. The GL context must be freed when you're
165 * finished with it. See also gtk_widget_get_gl_context().
166 * widget:
167 * a GtkWidget.
168 * share_list:
169 * the GdkGLContext with which to share display lists and texture
170 * objects. NULL indicates that no sharing is to take place.
171 * direct:
172 * whether rendering is to be done with a direct connection to
173 * the graphics system.
174 * render_type:
175 * GDK_GL_RGBA_TYPE or GDK_GL_COLOR_INDEX_TYPE (currently not
176 * used).
177 * Returns:
178 * the new GdkGLContext.
180 public static GLContext createGLContext(Widget widget, GLContext shareList, int direct, int renderType)
182 // GdkGLContext* gtk_widget_create_gl_context (GtkWidget *widget, GdkGLContext *share_list, gboolean direct, int render_type);
183 return new GLContext( gtk_widget_create_gl_context((widget is null) ? null : widget.getWidgetStruct(), (shareList is null) ? null : shareList.getGLContextStruct(), direct, renderType) );
187 * Returns the GdkGLContext with the appropriate GdkGLDrawable
188 * for this widget. Unlike the GL context returned by
189 * gtk_widget_create_gl_context(), this context is owned by the widget.
190 * GdkGLContext is needed for the function gdk_gl_drawable_begin,
191 * or for sharing display lists (see gtk_widget_set_gl_capability()).
192 * widget:
193 * a GtkWidget.
194 * Returns:
195 * the GdkGLContext.
197 public static GLContext getGLContext(Widget widget)
199 // GdkGLContext* gtk_widget_get_gl_context (GtkWidget *widget);
200 return new GLContext( gtk_widget_get_gl_context((widget is null) ? null : widget.getWidgetStruct()) );
204 * Returns the GdkGLWindow owned by the widget.
205 * widget:
206 * a GtkWidget.
207 * Returns:
208 * the GdkGLWindow.
210 public static GLWindow getGLWindow(Widget widget)
212 // GdkGLWindow* gtk_widget_get_gl_window (GtkWidget *widget);
213 return new GLWindow( gtk_widget_get_gl_window((widget is null) ? null : widget.getWidgetStruct()) );