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 = 27 * outPack = pango 28 * outFile = PgLayoutIter 29 * strct = PangoLayoutIter 30 * realStrct= 31 * ctorStrct= 32 * clss = PgLayoutIter 33 * interf = 34 * class Code: No 35 * interface Code: No 36 * template for: 37 * extend = 38 * implements: 39 * prefixes: 40 * - pango_layout_iter_ 41 * omit structs: 42 * omit prefixes: 43 * omit code: 44 * omit signals: 45 * imports: 46 * - pango.PgLayout 47 * - pango.PgLayoutLine 48 * structWrap: 49 * - PangoLayout* -> PgLayout 50 * - PangoLayoutIter* -> PgLayoutIter 51 * - PangoLayoutLine* -> PgLayoutLine 52 * module aliases: 53 * local aliases: 54 * overrides: 55 */ 56 57 module pango.PgLayoutIter; 58 59 public import gtkc.pangotypes; 60 61 private import gtkc.pango; 62 private import glib.ConstructionException; 63 private import gobject.ObjectG; 64 65 66 private import pango.PgLayout; 67 private import pango.PgLayoutLine; 68 69 70 71 72 /** 73 * While complete access to the layout capabilities of Pango is provided 74 * using the detailed interfaces for itemization and shaping, using 75 * that functionality directly involves writing a fairly large amount 76 * of code. The objects and functions in this section provide a 77 * high-level driver for formatting entire paragraphs of text 78 * at once. 79 */ 80 public class PgLayoutIter 81 { 82 83 /** the main Gtk struct */ 84 protected PangoLayoutIter* pangoLayoutIter; 85 86 87 public PangoLayoutIter* getPgLayoutIterStruct() 88 { 89 return pangoLayoutIter; 90 } 91 92 93 /** the main Gtk struct as a void* */ 94 protected void* getStruct() 95 { 96 return cast(void*)pangoLayoutIter; 97 } 98 99 /** 100 * Sets our main struct and passes it to the parent class 101 */ 102 public this (PangoLayoutIter* pangoLayoutIter) 103 { 104 this.pangoLayoutIter = pangoLayoutIter; 105 } 106 107 /** 108 */ 109 110 /** 111 * Copies a PangoLayoutIter. 112 * Since 1.20 113 * Returns: the newly allocated PangoLayoutIter, which should be freed with pango_layout_iter_free(), or NULL if iter was NULL. 114 */ 115 public PgLayoutIter copy() 116 { 117 // PangoLayoutIter * pango_layout_iter_copy (PangoLayoutIter *iter); 118 auto p = pango_layout_iter_copy(pangoLayoutIter); 119 120 if(p is null) 121 { 122 return null; 123 } 124 125 return ObjectG.getDObject!(PgLayoutIter)(cast(PangoLayoutIter*) p); 126 } 127 128 /** 129 * Frees an iterator that's no longer in use. 130 */ 131 public void free() 132 { 133 // void pango_layout_iter_free (PangoLayoutIter *iter); 134 pango_layout_iter_free(pangoLayoutIter); 135 } 136 137 /** 138 * Moves iter forward to the next run in visual order. If iter was 139 * already at the end of the layout, returns FALSE. 140 * Returns: whether motion was possible. 141 */ 142 public int nextRun() 143 { 144 // gboolean pango_layout_iter_next_run (PangoLayoutIter *iter); 145 return pango_layout_iter_next_run(pangoLayoutIter); 146 } 147 148 /** 149 * Moves iter forward to the next character in visual order. If iter was already at 150 * the end of the layout, returns FALSE. 151 * Returns: whether motion was possible. 152 */ 153 public int nextChar() 154 { 155 // gboolean pango_layout_iter_next_char (PangoLayoutIter *iter); 156 return pango_layout_iter_next_char(pangoLayoutIter); 157 } 158 159 /** 160 * Moves iter forward to the next cluster in visual order. If iter 161 * was already at the end of the layout, returns FALSE. 162 * Returns: whether motion was possible. 163 */ 164 public int nextCluster() 165 { 166 // gboolean pango_layout_iter_next_cluster (PangoLayoutIter *iter); 167 return pango_layout_iter_next_cluster(pangoLayoutIter); 168 } 169 170 /** 171 * Moves iter forward to the start of the next line. If iter is 172 * already on the last line, returns FALSE. 173 * Returns: whether motion was possible. 174 */ 175 public int nextLine() 176 { 177 // gboolean pango_layout_iter_next_line (PangoLayoutIter *iter); 178 return pango_layout_iter_next_line(pangoLayoutIter); 179 } 180 181 /** 182 * Determines whether iter is on the last line of the layout. 183 * Returns: TRUE if iter is on the last line. 184 */ 185 public int atLastLine() 186 { 187 // gboolean pango_layout_iter_at_last_line (PangoLayoutIter *iter); 188 return pango_layout_iter_at_last_line(pangoLayoutIter); 189 } 190 191 /** 192 * Gets the current byte index. Note that iterating forward by char 193 * moves in visual order, not logical order, so indexes may not be 194 * sequential. Also, the index may be equal to the length of the text 195 * in the layout, if on the NULL run (see pango_layout_iter_get_run()). 196 * Returns: current byte index. 197 */ 198 public int getIndex() 199 { 200 // int pango_layout_iter_get_index (PangoLayoutIter *iter); 201 return pango_layout_iter_get_index(pangoLayoutIter); 202 } 203 204 /** 205 * Gets the Y position of the current line's baseline, in layout 206 * coordinates (origin at top left of the entire layout). 207 * Returns: baseline of current line. 208 */ 209 public int getBaseline() 210 { 211 // int pango_layout_iter_get_baseline (PangoLayoutIter *iter); 212 return pango_layout_iter_get_baseline(pangoLayoutIter); 213 } 214 215 /** 216 * Gets the current run. When iterating by run, at the end of each 217 * line, there's a position with a NULL run, so this function can return 218 * NULL. The NULL run at the end of each line ensures that all lines have 219 * at least one run, even lines consisting of only a newline. 220 * Use the faster pango_layout_iter_get_run_readonly() if you do not plan 221 * to modify the contents of the run (glyphs, glyph widths, etc.). 222 * Returns: the current run. [transfer none] 223 */ 224 public PangoLayoutRun* getRun() 225 { 226 // PangoLayoutRun * pango_layout_iter_get_run (PangoLayoutIter *iter); 227 return pango_layout_iter_get_run(pangoLayoutIter); 228 } 229 230 /** 231 * Gets the current run. When iterating by run, at the end of each 232 * line, there's a position with a NULL run, so this function can return 233 * NULL. The NULL run at the end of each line ensures that all lines have 234 * at least one run, even lines consisting of only a newline. 235 * This is a faster alternative to pango_layout_iter_get_run(), 236 * but the user is not expected 237 * to modify the contents of the run (glyphs, glyph widths, etc.). 238 * Since 1.16 239 * Returns: the current run, that should not be modified. [transfer none] 240 */ 241 public PangoLayoutRun* getRunReadonly() 242 { 243 // PangoLayoutRun * pango_layout_iter_get_run_readonly (PangoLayoutIter *iter); 244 return pango_layout_iter_get_run_readonly(pangoLayoutIter); 245 } 246 247 /** 248 * Gets the current line. 249 * Use the faster pango_layout_iter_get_line_readonly() if you do not plan 250 * to modify the contents of the line (glyphs, glyph widths, etc.). 251 * Returns: the current line. 252 */ 253 public PgLayoutLine getLine() 254 { 255 // PangoLayoutLine * pango_layout_iter_get_line (PangoLayoutIter *iter); 256 auto p = pango_layout_iter_get_line(pangoLayoutIter); 257 258 if(p is null) 259 { 260 return null; 261 } 262 263 return ObjectG.getDObject!(PgLayoutLine)(cast(PangoLayoutLine*) p); 264 } 265 266 /** 267 * Gets the current line for read-only access. 268 * This is a faster alternative to pango_layout_iter_get_line(), 269 * but the user is not expected 270 * to modify the contents of the line (glyphs, glyph widths, etc.). 271 * Since 1.16 272 * Returns: the current line, that should not be modified. [transfer none] 273 */ 274 public PgLayoutLine getLineReadonly() 275 { 276 // PangoLayoutLine * pango_layout_iter_get_line_readonly (PangoLayoutIter *iter); 277 auto p = pango_layout_iter_get_line_readonly(pangoLayoutIter); 278 279 if(p is null) 280 { 281 return null; 282 } 283 284 return ObjectG.getDObject!(PgLayoutLine)(cast(PangoLayoutLine*) p); 285 } 286 287 /** 288 * Gets the layout associated with a PangoLayoutIter. 289 * Since 1.20 290 * Returns: the layout associated with iter. [transfer none] 291 */ 292 public PgLayout getLayout() 293 { 294 // PangoLayout * pango_layout_iter_get_layout (PangoLayoutIter *iter); 295 auto p = pango_layout_iter_get_layout(pangoLayoutIter); 296 297 if(p is null) 298 { 299 return null; 300 } 301 302 return ObjectG.getDObject!(PgLayout)(cast(PangoLayout*) p); 303 } 304 305 /** 306 * Gets the extents of the current character, in layout coordinates 307 * (origin is the top left of the entire layout). Only logical extents 308 * can sensibly be obtained for characters; ink extents make sense only 309 * down to the level of clusters. 310 * Params: 311 * logicalRect = rectangle to fill with 312 * logical extents. [out caller-allocates] 313 */ 314 public void getCharExtents(PangoRectangle* logicalRect) 315 { 316 // void pango_layout_iter_get_char_extents (PangoLayoutIter *iter, PangoRectangle *logical_rect); 317 pango_layout_iter_get_char_extents(pangoLayoutIter, logicalRect); 318 } 319 320 /** 321 * Gets the extents of the current cluster, in layout coordinates 322 * (origin is the top left of the entire layout). 323 * Params: 324 * inkRect = rectangle to fill with ink extents, or NULL. [out][allow-none] 325 * logicalRect = rectangle to fill with logical extents, or NULL. [out][allow-none] 326 */ 327 public void getClusterExtents(PangoRectangle* inkRect, PangoRectangle* logicalRect) 328 { 329 // void pango_layout_iter_get_cluster_extents (PangoLayoutIter *iter, PangoRectangle *ink_rect, PangoRectangle *logical_rect); 330 pango_layout_iter_get_cluster_extents(pangoLayoutIter, inkRect, logicalRect); 331 } 332 333 /** 334 * Gets the extents of the current run in layout coordinates 335 * (origin is the top left of the entire layout). 336 * Params: 337 * inkRect = rectangle to fill with ink extents, or NULL. [out][allow-none] 338 * logicalRect = rectangle to fill with logical extents, or NULL. [out][allow-none] 339 */ 340 public void getRunExtents(PangoRectangle* inkRect, PangoRectangle* logicalRect) 341 { 342 // void pango_layout_iter_get_run_extents (PangoLayoutIter *iter, PangoRectangle *ink_rect, PangoRectangle *logical_rect); 343 pango_layout_iter_get_run_extents(pangoLayoutIter, inkRect, logicalRect); 344 } 345 346 /** 347 * Divides the vertical space in the PangoLayout being iterated over 348 * between the lines in the layout, and returns the space belonging to 349 * the current line. A line's range includes the line's logical 350 * extents, plus half of the spacing above and below the line, if 351 * pango_layout_set_spacing() has been called to set layout spacing. 352 * The Y positions are in layout coordinates (origin at top left of the 353 * entire layout). 354 * Params: 355 * y0_ = start of line, or NULL. [out][allow-none] 356 * y1_ = end of line, or NULL. [out][allow-none] 357 */ 358 public void getLineYrange(out int y0_, out int y1_) 359 { 360 // void pango_layout_iter_get_line_yrange (PangoLayoutIter *iter, int *y0_, int *y1_); 361 pango_layout_iter_get_line_yrange(pangoLayoutIter, &y0_, &y1_); 362 } 363 364 /** 365 * Obtains the extents of the current line. ink_rect or logical_rect 366 * can be NULL if you aren't interested in them. Extents are in layout 367 * coordinates (origin is the top-left corner of the entire 368 * PangoLayout). Thus the extents returned by this function will be 369 * the same width/height but not at the same x/y as the extents 370 * returned from pango_layout_line_get_extents(). 371 * Params: 372 * inkRect = rectangle to fill with ink extents, or NULL. [out][allow-none] 373 * logicalRect = rectangle to fill with logical extents, or NULL. [out][allow-none] 374 */ 375 public void getLineExtents(PangoRectangle* inkRect, PangoRectangle* logicalRect) 376 { 377 // void pango_layout_iter_get_line_extents (PangoLayoutIter *iter, PangoRectangle *ink_rect, PangoRectangle *logical_rect); 378 pango_layout_iter_get_line_extents(pangoLayoutIter, inkRect, logicalRect); 379 } 380 381 /** 382 * Obtains the extents of the PangoLayout being iterated 383 * over. ink_rect or logical_rect can be NULL if you 384 * aren't interested in them. 385 * Params: 386 * inkRect = rectangle to fill with ink extents, 387 * or NULL. [out][allow-none] 388 * logicalRect = rectangle to fill with logical 389 * extents, or NULL. [out][allow-none] 390 */ 391 public void getLayoutExtents(PangoRectangle* inkRect, PangoRectangle* logicalRect) 392 { 393 // void pango_layout_iter_get_layout_extents (PangoLayoutIter *iter, PangoRectangle *ink_rect, PangoRectangle *logical_rect); 394 pango_layout_iter_get_layout_extents(pangoLayoutIter, inkRect, logicalRect); 395 } 396 }