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 = GtkTextIter.html 27 * outPack = gtk 28 * outFile = TextIter 29 * strct = GtkTextIter 30 * realStrct= 31 * ctorStrct= 32 * clss = TextIter 33 * interf = 34 * class Code: Yes 35 * interface Code: No 36 * template for: 37 * extend = 38 * implements: 39 * prefixes: 40 * - gtk_text_iter_ 41 * omit structs: 42 * - GtkTextIter 43 * omit prefixes: 44 * omit code: 45 * omit signals: 46 * imports: 47 * - glib.Str 48 * - glib.ListSG 49 * - gdk.Pixbuf 50 * - gtk.TextAttributes 51 * - gtk.TextBuffer 52 * - gtk.TextChildAnchor 53 * - gtk.TextTag 54 * - gtkc.Loader 55 * - gtkc.paths 56 * - pango.PgLanguage 57 * structWrap: 58 * - GSList* -> ListSG 59 * - GdkPixbuf* -> Pixbuf 60 * - GtkTextAttributes* -> TextAttributes 61 * - GtkTextBuffer* -> TextBuffer 62 * - GtkTextChildAnchor* -> TextChildAnchor 63 * - GtkTextIter* -> TextIter 64 * - GtkTextTag* -> TextTag 65 * - PangoLanguage* -> PgLanguage 66 * module aliases: 67 * local aliases: 68 * overrides: 69 */ 70 71 module gtk.TextIter; 72 73 public import gtkc.gtktypes; 74 75 private import gtkc.gtk; 76 private import glib.ConstructionException; 77 private import gobject.ObjectG; 78 79 private import glib.Str; 80 private import glib.ListSG; 81 private import gdk.Pixbuf; 82 private import gtk.TextAttributes; 83 private import gtk.TextBuffer; 84 private import gtk.TextChildAnchor; 85 private import gtk.TextTag; 86 private import gtkc.Loader; 87 private import gtkc.paths; 88 private import pango.PgLanguage; 89 90 91 private import gobject.Boxed; 92 93 /** 94 * You may wish to begin by reading the text widget 95 * conceptual overview which gives an overview of all the objects and data 96 * types related to the text widget and how they work together. 97 */ 98 public class TextIter : Boxed 99 { 100 101 /** the main Gtk struct */ 102 protected GtkTextIter* gtkTextIter; 103 104 105 /** Get the main Gtk struct */ 106 public GtkTextIter* getTextIterStruct() 107 { 108 return gtkTextIter; 109 } 110 111 112 /** the main Gtk struct as a void* */ 113 protected void* getStruct() 114 { 115 return cast(void*)gtkTextIter; 116 } 117 118 /** 119 * Sets our main struct and passes it to the parent class 120 */ 121 public this (GtkTextIter* gtkTextIter) 122 { 123 this.gtkTextIter = gtkTextIter; 124 } 125 126 /** */ 127 public this() 128 { 129 this(new GtkTextIter); 130 } 131 132 /** 133 */ 134 135 /** 136 * Returns the GtkTextBuffer this iterator is associated with. 137 * Returns: the buffer. [transfer none] 138 */ 139 public TextBuffer getBuffer() 140 { 141 // GtkTextBuffer * gtk_text_iter_get_buffer (const GtkTextIter *iter); 142 auto p = gtk_text_iter_get_buffer(gtkTextIter); 143 144 if(p is null) 145 { 146 return null; 147 } 148 149 return ObjectG.getDObject!(TextBuffer)(cast(GtkTextBuffer*) p); 150 } 151 152 /** 153 * Creates a dynamically-allocated copy of an iterator. This function 154 * is not useful in applications, because iterators can be copied with a 155 * simple assignment (GtkTextIter i = j;). The 156 * function is used by language bindings. 157 * Returns: a copy of the iter, free with gtk_text_iter_free() 158 */ 159 public TextIter copy() 160 { 161 // GtkTextIter * gtk_text_iter_copy (const GtkTextIter *iter); 162 auto p = gtk_text_iter_copy(gtkTextIter); 163 164 if(p is null) 165 { 166 return null; 167 } 168 169 return ObjectG.getDObject!(TextIter)(cast(GtkTextIter*) p); 170 } 171 172 /** 173 * Assigns the value of other to iter. This function 174 * is not useful in applications, because iterators can be assigned 175 * with GtkTextIter i = j;. The 176 * function is used by language bindings. 177 * Params: 178 * other = another GtkTextIter 179 * Since 3.2 180 */ 181 public void assign(TextIter other) 182 { 183 // void gtk_text_iter_assign (GtkTextIter *iter, const GtkTextIter *other); 184 gtk_text_iter_assign(gtkTextIter, (other is null) ? null : other.getTextIterStruct()); 185 } 186 187 /** 188 * Free an iterator allocated on the heap. This function 189 * is intended for use in language bindings, and is not 190 * especially useful for applications, because iterators can 191 * simply be allocated on the stack. 192 */ 193 public void free() 194 { 195 // void gtk_text_iter_free (GtkTextIter *iter); 196 gtk_text_iter_free(gtkTextIter); 197 } 198 199 /** 200 * Returns the character offset of an iterator. 201 * Each character in a GtkTextBuffer has an offset, 202 * starting with 0 for the first character in the buffer. 203 * Use gtk_text_buffer_get_iter_at_offset() to convert an 204 * offset back into an iterator. 205 * Returns: a character offset 206 */ 207 public int getOffset() 208 { 209 // gint gtk_text_iter_get_offset (const GtkTextIter *iter); 210 return gtk_text_iter_get_offset(gtkTextIter); 211 } 212 213 /** 214 * Returns the line number containing the iterator. Lines in 215 * a GtkTextBuffer are numbered beginning with 0 for the first 216 * line in the buffer. 217 * Returns: a line number 218 */ 219 public int getLine() 220 { 221 // gint gtk_text_iter_get_line (const GtkTextIter *iter); 222 return gtk_text_iter_get_line(gtkTextIter); 223 } 224 225 /** 226 * Returns the character offset of the iterator, 227 * counting from the start of a newline-terminated line. 228 * The first character on the line has offset 0. 229 * Returns: offset from start of line 230 */ 231 public int getLineOffset() 232 { 233 // gint gtk_text_iter_get_line_offset (const GtkTextIter *iter); 234 return gtk_text_iter_get_line_offset(gtkTextIter); 235 } 236 237 /** 238 * Returns the byte index of the iterator, counting 239 * from the start of a newline-terminated line. 240 * Remember that GtkTextBuffer encodes text in 241 * UTF-8, and that characters can require a variable 242 * number of bytes to represent. 243 * Returns: distance from start of line, in bytes 244 */ 245 public int getLineIndex() 246 { 247 // gint gtk_text_iter_get_line_index (const GtkTextIter *iter); 248 return gtk_text_iter_get_line_index(gtkTextIter); 249 } 250 251 /** 252 * Returns the number of bytes from the start of the 253 * line to the given iter, not counting bytes that 254 * are invisible due to tags with the "invisible" flag 255 * toggled on. 256 * Returns: byte index of iter with respect to the start of the line 257 */ 258 public int getVisibleLineIndex() 259 { 260 // gint gtk_text_iter_get_visible_line_index (const GtkTextIter *iter); 261 return gtk_text_iter_get_visible_line_index(gtkTextIter); 262 } 263 264 /** 265 * Returns the offset in characters from the start of the 266 * line to the given iter, not counting characters that 267 * are invisible due to tags with the "invisible" flag 268 * toggled on. 269 * Returns: offset in visible characters from the start of the line 270 */ 271 public int getVisibleLineOffset() 272 { 273 // gint gtk_text_iter_get_visible_line_offset (const GtkTextIter *iter); 274 return gtk_text_iter_get_visible_line_offset(gtkTextIter); 275 } 276 277 /** 278 * The Unicode character at this iterator is returned. (Equivalent to 279 * operator* on a C++ iterator.) If the element at this iterator is a 280 * non-character element, such as an image embedded in the buffer, the 281 * Unicode "unknown" character 0xFFFC is returned. If invoked on 282 * the end iterator, zero is returned; zero is not a valid Unicode character. 283 * So you can write a loop which ends when gtk_text_iter_get_char() 284 * returns 0. 285 * Returns: a Unicode character, or 0 if iter is not dereferenceable 286 */ 287 public gunichar getChar() 288 { 289 // gunichar gtk_text_iter_get_char (const GtkTextIter *iter); 290 return gtk_text_iter_get_char(gtkTextIter); 291 } 292 293 /** 294 * Returns the text in the given range. A "slice" is an array of 295 * characters encoded in UTF-8 format, including the Unicode "unknown" 296 * character 0xFFFC for iterable non-character elements in the buffer, 297 * such as images. Because images are encoded in the slice, byte and 298 * character offsets in the returned array will correspond to byte 299 * offsets in the text buffer. Note that 0xFFFC can occur in normal 300 * text as well, so it is not a reliable indicator that a pixbuf or 301 * widget is in the buffer. 302 * Params: 303 * end = iterator at end of a range 304 * Returns: slice of text from the buffer 305 */ 306 public string getSlice(TextIter end) 307 { 308 // gchar * gtk_text_iter_get_slice (const GtkTextIter *start, const GtkTextIter *end); 309 return Str.toString(gtk_text_iter_get_slice(gtkTextIter, (end is null) ? null : end.getTextIterStruct())); 310 } 311 312 /** 313 * Returns text in the given range. If the range 314 * contains non-text elements such as images, the character and byte 315 * offsets in the returned string will not correspond to character and 316 * byte offsets in the buffer. If you want offsets to correspond, see 317 * gtk_text_iter_get_slice(). 318 * Params: 319 * end = iterator at end of a range 320 * Returns: array of characters from the buffer 321 */ 322 public string getText(TextIter end) 323 { 324 // gchar * gtk_text_iter_get_text (const GtkTextIter *start, const GtkTextIter *end); 325 return Str.toString(gtk_text_iter_get_text(gtkTextIter, (end is null) ? null : end.getTextIterStruct())); 326 } 327 328 /** 329 * Like gtk_text_iter_get_slice(), but invisible text is not included. 330 * Invisible text is usually invisible because a GtkTextTag with the 331 * "invisible" attribute turned on has been applied to it. 332 * Params: 333 * end = iterator at end of range 334 * Returns: slice of text from the buffer 335 */ 336 public string getVisibleSlice(TextIter end) 337 { 338 // gchar * gtk_text_iter_get_visible_slice (const GtkTextIter *start, const GtkTextIter *end); 339 return Str.toString(gtk_text_iter_get_visible_slice(gtkTextIter, (end is null) ? null : end.getTextIterStruct())); 340 } 341 342 /** 343 * Like gtk_text_iter_get_text(), but invisible text is not included. 344 * Invisible text is usually invisible because a GtkTextTag with the 345 * "invisible" attribute turned on has been applied to it. 346 * Params: 347 * end = iterator at end of range 348 * Returns: string containing visible text in the range 349 */ 350 public string getVisibleText(TextIter end) 351 { 352 // gchar * gtk_text_iter_get_visible_text (const GtkTextIter *start, const GtkTextIter *end); 353 return Str.toString(gtk_text_iter_get_visible_text(gtkTextIter, (end is null) ? null : end.getTextIterStruct())); 354 } 355 356 /** 357 * If the element at iter is a pixbuf, the pixbuf is returned 358 * (with no new reference count added). Otherwise, 359 * NULL is returned. 360 * Returns: the pixbuf at iter. [transfer none] 361 */ 362 public Pixbuf getPixbuf() 363 { 364 // GdkPixbuf * gtk_text_iter_get_pixbuf (const GtkTextIter *iter); 365 auto p = gtk_text_iter_get_pixbuf(gtkTextIter); 366 367 if(p is null) 368 { 369 return null; 370 } 371 372 return ObjectG.getDObject!(Pixbuf)(cast(GdkPixbuf*) p); 373 } 374 375 /** 376 * Returns a list of all GtkTextMark at this location. Because marks 377 * are not iterable (they don't take up any "space" in the buffer, 378 * they are just marks in between iterable locations), multiple marks 379 * can exist in the same place. The returned list is not in any 380 * meaningful order. 381 * Returns: list of GtkTextMark. [element-type GtkTextMark][transfer container] 382 */ 383 public ListSG getMarks() 384 { 385 // GSList * gtk_text_iter_get_marks (const GtkTextIter *iter); 386 auto p = gtk_text_iter_get_marks(gtkTextIter); 387 388 if(p is null) 389 { 390 return null; 391 } 392 393 return ObjectG.getDObject!(ListSG)(cast(GSList*) p); 394 } 395 396 /** 397 * Returns a list of GtkTextTag that are toggled on or off at this 398 * point. (If toggled_on is TRUE, the list contains tags that are 399 * toggled on.) If a tag is toggled on at iter, then some non-empty 400 * range of characters following iter has that tag applied to it. If 401 * a tag is toggled off, then some non-empty range following iter 402 * does not have the tag applied to it. 403 * Params: 404 * toggledOn = TRUE to get toggled-on tags 405 * Returns: tags toggled at this point. [element-type GtkTextTag][transfer container] 406 */ 407 public ListSG getToggledTags(int toggledOn) 408 { 409 // GSList * gtk_text_iter_get_toggled_tags (const GtkTextIter *iter, gboolean toggled_on); 410 auto p = gtk_text_iter_get_toggled_tags(gtkTextIter, toggledOn); 411 412 if(p is null) 413 { 414 return null; 415 } 416 417 return ObjectG.getDObject!(ListSG)(cast(GSList*) p); 418 } 419 420 /** 421 * If the location at iter contains a child anchor, the 422 * anchor is returned (with no new reference count added). Otherwise, 423 * NULL is returned. 424 * Returns: the anchor at iter. [transfer none] 425 */ 426 public TextChildAnchor getChildAnchor() 427 { 428 // GtkTextChildAnchor * gtk_text_iter_get_child_anchor (const GtkTextIter *iter); 429 auto p = gtk_text_iter_get_child_anchor(gtkTextIter); 430 431 if(p is null) 432 { 433 return null; 434 } 435 436 return ObjectG.getDObject!(TextChildAnchor)(cast(GtkTextChildAnchor*) p); 437 } 438 439 /** 440 * Returns TRUE if tag is toggled on at exactly this point. If tag 441 * is NULL, returns TRUE if any tag is toggled on at this point. 442 * Note that if gtk_text_iter_begins_tag() returns TRUE, it means that iter is 443 * at the beginning of the tagged range, and that the 444 * character at iter is inside the tagged range. In other 445 * words, unlike gtk_text_iter_ends_tag(), if gtk_text_iter_begins_tag() returns 446 * TRUE, gtk_text_iter_has_tag() will also return TRUE for the same 447 * parameters. 448 * Params: 449 * tag = a GtkTextTag, or NULL. [allow-none] 450 * Returns: whether iter is the start of a range tagged with tag 451 */ 452 public int beginsTag(TextTag tag) 453 { 454 // gboolean gtk_text_iter_begins_tag (const GtkTextIter *iter, GtkTextTag *tag); 455 return gtk_text_iter_begins_tag(gtkTextIter, (tag is null) ? null : tag.getTextTagStruct()); 456 } 457 458 /** 459 * Returns TRUE if tag is toggled off at exactly this point. If tag 460 * is NULL, returns TRUE if any tag is toggled off at this point. 461 * Note that if gtk_text_iter_ends_tag() returns TRUE, it means that iter is 462 * at the end of the tagged range, but that the character 463 * at iter is outside the tagged range. In other words, 464 * unlike gtk_text_iter_begins_tag(), if gtk_text_iter_ends_tag() returns TRUE, 465 * gtk_text_iter_has_tag() will return FALSE for the same parameters. 466 * Params: 467 * tag = a GtkTextTag, or NULL. [allow-none] 468 * Returns: whether iter is the end of a range tagged with tag 469 */ 470 public int endsTag(TextTag tag) 471 { 472 // gboolean gtk_text_iter_ends_tag (const GtkTextIter *iter, GtkTextTag *tag); 473 return gtk_text_iter_ends_tag(gtkTextIter, (tag is null) ? null : tag.getTextTagStruct()); 474 } 475 476 /** 477 * This is equivalent to (gtk_text_iter_begins_tag() || 478 * gtk_text_iter_ends_tag()), i.e. it tells you whether a range with 479 * tag applied to it begins or ends at iter. 480 * Params: 481 * tag = a GtkTextTag, or NULL. [allow-none] 482 * Returns: whether tag is toggled on or off at iter 483 */ 484 public int togglesTag(TextTag tag) 485 { 486 // gboolean gtk_text_iter_toggles_tag (const GtkTextIter *iter, GtkTextTag *tag); 487 return gtk_text_iter_toggles_tag(gtkTextIter, (tag is null) ? null : tag.getTextTagStruct()); 488 } 489 490 /** 491 * Returns TRUE if iter points to a character that is part of a range tagged 492 * with tag. See also gtk_text_iter_begins_tag() and gtk_text_iter_ends_tag(). 493 * Params: 494 * tag = a GtkTextTag 495 * Returns: whether iter is tagged with tag 496 */ 497 public int hasTag(TextTag tag) 498 { 499 // gboolean gtk_text_iter_has_tag (const GtkTextIter *iter, GtkTextTag *tag); 500 return gtk_text_iter_has_tag(gtkTextIter, (tag is null) ? null : tag.getTextTagStruct()); 501 } 502 503 /** 504 * Returns a list of tags that apply to iter, in ascending order of 505 * priority (highest-priority tags are last). The GtkTextTag in the 506 * list don't have a reference added, but you have to free the list 507 * itself. 508 * Returns: list of GtkTextTag. [element-type GtkTextTag][transfer container] 509 */ 510 public ListSG getTags() 511 { 512 // GSList * gtk_text_iter_get_tags (const GtkTextIter *iter); 513 auto p = gtk_text_iter_get_tags(gtkTextIter); 514 515 if(p is null) 516 { 517 return null; 518 } 519 520 return ObjectG.getDObject!(ListSG)(cast(GSList*) p); 521 } 522 523 /** 524 * Returns whether the character at iter is within an editable region 525 * of text. Non-editable text is "locked" and can't be changed by the 526 * user via GtkTextView. This function is simply a convenience 527 * wrapper around gtk_text_iter_get_attributes(). If no tags applied 528 * to this text affect editability, default_setting will be returned. 529 * You don't want to use this function to decide whether text can be 530 * inserted at iter, because for insertion you don't want to know 531 * whether the char at iter is inside an editable range, you want to 532 * know whether a new character inserted at iter would be inside an 533 * editable range. Use gtk_text_iter_can_insert() to handle this 534 * case. 535 * Params: 536 * defaultSetting = TRUE if text is editable by default 537 * Returns: whether iter is inside an editable range 538 */ 539 public int editable(int defaultSetting) 540 { 541 // gboolean gtk_text_iter_editable (const GtkTextIter *iter, gboolean default_setting); 542 return gtk_text_iter_editable(gtkTextIter, defaultSetting); 543 } 544 545 /** 546 * Considering the default editability of the buffer, and tags that 547 * affect editability, determines whether text inserted at iter would 548 * be editable. If text inserted at iter would be editable then the 549 * user should be allowed to insert text at iter. 550 * gtk_text_buffer_insert_interactive() uses this function to decide 551 * whether insertions are allowed at a given position. 552 * Params: 553 * defaultEditability = TRUE if text is editable by default 554 * Returns: whether text inserted at iter would be editable 555 */ 556 public int canInsert(int defaultEditability) 557 { 558 // gboolean gtk_text_iter_can_insert (const GtkTextIter *iter, gboolean default_editability); 559 return gtk_text_iter_can_insert(gtkTextIter, defaultEditability); 560 } 561 562 /** 563 * Determines whether iter begins a natural-language word. Word 564 * breaks are determined by Pango and should be correct for nearly any 565 * language (if not, the correct fix would be to the Pango word break 566 * algorithms). 567 * Returns: TRUE if iter is at the start of a word 568 */ 569 public int startsWord() 570 { 571 // gboolean gtk_text_iter_starts_word (const GtkTextIter *iter); 572 return gtk_text_iter_starts_word(gtkTextIter); 573 } 574 575 /** 576 * Determines whether iter ends a natural-language word. Word breaks 577 * are determined by Pango and should be correct for nearly any 578 * language (if not, the correct fix would be to the Pango word break 579 * algorithms). 580 * Returns: TRUE if iter is at the end of a word 581 */ 582 public int endsWord() 583 { 584 // gboolean gtk_text_iter_ends_word (const GtkTextIter *iter); 585 return gtk_text_iter_ends_word(gtkTextIter); 586 } 587 588 /** 589 * Determines whether iter is inside a natural-language word (as 590 * opposed to say inside some whitespace). Word breaks are determined 591 * by Pango and should be correct for nearly any language (if not, the 592 * correct fix would be to the Pango word break algorithms). 593 * Returns: TRUE if iter is inside a word 594 */ 595 public int insideWord() 596 { 597 // gboolean gtk_text_iter_inside_word (const GtkTextIter *iter); 598 return gtk_text_iter_inside_word(gtkTextIter); 599 } 600 601 /** 602 * Returns TRUE if iter begins a paragraph, 603 * i.e. if gtk_text_iter_get_line_offset() would return 0. 604 * However this function is potentially more efficient than 605 * gtk_text_iter_get_line_offset() because it doesn't have to compute 606 * the offset, it just has to see whether it's 0. 607 * Returns: whether iter begins a line 608 */ 609 public int startsLine() 610 { 611 // gboolean gtk_text_iter_starts_line (const GtkTextIter *iter); 612 return gtk_text_iter_starts_line(gtkTextIter); 613 } 614 615 /** 616 * Returns TRUE if iter points to the start of the paragraph 617 * delimiter characters for a line (delimiters will be either a 618 * newline, a carriage return, a carriage return followed by a 619 * newline, or a Unicode paragraph separator character). Note that an 620 * iterator pointing to the \n of a \r\n pair will not be counted as 621 * the end of a line, the line ends before the \r. The end iterator is 622 * considered to be at the end of a line, even though there are no 623 * paragraph delimiter chars there. 624 * Returns: whether iter is at the end of a line 625 */ 626 public int endsLine() 627 { 628 // gboolean gtk_text_iter_ends_line (const GtkTextIter *iter); 629 return gtk_text_iter_ends_line(gtkTextIter); 630 } 631 632 /** 633 * Determines whether iter begins a sentence. Sentence boundaries are 634 * determined by Pango and should be correct for nearly any language 635 * (if not, the correct fix would be to the Pango text boundary 636 * algorithms). 637 * Returns: TRUE if iter is at the start of a sentence. 638 */ 639 public int startsSentence() 640 { 641 // gboolean gtk_text_iter_starts_sentence (const GtkTextIter *iter); 642 return gtk_text_iter_starts_sentence(gtkTextIter); 643 } 644 645 /** 646 * Determines whether iter ends a sentence. Sentence boundaries are 647 * determined by Pango and should be correct for nearly any language 648 * (if not, the correct fix would be to the Pango text boundary 649 * algorithms). 650 * Returns: TRUE if iter is at the end of a sentence. 651 */ 652 public int endsSentence() 653 { 654 // gboolean gtk_text_iter_ends_sentence (const GtkTextIter *iter); 655 return gtk_text_iter_ends_sentence(gtkTextIter); 656 } 657 658 /** 659 * Determines whether iter is inside a sentence (as opposed to in 660 * between two sentences, e.g. after a period and before the first 661 * letter of the next sentence). Sentence boundaries are determined 662 * by Pango and should be correct for nearly any language (if not, the 663 * correct fix would be to the Pango text boundary algorithms). 664 * Returns: TRUE if iter is inside a sentence. 665 */ 666 public int insideSentence() 667 { 668 // gboolean gtk_text_iter_inside_sentence (const GtkTextIter *iter); 669 return gtk_text_iter_inside_sentence(gtkTextIter); 670 } 671 672 /** 673 * See gtk_text_iter_forward_cursor_position() or PangoLogAttr or 674 * pango_break() for details on what a cursor position is. 675 * Returns: TRUE if the cursor can be placed at iter 676 */ 677 public int isCursorPosition() 678 { 679 // gboolean gtk_text_iter_is_cursor_position (const GtkTextIter *iter); 680 return gtk_text_iter_is_cursor_position(gtkTextIter); 681 } 682 683 /** 684 * Returns the number of characters in the line containing iter, 685 * including the paragraph delimiters. 686 * Returns: number of characters in the line 687 */ 688 public int getCharsInLine() 689 { 690 // gint gtk_text_iter_get_chars_in_line (const GtkTextIter *iter); 691 return gtk_text_iter_get_chars_in_line(gtkTextIter); 692 } 693 694 /** 695 * Returns the number of bytes in the line containing iter, 696 * including the paragraph delimiters. 697 * Returns: number of bytes in the line 698 */ 699 public int getBytesInLine() 700 { 701 // gint gtk_text_iter_get_bytes_in_line (const GtkTextIter *iter); 702 return gtk_text_iter_get_bytes_in_line(gtkTextIter); 703 } 704 705 /** 706 * Computes the effect of any tags applied to this spot in the 707 * text. The values parameter should be initialized to the default 708 * settings you wish to use if no tags are in effect. You'd typically 709 * obtain the defaults from gtk_text_view_get_default_attributes(). 710 * gtk_text_iter_get_attributes() will modify values, applying the 711 * effects of any tags present at iter. If any tags affected values, 712 * the function returns TRUE. 713 * Params: 714 * values = a GtkTextAttributes to be filled in. [out] 715 * Returns: TRUE if values was modified 716 */ 717 public int getAttributes(TextAttributes values) 718 { 719 // gboolean gtk_text_iter_get_attributes (const GtkTextIter *iter, GtkTextAttributes *values); 720 return gtk_text_iter_get_attributes(gtkTextIter, (values is null) ? null : values.getTextAttributesStruct()); 721 } 722 723 /** 724 * A convenience wrapper around gtk_text_iter_get_attributes(), 725 * which returns the language in effect at iter. If no tags affecting 726 * language apply to iter, the return value is identical to that of 727 * gtk_get_default_language(). 728 * Returns: language in effect at iter 729 */ 730 public PgLanguage getLanguage() 731 { 732 // PangoLanguage * gtk_text_iter_get_language (const GtkTextIter *iter); 733 auto p = gtk_text_iter_get_language(gtkTextIter); 734 735 if(p is null) 736 { 737 return null; 738 } 739 740 return ObjectG.getDObject!(PgLanguage)(cast(PangoLanguage*) p); 741 } 742 743 /** 744 * Returns TRUE if iter is the end iterator, i.e. one past the last 745 * dereferenceable iterator in the buffer. gtk_text_iter_is_end() is 746 * the most efficient way to check whether an iterator is the end 747 * iterator. 748 * Returns: whether iter is the end iterator 749 */ 750 public int isEnd() 751 { 752 // gboolean gtk_text_iter_is_end (const GtkTextIter *iter); 753 return gtk_text_iter_is_end(gtkTextIter); 754 } 755 756 /** 757 * Returns TRUE if iter is the first iterator in the buffer, that is 758 * if iter has a character offset of 0. 759 * Returns: whether iter is the first in the buffer 760 */ 761 public int isStart() 762 { 763 // gboolean gtk_text_iter_is_start (const GtkTextIter *iter); 764 return gtk_text_iter_is_start(gtkTextIter); 765 } 766 767 /** 768 * Moves iter forward by one character offset. Note that images 769 * embedded in the buffer occupy 1 character slot, so 770 * gtk_text_iter_forward_char() may actually move onto an image instead 771 * of a character, if you have images in your buffer. If iter is the 772 * end iterator or one character before it, iter will now point at 773 * the end iterator, and gtk_text_iter_forward_char() returns FALSE for 774 * convenience when writing loops. 775 * Returns: whether iter moved and is dereferenceable 776 */ 777 public int forwardChar() 778 { 779 // gboolean gtk_text_iter_forward_char (GtkTextIter *iter); 780 return gtk_text_iter_forward_char(gtkTextIter); 781 } 782 783 /** 784 * Moves backward by one character offset. Returns TRUE if movement 785 * was possible; if iter was the first in the buffer (character 786 * offset 0), gtk_text_iter_backward_char() returns FALSE for convenience when 787 * writing loops. 788 * Returns: whether movement was possible 789 */ 790 public int backwardChar() 791 { 792 // gboolean gtk_text_iter_backward_char (GtkTextIter *iter); 793 return gtk_text_iter_backward_char(gtkTextIter); 794 } 795 796 /** 797 * Moves count characters if possible (if count would move past the 798 * start or end of the buffer, moves to the start or end of the 799 * buffer). The return value indicates whether the new position of 800 * iter is different from its original position, and dereferenceable 801 * (the last iterator in the buffer is not dereferenceable). If count 802 * is 0, the function does nothing and returns FALSE. 803 * Params: 804 * count = number of characters to move, may be negative 805 * Returns: whether iter moved and is dereferenceable 806 */ 807 public int forwardChars(int count) 808 { 809 // gboolean gtk_text_iter_forward_chars (GtkTextIter *iter, gint count); 810 return gtk_text_iter_forward_chars(gtkTextIter, count); 811 } 812 813 /** 814 * Moves count characters backward, if possible (if count would move 815 * past the start or end of the buffer, moves to the start or end of 816 * the buffer). The return value indicates whether the iterator moved 817 * onto a dereferenceable position; if the iterator didn't move, or 818 * moved onto the end iterator, then FALSE is returned. If count is 0, 819 * the function does nothing and returns FALSE. 820 * Params: 821 * count = number of characters to move 822 * Returns: whether iter moved and is dereferenceable 823 */ 824 public int backwardChars(int count) 825 { 826 // gboolean gtk_text_iter_backward_chars (GtkTextIter *iter, gint count); 827 return gtk_text_iter_backward_chars(gtkTextIter, count); 828 } 829 830 /** 831 * Moves iter to the start of the next line. If the iter is already on the 832 * last line of the buffer, moves the iter to the end of the current line. 833 * If after the operation, the iter is at the end of the buffer and not 834 * dereferencable, returns FALSE. Otherwise, returns TRUE. 835 * Returns: whether iter can be dereferenced 836 */ 837 public int forwardLine() 838 { 839 // gboolean gtk_text_iter_forward_line (GtkTextIter *iter); 840 return gtk_text_iter_forward_line(gtkTextIter); 841 } 842 843 /** 844 * Moves iter to the start of the previous line. Returns TRUE if 845 * iter could be moved; i.e. if iter was at character offset 0, this 846 * function returns FALSE. Therefore if iter was already on line 0, 847 * but not at the start of the line, iter is snapped to the start of 848 * the line and the function returns TRUE. (Note that this implies that 849 * in a loop calling this function, the line number may not change on 850 * every iteration, if your first iteration is on line 0.) 851 * Returns: whether iter moved 852 */ 853 public int backwardLine() 854 { 855 // gboolean gtk_text_iter_backward_line (GtkTextIter *iter); 856 return gtk_text_iter_backward_line(gtkTextIter); 857 } 858 859 /** 860 * Moves count lines forward, if possible (if count would move 861 * past the start or end of the buffer, moves to the start or end of 862 * the buffer). The return value indicates whether the iterator moved 863 * onto a dereferenceable position; if the iterator didn't move, or 864 * moved onto the end iterator, then FALSE is returned. If count is 0, 865 * the function does nothing and returns FALSE. If count is negative, 866 * moves backward by 0 - count lines. 867 * Params: 868 * count = number of lines to move forward 869 * Returns: whether iter moved and is dereferenceable 870 */ 871 public int forwardLines(int count) 872 { 873 // gboolean gtk_text_iter_forward_lines (GtkTextIter *iter, gint count); 874 return gtk_text_iter_forward_lines(gtkTextIter, count); 875 } 876 877 /** 878 * Moves count lines backward, if possible (if count would move 879 * past the start or end of the buffer, moves to the start or end of 880 * the buffer). The return value indicates whether the iterator moved 881 * onto a dereferenceable position; if the iterator didn't move, or 882 * moved onto the end iterator, then FALSE is returned. If count is 0, 883 * the function does nothing and returns FALSE. If count is negative, 884 * moves forward by 0 - count lines. 885 * Params: 886 * count = number of lines to move backward 887 * Returns: whether iter moved and is dereferenceable 888 */ 889 public int backwardLines(int count) 890 { 891 // gboolean gtk_text_iter_backward_lines (GtkTextIter *iter, gint count); 892 return gtk_text_iter_backward_lines(gtkTextIter, count); 893 } 894 895 /** 896 * Calls gtk_text_iter_forward_word_end() up to count times. 897 * Params: 898 * count = number of times to move 899 * Returns: TRUE if iter moved and is not the end iterator 900 */ 901 public int forwardWordEnds(int count) 902 { 903 // gboolean gtk_text_iter_forward_word_ends (GtkTextIter *iter, gint count); 904 return gtk_text_iter_forward_word_ends(gtkTextIter, count); 905 } 906 907 /** 908 * Calls gtk_text_iter_backward_word_start() up to count times. 909 * Params: 910 * count = number of times to move 911 * Returns: TRUE if iter moved and is not the end iterator 912 */ 913 public int backwardWordStarts(int count) 914 { 915 // gboolean gtk_text_iter_backward_word_starts (GtkTextIter *iter, gint count); 916 return gtk_text_iter_backward_word_starts(gtkTextIter, count); 917 } 918 919 /** 920 * Moves forward to the next word end. (If iter is currently on a 921 * word end, moves forward to the next one after that.) Word breaks 922 * are determined by Pango and should be correct for nearly any 923 * language (if not, the correct fix would be to the Pango word break 924 * algorithms). 925 * Returns: TRUE if iter moved and is not the end iterator 926 */ 927 public int forwardWordEnd() 928 { 929 // gboolean gtk_text_iter_forward_word_end (GtkTextIter *iter); 930 return gtk_text_iter_forward_word_end(gtkTextIter); 931 } 932 933 /** 934 * Moves backward to the previous word start. (If iter is currently on a 935 * word start, moves backward to the next one after that.) Word breaks 936 * are determined by Pango and should be correct for nearly any 937 * language (if not, the correct fix would be to the Pango word break 938 * algorithms). 939 * Returns: TRUE if iter moved and is not the end iterator 940 */ 941 public int backwardWordStart() 942 { 943 // gboolean gtk_text_iter_backward_word_start (GtkTextIter *iter); 944 return gtk_text_iter_backward_word_start(gtkTextIter); 945 } 946 947 /** 948 * Moves iter forward by a single cursor position. Cursor positions 949 * are (unsurprisingly) positions where the cursor can appear. Perhaps 950 * surprisingly, there may not be a cursor position between all 951 * characters. The most common example for European languages would be 952 * a carriage return/newline sequence. For some Unicode characters, 953 * the equivalent of say the letter "a" with an accent mark will be 954 * represented as two characters, first the letter then a "combining 955 * mark" that causes the accent to be rendered; so the cursor can't go 956 * between those two characters. See also the PangoLogAttr structure and 957 * pango_break() function. 958 * Returns: TRUE if we moved and the new position is dereferenceable 959 */ 960 public int forwardCursorPosition() 961 { 962 // gboolean gtk_text_iter_forward_cursor_position (GtkTextIter *iter); 963 return gtk_text_iter_forward_cursor_position(gtkTextIter); 964 } 965 966 /** 967 * Like gtk_text_iter_forward_cursor_position(), but moves backward. 968 * Returns: TRUE if we moved 969 */ 970 public int backwardCursorPosition() 971 { 972 // gboolean gtk_text_iter_backward_cursor_position (GtkTextIter *iter); 973 return gtk_text_iter_backward_cursor_position(gtkTextIter); 974 } 975 976 /** 977 * Moves up to count cursor positions. See 978 * gtk_text_iter_forward_cursor_position() for details. 979 * Params: 980 * count = number of positions to move 981 * Returns: TRUE if we moved and the new position is dereferenceable 982 */ 983 public int forwardCursorPositions(int count) 984 { 985 // gboolean gtk_text_iter_forward_cursor_positions (GtkTextIter *iter, gint count); 986 return gtk_text_iter_forward_cursor_positions(gtkTextIter, count); 987 } 988 989 /** 990 * Moves up to count cursor positions. See 991 * gtk_text_iter_forward_cursor_position() for details. 992 * Params: 993 * count = number of positions to move 994 * Returns: TRUE if we moved and the new position is dereferenceable 995 */ 996 public int backwardCursorPositions(int count) 997 { 998 // gboolean gtk_text_iter_backward_cursor_positions (GtkTextIter *iter, gint count); 999 return gtk_text_iter_backward_cursor_positions(gtkTextIter, count); 1000 } 1001 1002 /** 1003 * Moves backward to the previous sentence start; if iter is already at 1004 * the start of a sentence, moves backward to the next one. Sentence 1005 * boundaries are determined by Pango and should be correct for nearly 1006 * any language (if not, the correct fix would be to the Pango text 1007 * boundary algorithms). 1008 * Returns: TRUE if iter moved and is not the end iterator 1009 */ 1010 public int backwardSentenceStart() 1011 { 1012 // gboolean gtk_text_iter_backward_sentence_start (GtkTextIter *iter); 1013 return gtk_text_iter_backward_sentence_start(gtkTextIter); 1014 } 1015 1016 /** 1017 * Calls gtk_text_iter_backward_sentence_start() up to count times, 1018 * or until it returns FALSE. If count is negative, moves forward 1019 * instead of backward. 1020 * Params: 1021 * count = number of sentences to move 1022 * Returns: TRUE if iter moved and is not the end iterator 1023 */ 1024 public int backwardSentenceStarts(int count) 1025 { 1026 // gboolean gtk_text_iter_backward_sentence_starts (GtkTextIter *iter, gint count); 1027 return gtk_text_iter_backward_sentence_starts(gtkTextIter, count); 1028 } 1029 1030 /** 1031 * Moves forward to the next sentence end. (If iter is at the end of 1032 * a sentence, moves to the next end of sentence.) Sentence 1033 * boundaries are determined by Pango and should be correct for nearly 1034 * any language (if not, the correct fix would be to the Pango text 1035 * boundary algorithms). 1036 * Returns: TRUE if iter moved and is not the end iterator 1037 */ 1038 public int forwardSentenceEnd() 1039 { 1040 // gboolean gtk_text_iter_forward_sentence_end (GtkTextIter *iter); 1041 return gtk_text_iter_forward_sentence_end(gtkTextIter); 1042 } 1043 1044 /** 1045 * Calls gtk_text_iter_forward_sentence_end() count times (or until 1046 * gtk_text_iter_forward_sentence_end() returns FALSE). If count is 1047 * negative, moves backward instead of forward. 1048 * Params: 1049 * count = number of sentences to move 1050 * Returns: TRUE if iter moved and is not the end iterator 1051 */ 1052 public int forwardSentenceEnds(int count) 1053 { 1054 // gboolean gtk_text_iter_forward_sentence_ends (GtkTextIter *iter, gint count); 1055 return gtk_text_iter_forward_sentence_ends(gtkTextIter, count); 1056 } 1057 1058 /** 1059 * Calls gtk_text_iter_forward_visible_word_end() up to count times. 1060 * Since 2.4 1061 * Params: 1062 * count = number of times to move 1063 * Returns: TRUE if iter moved and is not the end iterator 1064 */ 1065 public int forwardVisibleWordEnds(int count) 1066 { 1067 // gboolean gtk_text_iter_forward_visible_word_ends (GtkTextIter *iter, gint count); 1068 return gtk_text_iter_forward_visible_word_ends(gtkTextIter, count); 1069 } 1070 1071 /** 1072 * Calls gtk_text_iter_backward_visible_word_start() up to count times. 1073 * Since 2.4 1074 * Params: 1075 * count = number of times to move 1076 * Returns: TRUE if iter moved and is not the end iterator 1077 */ 1078 public int backwardVisibleWordStarts(int count) 1079 { 1080 // gboolean gtk_text_iter_backward_visible_word_starts (GtkTextIter *iter, gint count); 1081 return gtk_text_iter_backward_visible_word_starts(gtkTextIter, count); 1082 } 1083 1084 /** 1085 * Moves forward to the next visible word end. (If iter is currently on a 1086 * word end, moves forward to the next one after that.) Word breaks 1087 * are determined by Pango and should be correct for nearly any 1088 * language (if not, the correct fix would be to the Pango word break 1089 * algorithms). 1090 * Since 2.4 1091 * Returns: TRUE if iter moved and is not the end iterator 1092 */ 1093 public int forwardVisibleWordEnd() 1094 { 1095 // gboolean gtk_text_iter_forward_visible_word_end (GtkTextIter *iter); 1096 return gtk_text_iter_forward_visible_word_end(gtkTextIter); 1097 } 1098 1099 /** 1100 * Moves backward to the previous visible word start. (If iter is currently 1101 * on a word start, moves backward to the next one after that.) Word breaks 1102 * are determined by Pango and should be correct for nearly any 1103 * language (if not, the correct fix would be to the Pango word break 1104 * algorithms). 1105 * Since 2.4 1106 * Returns: TRUE if iter moved and is not the end iterator 1107 */ 1108 public int backwardVisibleWordStart() 1109 { 1110 // gboolean gtk_text_iter_backward_visible_word_start (GtkTextIter *iter); 1111 return gtk_text_iter_backward_visible_word_start(gtkTextIter); 1112 } 1113 1114 /** 1115 * Moves iter forward to the next visible cursor position. See 1116 * gtk_text_iter_forward_cursor_position() for details. 1117 * Since 2.4 1118 * Returns: TRUE if we moved and the new position is dereferenceable 1119 */ 1120 public int forwardVisibleCursorPosition() 1121 { 1122 // gboolean gtk_text_iter_forward_visible_cursor_position (GtkTextIter *iter); 1123 return gtk_text_iter_forward_visible_cursor_position(gtkTextIter); 1124 } 1125 1126 /** 1127 * Moves iter forward to the previous visible cursor position. See 1128 * gtk_text_iter_backward_cursor_position() for details. 1129 * Since 2.4 1130 * Returns: TRUE if we moved and the new position is dereferenceable 1131 */ 1132 public int backwardVisibleCursorPosition() 1133 { 1134 // gboolean gtk_text_iter_backward_visible_cursor_position (GtkTextIter *iter); 1135 return gtk_text_iter_backward_visible_cursor_position(gtkTextIter); 1136 } 1137 1138 /** 1139 * Moves up to count visible cursor positions. See 1140 * gtk_text_iter_forward_cursor_position() for details. 1141 * Since 2.4 1142 * Params: 1143 * count = number of positions to move 1144 * Returns: TRUE if we moved and the new position is dereferenceable 1145 */ 1146 public int forwardVisibleCursorPositions(int count) 1147 { 1148 // gboolean gtk_text_iter_forward_visible_cursor_positions (GtkTextIter *iter, gint count); 1149 return gtk_text_iter_forward_visible_cursor_positions(gtkTextIter, count); 1150 } 1151 1152 /** 1153 * Moves up to count visible cursor positions. See 1154 * gtk_text_iter_backward_cursor_position() for details. 1155 * Since 2.4 1156 * Params: 1157 * count = number of positions to move 1158 * Returns: TRUE if we moved and the new position is dereferenceable 1159 */ 1160 public int backwardVisibleCursorPositions(int count) 1161 { 1162 // gboolean gtk_text_iter_backward_visible_cursor_positions (GtkTextIter *iter, gint count); 1163 return gtk_text_iter_backward_visible_cursor_positions(gtkTextIter, count); 1164 } 1165 1166 /** 1167 * Moves iter to the start of the next visible line. Returns TRUE if there 1168 * was a next line to move to, and FALSE if iter was simply moved to 1169 * the end of the buffer and is now not dereferenceable, or if iter was 1170 * already at the end of the buffer. 1171 * Since 2.8 1172 * Returns: whether iter can be dereferenced 1173 */ 1174 public int forwardVisibleLine() 1175 { 1176 // gboolean gtk_text_iter_forward_visible_line (GtkTextIter *iter); 1177 return gtk_text_iter_forward_visible_line(gtkTextIter); 1178 } 1179 1180 /** 1181 * Moves iter to the start of the previous visible line. Returns TRUE if 1182 * iter could be moved; i.e. if iter was at character offset 0, this 1183 * function returns FALSE. Therefore if iter was already on line 0, 1184 * but not at the start of the line, iter is snapped to the start of 1185 * the line and the function returns TRUE. (Note that this implies that 1186 * in a loop calling this function, the line number may not change on 1187 * every iteration, if your first iteration is on line 0.) 1188 * Since 2.8 1189 * Returns: whether iter moved 1190 */ 1191 public int backwardVisibleLine() 1192 { 1193 // gboolean gtk_text_iter_backward_visible_line (GtkTextIter *iter); 1194 return gtk_text_iter_backward_visible_line(gtkTextIter); 1195 } 1196 1197 /** 1198 * Moves count visible lines forward, if possible (if count would move 1199 * past the start or end of the buffer, moves to the start or end of 1200 * the buffer). The return value indicates whether the iterator moved 1201 * onto a dereferenceable position; if the iterator didn't move, or 1202 * moved onto the end iterator, then FALSE is returned. If count is 0, 1203 * the function does nothing and returns FALSE. If count is negative, 1204 * moves backward by 0 - count lines. 1205 * Since 2.8 1206 * Params: 1207 * count = number of lines to move forward 1208 * Returns: whether iter moved and is dereferenceable 1209 */ 1210 public int forwardVisibleLines(int count) 1211 { 1212 // gboolean gtk_text_iter_forward_visible_lines (GtkTextIter *iter, gint count); 1213 return gtk_text_iter_forward_visible_lines(gtkTextIter, count); 1214 } 1215 1216 /** 1217 * Moves count visible lines backward, if possible (if count would move 1218 * past the start or end of the buffer, moves to the start or end of 1219 * the buffer). The return value indicates whether the iterator moved 1220 * onto a dereferenceable position; if the iterator didn't move, or 1221 * moved onto the end iterator, then FALSE is returned. If count is 0, 1222 * the function does nothing and returns FALSE. If count is negative, 1223 * moves forward by 0 - count lines. 1224 * Since 2.8 1225 * Params: 1226 * count = number of lines to move backward 1227 * Returns: whether iter moved and is dereferenceable 1228 */ 1229 public int backwardVisibleLines(int count) 1230 { 1231 // gboolean gtk_text_iter_backward_visible_lines (GtkTextIter *iter, gint count); 1232 return gtk_text_iter_backward_visible_lines(gtkTextIter, count); 1233 } 1234 1235 /** 1236 * Sets iter to point to char_offset. char_offset counts from the start 1237 * of the entire text buffer, starting with 0. 1238 * Params: 1239 * charOffset = a character number 1240 */ 1241 public void setOffset(int charOffset) 1242 { 1243 // void gtk_text_iter_set_offset (GtkTextIter *iter, gint char_offset); 1244 gtk_text_iter_set_offset(gtkTextIter, charOffset); 1245 } 1246 1247 /** 1248 * Moves iterator iter to the start of the line line_number. If 1249 * line_number is negative or larger than the number of lines in the 1250 * buffer, moves iter to the start of the last line in the buffer. 1251 * Params: 1252 * lineNumber = line number (counted from 0) 1253 */ 1254 public void setLine(int lineNumber) 1255 { 1256 // void gtk_text_iter_set_line (GtkTextIter *iter, gint line_number); 1257 gtk_text_iter_set_line(gtkTextIter, lineNumber); 1258 } 1259 1260 /** 1261 * Moves iter within a line, to a new character 1262 * (not byte) offset. The given character offset must be less than or 1263 * equal to the number of characters in the line; if equal, iter 1264 * moves to the start of the next line. See 1265 * gtk_text_iter_set_line_index() if you have a byte index rather than 1266 * a character offset. 1267 * Params: 1268 * charOnLine = a character offset relative to the start of iter's current line 1269 */ 1270 public void setLineOffset(int charOnLine) 1271 { 1272 // void gtk_text_iter_set_line_offset (GtkTextIter *iter, gint char_on_line); 1273 gtk_text_iter_set_line_offset(gtkTextIter, charOnLine); 1274 } 1275 1276 /** 1277 * Same as gtk_text_iter_set_line_offset(), but works with a 1278 * byte index. The given byte index must be at 1279 * the start of a character, it can't be in the middle of a UTF-8 1280 * encoded character. 1281 * Params: 1282 * byteOnLine = a byte index relative to the start of iter's current line 1283 */ 1284 public void setLineIndex(int byteOnLine) 1285 { 1286 // void gtk_text_iter_set_line_index (GtkTextIter *iter, gint byte_on_line); 1287 gtk_text_iter_set_line_index(gtkTextIter, byteOnLine); 1288 } 1289 1290 /** 1291 * Like gtk_text_iter_set_line_index(), but the index is in visible 1292 * bytes, i.e. text with a tag making it invisible is not counted 1293 * in the index. 1294 * Params: 1295 * byteOnLine = a byte index 1296 */ 1297 public void setVisibleLineIndex(int byteOnLine) 1298 { 1299 // void gtk_text_iter_set_visible_line_index (GtkTextIter *iter, gint byte_on_line); 1300 gtk_text_iter_set_visible_line_index(gtkTextIter, byteOnLine); 1301 } 1302 1303 /** 1304 * Like gtk_text_iter_set_line_offset(), but the offset is in visible 1305 * characters, i.e. text with a tag making it invisible is not 1306 * counted in the offset. 1307 * Params: 1308 * charOnLine = a character offset 1309 */ 1310 public void setVisibleLineOffset(int charOnLine) 1311 { 1312 // void gtk_text_iter_set_visible_line_offset (GtkTextIter *iter, gint char_on_line); 1313 gtk_text_iter_set_visible_line_offset(gtkTextIter, charOnLine); 1314 } 1315 1316 /** 1317 * Moves iter forward to the "end iterator," which points one past the last 1318 * valid character in the buffer. gtk_text_iter_get_char() called on the 1319 * end iterator returns 0, which is convenient for writing loops. 1320 */ 1321 public void forwardToEnd() 1322 { 1323 // void gtk_text_iter_forward_to_end (GtkTextIter *iter); 1324 gtk_text_iter_forward_to_end(gtkTextIter); 1325 } 1326 1327 /** 1328 * Moves the iterator to point to the paragraph delimiter characters, 1329 * which will be either a newline, a carriage return, a carriage 1330 * return/newline in sequence, or the Unicode paragraph separator 1331 * character. If the iterator is already at the paragraph delimiter 1332 * characters, moves to the paragraph delimiter characters for the 1333 * next line. If iter is on the last line in the buffer, which does 1334 * not end in paragraph delimiters, moves to the end iterator (end of 1335 * the last line), and returns FALSE. 1336 * Returns: TRUE if we moved and the new location is not the end iterator 1337 */ 1338 public int forwardToLineEnd() 1339 { 1340 // gboolean gtk_text_iter_forward_to_line_end (GtkTextIter *iter); 1341 return gtk_text_iter_forward_to_line_end(gtkTextIter); 1342 } 1343 1344 /** 1345 * Moves forward to the next toggle (on or off) of the 1346 * GtkTextTag tag, or to the next toggle of any tag if 1347 * tag is NULL. If no matching tag toggles are found, 1348 * returns FALSE, otherwise TRUE. Does not return toggles 1349 * located at iter, only toggles after iter. Sets iter to 1350 * the location of the toggle, or to the end of the buffer 1351 * if no toggle is found. 1352 * Params: 1353 * tag = a GtkTextTag, or NULL. [allow-none] 1354 * Returns: whether we found a tag toggle after iter 1355 */ 1356 public int forwardToTagToggle(TextTag tag) 1357 { 1358 // gboolean gtk_text_iter_forward_to_tag_toggle (GtkTextIter *iter, GtkTextTag *tag); 1359 return gtk_text_iter_forward_to_tag_toggle(gtkTextIter, (tag is null) ? null : tag.getTextTagStruct()); 1360 } 1361 1362 /** 1363 * Moves backward to the next toggle (on or off) of the 1364 * GtkTextTag tag, or to the next toggle of any tag if 1365 * tag is NULL. If no matching tag toggles are found, 1366 * returns FALSE, otherwise TRUE. Does not return toggles 1367 * located at iter, only toggles before iter. Sets iter 1368 * to the location of the toggle, or the start of the buffer 1369 * if no toggle is found. 1370 * Params: 1371 * tag = a GtkTextTag, or NULL. [allow-none] 1372 * Returns: whether we found a tag toggle before iter 1373 */ 1374 public int backwardToTagToggle(TextTag tag) 1375 { 1376 // gboolean gtk_text_iter_backward_to_tag_toggle (GtkTextIter *iter, GtkTextTag *tag); 1377 return gtk_text_iter_backward_to_tag_toggle(gtkTextIter, (tag is null) ? null : tag.getTextTagStruct()); 1378 } 1379 1380 /** 1381 * Advances iter, calling pred on each character. If 1382 * pred returns TRUE, returns TRUE and stops scanning. 1383 * If pred never returns TRUE, iter is set to limit if 1384 * limit is non-NULL, otherwise to the end iterator. 1385 * Params: 1386 * pred = a function to be called on each character. [scope call] 1387 * userData = user data for pred 1388 * limit = search limit, or NULL for none. [allow-none] 1389 * Returns: whether a match was found 1390 */ 1391 public int forwardFindChar(GtkTextCharPredicate pred, void* userData, TextIter limit) 1392 { 1393 // gboolean gtk_text_iter_forward_find_char (GtkTextIter *iter, GtkTextCharPredicate pred, gpointer user_data, const GtkTextIter *limit); 1394 return gtk_text_iter_forward_find_char(gtkTextIter, pred, userData, (limit is null) ? null : limit.getTextIterStruct()); 1395 } 1396 1397 /** 1398 * Same as gtk_text_iter_forward_find_char(), but goes backward from iter. 1399 * Params: 1400 * pred = function to be called on each character. [scope call] 1401 * userData = user data for pred 1402 * limit = search limit, or NULL for none. [allow-none] 1403 * Returns: whether a match was found 1404 */ 1405 public int backwardFindChar(GtkTextCharPredicate pred, void* userData, TextIter limit) 1406 { 1407 // gboolean gtk_text_iter_backward_find_char (GtkTextIter *iter, GtkTextCharPredicate pred, gpointer user_data, const GtkTextIter *limit); 1408 return gtk_text_iter_backward_find_char(gtkTextIter, pred, userData, (limit is null) ? null : limit.getTextIterStruct()); 1409 } 1410 1411 /** 1412 * Searches forward for str. Any match is returned by setting 1413 * match_start to the first character of the match and match_end to the 1414 * first character after the match. The search will not continue past 1415 * limit. Note that a search is a linear or O(n) operation, so you 1416 * may wish to use limit to avoid locking up your UI on large 1417 * buffers. 1418 * match_start will never be set to a GtkTextIter located before iter, even if 1419 * there is a possible match_end after or at iter. 1420 * Params: 1421 * str = a search string 1422 * flags = flags affecting how the search is done 1423 * matchStart = return location for start of match, or NULL. [out caller-allocates][allow-none] 1424 * matchEnd = return location for end of match, or NULL. [out caller-allocates][allow-none] 1425 * limit = location of last possible match_end, or NULL for the end of the buffer. [allow-none] 1426 * Returns: whether a match was found 1427 */ 1428 public int forwardSearch(string str, GtkTextSearchFlags flags, TextIter matchStart, TextIter matchEnd, TextIter limit) 1429 { 1430 // gboolean gtk_text_iter_forward_search (const GtkTextIter *iter, const gchar *str, GtkTextSearchFlags flags, GtkTextIter *match_start, GtkTextIter *match_end, const GtkTextIter *limit); 1431 return gtk_text_iter_forward_search(gtkTextIter, Str.toStringz(str), flags, (matchStart is null) ? null : matchStart.getTextIterStruct(), (matchEnd is null) ? null : matchEnd.getTextIterStruct(), (limit is null) ? null : limit.getTextIterStruct()); 1432 } 1433 1434 /** 1435 * Same as gtk_text_iter_forward_search(), but moves backward. 1436 * match_end will never be set to a GtkTextIter located after iter, even if 1437 * there is a possible match_start before or at iter. 1438 * Params: 1439 * str = search string 1440 * flags = bitmask of flags affecting the search 1441 * matchStart = return location for start of match, or NULL. [out caller-allocates][allow-none] 1442 * matchEnd = return location for end of match, or NULL. [out caller-allocates][allow-none] 1443 * limit = location of last possible match_start, or NULL for start of buffer. [allow-none] 1444 * Returns: whether a match was found 1445 */ 1446 public int backwardSearch(string str, GtkTextSearchFlags flags, TextIter matchStart, TextIter matchEnd, TextIter limit) 1447 { 1448 // gboolean gtk_text_iter_backward_search (const GtkTextIter *iter, const gchar *str, GtkTextSearchFlags flags, GtkTextIter *match_start, GtkTextIter *match_end, const GtkTextIter *limit); 1449 return gtk_text_iter_backward_search(gtkTextIter, Str.toStringz(str), flags, (matchStart is null) ? null : matchStart.getTextIterStruct(), (matchEnd is null) ? null : matchEnd.getTextIterStruct(), (limit is null) ? null : limit.getTextIterStruct()); 1450 } 1451 1452 /** 1453 * Tests whether two iterators are equal, using the fastest possible 1454 * mechanism. This function is very fast; you can expect it to perform 1455 * better than e.g. getting the character offset for each iterator and 1456 * comparing the offsets yourself. Also, it's a bit faster than 1457 * gtk_text_iter_compare(). 1458 * Params: 1459 * rhs = another GtkTextIter 1460 * Returns: TRUE if the iterators point to the same place in the buffer 1461 */ 1462 public int equal(TextIter rhs) 1463 { 1464 // gboolean gtk_text_iter_equal (const GtkTextIter *lhs, const GtkTextIter *rhs); 1465 return gtk_text_iter_equal(gtkTextIter, (rhs is null) ? null : rhs.getTextIterStruct()); 1466 } 1467 1468 /** 1469 * A qsort()-style function that returns negative if lhs is less than 1470 * rhs, positive if lhs is greater than rhs, and 0 if they're equal. 1471 * Ordering is in character offset order, i.e. the first character in the buffer 1472 * is less than the second character in the buffer. 1473 * Params: 1474 * rhs = another GtkTextIter 1475 * Returns: -1 if lhs is less than rhs, 1 if lhs is greater, 0 if they are equal 1476 */ 1477 public int compare(TextIter rhs) 1478 { 1479 // gint gtk_text_iter_compare (const GtkTextIter *lhs, const GtkTextIter *rhs); 1480 return gtk_text_iter_compare(gtkTextIter, (rhs is null) ? null : rhs.getTextIterStruct()); 1481 } 1482 1483 /** 1484 * Checks whether iter falls in the range [start, end). 1485 * start and end must be in ascending order. 1486 * Params: 1487 * start = start of range 1488 * end = end of range 1489 * Returns: TRUE if iter is in the range 1490 */ 1491 public int inRange(TextIter start, TextIter end) 1492 { 1493 // gboolean gtk_text_iter_in_range (const GtkTextIter *iter, const GtkTextIter *start, const GtkTextIter *end); 1494 return gtk_text_iter_in_range(gtkTextIter, (start is null) ? null : start.getTextIterStruct(), (end is null) ? null : end.getTextIterStruct()); 1495 } 1496 1497 /** 1498 * Swaps the value of first and second if second comes before 1499 * first in the buffer. That is, ensures that first and second are 1500 * in sequence. Most text buffer functions that take a range call this 1501 * automatically on your behalf, so there's no real reason to call it yourself 1502 * in those cases. There are some exceptions, such as gtk_text_iter_in_range(), 1503 * that expect a pre-sorted range. 1504 * Params: 1505 * second = another GtkTextIter 1506 */ 1507 public void order(TextIter second) 1508 { 1509 // void gtk_text_iter_order (GtkTextIter *first, GtkTextIter *second); 1510 gtk_text_iter_order(gtkTextIter, (second is null) ? null : second.getTextIterStruct()); 1511 } 1512 }