alternative to assert
[gtkD.git] / srcgl / glgtk / GLWidget.d
blob0aaaf38d5a5547755534739d2623a7a5caa988e4
1 /*
2 * This file is part of duit.
4 * duit 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 * duit 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 duit; 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 = /usr/share/doc/libgtkglext1-doc/html/gtkglext/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 * local aliases:
58 module glgtk.GLWidget;
60 private import glgtk.glgtktypes;
62 private import lib.glgtk;
64 private import gtk.Widget;
65 private import glgdk.GLDrawable;
66 private import glgdk.GLConfig;
67 private import glgdk.GLContext;
68 private import glgdk.GLWindow;
70 /**
71 * Description
72 * GtkGLExt is an extension to GTK which adds OpenGL capabilities to
73 * GtkWidget. Its use is quite simple: use gtk_widget_set_gl_capability
74 * to add OpenGL support to a widget, it will create a OpenGL drawable
75 * (GdkGLDrawable) for the widget, which can be obtained via
76 * gtk_widget_get_gl_drawable. OpenGL rendering context (GdkGLContext)
77 * can also be obtained via gtk_widget_get_gl_context.
78 * With GdkGLDrawable and GdkGLContext, gdk_gl_drawable_gl_begin and
79 * gdk_gl_drawable_gl_end can be called, and OpenGL function calls can
80 * be made between those two functions.
82 public class GLWidget
85 /**
86 * Gets the GL Frawable for (from???) the widget
87 * @param widget
88 * @return a new GLDrawable
90 static GLDrawable getGLDrawable(Widget widget)
92 return new GLDrawable(cast(GdkGLDrawable*)gtk_widget_get_gl_window((widget is null) ? null : widget.getWidgetStruct()));
95 /**
98 /**
99 * Set the OpenGL-capability to the widget.
100 * This function prepares the widget for its use with OpenGL.
101 * widget : the GtkWidget to be used as the rendering area.
102 * glconfig : a GdkGLConfig.
103 * share_list : the GdkGLContext with which to share display lists and texture
104 * objects. NULL indicates that no sharing is to take place.
105 * direct : whether rendering is to be done with a direct connection to
106 * the graphics system.
107 * render_type : GDK_GL_RGBA_TYPE or GDK_GL_COLOR_INDEX_TYPE (currently not
108 * used).
109 * Returns : TRUE if it is successful, FALSE otherwise.
111 public static int setGLCapability(Widget widget, GLConfig glconfig, GLContext shareList, int direct, int renderType)
113 // gboolean gtk_widget_set_gl_capability (GtkWidget *widget, GdkGLConfig *glconfig, GdkGLContext *share_list, gboolean direct, int render_type);
114 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);
118 * Returns whether the widget is OpenGL-capable.
119 * widget : a GtkWidget.
120 * Returns : TRUE if the widget is OpenGL-capable, FALSE otherwise.
122 public static int isGLCapable(Widget widget)
124 // gboolean gtk_widget_is_gl_capable (GtkWidget *widget);
125 return gtk_widget_is_gl_capable((widget is null) ? null : widget.getWidgetStruct());
129 * Returns the GdkGLConfig referred by the widget.
130 * widget : a GtkWidget.
131 * Returns : the GdkGLConfig.
133 public static GLConfig getGLConfig(Widget widget)
135 // GdkGLConfig* gtk_widget_get_gl_config (GtkWidget *widget);
136 return new GLConfig( gtk_widget_get_gl_config((widget is null) ? null : widget.getWidgetStruct()) );
140 * Creates a new GdkGLContext with the appropriate GdkGLDrawable
141 * for this widget. The GL context must be freed when you're
142 * finished with it. See also gtk_widget_get_gl_context().
143 * widget : a GtkWidget.
144 * share_list : the GdkGLContext with which to share display lists and texture
145 * objects. NULL indicates that no sharing is to take place.
146 * direct : whether rendering is to be done with a direct connection to
147 * the graphics system.
148 * render_type : GDK_GL_RGBA_TYPE or GDK_GL_COLOR_INDEX_TYPE (currently not
149 * used).
150 * Returns : the new GdkGLContext.
152 public static GLContext createGLContext(Widget widget, GLContext shareList, int direct, int renderType)
154 // GdkGLContext* gtk_widget_create_gl_context (GtkWidget *widget, GdkGLContext *share_list, gboolean direct, int render_type);
155 return new GLContext( gtk_widget_create_gl_context((widget is null) ? null : widget.getWidgetStruct(), (shareList is null) ? null : shareList.getGLContextStruct(), direct, renderType) );
159 * Returns the GdkGLContext with the appropriate GdkGLDrawable
160 * for this widget. Unlike the GL context returned by
161 * gtk_widget_create_gl_context(), this context is owned by the widget.
162 * GdkGLContext is needed for the function gdk_gl_drawable_begin,
163 * or for sharing display lists (see gtk_widget_set_gl_capability()).
164 * widget : a GtkWidget.
165 * Returns : the GdkGLContext.
167 public static GLContext getGLContext(Widget widget)
169 // GdkGLContext* gtk_widget_get_gl_context (GtkWidget *widget);
170 return new GLContext( gtk_widget_get_gl_context((widget is null) ? null : widget.getWidgetStruct()) );
174 * Returns the GdkGLWindow owned by the widget.
175 * widget : a GtkWidget.
176 * Returns : the GdkGLWindow.
178 public static GLWindow getGLWindow(Widget widget)
180 // GdkGLWindow* gtk_widget_get_gl_window (GtkWidget *widget);
181 return new GLWindow( gtk_widget_get_gl_window((widget is null) ? null : widget.getWidgetStruct()) );