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 = GLWidget 33 * interf = 34 * class Code: Yes 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.GLDrawable 48 * - glgdk.GLConfig 49 * - glgdk.GLContext 50 * - glgdk.GLWindow 51 * structWrap: 52 * - GdkGLConfig* -> GLConfig 53 * - GdkGLContext* -> GLContext 54 * - GdkGLDrawable* -> Drawable 55 * - GdkGLWindow* -> GLWindow 56 * - GtkWidget* -> Widget 57 * module aliases: 58 * local aliases: 59 * overrides: 60 */ 61 62 module glgtk.GLWidget; 63 64 public import gtkglc.glgtktypes; 65 66 private import gtkglc.glgtk; 67 private import glib.ConstructionException; 68 private import gobject.ObjectG; 69 70 71 private import gtk.Widget; 72 private import glgdk.GLDrawable; 73 private import glgdk.GLConfig; 74 private import glgdk.GLContext; 75 private import glgdk.GLWindow; 76 77 78 79 80 /** 81 * Description 82 * GtkGLExt is an extension to GTK which adds OpenGL capabilities to 83 * GtkWidget. Its use is quite simple: use gtk_widget_set_gl_capability 84 * to add OpenGL support to a widget, it will create a OpenGL drawable 85 * (GdkGLDrawable) for the widget, which can be obtained via 86 * gtk_widget_get_gl_drawable. OpenGL rendering context (GdkGLContext) 87 * can also be obtained via gtk_widget_get_gl_context. 88 * With GdkGLDrawable and GdkGLContext, gdk_gl_drawable_gl_begin and 89 * gdk_gl_drawable_gl_end can be called, and OpenGL function calls can 90 * be made between those two functions. 91 */ 92 public class GLWidget 93 { 94 95 /** 96 * Gets the GL Frawable for (from???) the widget 97 * Params: 98 * widget = 99 * Returns: a new GLDrawable 100 */ 101 static GLDrawable getGLDrawable(Widget widget) 102 { 103 auto p = gtk_widget_get_gl_window((widget is null) ? null : widget.getWidgetStruct()); 104 105 if ( p is null ) 106 { 107 return null; 108 } 109 110 return ObjectG.getDObject!(GLDrawable)(cast(GdkGLDrawable*)p); 111 } 112 113 /** 114 */ 115 116 /** 117 * Set the OpenGL-capability to the widget. 118 * This function prepares the widget for its use with OpenGL. 119 * Params: 120 * widget = the GtkWidget to be used as the rendering area. 121 * glconfig = a GdkGLConfig. 122 * shareList = the GdkGLContext with which to share display lists and texture 123 * objects. NULL indicates that no sharing is to take place. 124 * direct = whether rendering is to be done with a direct connection to 125 * the graphics system. 126 * renderType = GDK_GL_RGBA_TYPE or GDK_GL_COLOR_INDEX_TYPE (currently not 127 * used). 128 * Returns: TRUE if it is successful, FALSE otherwise. 129 */ 130 public static int setGLCapability(Widget widget, GLConfig glconfig, GLContext shareList, int direct, int renderType) 131 { 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); 134 } 135 136 /** 137 * Returns whether the widget is OpenGL-capable. 138 * Params: 139 * widget = a GtkWidget. 140 * Returns: TRUE if the widget is OpenGL-capable, FALSE otherwise. 141 */ 142 public static int isGLCapable(Widget widget) 143 { 144 // gboolean gtk_widget_is_gl_capable (GtkWidget *widget); 145 return gtk_widget_is_gl_capable((widget is null) ? null : widget.getWidgetStruct()); 146 } 147 148 /** 149 * Returns the GdkGLConfig referred by the widget. 150 * Params: 151 * widget = a GtkWidget. 152 * Returns: the GdkGLConfig. 153 */ 154 public static GLConfig getGLConfig(Widget widget) 155 { 156 // GdkGLConfig* gtk_widget_get_gl_config (GtkWidget *widget); 157 auto p = gtk_widget_get_gl_config((widget is null) ? null : widget.getWidgetStruct()); 158 159 if(p is null) 160 { 161 return null; 162 } 163 164 return ObjectG.getDObject!(GLConfig)(cast(GdkGLConfig*) p); 165 } 166 167 /** 168 * Creates a new GdkGLContext with the appropriate GdkGLDrawable 169 * for this widget. The GL context must be freed when you're 170 * finished with it. See also gtk_widget_get_gl_context(). 171 * Params: 172 * widget = a GtkWidget. 173 * shareList = the GdkGLContext with which to share display lists and texture 174 * objects. NULL indicates that no sharing is to take place. 175 * direct = whether rendering is to be done with a direct connection to 176 * the graphics system. 177 * renderType = GDK_GL_RGBA_TYPE or GDK_GL_COLOR_INDEX_TYPE (currently not 178 * used). 179 * Returns: the new GdkGLContext. 180 */ 181 public static GLContext createGLContext(Widget widget, GLContext shareList, int direct, int renderType) 182 { 183 // GdkGLContext* gtk_widget_create_gl_context (GtkWidget *widget, GdkGLContext *share_list, gboolean direct, int render_type); 184 auto p = gtk_widget_create_gl_context((widget is null) ? null : widget.getWidgetStruct(), (shareList is null) ? null : shareList.getGLContextStruct(), direct, renderType); 185 186 if(p is null) 187 { 188 return null; 189 } 190 191 return ObjectG.getDObject!(GLContext)(cast(GdkGLContext*) p); 192 } 193 194 /** 195 * Returns the GdkGLContext with the appropriate GdkGLDrawable 196 * for this widget. Unlike the GL context returned by 197 * gtk_widget_create_gl_context(), this context is owned by the widget. 198 * GdkGLContext is needed for the function gdk_gl_drawable_begin, 199 * or for sharing display lists (see gtk_widget_set_gl_capability()). 200 * Params: 201 * widget = a GtkWidget. 202 * Returns: the GdkGLContext. 203 */ 204 public static GLContext getGLContext(Widget widget) 205 { 206 // GdkGLContext* gtk_widget_get_gl_context (GtkWidget *widget); 207 auto p = gtk_widget_get_gl_context((widget is null) ? null : widget.getWidgetStruct()); 208 209 if(p is null) 210 { 211 return null; 212 } 213 214 return ObjectG.getDObject!(GLContext)(cast(GdkGLContext*) p); 215 } 216 217 /** 218 * Returns the GdkGLWindow owned by the widget. 219 * Params: 220 * widget = a GtkWidget. 221 * Returns: the GdkGLWindow. 222 */ 223 public static GLWindow getGLWindow(Widget widget) 224 { 225 // GdkGLWindow* gtk_widget_get_gl_window (GtkWidget *widget); 226 auto p = gtk_widget_get_gl_window((widget is null) ? null : widget.getWidgetStruct()); 227 228 if(p is null) 229 { 230 return null; 231 } 232 233 return ObjectG.getDObject!(GLWindow)(cast(GdkGLWindow*) p); 234 } 235 }