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