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 = pango-Coverage-Maps.html 27 * outPack = pango 28 * outFile = PgCoverage 29 * strct = PangoCoverage 30 * realStrct= 31 * ctorStrct= 32 * clss = PgCoverage 33 * interf = 34 * class Code: No 35 * interface Code: No 36 * template for: 37 * extend = 38 * implements: 39 * prefixes: 40 * - pango_coverage_ 41 * omit structs: 42 * omit prefixes: 43 * omit code: 44 * omit signals: 45 * imports: 46 * structWrap: 47 * - PangoCoverage* -> PgCoverage 48 * module aliases: 49 * local aliases: 50 * overrides: 51 */ 52 53 module pango.PgCoverage; 54 55 public import gtkc.pangotypes; 56 57 private import gtkc.pango; 58 private import glib.ConstructionException; 59 private import gobject.ObjectG; 60 61 62 63 64 /** 65 * It is often necessary in Pango to determine if a particular font can 66 * represent a particular character, and also how well it can represent 67 * that character. The PangoCoverage is a data structure that is used 68 * to represent that information. 69 */ 70 public class PgCoverage 71 { 72 73 /** the main Gtk struct */ 74 protected PangoCoverage* pangoCoverage; 75 76 77 /** Get the main Gtk struct */ 78 public PangoCoverage* getPgCoverageStruct() 79 { 80 return pangoCoverage; 81 } 82 83 84 /** the main Gtk struct as a void* */ 85 protected void* getStruct() 86 { 87 return cast(void*)pangoCoverage; 88 } 89 90 /** 91 * Sets our main struct and passes it to the parent class 92 */ 93 public this (PangoCoverage* pangoCoverage) 94 { 95 this.pangoCoverage = pangoCoverage; 96 } 97 98 /** 99 */ 100 101 /** 102 * Create a new PangoCoverage 103 * Throws: ConstructionException GTK+ fails to create the object. 104 */ 105 public this () 106 { 107 // PangoCoverage * pango_coverage_new (void); 108 auto p = pango_coverage_new(); 109 if(p is null) 110 { 111 throw new ConstructionException("null returned by pango_coverage_new()"); 112 } 113 this(cast(PangoCoverage*) p); 114 } 115 116 /** 117 * Increase the reference count on the PangoCoverage by one 118 * Returns: coverage 119 */ 120 public PgCoverage doref() 121 { 122 // PangoCoverage * pango_coverage_ref (PangoCoverage *coverage); 123 auto p = pango_coverage_ref(pangoCoverage); 124 125 if(p is null) 126 { 127 return null; 128 } 129 130 return ObjectG.getDObject!(PgCoverage)(cast(PangoCoverage*) p); 131 } 132 133 /** 134 * Decrease the reference count on the PangoCoverage by one. 135 * If the result is zero, free the coverage and all associated memory. 136 */ 137 public void unref() 138 { 139 // void pango_coverage_unref (PangoCoverage *coverage); 140 pango_coverage_unref(pangoCoverage); 141 } 142 143 /** 144 * Copy an existing PangoCoverage. (This function may now be unnecessary 145 * since we refcount the structure. File a bug if you use it.) 146 * Returns: the newly allocated PangoCoverage, with a reference count of one, which should be freed with pango_coverage_unref(). [transfer full] 147 */ 148 public PgCoverage copy() 149 { 150 // PangoCoverage * pango_coverage_copy (PangoCoverage *coverage); 151 auto p = pango_coverage_copy(pangoCoverage); 152 153 if(p is null) 154 { 155 return null; 156 } 157 158 return ObjectG.getDObject!(PgCoverage)(cast(PangoCoverage*) p); 159 } 160 161 /** 162 * Determine whether a particular index is covered by coverage 163 * Params: 164 * index = the index to check 165 * Returns: the coverage level of coverage for character index_. 166 */ 167 public PangoCoverageLevel get(int index) 168 { 169 // PangoCoverageLevel pango_coverage_get (PangoCoverage *coverage, int index_); 170 return pango_coverage_get(pangoCoverage, index); 171 } 172 173 /** 174 * Set the coverage for each index in coverage to be the max (better) 175 * value of the current coverage for the index and the coverage for 176 * the corresponding index in other. 177 * Params: 178 * other = another PangoCoverage 179 */ 180 public void max(PgCoverage other) 181 { 182 // void pango_coverage_max (PangoCoverage *coverage, PangoCoverage *other); 183 pango_coverage_max(pangoCoverage, (other is null) ? null : other.getPgCoverageStruct()); 184 } 185 186 /** 187 * Modify a particular index within coverage 188 * Params: 189 * index = the index to modify 190 * level = the new level for index_ 191 */ 192 public void set(int index, PangoCoverageLevel level) 193 { 194 // void pango_coverage_set (PangoCoverage *coverage, int index_, PangoCoverageLevel level); 195 pango_coverage_set(pangoCoverage, index, level); 196 } 197 198 /** 199 * Convert a PangoCoverage structure into a flat binary format 200 * Params: 201 * bytes = location to store result (must be freed with g_free()). [out][array length=n_bytes][element-type guint8] 202 */ 203 public void toBytes(out char[] bytes) 204 { 205 // void pango_coverage_to_bytes (PangoCoverage *coverage, guchar **bytes, int *n_bytes); 206 guchar* outbytes = null; 207 int nBytes; 208 209 pango_coverage_to_bytes(pangoCoverage, &outbytes, &nBytes); 210 211 bytes = outbytes[0 .. nBytes]; 212 } 213 214 /** 215 * Convert data generated from pango_converage_to_bytes() back 216 * to a PangoCoverage 217 * Params: 218 * bytes = binary data 219 * representing a PangoCoverage. [array length=n_bytes][element-type guint8] 220 * Returns: a newly allocated PangoCoverage, or NULL if the data was invalid. [transfer full] 221 */ 222 public static PgCoverage fromBytes(char[] bytes) 223 { 224 // PangoCoverage * pango_coverage_from_bytes (guchar *bytes, int n_bytes); 225 auto p = pango_coverage_from_bytes(bytes.ptr, cast(int) bytes.length); 226 227 if(p is null) 228 { 229 return null; 230 } 231 232 return ObjectG.getDObject!(PgCoverage)(cast(PangoCoverage*) p); 233 } 234 }