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 = gtk-Graphics-Contexts.html 27 * outPack = gtk 28 * outFile = GCs 29 * strct = 30 * realStrct= 31 * ctorStrct= 32 * clss = GCs 33 * interf = 34 * class Code: No 35 * interface Code: No 36 * template for: 37 * extend = 38 * implements: 39 * prefixes: 40 * - gtk_gc_ 41 * - gtk_ 42 * omit structs: 43 * omit prefixes: 44 * omit code: 45 * omit signals: 46 * imports: 47 * - gdk.GC 48 * - gdk.Colormap 49 * structWrap: 50 * - GdkColormap* -> Colormap 51 * - GdkGC* -> GC 52 * module aliases: 53 * local aliases: 54 * overrides: 55 */ 56 57 module gtk.GCs; 58 59 public import gtkc.gtktypes; 60 61 private import gtkc.gtk; 62 private import glib.ConstructionException; 63 private import gobject.ObjectG; 64 65 66 private import gdk.GC; 67 private import gdk.Colormap; 68 69 70 71 72 /** 73 * Description 74 * These functions provide access to a shared pool of GdkGC objects. 75 * When a new GdkGC is needed, gtk_gc_get() is called with the required depth, 76 * colormap and GdkGCValues. If a GdkGC with the required properties already 77 * exists then that is returned. If not, a new GdkGC is created. 78 * When the GdkGC is no longer needed, gtk_gc_release() should be called. 79 */ 80 public class GCs 81 { 82 83 /** 84 */ 85 86 /** 87 * Gets a GdkGC with the given depth, colormap and GdkGCValues. 88 * If a GdkGC with the given properties already exists then it is returned, 89 * otherwise a new GdkGC is created. 90 * The returned GdkGC should be released with gtk_gc_release() when it is no 91 * longer needed. 92 * Params: 93 * depth = the depth of the GdkGC to create. 94 * colormap = the GdkColormap (FIXME: I don't know why this is needed). 95 * values = a GdkGCValues struct containing settings for the GdkGC. 96 * valuesMask = a set of flags indicating which of the fields in values has 97 * been set. 98 * Returns: a GdkGC. 99 */ 100 public static GC get(int depth, Colormap colormap, GdkGCValues* values, GdkGCValuesMask valuesMask) 101 { 102 // GdkGC * gtk_gc_get (gint depth, GdkColormap *colormap, GdkGCValues *values, GdkGCValuesMask values_mask); 103 auto p = gtk_gc_get(depth, (colormap is null) ? null : colormap.getColormapStruct(), values, valuesMask); 104 105 if(p is null) 106 { 107 return null; 108 } 109 110 return ObjectG.getDObject!(GC)(cast(GdkGC*) p); 111 } 112 113 /** 114 * Releases a GdkGC allocated using gtk_gc_get(). 115 * Params: 116 * gc = a GdkGC. 117 */ 118 public static void release(GC gc) 119 { 120 // void gtk_gc_release (GdkGC *gc); 121 gtk_gc_release((gc is null) ? null : gc.getGCStruct()); 122 } 123 }