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 gsv.SourceView; 26 27 private import gdk.Event; 28 private import glib.ConstructionException; 29 private import glib.Str; 30 private import gobject.ObjectG; 31 private import gobject.Signals; 32 private import gsv.SourceBuffer; 33 private import gsv.SourceCompletion; 34 private import gsv.SourceGutter; 35 private import gsv.SourceMarkAttributes; 36 private import gsv.SpaceDrawer; 37 private import gsv.c.functions; 38 public import gsv.c.types; 39 public import gsvc.gsvtypes; 40 private import gtk.BuildableIF; 41 private import gtk.BuildableT; 42 private import gtk.ScrollableIF; 43 private import gtk.ScrollableT; 44 private import gtk.TextIter; 45 private import gtk.TextView; 46 private import gtk.Widget; 47 private import std.algorithm; 48 49 50 /** */ 51 public class SourceView : TextView 52 { 53 /** the main Gtk struct */ 54 protected GtkSourceView* gtkSourceView; 55 56 /** Get the main Gtk struct */ 57 public GtkSourceView* getSourceViewStruct(bool transferOwnership = false) 58 { 59 if (transferOwnership) 60 ownedRef = false; 61 return gtkSourceView; 62 } 63 64 /** the main Gtk struct as a void* */ 65 protected override void* getStruct() 66 { 67 return cast(void*)gtkSourceView; 68 } 69 70 /** 71 * Sets our main struct and passes it to the parent class. 72 */ 73 public this (GtkSourceView* gtkSourceView, bool ownedRef = false) 74 { 75 this.gtkSourceView = gtkSourceView; 76 super(cast(GtkTextView*)gtkSourceView, ownedRef); 77 } 78 79 /** 80 * Returns the GtkSourceBuffer being displayed by this source view. 81 * The reference count on the buffer is not incremented; the caller 82 * of this function won't own a new reference. 83 * 84 * Returns: 85 * a GtkSourceBuffer 86 */ 87 public override SourceBuffer getBuffer() 88 { 89 auto p = gtk_text_view_get_buffer(cast(GtkTextView*)gtkSourceView); 90 91 return ObjectG.getDObject!(SourceBuffer)(cast(GtkSourceBuffer*) p); 92 } 93 94 /** 95 */ 96 97 /** */ 98 public static GType getType() 99 { 100 return gtk_source_view_get_type(); 101 } 102 103 /** 104 * Creates a new #GtkSourceView. 105 * 106 * By default, an empty #GtkSourceBuffer will be lazily created and can be 107 * retrieved with gtk_text_view_get_buffer(). 108 * 109 * If you want to specify your own buffer, either override the 110 * #GtkTextViewClass create_buffer factory method, or use 111 * gtk_source_view_new_with_buffer(). 112 * 113 * Returns: a new #GtkSourceView. 114 * 115 * Throws: ConstructionException GTK+ fails to create the object. 116 */ 117 public this() 118 { 119 auto p = gtk_source_view_new(); 120 121 if(p is null) 122 { 123 throw new ConstructionException("null returned by new"); 124 } 125 126 this(cast(GtkSourceView*) p); 127 } 128 129 /** 130 * Creates a new #GtkSourceView widget displaying the buffer 131 * @buffer. One buffer can be shared among many widgets. 132 * 133 * Params: 134 * buffer = a #GtkSourceBuffer. 135 * 136 * Returns: a new #GtkSourceView. 137 * 138 * Throws: ConstructionException GTK+ fails to create the object. 139 */ 140 public this(SourceBuffer buffer) 141 { 142 auto p = gtk_source_view_new_with_buffer((buffer is null) ? null : buffer.getSourceBufferStruct()); 143 144 if(p is null) 145 { 146 throw new ConstructionException("null returned by new_with_buffer"); 147 } 148 149 this(cast(GtkSourceView*) p); 150 } 151 152 /** 153 * Returns whether auto-indentation of text is enabled. 154 * 155 * Returns: %TRUE if auto indentation is enabled. 156 */ 157 public bool getAutoIndent() 158 { 159 return gtk_source_view_get_auto_indent(gtkSourceView) != 0; 160 } 161 162 /** 163 * Returns the #GtkSourceBackgroundPatternType specifying if and how 164 * the background pattern should be displayed for this @view. 165 * 166 * Returns: the #GtkSourceBackgroundPatternType. 167 * 168 * Since: 3.16 169 */ 170 public GtkSourceBackgroundPatternType getBackgroundPattern() 171 { 172 return gtk_source_view_get_background_pattern(gtkSourceView); 173 } 174 175 /** 176 * Gets the #GtkSourceCompletion associated with @view. The returned object is 177 * guaranteed to be the same for the lifetime of @view. Each #GtkSourceView 178 * object has a different #GtkSourceCompletion. 179 * 180 * Returns: the #GtkSourceCompletion associated with @view. 181 */ 182 public SourceCompletion getCompletion() 183 { 184 auto p = gtk_source_view_get_completion(gtkSourceView); 185 186 if(p is null) 187 { 188 return null; 189 } 190 191 return ObjectG.getDObject!(SourceCompletion)(cast(GtkSourceCompletion*) p); 192 } 193 194 /** 195 * Returns the #GtkSourceDrawSpacesFlags specifying if and how spaces 196 * should be displayed for this @view. 197 * 198 * Deprecated: Use gtk_source_space_drawer_get_types_for_locations() 199 * instead. 200 * 201 * Returns: the #GtkSourceDrawSpacesFlags, 0 if no spaces should be drawn. 202 */ 203 public GtkSourceDrawSpacesFlags getDrawSpaces() 204 { 205 return gtk_source_view_get_draw_spaces(gtkSourceView); 206 } 207 208 /** 209 * Returns the #GtkSourceGutter object associated with @window_type for @view. 210 * Only GTK_TEXT_WINDOW_LEFT and GTK_TEXT_WINDOW_RIGHT are supported, 211 * respectively corresponding to the left and right gutter. The line numbers 212 * and mark category icons are rendered in the left gutter. 213 * 214 * Params: 215 * windowType = the gutter window type. 216 * 217 * Returns: the #GtkSourceGutter. 218 * 219 * Since: 2.8 220 */ 221 public SourceGutter getGutter(GtkTextWindowType windowType) 222 { 223 auto p = gtk_source_view_get_gutter(gtkSourceView, windowType); 224 225 if(p is null) 226 { 227 return null; 228 } 229 230 return ObjectG.getDObject!(SourceGutter)(cast(GtkSourceGutter*) p); 231 } 232 233 /** 234 * Returns whether the current line is highlighted. 235 * 236 * Returns: %TRUE if the current line is highlighted. 237 */ 238 public bool getHighlightCurrentLine() 239 { 240 return gtk_source_view_get_highlight_current_line(gtkSourceView) != 0; 241 } 242 243 /** 244 * Returns whether when the tab key is pressed the current selection 245 * should get indented instead of replaced with the \t character. 246 * 247 * Returns: %TRUE if the selection is indented when tab is pressed. 248 */ 249 public bool getIndentOnTab() 250 { 251 return gtk_source_view_get_indent_on_tab(gtkSourceView) != 0; 252 } 253 254 /** 255 * Returns the number of spaces to use for each step of indent. 256 * See gtk_source_view_set_indent_width() for details. 257 * 258 * Returns: indent width. 259 */ 260 public int getIndentWidth() 261 { 262 return gtk_source_view_get_indent_width(gtkSourceView); 263 } 264 265 /** 266 * Returns whether when inserting a tabulator character it should 267 * be replaced by a group of space characters. 268 * 269 * Returns: %TRUE if spaces are inserted instead of tabs. 270 */ 271 public bool getInsertSpacesInsteadOfTabs() 272 { 273 return gtk_source_view_get_insert_spaces_instead_of_tabs(gtkSourceView) != 0; 274 } 275 276 /** 277 * Gets attributes and priority for the @category. 278 * 279 * Params: 280 * category = the category. 281 * priority = place where priority of the category will be stored. 282 * 283 * Returns: #GtkSourceMarkAttributes for the @category. 284 * The object belongs to @view, so it must not be unreffed. 285 */ 286 public SourceMarkAttributes getMarkAttributes(string category, int* priority) 287 { 288 auto p = gtk_source_view_get_mark_attributes(gtkSourceView, Str.toStringz(category), priority); 289 290 if(p is null) 291 { 292 return null; 293 } 294 295 return ObjectG.getDObject!(SourceMarkAttributes)(cast(GtkSourceMarkAttributes*) p); 296 } 297 298 /** 299 * Gets the position of the right margin in the given @view. 300 * 301 * Returns: the position of the right margin. 302 */ 303 public uint getRightMarginPosition() 304 { 305 return gtk_source_view_get_right_margin_position(gtkSourceView); 306 } 307 308 /** 309 * Returns whether line marks are displayed beside the text. 310 * 311 * Returns: %TRUE if the line marks are displayed. 312 * 313 * Since: 2.2 314 */ 315 public bool getShowLineMarks() 316 { 317 return gtk_source_view_get_show_line_marks(gtkSourceView) != 0; 318 } 319 320 /** 321 * Returns whether line numbers are displayed beside the text. 322 * 323 * Returns: %TRUE if the line numbers are displayed. 324 */ 325 public bool getShowLineNumbers() 326 { 327 return gtk_source_view_get_show_line_numbers(gtkSourceView) != 0; 328 } 329 330 /** 331 * Returns whether a right margin is displayed. 332 * 333 * Returns: %TRUE if the right margin is shown. 334 */ 335 public bool getShowRightMargin() 336 { 337 return gtk_source_view_get_show_right_margin(gtkSourceView) != 0; 338 } 339 340 /** 341 * Returns %TRUE if pressing the Backspace key will try to delete spaces 342 * up to the previous tab stop. 343 * 344 * Returns: %TRUE if smart Backspace handling is enabled. 345 * 346 * Since: 3.18 347 */ 348 public bool getSmartBackspace() 349 { 350 return gtk_source_view_get_smart_backspace(gtkSourceView) != 0; 351 } 352 353 /** 354 * Returns a #GtkSourceSmartHomeEndType end value specifying 355 * how the cursor will move when HOME and END keys are pressed. 356 * 357 * Returns: a #GtkSourceSmartHomeEndType value. 358 */ 359 public GtkSourceSmartHomeEndType getSmartHomeEnd() 360 { 361 return gtk_source_view_get_smart_home_end(gtkSourceView); 362 } 363 364 /** 365 * Gets the #GtkSourceSpaceDrawer associated with @view. The returned object is 366 * guaranteed to be the same for the lifetime of @view. Each #GtkSourceView 367 * object has a different #GtkSourceSpaceDrawer. 368 * 369 * Returns: the #GtkSourceSpaceDrawer associated with @view. 370 * 371 * Since: 3.24 372 */ 373 public SpaceDrawer getSpaceDrawer() 374 { 375 auto p = gtk_source_view_get_space_drawer(gtkSourceView); 376 377 if(p is null) 378 { 379 return null; 380 } 381 382 return ObjectG.getDObject!(SpaceDrawer)(cast(GtkSourceSpaceDrawer*) p); 383 } 384 385 /** 386 * Returns the width of tabulation in characters. 387 * 388 * Returns: width of tab. 389 */ 390 public uint getTabWidth() 391 { 392 return gtk_source_view_get_tab_width(gtkSourceView); 393 } 394 395 /** 396 * Determines the visual column at @iter taking into consideration the 397 * #GtkSourceView:tab-width of @view. 398 * 399 * Params: 400 * iter = a position in @view. 401 * 402 * Returns: the visual column at @iter. 403 */ 404 public uint getVisualColumn(TextIter iter) 405 { 406 return gtk_source_view_get_visual_column(gtkSourceView, (iter is null) ? null : iter.getTextIterStruct()); 407 } 408 409 /** 410 * Inserts one indentation level at the beginning of the specified lines. The 411 * empty lines are not indented. 412 * 413 * Params: 414 * start = #GtkTextIter of the first line to indent 415 * end = #GtkTextIter of the last line to indent 416 * 417 * Since: 3.16 418 */ 419 public void indentLines(TextIter start, TextIter end) 420 { 421 gtk_source_view_indent_lines(gtkSourceView, (start is null) ? null : start.getTextIterStruct(), (end is null) ? null : end.getTextIterStruct()); 422 } 423 424 /** 425 * If %TRUE auto-indentation of text is enabled. 426 * 427 * When Enter is pressed to create a new line, the auto-indentation inserts the 428 * same indentation as the previous line. This is <emphasis>not</emphasis> a 429 * "smart indentation" where an indentation level is added or removed depending 430 * on the context. 431 * 432 * Params: 433 * enable = whether to enable auto indentation. 434 */ 435 public void setAutoIndent(bool enable) 436 { 437 gtk_source_view_set_auto_indent(gtkSourceView, enable); 438 } 439 440 /** 441 * Set if and how the background pattern should be displayed. 442 * 443 * Params: 444 * backgroundPattern = the #GtkSourceBackgroundPatternType. 445 * 446 * Since: 3.16 447 */ 448 public void setBackgroundPattern(GtkSourceBackgroundPatternType backgroundPattern) 449 { 450 gtk_source_view_set_background_pattern(gtkSourceView, backgroundPattern); 451 } 452 453 /** 454 * Set if and how the spaces should be visualized. Specifying @flags as 0 will 455 * disable display of spaces. 456 * 457 * For a finer-grained method, there is also the GtkSourceTag's 458 * #GtkSourceTag:draw-spaces property. 459 * 460 * Deprecated: Use gtk_source_space_drawer_set_types_for_locations() 461 * instead. 462 * 463 * Params: 464 * flags = #GtkSourceDrawSpacesFlags specifing how white spaces should 465 * be displayed 466 */ 467 public void setDrawSpaces(GtkSourceDrawSpacesFlags flags) 468 { 469 gtk_source_view_set_draw_spaces(gtkSourceView, flags); 470 } 471 472 /** 473 * If @highlight is %TRUE the current line will be highlighted. 474 * 475 * Params: 476 * highlight = whether to highlight the current line. 477 */ 478 public void setHighlightCurrentLine(bool highlight) 479 { 480 gtk_source_view_set_highlight_current_line(gtkSourceView, highlight); 481 } 482 483 /** 484 * If %TRUE, when the tab key is pressed when several lines are selected, the 485 * selected lines are indented of one level instead of being replaced with a \t 486 * character. Shift+Tab unindents the selection. 487 * 488 * If the first or last line is not selected completely, it is also indented or 489 * unindented. 490 * 491 * When the selection doesn't span several lines, the tab key always replaces 492 * the selection with a normal \t character. 493 * 494 * Params: 495 * enable = whether to indent a block when tab is pressed. 496 */ 497 public void setIndentOnTab(bool enable) 498 { 499 gtk_source_view_set_indent_on_tab(gtkSourceView, enable); 500 } 501 502 /** 503 * Sets the number of spaces to use for each step of indent when the tab key is 504 * pressed. If @width is -1, the value of the #GtkSourceView:tab-width property 505 * will be used. 506 * 507 * The #GtkSourceView:indent-width interacts with the 508 * #GtkSourceView:insert-spaces-instead-of-tabs property and 509 * #GtkSourceView:tab-width. An example will be clearer: if the 510 * #GtkSourceView:indent-width is 4 and 511 * #GtkSourceView:tab-width is 8 and 512 * #GtkSourceView:insert-spaces-instead-of-tabs is %FALSE, then pressing the tab 513 * key at the beginning of a line will insert 4 spaces. So far so good. Pressing 514 * the tab key a second time will remove the 4 spaces and insert a \t character 515 * instead (since #GtkSourceView:tab-width is 8). On the other hand, if 516 * #GtkSourceView:insert-spaces-instead-of-tabs is %TRUE, the second tab key 517 * pressed will insert 4 more spaces for a total of 8 spaces in the 518 * #GtkTextBuffer. 519 * 520 * The test-widget program (available in the GtkSourceView repository) may be 521 * useful to better understand the indentation settings (enable the space 522 * drawing!). 523 * 524 * Params: 525 * width = indent width in characters. 526 */ 527 public void setIndentWidth(int width) 528 { 529 gtk_source_view_set_indent_width(gtkSourceView, width); 530 } 531 532 /** 533 * If %TRUE a tab key pressed is replaced by a group of space characters. Of 534 * course it is still possible to insert a real \t programmatically with the 535 * #GtkTextBuffer API. 536 * 537 * Params: 538 * enable = whether to insert spaces instead of tabs. 539 */ 540 public void setInsertSpacesInsteadOfTabs(bool enable) 541 { 542 gtk_source_view_set_insert_spaces_instead_of_tabs(gtkSourceView, enable); 543 } 544 545 /** 546 * Sets attributes and priority for the @category. 547 * 548 * Params: 549 * category = the category. 550 * attributes = mark attributes. 551 * priority = priority of the category. 552 */ 553 public void setMarkAttributes(string category, SourceMarkAttributes attributes, int priority) 554 { 555 gtk_source_view_set_mark_attributes(gtkSourceView, Str.toStringz(category), (attributes is null) ? null : attributes.getSourceMarkAttributesStruct(), priority); 556 } 557 558 /** 559 * Sets the position of the right margin in the given @view. 560 * 561 * Params: 562 * pos = the width in characters where to position the right margin. 563 */ 564 public void setRightMarginPosition(uint pos) 565 { 566 gtk_source_view_set_right_margin_position(gtkSourceView, pos); 567 } 568 569 /** 570 * If %TRUE line marks will be displayed beside the text. 571 * 572 * Params: 573 * show = whether line marks should be displayed. 574 * 575 * Since: 2.2 576 */ 577 public void setShowLineMarks(bool show) 578 { 579 gtk_source_view_set_show_line_marks(gtkSourceView, show); 580 } 581 582 /** 583 * If %TRUE line numbers will be displayed beside the text. 584 * 585 * Params: 586 * show = whether line numbers should be displayed. 587 */ 588 public void setShowLineNumbers(bool show) 589 { 590 gtk_source_view_set_show_line_numbers(gtkSourceView, show); 591 } 592 593 /** 594 * If %TRUE a right margin is displayed. 595 * 596 * Params: 597 * show = whether to show a right margin. 598 */ 599 public void setShowRightMargin(bool show) 600 { 601 gtk_source_view_set_show_right_margin(gtkSourceView, show); 602 } 603 604 /** 605 * When set to %TRUE, pressing the Backspace key will try to delete spaces 606 * up to the previous tab stop. 607 * 608 * Params: 609 * smartBackspace = whether to enable smart Backspace handling. 610 * 611 * Since: 3.18 612 */ 613 public void setSmartBackspace(bool smartBackspace) 614 { 615 gtk_source_view_set_smart_backspace(gtkSourceView, smartBackspace); 616 } 617 618 /** 619 * Set the desired movement of the cursor when HOME and END keys 620 * are pressed. 621 * 622 * Params: 623 * smartHomeEnd = the desired behavior among #GtkSourceSmartHomeEndType. 624 */ 625 public void setSmartHomeEnd(GtkSourceSmartHomeEndType smartHomeEnd) 626 { 627 gtk_source_view_set_smart_home_end(gtkSourceView, smartHomeEnd); 628 } 629 630 /** 631 * Sets the width of tabulation in characters. The #GtkTextBuffer still contains 632 * \t characters, but they can take a different visual width in a #GtkSourceView 633 * widget. 634 * 635 * Params: 636 * width = width of tab in characters. 637 */ 638 public void setTabWidth(uint width) 639 { 640 gtk_source_view_set_tab_width(gtkSourceView, width); 641 } 642 643 /** 644 * Removes one indentation level at the beginning of the 645 * specified lines. 646 * 647 * Params: 648 * start = #GtkTextIter of the first line to indent 649 * end = #GtkTextIter of the last line to indent 650 * 651 * Since: 3.16 652 */ 653 public void unindentLines(TextIter start, TextIter end) 654 { 655 gtk_source_view_unindent_lines(gtkSourceView, (start is null) ? null : start.getTextIterStruct(), (end is null) ? null : end.getTextIterStruct()); 656 } 657 658 /** 659 * Keybinding signal to change case of the text at the current cursor position. 660 * 661 * Params: 662 * caseType = the case to use 663 * 664 * Since: 3.16 665 */ 666 gulong addOnChangeCase(void delegate(GtkSourceChangeCaseType, SourceView) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 667 { 668 return Signals.connect(this, "change-case", dlg, connectFlags ^ ConnectFlags.SWAPPED); 669 } 670 671 /** 672 * Keybinding signal to edit a number at the current cursor position. 673 * 674 * Params: 675 * count = the number to add to the number at the current position 676 * 677 * Since: 3.16 678 */ 679 gulong addOnChangeNumber(void delegate(int, SourceView) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 680 { 681 return Signals.connect(this, "change-number", dlg, connectFlags ^ ConnectFlags.SWAPPED); 682 } 683 684 /** 685 * Keybinding signal to join the lines currently selected. 686 * 687 * Since: 3.16 688 */ 689 gulong addOnJoinLines(void delegate(SourceView) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 690 { 691 return Signals.connect(this, "join-lines", dlg, connectFlags ^ ConnectFlags.SWAPPED); 692 } 693 694 /** 695 * Emitted when a line mark has been activated (for instance when there 696 * was a button press in the line marks gutter). You can use @iter to 697 * determine on which line the activation took place. 698 * 699 * Params: 700 * iter = a #GtkTextIter 701 * event = the #GdkEvent that activated the event 702 */ 703 gulong addOnLineMarkActivated(void delegate(TextIter, Event, SourceView) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 704 { 705 return Signals.connect(this, "line-mark-activated", dlg, connectFlags ^ ConnectFlags.SWAPPED); 706 } 707 708 /** 709 * The ::move-lines signal is a keybinding which gets emitted 710 * when the user initiates moving a line. The default binding key 711 * is Alt+Up/Down arrow. And moves the currently selected lines, 712 * or the current line by @count. For the moment, only 713 * @count of -1 or 1 is valid. 714 * 715 * The @copy parameter is deprecated, it has never been used by 716 * GtkSourceView (the value is always %FALSE) and was buggy. 717 * 718 * Params: 719 * copy = %TRUE if the line should be copied, %FALSE if it should be 720 * moved. This parameter is deprecated and will be removed in a later 721 * version, it should be always %FALSE. 722 * count = the number of lines to move over. Only 1 and -1 are 723 * supported. 724 * 725 * Since: 2.10 726 */ 727 gulong addOnMoveLines(void delegate(bool, int, SourceView) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 728 { 729 return Signals.connect(this, "move-lines", dlg, connectFlags ^ ConnectFlags.SWAPPED); 730 } 731 732 /** 733 * Keybinding signal to move the cursor to the matching bracket. 734 * 735 * Params: 736 * extendSelection = %TRUE if the move should extend the selection 737 * 738 * Since: 3.16 739 */ 740 gulong addOnMoveToMatchingBracket(void delegate(bool, SourceView) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 741 { 742 return Signals.connect(this, "move-to-matching-bracket", dlg, connectFlags ^ ConnectFlags.SWAPPED); 743 } 744 745 /** 746 * The ::move-words signal is a keybinding which gets emitted 747 * when the user initiates moving a word. The default binding key 748 * is Alt+Left/Right Arrow and moves the current selection, or the current 749 * word by one word. 750 * 751 * Params: 752 * count = the number of words to move over 753 * 754 * Since: 3.0 755 */ 756 gulong addOnMoveWords(void delegate(int, SourceView) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 757 { 758 return Signals.connect(this, "move-words", dlg, connectFlags ^ ConnectFlags.SWAPPED); 759 } 760 761 /** */ 762 gulong addOnRedo(void delegate(SourceView) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 763 { 764 return Signals.connect(this, "redo", dlg, connectFlags ^ ConnectFlags.SWAPPED); 765 } 766 767 /** 768 * The ::show-completion signal is a key binding signal which gets 769 * emitted when the user requests a completion, by pressing 770 * <keycombo><keycap>Control</keycap><keycap>space</keycap></keycombo>. 771 * 772 * This will create a #GtkSourceCompletionContext with the activation 773 * type as %GTK_SOURCE_COMPLETION_ACTIVATION_USER_REQUESTED. 774 * 775 * Applications should not connect to it, but may emit it with 776 * g_signal_emit_by_name() if they need to activate the completion by 777 * another means, for example with another key binding or a menu entry. 778 */ 779 gulong addOnShowCompletion(void delegate(SourceView) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 780 { 781 return Signals.connect(this, "show-completion", dlg, connectFlags ^ ConnectFlags.SWAPPED); 782 } 783 784 /** 785 * Emitted when a the cursor was moved according to the smart home 786 * end setting. The signal is emitted after the cursor is moved, but 787 * during the GtkTextView::move-cursor action. This can be used to find 788 * out whether the cursor was moved by a normal home/end or by a smart 789 * home/end. 790 * 791 * Params: 792 * iter = a #GtkTextIter 793 * count = the count 794 * 795 * Since: 3.0 796 */ 797 gulong addOnSmartHomeEnd(void delegate(TextIter, int, SourceView) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 798 { 799 return Signals.connect(this, "smart-home-end", dlg, connectFlags ^ ConnectFlags.SWAPPED); 800 } 801 802 /** */ 803 gulong addOnUndo(void delegate(SourceView) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 804 { 805 return Signals.connect(this, "undo", dlg, connectFlags ^ ConnectFlags.SWAPPED); 806 } 807 }