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 module gtk.TextView; 26 27 private import gdk.Event; 28 private import gio.MenuModel; 29 private import glib.ConstructionException; 30 private import glib.MemorySlice; 31 private import glib.Str; 32 private import gobject.ObjectG; 33 private import gobject.Signals; 34 private import gtk.ScrollableIF; 35 private import gtk.ScrollableT; 36 private import gtk.TextBuffer; 37 private import gtk.TextChildAnchor; 38 private import gtk.TextIter; 39 private import gtk.TextMark; 40 private import gtk.Widget; 41 private import gtk.c.functions; 42 public import gtk.c.types; 43 private import pango.PgTabArray; 44 private import std.algorithm; 45 46 47 /** 48 * A widget that displays the contents of a [class@Gtk.TextBuffer]. 49 * 50 * ![An example GtkTextview](multiline-text.png) 51 * 52 * You may wish to begin by reading the [conceptual overview](section-text-widget.html), 53 * which gives an overview of all the objects and data types related to the 54 * text widget and how they work together. 55 * 56 * ## CSS nodes 57 * 58 * ``` 59 * textview.view 60 * ├── border.top 61 * ├── border.left 62 * ├── text 63 * │ ╰── [selection] 64 * ├── border.right 65 * ├── border.bottom 66 * ╰── [window.popup] 67 * ``` 68 * 69 * `GtkTextView` has a main css node with name textview and style class .view, 70 * and subnodes for each of the border windows, and the main text area, 71 * with names border and text, respectively. The border nodes each get 72 * one of the style classes .left, .right, .top or .bottom. 73 * 74 * A node representing the selection will appear below the text node. 75 * 76 * If a context menu is opened, the window node will appear as a subnode 77 * of the main node. 78 * 79 * ## Accessibility 80 * 81 * `GtkTextView` uses the #GTK_ACCESSIBLE_ROLE_TEXT_BOX role. 82 */ 83 public class TextView : Widget, ScrollableIF 84 { 85 /** the main Gtk struct */ 86 protected GtkTextView* gtkTextView; 87 88 /** Get the main Gtk struct */ 89 public GtkTextView* getTextViewStruct(bool transferOwnership = false) 90 { 91 if (transferOwnership) 92 ownedRef = false; 93 return gtkTextView; 94 } 95 96 /** the main Gtk struct as a void* */ 97 protected override void* getStruct() 98 { 99 return cast(void*)gtkTextView; 100 } 101 102 /** 103 * Sets our main struct and passes it to the parent class. 104 */ 105 public this (GtkTextView* gtkTextView, bool ownedRef = false) 106 { 107 this.gtkTextView = gtkTextView; 108 super(cast(GtkWidget*)gtkTextView, ownedRef); 109 } 110 111 // add the Scrollable capabilities 112 mixin ScrollableT!(GtkTextView); 113 114 115 /** */ 116 public static GType getType() 117 { 118 return gtk_text_view_get_type(); 119 } 120 121 /** 122 * Creates a new `GtkTextView`. 123 * 124 * If you don’t call [method@Gtk.TextView.set_buffer] before using the 125 * text view, an empty default buffer will be created for you. Get the 126 * buffer with [method@Gtk.TextView.get_buffer]. If you want to specify 127 * your own buffer, consider [ctor@Gtk.TextView.new_with_buffer]. 128 * 129 * Returns: a new `GtkTextView` 130 * 131 * Throws: ConstructionException GTK+ fails to create the object. 132 */ 133 public this() 134 { 135 auto __p = gtk_text_view_new(); 136 137 if(__p is null) 138 { 139 throw new ConstructionException("null returned by new"); 140 } 141 142 this(cast(GtkTextView*) __p); 143 } 144 145 /** 146 * Creates a new `GtkTextView` widget displaying the buffer @buffer. 147 * 148 * One buffer can be shared among many widgets. @buffer may be %NULL 149 * to create a default buffer, in which case this function is equivalent 150 * to [ctor@Gtk.TextView.new]. The text view adds its own reference count 151 * to the buffer; it does not take over an existing reference. 152 * 153 * Params: 154 * buffer = a `GtkTextBuffer` 155 * 156 * Returns: a new `GtkTextView`. 157 * 158 * Throws: ConstructionException GTK+ fails to create the object. 159 */ 160 public this(TextBuffer buffer) 161 { 162 auto __p = gtk_text_view_new_with_buffer((buffer is null) ? null : buffer.getTextBufferStruct()); 163 164 if(__p is null) 165 { 166 throw new ConstructionException("null returned by new_with_buffer"); 167 } 168 169 this(cast(GtkTextView*) __p); 170 } 171 172 /** 173 * Adds a child widget in the text buffer, at the given @anchor. 174 * 175 * Params: 176 * child = a `GtkWidget` 177 * anchor = a `GtkTextChildAnchor` in the `GtkTextBuffer` for @text_view 178 */ 179 public void addChildAtAnchor(Widget child, TextChildAnchor anchor) 180 { 181 gtk_text_view_add_child_at_anchor(gtkTextView, (child is null) ? null : child.getWidgetStruct(), (anchor is null) ? null : anchor.getTextChildAnchorStruct()); 182 } 183 184 /** 185 * Adds @child at a fixed coordinate in the `GtkTextView`'s text window. 186 * 187 * The @xpos and @ypos must be in buffer coordinates (see 188 * [method@Gtk.TextView.get_iter_location] to convert to 189 * buffer coordinates). 190 * 191 * @child will scroll with the text view. 192 * 193 * If instead you want a widget that will not move with the 194 * `GtkTextView` contents see #GtkOverlay. 195 * 196 * Params: 197 * child = a #GtkWidget 198 * xpos = X position of child in window coordinates 199 * ypos = Y position of child in window coordinates 200 */ 201 public void addOverlay(Widget child, int xpos, int ypos) 202 { 203 gtk_text_view_add_overlay(gtkTextView, (child is null) ? null : child.getWidgetStruct(), xpos, ypos); 204 } 205 206 /** 207 * Moves the given @iter backward by one display (wrapped) line. 208 * 209 * A display line is different from a paragraph. Paragraphs are 210 * separated by newlines or other paragraph separator characters. 211 * Display lines are created by line-wrapping a paragraph. If 212 * wrapping is turned off, display lines and paragraphs will be the 213 * same. Display lines are divided differently for each view, since 214 * they depend on the view’s width; paragraphs are the same in all 215 * views, since they depend on the contents of the `GtkTextBuffer`. 216 * 217 * Params: 218 * iter = a `GtkTextIter` 219 * 220 * Returns: %TRUE if @iter was moved and is not on the end iterator 221 */ 222 public bool backwardDisplayLine(TextIter iter) 223 { 224 return gtk_text_view_backward_display_line(gtkTextView, (iter is null) ? null : iter.getTextIterStruct()) != 0; 225 } 226 227 /** 228 * Moves the given @iter backward to the next display line start. 229 * 230 * A display line is different from a paragraph. Paragraphs are 231 * separated by newlines or other paragraph separator characters. 232 * Display lines are created by line-wrapping a paragraph. If 233 * wrapping is turned off, display lines and paragraphs will be the 234 * same. Display lines are divided differently for each view, since 235 * they depend on the view’s width; paragraphs are the same in all 236 * views, since they depend on the contents of the `GtkTextBuffer`. 237 * 238 * Params: 239 * iter = a `GtkTextIter` 240 * 241 * Returns: %TRUE if @iter was moved and is not on the end iterator 242 */ 243 public bool backwardDisplayLineStart(TextIter iter) 244 { 245 return gtk_text_view_backward_display_line_start(gtkTextView, (iter is null) ? null : iter.getTextIterStruct()) != 0; 246 } 247 248 /** 249 * Converts buffer coordinates to window coordinates. 250 * 251 * Params: 252 * win = a #GtkTextWindowType 253 * bufferX = buffer x coordinate 254 * bufferY = buffer y coordinate 255 * windowX = window x coordinate return location or %NULL 256 * windowY = window y coordinate return location or %NULL 257 */ 258 public void bufferToWindowCoords(GtkTextWindowType win, int bufferX, int bufferY, out int windowX, out int windowY) 259 { 260 gtk_text_view_buffer_to_window_coords(gtkTextView, win, bufferX, bufferY, &windowX, &windowY); 261 } 262 263 /** 264 * Moves the given @iter forward by one display (wrapped) line. 265 * 266 * A display line is different from a paragraph. Paragraphs are 267 * separated by newlines or other paragraph separator characters. 268 * Display lines are created by line-wrapping a paragraph. If 269 * wrapping is turned off, display lines and paragraphs will be the 270 * same. Display lines are divided differently for each view, since 271 * they depend on the view’s width; paragraphs are the same in all 272 * views, since they depend on the contents of the `GtkTextBuffer`. 273 * 274 * Params: 275 * iter = a `GtkTextIter` 276 * 277 * Returns: %TRUE if @iter was moved and is not on the end iterator 278 */ 279 public bool forwardDisplayLine(TextIter iter) 280 { 281 return gtk_text_view_forward_display_line(gtkTextView, (iter is null) ? null : iter.getTextIterStruct()) != 0; 282 } 283 284 /** 285 * Moves the given @iter forward to the next display line end. 286 * 287 * A display line is different from a paragraph. Paragraphs are 288 * separated by newlines or other paragraph separator characters. 289 * Display lines are created by line-wrapping a paragraph. If 290 * wrapping is turned off, display lines and paragraphs will be the 291 * same. Display lines are divided differently for each view, since 292 * they depend on the view’s width; paragraphs are the same in all 293 * views, since they depend on the contents of the `GtkTextBuffer`. 294 * 295 * Params: 296 * iter = a `GtkTextIter` 297 * 298 * Returns: %TRUE if @iter was moved and is not on the end iterator 299 */ 300 public bool forwardDisplayLineEnd(TextIter iter) 301 { 302 return gtk_text_view_forward_display_line_end(gtkTextView, (iter is null) ? null : iter.getTextIterStruct()) != 0; 303 } 304 305 /** 306 * Returns whether pressing the Tab key inserts a tab characters. 307 * 308 * See [method@Gtk.TextView.set_accepts_tab]. 309 * 310 * Returns: %TRUE if pressing the Tab key inserts a tab character, 311 * %FALSE if pressing the Tab key moves the keyboard focus. 312 */ 313 public bool getAcceptsTab() 314 { 315 return gtk_text_view_get_accepts_tab(gtkTextView) != 0; 316 } 317 318 /** 319 * Gets the bottom margin for text in the @text_view. 320 * 321 * Returns: bottom margin in pixels 322 */ 323 public int getBottomMargin() 324 { 325 return gtk_text_view_get_bottom_margin(gtkTextView); 326 } 327 328 /** 329 * Returns the `GtkTextBuffer` being displayed by this text view. 330 * 331 * The reference count on the buffer is not incremented; the caller 332 * of this function won’t own a new reference. 333 * 334 * Returns: a `GtkTextBuffer` 335 */ 336 public TextBuffer getBuffer() 337 { 338 auto __p = gtk_text_view_get_buffer(gtkTextView); 339 340 if(__p is null) 341 { 342 return null; 343 } 344 345 return ObjectG.getDObject!(TextBuffer)(cast(GtkTextBuffer*) __p); 346 } 347 348 /** 349 * Determine the positions of the strong and weak cursors if the 350 * insertion point is at @iter. 351 * 352 * The position of each cursor is stored as a zero-width rectangle. 353 * The strong cursor location is the location where characters of 354 * the directionality equal to the base direction of the paragraph 355 * are inserted. The weak cursor location is the location where 356 * characters of the directionality opposite to the base direction 357 * of the paragraph are inserted. 358 * 359 * If @iter is %NULL, the actual cursor position is used. 360 * 361 * Note that if @iter happens to be the actual cursor position, and 362 * there is currently an IM preedit sequence being entered, the 363 * returned locations will be adjusted to account for the preedit 364 * cursor’s offset within the preedit sequence. 365 * 366 * The rectangle position is in buffer coordinates; use 367 * [method@Gtk.TextView.buffer_to_window_coords] to convert these 368 * coordinates to coordinates for one of the windows in the text view. 369 * 370 * Params: 371 * iter = a `GtkTextIter` 372 * strong = location to store the strong 373 * cursor position (may be %NULL) 374 * weak = location to store the weak 375 * cursor position (may be %NULL) 376 */ 377 public void getCursorLocations(TextIter iter, out GdkRectangle strong, out GdkRectangle weak) 378 { 379 gtk_text_view_get_cursor_locations(gtkTextView, (iter is null) ? null : iter.getTextIterStruct(), &strong, &weak); 380 } 381 382 /** 383 * Find out whether the cursor should be displayed. 384 * 385 * Returns: whether the insertion mark is visible 386 */ 387 public bool getCursorVisible() 388 { 389 return gtk_text_view_get_cursor_visible(gtkTextView) != 0; 390 } 391 392 /** 393 * Returns the default editability of the `GtkTextView`. 394 * 395 * Tags in the buffer may override this setting for some ranges of text. 396 * 397 * Returns: whether text is editable by default 398 */ 399 public bool getEditable() 400 { 401 return gtk_text_view_get_editable(gtkTextView) != 0; 402 } 403 404 /** 405 * Gets the menu model that gets added to the context menu 406 * or %NULL if none has been set. 407 * 408 * Returns: the menu model 409 */ 410 public MenuModel getExtraMenu() 411 { 412 auto __p = gtk_text_view_get_extra_menu(gtkTextView); 413 414 if(__p is null) 415 { 416 return null; 417 } 418 419 return ObjectG.getDObject!(MenuModel)(cast(GMenuModel*) __p); 420 } 421 422 /** 423 * Gets a `GtkWidget` that has previously been set as gutter. 424 * 425 * See [method@Gtk.TextView.set_gutter]. 426 * 427 * @win must be one of %GTK_TEXT_WINDOW_LEFT, %GTK_TEXT_WINDOW_RIGHT, 428 * %GTK_TEXT_WINDOW_TOP, or %GTK_TEXT_WINDOW_BOTTOM. 429 * 430 * Params: 431 * win = a `GtkTextWindowType` 432 * 433 * Returns: a `GtkWidget` or %NULL 434 */ 435 public Widget getGutter(GtkTextWindowType win) 436 { 437 auto __p = gtk_text_view_get_gutter(gtkTextView, win); 438 439 if(__p is null) 440 { 441 return null; 442 } 443 444 return ObjectG.getDObject!(Widget)(cast(GtkWidget*) __p); 445 } 446 447 /** 448 * Gets the default indentation of paragraphs in @text_view. 449 * 450 * Tags in the view’s buffer may override the default. 451 * The indentation may be negative. 452 * 453 * Returns: number of pixels of indentation 454 */ 455 public int getIndent() 456 { 457 return gtk_text_view_get_indent(gtkTextView); 458 } 459 460 /** 461 * Gets the `input-hints` of the `GtkTextView`. 462 */ 463 public GtkInputHints getInputHints() 464 { 465 return gtk_text_view_get_input_hints(gtkTextView); 466 } 467 468 /** 469 * Gets the `input-purpose` of the `GtkTextView`. 470 */ 471 public GtkInputPurpose getInputPurpose() 472 { 473 return gtk_text_view_get_input_purpose(gtkTextView); 474 } 475 476 /** 477 * Retrieves the iterator at buffer coordinates @x and @y. 478 * 479 * Buffer coordinates are coordinates for the entire buffer, not just 480 * the currently-displayed portion. If you have coordinates from an 481 * event, you have to convert those to buffer coordinates with 482 * [method@Gtk.TextView.window_to_buffer_coords]. 483 * 484 * Params: 485 * iter = a `GtkTextIter` 486 * x = x position, in buffer coordinates 487 * y = y position, in buffer coordinates 488 * 489 * Returns: %TRUE if the position is over text 490 */ 491 public bool getIterAtLocation(out TextIter iter, int x, int y) 492 { 493 GtkTextIter* outiter = sliceNew!GtkTextIter(); 494 495 auto __p = gtk_text_view_get_iter_at_location(gtkTextView, outiter, x, y) != 0; 496 497 iter = ObjectG.getDObject!(TextIter)(outiter, true); 498 499 return __p; 500 } 501 502 /** 503 * Retrieves the iterator pointing to the character at buffer 504 * coordinates @x and @y. 505 * 506 * Buffer coordinates are coordinates for the entire buffer, not just 507 * the currently-displayed portion. If you have coordinates from an event, 508 * you have to convert those to buffer coordinates with 509 * [method@Gtk.TextView.window_to_buffer_coords]. 510 * 511 * Note that this is different from [method@Gtk.TextView.get_iter_at_location], 512 * which returns cursor locations, i.e. positions between characters. 513 * 514 * Params: 515 * iter = a `GtkTextIter` 516 * trailing = if non-%NULL, location to store 517 * an integer indicating where in the grapheme the user clicked. 518 * It will either be zero, or the number of characters in the grapheme. 519 * 0 represents the trailing edge of the grapheme. 520 * x = x position, in buffer coordinates 521 * y = y position, in buffer coordinates 522 * 523 * Returns: %TRUE if the position is over text 524 */ 525 public bool getIterAtPosition(out TextIter iter, out int trailing, int x, int y) 526 { 527 GtkTextIter* outiter = sliceNew!GtkTextIter(); 528 529 auto __p = gtk_text_view_get_iter_at_position(gtkTextView, outiter, &trailing, x, y) != 0; 530 531 iter = ObjectG.getDObject!(TextIter)(outiter, true); 532 533 return __p; 534 } 535 536 /** 537 * Gets a rectangle which roughly contains the character at @iter. 538 * 539 * The rectangle position is in buffer coordinates; use 540 * [method@Gtk.TextView.buffer_to_window_coords] to convert these 541 * coordinates to coordinates for one of the windows in the text view. 542 * 543 * Params: 544 * iter = a `GtkTextIter` 545 * location = bounds of the character at @iter 546 */ 547 public void getIterLocation(TextIter iter, out GdkRectangle location) 548 { 549 gtk_text_view_get_iter_location(gtkTextView, (iter is null) ? null : iter.getTextIterStruct(), &location); 550 } 551 552 /** 553 * Gets the default justification of paragraphs in @text_view. 554 * 555 * Tags in the buffer may override the default. 556 * 557 * Returns: default justification 558 */ 559 public GtkJustification getJustification() 560 { 561 return gtk_text_view_get_justification(gtkTextView); 562 } 563 564 /** 565 * Gets the default left margin size of paragraphs in the @text_view. 566 * 567 * Tags in the buffer may override the default. 568 * 569 * Returns: left margin in pixels 570 */ 571 public int getLeftMargin() 572 { 573 return gtk_text_view_get_left_margin(gtkTextView); 574 } 575 576 /** 577 * Gets the `GtkTextIter` at the start of the line containing 578 * the coordinate @y. 579 * 580 * @y is in buffer coordinates, convert from window coordinates with 581 * [method@Gtk.TextView.window_to_buffer_coords]. If non-%NULL, 582 * @line_top will be filled with the coordinate of the top edge 583 * of the line. 584 * 585 * Params: 586 * targetIter = a `GtkTextIter` 587 * y = a y coordinate 588 * lineTop = return location for top coordinate of the line 589 */ 590 public void getLineAtY(out TextIter targetIter, int y, out int lineTop) 591 { 592 GtkTextIter* outtargetIter = sliceNew!GtkTextIter(); 593 594 gtk_text_view_get_line_at_y(gtkTextView, outtargetIter, y, &lineTop); 595 596 targetIter = ObjectG.getDObject!(TextIter)(outtargetIter, true); 597 } 598 599 /** 600 * Gets the y coordinate of the top of the line containing @iter, 601 * and the height of the line. 602 * 603 * The coordinate is a buffer coordinate; convert to window 604 * coordinates with [method@Gtk.TextView.buffer_to_window_coords]. 605 * 606 * Params: 607 * iter = a `GtkTextIter` 608 * y = return location for a y coordinate 609 * height = return location for a height 610 */ 611 public void getLineYrange(TextIter iter, out int y, out int height) 612 { 613 gtk_text_view_get_line_yrange(gtkTextView, (iter is null) ? null : iter.getTextIterStruct(), &y, &height); 614 } 615 616 /** 617 * Gets whether the `GtkTextView` uses monospace styling. 618 * 619 * Returns: %TRUE if monospace fonts are desired 620 */ 621 public bool getMonospace() 622 { 623 return gtk_text_view_get_monospace(gtkTextView) != 0; 624 } 625 626 /** 627 * Returns whether the `GtkTextView` is in overwrite mode or not. 628 * 629 * Returns: whether @text_view is in overwrite mode or not. 630 */ 631 public bool getOverwrite() 632 { 633 return gtk_text_view_get_overwrite(gtkTextView) != 0; 634 } 635 636 /** 637 * Gets the default number of pixels to put above paragraphs. 638 * 639 * Adding this function with [method@Gtk.TextView.get_pixels_below_lines] 640 * is equal to the line space between each paragraph. 641 * 642 * Returns: default number of pixels above paragraphs 643 */ 644 public int getPixelsAboveLines() 645 { 646 return gtk_text_view_get_pixels_above_lines(gtkTextView); 647 } 648 649 /** 650 * Gets the default number of pixels to put below paragraphs. 651 * 652 * The line space is the sum of the value returned by this function and 653 * the value returned by [method@Gtk.TextView.get_pixels_above_lines]. 654 * 655 * Returns: default number of blank pixels below paragraphs 656 */ 657 public int getPixelsBelowLines() 658 { 659 return gtk_text_view_get_pixels_below_lines(gtkTextView); 660 } 661 662 /** 663 * Gets the default number of pixels to put between wrapped lines 664 * inside a paragraph. 665 * 666 * Returns: default number of pixels of blank space between wrapped lines 667 */ 668 public int getPixelsInsideWrap() 669 { 670 return gtk_text_view_get_pixels_inside_wrap(gtkTextView); 671 } 672 673 /** 674 * Gets the default right margin for text in @text_view. 675 * 676 * Tags in the buffer may override the default. 677 * 678 * Returns: right margin in pixels 679 */ 680 public int getRightMargin() 681 { 682 return gtk_text_view_get_right_margin(gtkTextView); 683 } 684 685 /** 686 * Gets the default tabs for @text_view. 687 * 688 * Tags in the buffer may override the defaults. The returned array 689 * will be %NULL if “standard” (8-space) tabs are used. Free the 690 * return value with [method@Pango.TabArray.free]. 691 * 692 * Returns: copy of default tab array, 693 * or %NULL if standard tabs are used; must be freed with 694 * [method@Pango.TabArray.free]. 695 */ 696 public PgTabArray getTabs() 697 { 698 auto __p = gtk_text_view_get_tabs(gtkTextView); 699 700 if(__p is null) 701 { 702 return null; 703 } 704 705 return ObjectG.getDObject!(PgTabArray)(cast(PangoTabArray*) __p, true); 706 } 707 708 /** 709 * Gets the top margin for text in the @text_view. 710 * 711 * Returns: top margin in pixels 712 */ 713 public int getTopMargin() 714 { 715 return gtk_text_view_get_top_margin(gtkTextView); 716 } 717 718 /** 719 * Fills @visible_rect with the currently-visible 720 * region of the buffer, in buffer coordinates. 721 * 722 * Convert to window coordinates with 723 * [method@Gtk.TextView.buffer_to_window_coords]. 724 * 725 * Params: 726 * visibleRect = rectangle to fill 727 */ 728 public void getVisibleRect(out GdkRectangle visibleRect) 729 { 730 gtk_text_view_get_visible_rect(gtkTextView, &visibleRect); 731 } 732 733 /** 734 * Gets the line wrapping for the view. 735 * 736 * Returns: the line wrap setting 737 */ 738 public GtkWrapMode getWrapMode() 739 { 740 return gtk_text_view_get_wrap_mode(gtkTextView); 741 } 742 743 /** 744 * Allow the `GtkTextView` input method to internally handle key press 745 * and release events. 746 * 747 * If this function returns %TRUE, then no further processing should be 748 * done for this key event. See [method@Gtk.IMContext.filter_keypress]. 749 * 750 * Note that you are expected to call this function from your handler 751 * when overriding key event handling. This is needed in the case when 752 * you need to insert your own key handling between the input method 753 * and the default key event handling of the `GtkTextView`. 754 * 755 * ```c 756 * static gboolean 757 * gtk_foo_bar_key_press_event (GtkWidget *widget, 758 * GdkEvent *event) 759 * { 760 * guint keyval; 761 * 762 * gdk_event_get_keyval ((GdkEvent*)event, &keyval); 763 * 764 * if (keyval == GDK_KEY_Return || keyval == GDK_KEY_KP_Enter) 765 * { 766 * if (gtk_text_view_im_context_filter_keypress (GTK_TEXT_VIEW (widget), event)) 767 * return TRUE; 768 * } 769 * 770 * // Do some stuff 771 * 772 * return GTK_WIDGET_CLASS (gtk_foo_bar_parent_class)->key_press_event (widget, event); 773 * } 774 * ``` 775 * 776 * Params: 777 * event = the key event 778 * 779 * Returns: %TRUE if the input method handled the key event. 780 */ 781 public bool imContextFilterKeypress(Event event) 782 { 783 return gtk_text_view_im_context_filter_keypress(gtkTextView, (event is null) ? null : event.getEventStruct()) != 0; 784 } 785 786 /** 787 * Moves a mark within the buffer so that it's 788 * located within the currently-visible text area. 789 * 790 * Params: 791 * mark = a `GtkTextMark` 792 * 793 * Returns: %TRUE if the mark moved (wasn’t already onscreen) 794 */ 795 public bool moveMarkOnscreen(TextMark mark) 796 { 797 return gtk_text_view_move_mark_onscreen(gtkTextView, (mark is null) ? null : mark.getTextMarkStruct()) != 0; 798 } 799 800 /** 801 * Updates the position of a child. 802 * 803 * See [method@Gtk.TextView.add_overlay]. 804 * 805 * Params: 806 * child = a widget already added with [method@Gtk.TextView.add_overlay] 807 * xpos = new X position in buffer coordinates 808 * ypos = new Y position in buffer coordinates 809 */ 810 public void moveOverlay(Widget child, int xpos, int ypos) 811 { 812 gtk_text_view_move_overlay(gtkTextView, (child is null) ? null : child.getWidgetStruct(), xpos, ypos); 813 } 814 815 /** 816 * Move the iterator a given number of characters visually, treating 817 * it as the strong cursor position. 818 * 819 * If @count is positive, then the new strong cursor position will 820 * be @count positions to the right of the old cursor position. 821 * If @count is negative then the new strong cursor position will 822 * be @count positions to the left of the old cursor position. 823 * 824 * In the presence of bi-directional text, the correspondence 825 * between logical and visual order will depend on the direction 826 * of the current run, and there may be jumps when the cursor 827 * is moved off of the end of a run. 828 * 829 * Params: 830 * iter = a `GtkTextIter` 831 * count = number of characters to move (negative moves left, 832 * positive moves right) 833 * 834 * Returns: %TRUE if @iter moved and is not on the end iterator 835 */ 836 public bool moveVisually(TextIter iter, int count) 837 { 838 return gtk_text_view_move_visually(gtkTextView, (iter is null) ? null : iter.getTextIterStruct(), count) != 0; 839 } 840 841 /** 842 * Moves the cursor to the currently visible region of the 843 * buffer. 844 * 845 * Returns: %TRUE if the cursor had to be moved. 846 */ 847 public bool placeCursorOnscreen() 848 { 849 return gtk_text_view_place_cursor_onscreen(gtkTextView) != 0; 850 } 851 852 /** 853 * Removes a child widget from @text_view. 854 * 855 * Params: 856 * child = the child to remove 857 */ 858 public void remove(Widget child) 859 { 860 gtk_text_view_remove(gtkTextView, (child is null) ? null : child.getWidgetStruct()); 861 } 862 863 /** 864 * Ensures that the cursor is shown. 865 * 866 * This also resets the time that it will stay blinking (or 867 * visible, in case blinking is disabled). 868 * 869 * This function should be called in response to user input 870 * (e.g. from derived classes that override the textview's 871 * event handlers). 872 */ 873 public void resetCursorBlink() 874 { 875 gtk_text_view_reset_cursor_blink(gtkTextView); 876 } 877 878 /** 879 * Reset the input method context of the text view if needed. 880 * 881 * This can be necessary in the case where modifying the buffer 882 * would confuse on-going input method behavior. 883 */ 884 public void resetImContext() 885 { 886 gtk_text_view_reset_im_context(gtkTextView); 887 } 888 889 /** 890 * Scrolls @text_view the minimum distance such that @mark is contained 891 * within the visible area of the widget. 892 * 893 * Params: 894 * mark = a mark in the buffer for @text_view 895 */ 896 public void scrollMarkOnscreen(TextMark mark) 897 { 898 gtk_text_view_scroll_mark_onscreen(gtkTextView, (mark is null) ? null : mark.getTextMarkStruct()); 899 } 900 901 /** 902 * Scrolls @text_view so that @iter is on the screen in the position 903 * indicated by @xalign and @yalign. 904 * 905 * An alignment of 0.0 indicates left or top, 1.0 indicates right or 906 * bottom, 0.5 means center. If @use_align is %FALSE, the text scrolls 907 * the minimal distance to get the mark onscreen, possibly not scrolling 908 * at all. The effective screen for purposes of this function is reduced 909 * by a margin of size @within_margin. 910 * 911 * Note that this function uses the currently-computed height of the 912 * lines in the text buffer. Line heights are computed in an idle 913 * handler; so this function may not have the desired effect if it’s 914 * called before the height computations. To avoid oddness, consider 915 * using [method@Gtk.TextView.scroll_to_mark] which saves a point to be 916 * scrolled to after line validation. 917 * 918 * Params: 919 * iter = a `GtkTextIter` 920 * withinMargin = margin as a [0.0,0.5) fraction of screen size 921 * useAlign = whether to use alignment arguments (if %FALSE, 922 * just get the mark onscreen) 923 * xalign = horizontal alignment of mark within visible area 924 * yalign = vertical alignment of mark within visible area 925 * 926 * Returns: %TRUE if scrolling occurred 927 */ 928 public bool scrollToIter(TextIter iter, double withinMargin, bool useAlign, double xalign, double yalign) 929 { 930 return gtk_text_view_scroll_to_iter(gtkTextView, (iter is null) ? null : iter.getTextIterStruct(), withinMargin, useAlign, xalign, yalign) != 0; 931 } 932 933 /** 934 * Scrolls @text_view so that @mark is on the screen in the position 935 * indicated by @xalign and @yalign. 936 * 937 * An alignment of 0.0 indicates left or top, 1.0 indicates right or 938 * bottom, 0.5 means center. If @use_align is %FALSE, the text scrolls 939 * the minimal distance to get the mark onscreen, possibly not scrolling 940 * at all. The effective screen for purposes of this function is reduced 941 * by a margin of size @within_margin. 942 * 943 * Params: 944 * mark = a `GtkTextMark` 945 * withinMargin = margin as a [0.0,0.5) fraction of screen size 946 * useAlign = whether to use alignment arguments (if %FALSE, just 947 * get the mark onscreen) 948 * xalign = horizontal alignment of mark within visible area 949 * yalign = vertical alignment of mark within visible area 950 */ 951 public void scrollToMark(TextMark mark, double withinMargin, bool useAlign, double xalign, double yalign) 952 { 953 gtk_text_view_scroll_to_mark(gtkTextView, (mark is null) ? null : mark.getTextMarkStruct(), withinMargin, useAlign, xalign, yalign); 954 } 955 956 /** 957 * Sets the behavior of the text widget when the Tab key is pressed. 958 * 959 * If @accepts_tab is %TRUE, a tab character is inserted. If @accepts_tab 960 * is %FALSE the keyboard focus is moved to the next widget in the focus 961 * chain. 962 * 963 * Params: 964 * acceptsTab = %TRUE if pressing the Tab key should insert a tab 965 * character, %FALSE, if pressing the Tab key should move the 966 * keyboard focus. 967 */ 968 public void setAcceptsTab(bool acceptsTab) 969 { 970 gtk_text_view_set_accepts_tab(gtkTextView, acceptsTab); 971 } 972 973 /** 974 * Sets the bottom margin for text in @text_view. 975 * 976 * Note that this function is confusingly named. 977 * In CSS terms, the value set here is padding. 978 * 979 * Params: 980 * bottomMargin = bottom margin in pixels 981 */ 982 public void setBottomMargin(int bottomMargin) 983 { 984 gtk_text_view_set_bottom_margin(gtkTextView, bottomMargin); 985 } 986 987 /** 988 * Sets @buffer as the buffer being displayed by @text_view. 989 * 990 * The previous buffer displayed by the text view is unreferenced, and 991 * a reference is added to @buffer. If you owned a reference to @buffer 992 * before passing it to this function, you must remove that reference 993 * yourself; `GtkTextView` will not “adopt” it. 994 * 995 * Params: 996 * buffer = a `GtkTextBuffer` 997 */ 998 public void setBuffer(TextBuffer buffer) 999 { 1000 gtk_text_view_set_buffer(gtkTextView, (buffer is null) ? null : buffer.getTextBufferStruct()); 1001 } 1002 1003 /** 1004 * Toggles whether the insertion point should be displayed. 1005 * 1006 * A buffer with no editable text probably shouldn’t have a visible 1007 * cursor, so you may want to turn the cursor off. 1008 * 1009 * Note that this property may be overridden by the 1010 * [property@GtkSettings:gtk-keynav-use-caret] setting. 1011 * 1012 * Params: 1013 * setting = whether to show the insertion cursor 1014 */ 1015 public void setCursorVisible(bool setting) 1016 { 1017 gtk_text_view_set_cursor_visible(gtkTextView, setting); 1018 } 1019 1020 /** 1021 * Sets the default editability of the `GtkTextView`. 1022 * 1023 * You can override this default setting with tags in the buffer, 1024 * using the “editable” attribute of tags. 1025 * 1026 * Params: 1027 * setting = whether it’s editable 1028 */ 1029 public void setEditable(bool setting) 1030 { 1031 gtk_text_view_set_editable(gtkTextView, setting); 1032 } 1033 1034 /** 1035 * Sets a menu model to add when constructing the context 1036 * menu for @text_view. 1037 * 1038 * You can pass %NULL to remove a previously set extra menu. 1039 * 1040 * Params: 1041 * model = a `GMenuModel` 1042 */ 1043 public void setExtraMenu(MenuModel model) 1044 { 1045 gtk_text_view_set_extra_menu(gtkTextView, (model is null) ? null : model.getMenuModelStruct()); 1046 } 1047 1048 /** 1049 * Places @widget into the gutter specified by @win. 1050 * 1051 * @win must be one of %GTK_TEXT_WINDOW_LEFT, %GTK_TEXT_WINDOW_RIGHT, 1052 * %GTK_TEXT_WINDOW_TOP, or %GTK_TEXT_WINDOW_BOTTOM. 1053 * 1054 * Params: 1055 * win = a `GtkTextWindowType` 1056 * widget = a `GtkWidget` or %NULL 1057 */ 1058 public void setGutter(GtkTextWindowType win, Widget widget) 1059 { 1060 gtk_text_view_set_gutter(gtkTextView, win, (widget is null) ? null : widget.getWidgetStruct()); 1061 } 1062 1063 /** 1064 * Sets the default indentation for paragraphs in @text_view. 1065 * 1066 * Tags in the buffer may override the default. 1067 * 1068 * Params: 1069 * indent = indentation in pixels 1070 */ 1071 public void setIndent(int indent) 1072 { 1073 gtk_text_view_set_indent(gtkTextView, indent); 1074 } 1075 1076 /** 1077 * Sets the `input-hints` of the `GtkTextView`. 1078 * 1079 * The `input-hints` allow input methods to fine-tune 1080 * their behaviour. 1081 * 1082 * Params: 1083 * hints = the hints 1084 */ 1085 public void setInputHints(GtkInputHints hints) 1086 { 1087 gtk_text_view_set_input_hints(gtkTextView, hints); 1088 } 1089 1090 /** 1091 * Sets the `input-purpose` of the `GtkTextView`. 1092 * 1093 * The `input-purpose` can be used by on-screen keyboards 1094 * and other input methods to adjust their behaviour. 1095 * 1096 * Params: 1097 * purpose = the purpose 1098 */ 1099 public void setInputPurpose(GtkInputPurpose purpose) 1100 { 1101 gtk_text_view_set_input_purpose(gtkTextView, purpose); 1102 } 1103 1104 /** 1105 * Sets the default justification of text in @text_view. 1106 * 1107 * Tags in the view’s buffer may override the default. 1108 * 1109 * Params: 1110 * justification = justification 1111 */ 1112 public void setJustification(GtkJustification justification) 1113 { 1114 gtk_text_view_set_justification(gtkTextView, justification); 1115 } 1116 1117 /** 1118 * Sets the default left margin for text in @text_view. 1119 * 1120 * Tags in the buffer may override the default. 1121 * 1122 * Note that this function is confusingly named. 1123 * In CSS terms, the value set here is padding. 1124 * 1125 * Params: 1126 * leftMargin = left margin in pixels 1127 */ 1128 public void setLeftMargin(int leftMargin) 1129 { 1130 gtk_text_view_set_left_margin(gtkTextView, leftMargin); 1131 } 1132 1133 /** 1134 * Sets whether the `GtkTextView` should display text in 1135 * monospace styling. 1136 * 1137 * Params: 1138 * monospace = %TRUE to request monospace styling 1139 */ 1140 public void setMonospace(bool monospace) 1141 { 1142 gtk_text_view_set_monospace(gtkTextView, monospace); 1143 } 1144 1145 /** 1146 * Changes the `GtkTextView` overwrite mode. 1147 * 1148 * Params: 1149 * overwrite = %TRUE to turn on overwrite mode, %FALSE to turn it off 1150 */ 1151 public void setOverwrite(bool overwrite) 1152 { 1153 gtk_text_view_set_overwrite(gtkTextView, overwrite); 1154 } 1155 1156 /** 1157 * Sets the default number of blank pixels above paragraphs in @text_view. 1158 * 1159 * Tags in the buffer for @text_view may override the defaults. 1160 * 1161 * Params: 1162 * pixelsAboveLines = pixels above paragraphs 1163 */ 1164 public void setPixelsAboveLines(int pixelsAboveLines) 1165 { 1166 gtk_text_view_set_pixels_above_lines(gtkTextView, pixelsAboveLines); 1167 } 1168 1169 /** 1170 * Sets the default number of pixels of blank space 1171 * to put below paragraphs in @text_view. 1172 * 1173 * May be overridden by tags applied to @text_view’s buffer. 1174 * 1175 * Params: 1176 * pixelsBelowLines = pixels below paragraphs 1177 */ 1178 public void setPixelsBelowLines(int pixelsBelowLines) 1179 { 1180 gtk_text_view_set_pixels_below_lines(gtkTextView, pixelsBelowLines); 1181 } 1182 1183 /** 1184 * Sets the default number of pixels of blank space to leave between 1185 * display/wrapped lines within a paragraph. 1186 * 1187 * May be overridden by tags in @text_view’s buffer. 1188 * 1189 * Params: 1190 * pixelsInsideWrap = default number of pixels between wrapped lines 1191 */ 1192 public void setPixelsInsideWrap(int pixelsInsideWrap) 1193 { 1194 gtk_text_view_set_pixels_inside_wrap(gtkTextView, pixelsInsideWrap); 1195 } 1196 1197 /** 1198 * Sets the default right margin for text in the text view. 1199 * 1200 * Tags in the buffer may override the default. 1201 * 1202 * Note that this function is confusingly named. 1203 * In CSS terms, the value set here is padding. 1204 * 1205 * Params: 1206 * rightMargin = right margin in pixels 1207 */ 1208 public void setRightMargin(int rightMargin) 1209 { 1210 gtk_text_view_set_right_margin(gtkTextView, rightMargin); 1211 } 1212 1213 /** 1214 * Sets the default tab stops for paragraphs in @text_view. 1215 * 1216 * Tags in the buffer may override the default. 1217 * 1218 * Params: 1219 * tabs = tabs as a #PangoTabArray 1220 */ 1221 public void setTabs(PgTabArray tabs) 1222 { 1223 gtk_text_view_set_tabs(gtkTextView, (tabs is null) ? null : tabs.getPgTabArrayStruct()); 1224 } 1225 1226 /** 1227 * Sets the top margin for text in @text_view. 1228 * 1229 * Note that this function is confusingly named. 1230 * In CSS terms, the value set here is padding. 1231 * 1232 * Params: 1233 * topMargin = top margin in pixels 1234 */ 1235 public void setTopMargin(int topMargin) 1236 { 1237 gtk_text_view_set_top_margin(gtkTextView, topMargin); 1238 } 1239 1240 /** 1241 * Sets the line wrapping for the view. 1242 * 1243 * Params: 1244 * wrapMode = a `GtkWrapMode` 1245 */ 1246 public void setWrapMode(GtkWrapMode wrapMode) 1247 { 1248 gtk_text_view_set_wrap_mode(gtkTextView, wrapMode); 1249 } 1250 1251 /** 1252 * Determines whether @iter is at the start of a display line. 1253 * 1254 * See [method@Gtk.TextView.forward_display_line] for an 1255 * explanation of display lines vs. paragraphs. 1256 * 1257 * Params: 1258 * iter = a `GtkTextIter` 1259 * 1260 * Returns: %TRUE if @iter begins a wrapped line 1261 */ 1262 public bool startsDisplayLine(TextIter iter) 1263 { 1264 return gtk_text_view_starts_display_line(gtkTextView, (iter is null) ? null : iter.getTextIterStruct()) != 0; 1265 } 1266 1267 /** 1268 * Converts coordinates on the window identified by @win to buffer 1269 * coordinates. 1270 * 1271 * Params: 1272 * win = a #GtkTextWindowType 1273 * windowX = window x coordinate 1274 * windowY = window y coordinate 1275 * bufferX = buffer x coordinate return location or %NULL 1276 * bufferY = buffer y coordinate return location or %NULL 1277 */ 1278 public void windowToBufferCoords(GtkTextWindowType win, int windowX, int windowY, out int bufferX, out int bufferY) 1279 { 1280 gtk_text_view_window_to_buffer_coords(gtkTextView, win, windowX, windowY, &bufferX, &bufferY); 1281 } 1282 1283 /** 1284 * Gets emitted when the user asks for it. 1285 * 1286 * The ::backspace signal is a [keybinding signal](class.SignalAction.html). 1287 * 1288 * The default bindings for this signal are 1289 * <kbd>Backspace</kbd> and <kbd>Shift</kbd>-<kbd>Backspace</kbd>. 1290 */ 1291 gulong addOnBackspace(void delegate(TextView) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 1292 { 1293 return Signals.connect(this, "backspace", dlg, connectFlags ^ ConnectFlags.SWAPPED); 1294 } 1295 1296 /** 1297 * Gets emitted to copy the selection to the clipboard. 1298 * 1299 * The ::copy-clipboard signal is a [keybinding signal](class.SignalAction.html). 1300 * 1301 * The default bindings for this signal are 1302 * <kbd>Ctrl</kbd>-<kbd>c</kbd> and 1303 * <kbd>Ctrl</kbd>-<kbd>Insert</kbd>. 1304 */ 1305 gulong addOnCopyClipboard(void delegate(TextView) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 1306 { 1307 return Signals.connect(this, "copy-clipboard", dlg, connectFlags ^ ConnectFlags.SWAPPED); 1308 } 1309 1310 /** 1311 * Gets emitted to cut the selection to the clipboard. 1312 * 1313 * The ::cut-clipboard signal is a [keybinding signal](class.SignalAction.html). 1314 * 1315 * The default bindings for this signal are 1316 * <kbd>Ctrl</kbd>-<kbd>x</kbd> and 1317 * <kbd>Shift</kbd>-<kbd>Delete</kbd>. 1318 */ 1319 gulong addOnCutClipboard(void delegate(TextView) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 1320 { 1321 return Signals.connect(this, "cut-clipboard", dlg, connectFlags ^ ConnectFlags.SWAPPED); 1322 } 1323 1324 /** 1325 * Gets emitted when the user initiates a text deletion. 1326 * 1327 * The ::delete-from-cursor signal is a [keybinding signal](class.SignalAction.html). 1328 * 1329 * If the @type is %GTK_DELETE_CHARS, GTK deletes the selection 1330 * if there is one, otherwise it deletes the requested number 1331 * of characters. 1332 * 1333 * The default bindings for this signal are <kbd>Delete</kbd> for 1334 * deleting a character, <kbd>Ctrl</kbd>-<kbd>Delete</kbd> for 1335 * deleting a word and <kbd>Ctrl</kbd>-<kbd>Backspace</kbd> for 1336 * deleting a word backwards. 1337 * 1338 * Params: 1339 * type = the granularity of the deletion, as a #GtkDeleteType 1340 * count = the number of @type units to delete 1341 */ 1342 gulong addOnDeleteFromCursor(void delegate(GtkDeleteType, int, TextView) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 1343 { 1344 return Signals.connect(this, "delete-from-cursor", dlg, connectFlags ^ ConnectFlags.SWAPPED); 1345 } 1346 1347 /** 1348 * Emitted when the selection needs to be extended at @location. 1349 * 1350 * Params: 1351 * granularity = the granularity type 1352 * location = the location where to extend the selection 1353 * start = where the selection should start 1354 * end = where the selection should end 1355 * 1356 * Returns: %GDK_EVENT_STOP to stop other handlers from being invoked for the 1357 * event. %GDK_EVENT_PROPAGATE to propagate the event further. 1358 */ 1359 gulong addOnExtendSelection(bool delegate(GtkTextExtendSelection, TextIter, TextIter, TextIter, TextView) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 1360 { 1361 return Signals.connect(this, "extend-selection", dlg, connectFlags ^ ConnectFlags.SWAPPED); 1362 } 1363 1364 /** 1365 * Gets emitted when the user initiates the insertion of a 1366 * fixed string at the cursor. 1367 * 1368 * The ::insert-at-cursor signal is a [keybinding signal](class.SignalAction.html). 1369 * 1370 * This signal has no default bindings. 1371 * 1372 * Params: 1373 * string_ = the string to insert 1374 */ 1375 gulong addOnInsertAtCursor(void delegate(string, TextView) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 1376 { 1377 return Signals.connect(this, "insert-at-cursor", dlg, connectFlags ^ ConnectFlags.SWAPPED); 1378 } 1379 1380 /** 1381 * Gets emitted to present the Emoji chooser for the @text_view. 1382 * 1383 * The ::insert-emoji signal is a [keybinding signal](class.SignalAction.html). 1384 * 1385 * The default bindings for this signal are 1386 * <kbd>Ctrl</kbd>-<kbd>.</kbd> and 1387 * <kbd>Ctrl</kbd>-<kbd>;</kbd> 1388 */ 1389 gulong addOnInsertEmoji(void delegate(TextView) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 1390 { 1391 return Signals.connect(this, "insert-emoji", dlg, connectFlags ^ ConnectFlags.SWAPPED); 1392 } 1393 1394 /** 1395 * Gets emitted when the user initiates a cursor movement. 1396 * 1397 * The ::move-cursor signal is a [keybinding signal](class.SignalAction.html). 1398 * If the cursor is not visible in @text_view, this signal causes 1399 * the viewport to be moved instead. 1400 * 1401 * Applications should not connect to it, but may emit it with 1402 * g_signal_emit_by_name() if they need to control the cursor 1403 * programmatically. 1404 * 1405 * 1406 * The default bindings for this signal come in two variants, 1407 * the variant with the <kbd>Shift</kbd> modifier extends the 1408 * selection, the variant without it does not. 1409 * There are too many key combinations to list them all here. 1410 * 1411 * - <kbd>←</kbd>, <kbd>→</kbd>, <kbd>↑</kbd>, <kbd>↓</kbd> 1412 * move by individual characters/lines 1413 * - <kbd>Ctrl</kbd>-<kbd>→</kbd>, etc. move by words/paragraphs 1414 * - <kbd>Home</kbd>, <kbd>End</kbd> move to the ends of the buffer 1415 * - <kbd>PgUp</kbd>, <kbd>PgDn</kbd> move vertically by pages 1416 * - <kbd>Ctrl</kbd>-<kbd>PgUp</kbd>, <kbd>Ctrl</kbd>-<kbd>PgDn</kbd> 1417 * move horizontally by pages 1418 * 1419 * Params: 1420 * step = the granularity of the move, as a #GtkMovementStep 1421 * count = the number of @step units to move 1422 * extendSelection = %TRUE if the move should extend the selection 1423 */ 1424 gulong addOnMoveCursor(void delegate(GtkMovementStep, int, bool, TextView) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 1425 { 1426 return Signals.connect(this, "move-cursor", dlg, connectFlags ^ ConnectFlags.SWAPPED); 1427 } 1428 1429 /** 1430 * Gets emitted to move the viewport. 1431 * 1432 * The ::move-viewport signal is a [keybinding signal](class.SignalAction.html), 1433 * which can be bound to key combinations to allow the user to move the viewport, 1434 * i.e. change what part of the text view is visible in a containing scrolled 1435 * window. 1436 * 1437 * There are no default bindings for this signal. 1438 * 1439 * Params: 1440 * step = the granularity of the movement, as a #GtkScrollStep 1441 * count = the number of @step units to move 1442 */ 1443 gulong addOnMoveViewport(void delegate(GtkScrollStep, int, TextView) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 1444 { 1445 return Signals.connect(this, "move-viewport", dlg, connectFlags ^ ConnectFlags.SWAPPED); 1446 } 1447 1448 /** 1449 * Gets emitted to paste the contents of the clipboard 1450 * into the text view. 1451 * 1452 * The ::paste-clipboard signal is a [keybinding signal](class.SignalAction.html). 1453 * 1454 * The default bindings for this signal are 1455 * <kbd>Ctrl</kbd>-<kbd>v</kbd> and 1456 * <kbd>Shift</kbd>-<kbd>Insert</kbd>. 1457 */ 1458 gulong addOnPasteClipboard(void delegate(TextView) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 1459 { 1460 return Signals.connect(this, "paste-clipboard", dlg, connectFlags ^ ConnectFlags.SWAPPED); 1461 } 1462 1463 /** 1464 * Emitted when preedit text of the active IM changes. 1465 * 1466 * If an input method is used, the typed text will not immediately 1467 * be committed to the buffer. So if you are interested in the text, 1468 * connect to this signal. 1469 * 1470 * This signal is only emitted if the text at the given position 1471 * is actually editable. 1472 * 1473 * Params: 1474 * preedit = the current preedit string 1475 */ 1476 gulong addOnPreeditChanged(void delegate(string, TextView) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 1477 { 1478 return Signals.connect(this, "preedit-changed", dlg, connectFlags ^ ConnectFlags.SWAPPED); 1479 } 1480 1481 /** 1482 * Gets emitted to select or unselect the complete contents of the text view. 1483 * 1484 * The ::select-all signal is a [keybinding signal](class.SignalAction.html). 1485 * 1486 * The default bindings for this signal are 1487 * <kbd>Ctrl</kbd>-<kbd>a</kbd> and 1488 * <kbd>Ctrl</kbd>-<kbd>/</kbd> for selecting and 1489 * <kbd>Shift</kbd>-<kbd>Ctrl</kbd>-<kbd>a</kbd> and 1490 * <kbd>Ctrl</kbd>-<kbd>\</kbd> for unselecting. 1491 * 1492 * Params: 1493 * select = %TRUE to select, %FALSE to unselect 1494 */ 1495 gulong addOnSelectAll(void delegate(bool, TextView) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 1496 { 1497 return Signals.connect(this, "select-all", dlg, connectFlags ^ ConnectFlags.SWAPPED); 1498 } 1499 1500 /** 1501 * Gets emitted when the user initiates settings the "anchor" mark. 1502 * 1503 * The ::set-anchor signal is a [keybinding signal](class.SignalAction.html) 1504 * which gets emitted when the user initiates setting the "anchor" 1505 * mark. The "anchor" mark gets placed at the same position as the 1506 * "insert" mark. 1507 * 1508 * This signal has no default bindings. 1509 */ 1510 gulong addOnSetAnchor(void delegate(TextView) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 1511 { 1512 return Signals.connect(this, "set-anchor", dlg, connectFlags ^ ConnectFlags.SWAPPED); 1513 } 1514 1515 /** 1516 * Gets emitted to toggle the `cursor-visible` property. 1517 * 1518 * The ::toggle-cursor-visible signal is a 1519 * [keybinding signal](class.SignalAction.html). 1520 * 1521 * The default binding for this signal is <kbd>F7</kbd>. 1522 */ 1523 gulong addOnToggleCursorVisible(void delegate(TextView) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 1524 { 1525 return Signals.connect(this, "toggle-cursor-visible", dlg, connectFlags ^ ConnectFlags.SWAPPED); 1526 } 1527 1528 /** 1529 * Gets emitted to toggle the overwrite mode of the text view. 1530 * 1531 * The ::toggle-overwrite signal is a [keybinding signal](class.SignalAction.html). 1532 * 1533 * The default binding for this signal is <kbd>Insert</kbd>. 1534 */ 1535 gulong addOnToggleOverwrite(void delegate(TextView) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 1536 { 1537 return Signals.connect(this, "toggle-overwrite", dlg, connectFlags ^ ConnectFlags.SWAPPED); 1538 } 1539 }