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 module glgtk.GLWidget; 26 27 private import glgdk.GLConfig; 28 private import glgdk.GLContext; 29 private import glgdk.GLWindow; 30 private import gobject.ObjectG; 31 private import gtk.Widget; 32 private import gtkglc.glgtk; 33 public import gtkglc.glgtktypes; 34 35 36 /** 37 */ 38 39 public bool beginGl(Widget widget) 40 { 41 return gtk_widget_begin_gl((widget is null) ? null : widget.getWidgetStruct()) != 0; 42 } 43 44 /** 45 * Creates a new #GdkGLContext with the appropriate #GdkGLDrawable 46 * for this widget. The GL context must be freed when you're 47 * finished with it. See also gtk_widget_get_gl_context(). 48 * 49 * Params: 50 * widget = a #GtkWidget. 51 * shareList = the #GdkGLContext with which to share display lists and texture objects. NULL indicates that no sharing is to take place. 52 * direct = whether rendering is to be done with a direct connection to the graphics system. 53 * renderType = GDK_GL_RGBA_TYPE. 54 * 55 * Return: the new #GdkGLContext. 56 */ 57 public GLContext createGlContext(Widget widget, GLContext shareList, bool direct, int renderType) 58 { 59 auto p = gtk_widget_create_gl_context((widget is null) ? null : widget.getWidgetStruct(), (shareList is null) ? null : shareList.getGLContextStruct(), direct, renderType); 60 61 if(p is null) 62 { 63 return null; 64 } 65 66 return ObjectG.getDObject!(GLContext)(cast(GdkGLContext*) p); 67 } 68 69 public void widgetEndGl(Widget widget, bool doSwap) 70 { 71 gtk_widget_end_gl((widget is null) ? null : widget.getWidgetStruct(), doSwap); 72 } 73 74 /** 75 * Returns the #GdkGLConfig referred by the @widget. 76 * 77 * Params: 78 * widget = a #GtkWidget. 79 * 80 * Return: the #GdkGLConfig. 81 */ 82 public GLConfig getGlConfig(Widget widget) 83 { 84 auto p = gtk_widget_get_gl_config((widget is null) ? null : widget.getWidgetStruct()); 85 86 if(p is null) 87 { 88 return null; 89 } 90 91 return ObjectG.getDObject!(GLConfig)(cast(GdkGLConfig*) p); 92 } 93 94 /** 95 * Returns the #GdkGLContext with the appropriate #GdkGLDrawable 96 * for this widget. Unlike the GL context returned by 97 * gtk_widget_create_gl_context(), this context is owned by the widget. 98 * 99 * #GdkGLContext is needed for the function gdk_gl_drawable_begin, 100 * or for sharing display lists (see gtk_widget_set_gl_capability()). 101 * 102 * Params: 103 * widget = a #GtkWidget. 104 * 105 * Return: the #GdkGLContext. 106 */ 107 public GLContext getGlContext(Widget widget) 108 { 109 auto p = gtk_widget_get_gl_context((widget is null) ? null : widget.getWidgetStruct()); 110 111 if(p is null) 112 { 113 return null; 114 } 115 116 return ObjectG.getDObject!(GLContext)(cast(GdkGLContext*) p); 117 } 118 119 /** 120 * Returns the #GdkGLWindow owned by the @widget. 121 * 122 * Params: 123 * widget = a #GtkWidget. 124 * 125 * Return: the #GdkGLWindow. 126 */ 127 public GLWindow getGlWindow(Widget widget) 128 { 129 auto p = gtk_widget_get_gl_window((widget is null) ? null : widget.getWidgetStruct()); 130 131 if(p is null) 132 { 133 return null; 134 } 135 136 return ObjectG.getDObject!(GLWindow)(cast(GdkGLWindow*) p); 137 } 138 139 /** 140 * Returns whether the @widget is OpenGL-capable. 141 * 142 * Params: 143 * widget = a #GtkWidget. 144 * 145 * Return: TRUE if the @widget is OpenGL-capable, FALSE otherwise. 146 */ 147 public bool isGlCapable(Widget widget) 148 { 149 return gtk_widget_is_gl_capable((widget is null) ? null : widget.getWidgetStruct()) != 0; 150 } 151 152 /** 153 * Set the OpenGL-capability to the @widget. 154 * This function prepares the widget for its use with OpenGL. 155 * 156 * Params: 157 * widget = the #GtkWidget to be used as the rendering area. 158 * glconfig = a #GdkGLConfig. 159 * shareList = the #GdkGLContext with which to share display lists and texture objects. NULL indicates that no sharing is to take place. 160 * direct = whether rendering is to be done with a direct connection to the graphics system. 161 * renderType = GDK_GL_RGBA_TYPE. 162 * 163 * Return: TRUE if it is successful, FALSE otherwise. 164 */ 165 public bool setGlCapability(Widget widget, GLConfig glconfig, GLContext shareList, bool direct, int renderType) 166 { 167 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) != 0; 168 }