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.PgGlyphItemIter; 26 27 private import glib.Str; 28 private import glib.c.functions; 29 private import gobject.ObjectG; 30 public import gtkc.pangotypes; 31 private import gtkd.Loader; 32 private import pango.PgGlyphItem; 33 private import pango.c.functions; 34 public import pango.c.types; 35 36 37 /** 38 * A #PangoGlyphItemIter is an iterator over the clusters in a 39 * #PangoGlyphItem. The <firstterm>forward direction</firstterm> of the 40 * iterator is the logical direction of text. That is, with increasing 41 * @start_index and @start_char values. If @glyph_item is right-to-left 42 * (that is, if <literal>@glyph_item->item->analysis.level</literal> is odd), 43 * then @start_glyph decreases as the iterator moves forward. Moreover, 44 * in right-to-left cases, @start_glyph is greater than @end_glyph. 45 * 46 * An iterator should be initialized using either of 47 * pango_glyph_item_iter_init_start() and 48 * pango_glyph_item_iter_init_end(), for forward and backward iteration 49 * respectively, and walked over using any desired mixture of 50 * pango_glyph_item_iter_next_cluster() and 51 * pango_glyph_item_iter_prev_cluster(). A common idiom for doing a 52 * forward iteration over the clusters is: 53 * <programlisting> 54 * PangoGlyphItemIter cluster_iter; 55 * gboolean have_cluster; 56 * 57 * for (have_cluster = pango_glyph_item_iter_init_start (&cluster_iter, 58 * glyph_item, text); 59 * have_cluster; 60 * have_cluster = pango_glyph_item_iter_next_cluster (&cluster_iter)) 61 * { 62 * ... 63 * } 64 * </programlisting> 65 * 66 * Note that @text is the start of the text for layout, which is then 67 * indexed by <literal>@glyph_item->item->offset</literal> to get to the 68 * text of @glyph_item. The @start_index and @end_index values can directly 69 * index into @text. The @start_glyph, @end_glyph, @start_char, and @end_char 70 * values however are zero-based for the @glyph_item. For each cluster, the 71 * item pointed at by the start variables is included in the cluster while 72 * the one pointed at by end variables is not. 73 * 74 * None of the members of a #PangoGlyphItemIter should be modified manually. 75 * 76 * Since: 1.22 77 */ 78 public final class PgGlyphItemIter 79 { 80 /** the main Gtk struct */ 81 protected PangoGlyphItemIter* pangoGlyphItemIter; 82 protected bool ownedRef; 83 84 /** Get the main Gtk struct */ 85 public PangoGlyphItemIter* getPgGlyphItemIterStruct(bool transferOwnership = false) 86 { 87 if (transferOwnership) 88 ownedRef = false; 89 return pangoGlyphItemIter; 90 } 91 92 /** the main Gtk struct as a void* */ 93 protected void* getStruct() 94 { 95 return cast(void*)pangoGlyphItemIter; 96 } 97 98 /** 99 * Sets our main struct and passes it to the parent class. 100 */ 101 public this (PangoGlyphItemIter* pangoGlyphItemIter, bool ownedRef = false) 102 { 103 this.pangoGlyphItemIter = pangoGlyphItemIter; 104 this.ownedRef = ownedRef; 105 } 106 107 ~this () 108 { 109 if ( Linker.isLoaded(LIBRARY_PANGO) && ownedRef ) 110 pango_glyph_item_iter_free(pangoGlyphItemIter); 111 } 112 113 114 /** */ 115 public @property PgGlyphItem glyphItem() 116 { 117 return ObjectG.getDObject!(PgGlyphItem)(pangoGlyphItemIter.glyphItem, false); 118 } 119 120 /** Ditto */ 121 public @property void glyphItem(PgGlyphItem value) 122 { 123 pangoGlyphItemIter.glyphItem = value.getPgGlyphItemStruct(); 124 } 125 126 /** */ 127 public @property string text() 128 { 129 return Str.toString(pangoGlyphItemIter.text); 130 } 131 132 /** Ditto */ 133 public @property void text(string value) 134 { 135 pangoGlyphItemIter.text = Str.toStringz(value); 136 } 137 138 /** */ 139 public @property int startGlyph() 140 { 141 return pangoGlyphItemIter.startGlyph; 142 } 143 144 /** Ditto */ 145 public @property void startGlyph(int value) 146 { 147 pangoGlyphItemIter.startGlyph = value; 148 } 149 150 /** */ 151 public @property int startIndex() 152 { 153 return pangoGlyphItemIter.startIndex; 154 } 155 156 /** Ditto */ 157 public @property void startIndex(int value) 158 { 159 pangoGlyphItemIter.startIndex = value; 160 } 161 162 /** */ 163 public @property int startChar() 164 { 165 return pangoGlyphItemIter.startChar; 166 } 167 168 /** Ditto */ 169 public @property void startChar(int value) 170 { 171 pangoGlyphItemIter.startChar = value; 172 } 173 174 /** */ 175 public @property int endGlyph() 176 { 177 return pangoGlyphItemIter.endGlyph; 178 } 179 180 /** Ditto */ 181 public @property void endGlyph(int value) 182 { 183 pangoGlyphItemIter.endGlyph = value; 184 } 185 186 /** */ 187 public @property int endIndex() 188 { 189 return pangoGlyphItemIter.endIndex; 190 } 191 192 /** Ditto */ 193 public @property void endIndex(int value) 194 { 195 pangoGlyphItemIter.endIndex = value; 196 } 197 198 /** */ 199 public @property int endChar() 200 { 201 return pangoGlyphItemIter.endChar; 202 } 203 204 /** Ditto */ 205 public @property void endChar(int value) 206 { 207 pangoGlyphItemIter.endChar = value; 208 } 209 210 /** */ 211 public static GType getType() 212 { 213 return pango_glyph_item_iter_get_type(); 214 } 215 216 /** 217 * Make a shallow copy of an existing #PangoGlyphItemIter structure. 218 * 219 * Returns: the newly allocated #PangoGlyphItemIter, which should 220 * be freed with pango_glyph_item_iter_free(), or %NULL 221 * if @orig was %NULL. 222 * 223 * Since: 1.22 224 */ 225 public PgGlyphItemIter copy() 226 { 227 auto p = pango_glyph_item_iter_copy(pangoGlyphItemIter); 228 229 if(p is null) 230 { 231 return null; 232 } 233 234 return ObjectG.getDObject!(PgGlyphItemIter)(cast(PangoGlyphItemIter*) p, true); 235 } 236 237 /** 238 * Frees a #PangoGlyphItemIter created by pango_glyph_item_iter_copy(). 239 * 240 * Since: 1.22 241 */ 242 public void free() 243 { 244 pango_glyph_item_iter_free(pangoGlyphItemIter); 245 ownedRef = false; 246 } 247 248 /** 249 * Initializes a #PangoGlyphItemIter structure to point to the 250 * last cluster in a glyph item. 251 * See #PangoGlyphItemIter for details of cluster orders. 252 * 253 * Params: 254 * glyphItem = the glyph item to iterate over 255 * text = text corresponding to the glyph item 256 * 257 * Returns: %FALSE if there are no clusters in the glyph item 258 * 259 * Since: 1.22 260 */ 261 public bool initEnd(PgGlyphItem glyphItem, string text) 262 { 263 return pango_glyph_item_iter_init_end(pangoGlyphItemIter, (glyphItem is null) ? null : glyphItem.getPgGlyphItemStruct(), Str.toStringz(text)) != 0; 264 } 265 266 /** 267 * Initializes a #PangoGlyphItemIter structure to point to the 268 * first cluster in a glyph item. 269 * See #PangoGlyphItemIter for details of cluster orders. 270 * 271 * Params: 272 * glyphItem = the glyph item to iterate over 273 * text = text corresponding to the glyph item 274 * 275 * Returns: %FALSE if there are no clusters in the glyph item 276 * 277 * Since: 1.22 278 */ 279 public bool initStart(PgGlyphItem glyphItem, string text) 280 { 281 return pango_glyph_item_iter_init_start(pangoGlyphItemIter, (glyphItem is null) ? null : glyphItem.getPgGlyphItemStruct(), Str.toStringz(text)) != 0; 282 } 283 284 /** 285 * Advances the iterator to the next cluster in the glyph item. 286 * See #PangoGlyphItemIter for details of cluster orders. 287 * 288 * Returns: %TRUE if the iterator was advanced, %FALSE if we were already on the 289 * last cluster. 290 * 291 * Since: 1.22 292 */ 293 public bool nextCluster() 294 { 295 return pango_glyph_item_iter_next_cluster(pangoGlyphItemIter) != 0; 296 } 297 298 /** 299 * Moves the iterator to the preceding cluster in the glyph item. 300 * See #PangoGlyphItemIter for details of cluster orders. 301 * 302 * Returns: %TRUE if the iterator was moved, %FALSE if we were already on the 303 * first cluster. 304 * 305 * Since: 1.22 306 */ 307 public bool prevCluster() 308 { 309 return pango_glyph_item_iter_prev_cluster(pangoGlyphItemIter) != 0; 310 } 311 }