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