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