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