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