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 vte.Terminal; 26 27 private import gdk.Cursor; 28 private import gdk.Event; 29 private import gdk.RGBA; 30 private import gio.Cancellable; 31 private import gio.OutputStream; 32 private import glib.ArrayG; 33 private import glib.ConstructionException; 34 private import glib.ErrorG; 35 private import glib.GException; 36 private import glib.Regex; 37 private import glib.Str; 38 private import gobject.ObjectG; 39 private import gobject.Signals; 40 private import gtk.BuildableIF; 41 private import gtk.BuildableT; 42 private import gtk.ScrollableIF; 43 private import gtk.ScrollableT; 44 private import gtk.Widget; 45 private import gtk.Window; 46 public import gtkc.gdktypes; 47 private import pango.PgFontDescription; 48 private import vte.Pty; 49 private import vtec.vte; 50 public import vtec.vtetypes; 51 52 53 /** */ 54 public class Terminal : Widget, ScrollableIF 55 { 56 /** the main Gtk struct */ 57 protected VteTerminal* vteTerminal; 58 59 /** Get the main Gtk struct */ 60 public VteTerminal* getTerminalStruct() 61 { 62 return vteTerminal; 63 } 64 65 /** the main Gtk struct as a void* */ 66 protected override void* getStruct() 67 { 68 return cast(void*)vteTerminal; 69 } 70 71 protected override void setStruct(GObject* obj) 72 { 73 vteTerminal = cast(VteTerminal*)obj; 74 super.setStruct(obj); 75 } 76 77 /** 78 * Sets our main struct and passes it to the parent class. 79 */ 80 public this (VteTerminal* vteTerminal, bool ownedRef = false) 81 { 82 this.vteTerminal = vteTerminal; 83 super(cast(GtkWidget*)vteTerminal, ownedRef); 84 } 85 86 // add the Scrollable capabilities 87 mixin ScrollableT!(VteTerminal); 88 89 90 /** */ 91 public static GType getType() 92 { 93 return vte_terminal_get_type(); 94 } 95 96 /** 97 * Creates a new terminal widget. 98 * 99 * Return: a new #VteTerminal object 100 * 101 * Throws: ConstructionException GTK+ fails to create the object. 102 */ 103 public this() 104 { 105 auto p = vte_terminal_new(); 106 107 if(p is null) 108 { 109 throw new ConstructionException("null returned by new"); 110 } 111 112 this(cast(VteTerminal*) p); 113 } 114 115 /** 116 * Places the selected text in the terminal in the #GDK_SELECTION_CLIPBOARD 117 * selection. 118 */ 119 public void copyClipboard() 120 { 121 vte_terminal_copy_clipboard(vteTerminal); 122 } 123 124 /** 125 * Places the selected text in the terminal in the #GDK_SELECTION_PRIMARY 126 * selection. 127 */ 128 public void copyPrimary() 129 { 130 vte_terminal_copy_primary(vteTerminal); 131 } 132 133 /** 134 * Checks each regex in @regexes if the text in and around the position of 135 * the event matches the regular expressions. If a match exists, the matched 136 * text is stored in @matches at the position of the regex in @regexes; otherwise 137 * %NULL is stored there. 138 * 139 * Params: 140 * event = a #GdkEvent 141 * regexes = an array of #GRegex 142 * nRegexes = number of items in @regexes 143 * matchFlags = the #GRegexMatchFlags to use when matching the regexes 144 * matches = a location to store the matches 145 * 146 * Return: %TRUE iff any of the regexes produced a match 147 */ 148 public bool eventCheckGregexSimple(Event event, Regex[] regexes, GRegexMatchFlags matchFlags, string[] matches) 149 { 150 GRegex*[] regexesArray = new GRegex*[regexes.length]; 151 for ( int i = 0; i < regexes.length; i++ ) 152 { 153 regexesArray[i] = regexes[i].getRegexStruct(); 154 } 155 156 return vte_terminal_event_check_gregex_simple(vteTerminal, (event is null) ? null : event.getEventStruct(), regexesArray.ptr, cast(size_t)matches.length, matchFlags, Str.toStringzArray(matches)) != 0; 157 } 158 159 /** 160 * Interprets @data as if it were data received from a child process. This 161 * can either be used to drive the terminal without a child process, or just 162 * to mess with your users. 163 * 164 * Params: 165 * data = a string in the terminal's current encoding 166 * length = the length of the string, or -1 to use the full length or a nul-terminated string 167 */ 168 public void feed(string data) 169 { 170 vte_terminal_feed(vteTerminal, Str.toStringz(data), cast(ptrdiff_t)data.length); 171 } 172 173 /** 174 * Sends a block of UTF-8 text to the child as if it were entered by the user 175 * at the keyboard. 176 * 177 * Params: 178 * text = data to send to the child 179 * length = length of @text in bytes, or -1 if @text is NUL-terminated 180 */ 181 public void feedChild(string text, ptrdiff_t length) 182 { 183 vte_terminal_feed_child(vteTerminal, Str.toStringz(text), length); 184 } 185 186 /** 187 * Sends a block of binary data to the child. 188 * 189 * Params: 190 * data = data to send to the child 191 * length = length of @data 192 */ 193 public void feedChildBinary(ubyte* data, size_t length) 194 { 195 vte_terminal_feed_child_binary(vteTerminal, data, length); 196 } 197 198 /** 199 * Checks whether or not the terminal will attempt to draw bold text by 200 * repainting text with a one-pixel offset. 201 * 202 * Return: %TRUE if bolding is enabled, %FALSE if not 203 */ 204 public bool getAllowBold() 205 { 206 return vte_terminal_get_allow_bold(vteTerminal) != 0; 207 } 208 209 /** 210 * Checks whether or not the terminal will beep when the child outputs the 211 * "bl" sequence. 212 * 213 * Return: %TRUE if audible bell is enabled, %FALSE if not 214 */ 215 public bool getAudibleBell() 216 { 217 return vte_terminal_get_audible_bell(vteTerminal) != 0; 218 } 219 220 /** 221 * Return: the height of a character cell 222 */ 223 public glong getCharHeight() 224 { 225 return vte_terminal_get_char_height(vteTerminal); 226 } 227 228 /** 229 * Return: the width of a character cell 230 */ 231 public glong getCharWidth() 232 { 233 return vte_terminal_get_char_width(vteTerminal); 234 } 235 236 /** 237 * Returns whether ambiguous-width characters are narrow or wide when using 238 * the UTF-8 encoding (vte_terminal_set_encoding()). 239 * 240 * Return: 1 if ambiguous-width characters are narrow, or 2 if they are wide 241 */ 242 public int getCjkAmbiguousWidth() 243 { 244 return vte_terminal_get_cjk_ambiguous_width(vteTerminal); 245 } 246 247 /** 248 * Return: the number of columns 249 */ 250 public glong getColumnCount() 251 { 252 return vte_terminal_get_column_count(vteTerminal); 253 } 254 255 /** 256 * Return: the URI of the current directory of the 257 * process running in the terminal, or %NULL 258 */ 259 public string getCurrentDirectoryUri() 260 { 261 return Str.toString(vte_terminal_get_current_directory_uri(vteTerminal)); 262 } 263 264 /** 265 * Return: the URI of the current file the 266 * process running in the terminal is operating on, or %NULL if 267 * not set 268 */ 269 public string getCurrentFileUri() 270 { 271 return Str.toString(vte_terminal_get_current_file_uri(vteTerminal)); 272 } 273 274 /** 275 * Returns the currently set cursor blink mode. 276 * 277 * Return: cursor blink mode. 278 */ 279 public VteCursorBlinkMode getCursorBlinkMode() 280 { 281 return vte_terminal_get_cursor_blink_mode(vteTerminal); 282 } 283 284 /** 285 * Reads the location of the insertion cursor and returns it. The row 286 * coordinate is absolute. 287 * 288 * Params: 289 * column = a location to store the column, or %NULL 290 * row = a location to store the row, or %NULL 291 */ 292 public void getCursorPosition(out glong column, out glong row) 293 { 294 vte_terminal_get_cursor_position(vteTerminal, &column, &row); 295 } 296 297 /** 298 * Returns the currently set cursor shape. 299 * 300 * Return: cursor shape. 301 */ 302 public VteCursorShape getCursorShape() 303 { 304 return vte_terminal_get_cursor_shape(vteTerminal); 305 } 306 307 /** 308 * Determines the name of the encoding in which the terminal expects data to be 309 * encoded. 310 * 311 * Return: the current encoding for the terminal 312 */ 313 public string getEncoding() 314 { 315 return Str.toString(vte_terminal_get_encoding(vteTerminal)); 316 } 317 318 /** 319 * Queries the terminal for information about the fonts which will be 320 * used to draw text in the terminal. The actual font takes the font scale 321 * into account, this is not reflected in the return value, the unscaled 322 * font is returned. 323 * 324 * Return: a #PangoFontDescription describing the font the 325 * terminal uses to render text at the default font scale of 1.0. 326 */ 327 public PgFontDescription getFont() 328 { 329 auto p = vte_terminal_get_font(vteTerminal); 330 331 if(p is null) 332 { 333 return null; 334 } 335 336 return ObjectG.getDObject!(PgFontDescription)(cast(PangoFontDescription*) p); 337 } 338 339 /** 340 * Return: the terminal's font scale 341 */ 342 public double getFontScale() 343 { 344 return vte_terminal_get_font_scale(vteTerminal); 345 } 346 347 /** 348 * Fills in some @hints from @terminal's geometry. The hints 349 * filled are those covered by the %GDK_HINT_RESIZE_INC, 350 * %GDK_HINT_MIN_SIZE and %GDK_HINT_BASE_SIZE flags. 351 * 352 * See gtk_window_set_geometry_hints() for more information. 353 * 354 * @terminal must be realized (see gtk_widget_get_realized()). 355 * 356 * Params: 357 * hints = a #GdkGeometry to fill in 358 * minRows = the minimum number of rows to request 359 * minColumns = the minimum number of columns to request 360 */ 361 public void getGeometryHints(out GdkGeometry hints, int minRows, int minColumns) 362 { 363 vte_terminal_get_geometry_hints(vteTerminal, &hints, minRows, minColumns); 364 } 365 366 /** 367 * Checks if the terminal currently contains selected text. Note that this 368 * is different from determining if the terminal is the owner of any 369 * #GtkClipboard items. 370 * 371 * Return: %TRUE if part of the text in the terminal is selected. 372 */ 373 public bool getHasSelection() 374 { 375 return vte_terminal_get_has_selection(vteTerminal) != 0; 376 } 377 378 /** 379 * Return: the icon title 380 */ 381 public string getIconTitle() 382 { 383 return Str.toString(vte_terminal_get_icon_title(vteTerminal)); 384 } 385 386 /** 387 * Returns whether the terminal allow user input. 388 */ 389 public bool getInputEnabled() 390 { 391 return vte_terminal_get_input_enabled(vteTerminal) != 0; 392 } 393 394 /** 395 * Determines the value of the terminal's mouse autohide setting. When 396 * autohiding is enabled, the mouse cursor will be hidden when the user presses 397 * a key and shown when the user moves the mouse. This setting can be changed 398 * using vte_terminal_set_mouse_autohide(). 399 * 400 * Return: %TRUE if autohiding is enabled, %FALSE if not 401 */ 402 public bool getMouseAutohide() 403 { 404 return vte_terminal_get_mouse_autohide(vteTerminal) != 0; 405 } 406 407 /** 408 * Returns the #VtePty of @terminal. 409 * 410 * Return: a #VtePty, or %NULL 411 */ 412 public Pty getPty() 413 { 414 auto p = vte_terminal_get_pty(vteTerminal); 415 416 if(p is null) 417 { 418 return null; 419 } 420 421 return ObjectG.getDObject!(Pty)(cast(VtePty*) p); 422 } 423 424 /** 425 * Checks whether or not the terminal will rewrap its contents upon resize. 426 * 427 * Return: %TRUE if rewrapping is enabled, %FALSE if not 428 */ 429 public bool getRewrapOnResize() 430 { 431 return vte_terminal_get_rewrap_on_resize(vteTerminal) != 0; 432 } 433 434 /** 435 * Return: the number of rows 436 */ 437 public glong getRowCount() 438 { 439 return vte_terminal_get_row_count(vteTerminal); 440 } 441 442 /** 443 * Extracts a view of the visible part of the terminal. If @is_selected is not 444 * %NULL, characters will only be read if @is_selected returns %TRUE after being 445 * passed the column and row, respectively. A #VteCharAttributes structure 446 * is added to @attributes for each byte added to the returned string detailing 447 * the character's position, colors, and other characteristics. 448 * 449 * Params: 450 * isSelected = a #VteSelectionFunc callback 451 * userData = user data to be passed to the callback 452 * attributes = location for storing text attributes 453 * 454 * Return: a newly allocated text string, or %NULL. 455 */ 456 public string getText(VteSelectionFunc isSelected, void* userData, out ArrayG attributes) 457 { 458 GArray* outattributes = gMalloc!GArray(); 459 460 auto retStr = vte_terminal_get_text(vteTerminal, isSelected, userData, outattributes); 461 462 attributes = new ArrayG(outattributes, true); 463 464 scope(exit) Str.freeString(retStr); 465 return Str.toString(retStr); 466 } 467 468 /** 469 * Extracts a view of the visible part of the terminal. If @is_selected is not 470 * %NULL, characters will only be read if @is_selected returns %TRUE after being 471 * passed the column and row, respectively. A #VteCharAttributes structure 472 * is added to @attributes for each byte added to the returned string detailing 473 * the character's position, colors, and other characteristics. This function 474 * differs from vte_terminal_get_text() in that trailing spaces at the end of 475 * lines are included. 476 * 477 * Params: 478 * isSelected = a #VteSelectionFunc callback 479 * userData = user data to be passed to the callback 480 * attributes = location for storing text attributes 481 * 482 * Return: a newly allocated text string, or %NULL. 483 */ 484 public string getTextIncludeTrailingSpaces(VteSelectionFunc isSelected, void* userData, out ArrayG attributes) 485 { 486 GArray* outattributes = gMalloc!GArray(); 487 488 auto retStr = vte_terminal_get_text_include_trailing_spaces(vteTerminal, isSelected, userData, outattributes); 489 490 attributes = new ArrayG(outattributes, true); 491 492 scope(exit) Str.freeString(retStr); 493 return Str.toString(retStr); 494 } 495 496 /** 497 * Extracts a view of the visible part of the terminal. If @is_selected is not 498 * %NULL, characters will only be read if @is_selected returns %TRUE after being 499 * passed the column and row, respectively. A #VteCharAttributes structure 500 * is added to @attributes for each byte added to the returned string detailing 501 * the character's position, colors, and other characteristics. The 502 * entire scrollback buffer is scanned, so it is possible to read the entire 503 * contents of the buffer using this function. 504 * 505 * Params: 506 * startRow = first row to search for data 507 * startCol = first column to search for data 508 * endRow = last row to search for data 509 * endCol = last column to search for data 510 * isSelected = a #VteSelectionFunc callback 511 * userData = user data to be passed to the callback 512 * attributes = location for storing text attributes 513 * 514 * Return: a newly allocated text string, or %NULL. 515 */ 516 public string getTextRange(glong startRow, glong startCol, glong endRow, glong endCol, VteSelectionFunc isSelected, void* userData, out ArrayG attributes) 517 { 518 GArray* outattributes = gMalloc!GArray(); 519 520 auto retStr = vte_terminal_get_text_range(vteTerminal, startRow, startCol, endRow, endCol, isSelected, userData, outattributes); 521 522 attributes = new ArrayG(outattributes, true); 523 524 scope(exit) Str.freeString(retStr); 525 return Str.toString(retStr); 526 } 527 528 /** 529 * Return: the window title 530 */ 531 public string getWindowTitle() 532 { 533 return Str.toString(vte_terminal_get_window_title(vteTerminal)); 534 } 535 536 /** 537 * Returns the set of characters which will be considered parts of a word 538 * when doing word-wise selection, in addition to the default which only 539 * considers alphanumeric characters part of a word. 540 * 541 * If %NULL, a built-in set is used. 542 * 543 * Return: a string, or %NULL 544 * 545 * Since: 0.40 546 */ 547 public string getWordCharExceptions() 548 { 549 return Str.toString(vte_terminal_get_word_char_exceptions(vteTerminal)); 550 } 551 552 /** 553 * Adds the regular expression @regex to the list of matching expressions. When the 554 * user moves the mouse cursor over a section of displayed text which matches 555 * this expression, the text will be highlighted. 556 * 557 * Params: 558 * gregex = a #GRegex 559 * gflags = the #GRegexMatchFlags to use when matching the regex 560 * 561 * Return: an integer associated with this expression, or -1 if @gregex could not be 562 * transformed into a #VteRegex or @flags were incompatible 563 */ 564 public int matchAddGregex(Regex gregex, GRegexMatchFlags gflags) 565 { 566 return vte_terminal_match_add_gregex(vteTerminal, (gregex is null) ? null : gregex.getRegexStruct(), gflags); 567 } 568 569 /** 570 * Checks if the text in and around the specified position matches any of the 571 * regular expressions previously set using vte_terminal_match_add(). If a 572 * match exists, the text string is returned and if @tag is not %NULL, the number 573 * associated with the matched regular expression will be stored in @tag. 574 * 575 * If more than one regular expression has been set with 576 * vte_terminal_match_add(), then expressions are checked in the order in 577 * which they were added. 578 * 579 * Deprecated: Use vte_terminal_match_check_event() instead. 580 * 581 * Params: 582 * column = the text column 583 * row = the text row 584 * tag = a location to store the tag, or %NULL 585 * 586 * Return: a newly allocated string which matches one of the previously 587 * set regular expressions 588 */ 589 public string matchCheck(glong column, glong row, out int tag) 590 { 591 auto retStr = vte_terminal_match_check(vteTerminal, column, row, &tag); 592 593 scope(exit) Str.freeString(retStr); 594 return Str.toString(retStr); 595 } 596 597 /** 598 * Checks if the text in and around the position of the event matches any of the 599 * regular expressions previously set using vte_terminal_match_add(). If a 600 * match exists, the text string is returned and if @tag is not %NULL, the number 601 * associated with the matched regular expression will be stored in @tag. 602 * 603 * If more than one regular expression has been set with 604 * vte_terminal_match_add(), then expressions are checked in the order in 605 * which they were added. 606 * 607 * Params: 608 * event = a #GdkEvent 609 * tag = a location to store the tag, or %NULL 610 * 611 * Return: a newly allocated string which matches one of the previously 612 * set regular expressions 613 */ 614 public string matchCheckEvent(Event event, out int tag) 615 { 616 auto retStr = vte_terminal_match_check_event(vteTerminal, (event is null) ? null : event.getEventStruct(), &tag); 617 618 scope(exit) Str.freeString(retStr); 619 return Str.toString(retStr); 620 } 621 622 /** 623 * Removes the regular expression which is associated with the given @tag from 624 * the list of expressions which the terminal will highlight when the user 625 * moves the mouse cursor over matching text. 626 * 627 * Params: 628 * tag = the tag of the regex to remove 629 */ 630 public void matchRemove(int tag) 631 { 632 vte_terminal_match_remove(vteTerminal, tag); 633 } 634 635 /** 636 * Clears the list of regular expressions the terminal uses to highlight text 637 * when the user moves the mouse cursor. 638 */ 639 public void matchRemoveAll() 640 { 641 vte_terminal_match_remove_all(vteTerminal); 642 } 643 644 /** 645 * Sets which cursor the terminal will use if the pointer is over the pattern 646 * specified by @tag. The terminal keeps a reference to @cursor. 647 * 648 * Deprecated: Use vte_terminal_match_set_cursor_type() or vte_terminal_match_set_cursor_named() instead. 649 * 650 * Params: 651 * tag = the tag of the regex which should use the specified cursor 652 * cursor = the #GdkCursor which the terminal should use when the pattern is 653 * highlighted, or %NULL to use the standard cursor 654 */ 655 public void matchSetCursor(int tag, Cursor cursor) 656 { 657 vte_terminal_match_set_cursor(vteTerminal, tag, (cursor is null) ? null : cursor.getCursorStruct()); 658 } 659 660 /** 661 * Sets which cursor the terminal will use if the pointer is over the pattern 662 * specified by @tag. 663 * 664 * Params: 665 * tag = the tag of the regex which should use the specified cursor 666 * cursorName = the name of the cursor 667 */ 668 public void matchSetCursorName(int tag, string cursorName) 669 { 670 vte_terminal_match_set_cursor_name(vteTerminal, tag, Str.toStringz(cursorName)); 671 } 672 673 /** 674 * Sets which cursor the terminal will use if the pointer is over the pattern 675 * specified by @tag. 676 * 677 * Params: 678 * tag = the tag of the regex which should use the specified cursor 679 * cursorType = a #GdkCursorType 680 */ 681 public void matchSetCursorType(int tag, GdkCursorType cursorType) 682 { 683 vte_terminal_match_set_cursor_type(vteTerminal, tag, cursorType); 684 } 685 686 /** 687 * Sends the contents of the #GDK_SELECTION_CLIPBOARD selection to the 688 * terminal's child. If necessary, the data is converted from UTF-8 to the 689 * terminal's current encoding. It's called on paste menu item, or when 690 * user presses Shift+Insert. 691 */ 692 public void pasteClipboard() 693 { 694 vte_terminal_paste_clipboard(vteTerminal); 695 } 696 697 /** 698 * Sends the contents of the #GDK_SELECTION_PRIMARY selection to the terminal's 699 * child. If necessary, the data is converted from UTF-8 to the terminal's 700 * current encoding. The terminal will call also paste the 701 * #GDK_SELECTION_PRIMARY selection when the user clicks with the the second 702 * mouse button. 703 */ 704 public void pastePrimary() 705 { 706 vte_terminal_paste_primary(vteTerminal); 707 } 708 709 /** 710 * Creates a new #VtePty, and sets the emulation property 711 * from #VteTerminal:emulation. 712 * 713 * See vte_pty_new() for more information. 714 * 715 * Params: 716 * flags = flags from #VtePtyFlags 717 * cancellable = a #GCancellable, or %NULL 718 * 719 * Return: a new #VtePty 720 * 721 * Throws: GException on failure. 722 */ 723 public Pty ptyNewSync(VtePtyFlags flags, Cancellable cancellable) 724 { 725 GError* err = null; 726 727 auto p = vte_terminal_pty_new_sync(vteTerminal, flags, (cancellable is null) ? null : cancellable.getCancellableStruct(), &err); 728 729 if (err !is null) 730 { 731 throw new GException( new ErrorG(err) ); 732 } 733 734 if(p is null) 735 { 736 return null; 737 } 738 739 return ObjectG.getDObject!(Pty)(cast(VtePty*) p, true); 740 } 741 742 /** 743 * Resets as much of the terminal's internal state as possible, discarding any 744 * unprocessed input data, resetting character attributes, cursor state, 745 * national character set state, status line, terminal modes (insert/delete), 746 * selection state, and encoding. 747 * 748 * Params: 749 * clearTabstops = whether to reset tabstops 750 * clearHistory = whether to empty the terminal's scrollback buffer 751 */ 752 public void reset(bool clearTabstops, bool clearHistory) 753 { 754 vte_terminal_reset(vteTerminal, clearTabstops, clearHistory); 755 } 756 757 /** 758 * Searches the next string matching the search regex set with 759 * vte_terminal_search_set_gregex(). 760 * 761 * Return: %TRUE if a match was found 762 */ 763 public bool searchFindNext() 764 { 765 return vte_terminal_search_find_next(vteTerminal) != 0; 766 } 767 768 /** 769 * Searches the previous string matching the search regex set with 770 * vte_terminal_search_set_gregex(). 771 * 772 * Return: %TRUE if a match was found 773 */ 774 public bool searchFindPrevious() 775 { 776 return vte_terminal_search_find_previous(vteTerminal) != 0; 777 } 778 779 /** 780 * Return: the search #GRegex regex set in @terminal, or %NULL 781 */ 782 public Regex searchGetGregex() 783 { 784 auto p = vte_terminal_search_get_gregex(vteTerminal); 785 786 if(p is null) 787 { 788 return null; 789 } 790 791 return new Regex(cast(GRegex*) p); 792 } 793 794 /** 795 * Return: whether searching will wrap around 796 */ 797 public bool searchGetWrapAround() 798 { 799 return vte_terminal_search_get_wrap_around(vteTerminal) != 0; 800 } 801 802 /** 803 * Sets the #GRegex regex to search for. Unsets the search regex when passed %NULL. 804 * 805 * Params: 806 * gregex = a #GRegex, or %NULL 807 * gflags = flags from #GRegexMatchFlags 808 */ 809 public void searchSetGregex(Regex gregex, GRegexMatchFlags gflags) 810 { 811 vte_terminal_search_set_gregex(vteTerminal, (gregex is null) ? null : gregex.getRegexStruct(), gflags); 812 } 813 814 /** 815 * Sets whether search should wrap around to the beginning of the 816 * terminal content when reaching its end. 817 * 818 * Params: 819 * wrapAround = whether search should wrap 820 */ 821 public void searchSetWrapAround(bool wrapAround) 822 { 823 vte_terminal_search_set_wrap_around(vteTerminal, wrapAround); 824 } 825 826 /** 827 * Selects all text within the terminal (including the scrollback buffer). 828 */ 829 public void selectAll() 830 { 831 vte_terminal_select_all(vteTerminal); 832 } 833 834 /** 835 * Controls whether or not the terminal will attempt to draw bold text, 836 * either by using a bold font variant or by repainting text with a different 837 * offset. 838 * 839 * Params: 840 * allowBold = %TRUE if the terminal should attempt to draw bold text 841 */ 842 public void setAllowBold(bool allowBold) 843 { 844 vte_terminal_set_allow_bold(vteTerminal, allowBold); 845 } 846 847 /** 848 * Controls whether or not the terminal will beep when the child outputs the 849 * "bl" sequence. 850 * 851 * Params: 852 * isAudible = %TRUE if the terminal should beep 853 */ 854 public void setAudibleBell(bool isAudible) 855 { 856 vte_terminal_set_audible_bell(vteTerminal, isAudible); 857 } 858 859 /** 860 * Modifies the terminal's backspace key binding, which controls what 861 * string or control sequence the terminal sends to its child when the user 862 * presses the backspace key. 863 * 864 * Params: 865 * binding = a #VteEraseBinding for the backspace key 866 */ 867 public void setBackspaceBinding(VteEraseBinding binding) 868 { 869 vte_terminal_set_backspace_binding(vteTerminal, binding); 870 } 871 872 /** 873 * This setting controls whether ambiguous-width characters are narrow or wide 874 * when using the UTF-8 encoding (vte_terminal_set_encoding()). In all other encodings, 875 * the width of ambiguous-width characters is fixed. 876 * 877 * Params: 878 * width = either 1 (narrow) or 2 (wide) 879 */ 880 public void setCjkAmbiguousWidth(int width) 881 { 882 vte_terminal_set_cjk_ambiguous_width(vteTerminal, width); 883 } 884 885 /** 886 * Sets the background color for text which does not have a specific background 887 * color assigned. Only has effect when no background image is set and when 888 * the terminal is not transparent. 889 * 890 * Params: 891 * background = the new background color 892 */ 893 public void setColorBackground(RGBA background) 894 { 895 vte_terminal_set_color_background(vteTerminal, (background is null) ? null : background.getRGBAStruct()); 896 } 897 898 /** 899 * Sets the color used to draw bold text in the default foreground color. 900 * If @bold is %NULL then the default color is used. 901 * 902 * Params: 903 * bold = the new bold color or %NULL 904 */ 905 public void setColorBold(RGBA bold) 906 { 907 vte_terminal_set_color_bold(vteTerminal, (bold is null) ? null : bold.getRGBAStruct()); 908 } 909 910 /** 911 * Sets the background color for text which is under the cursor. If %NULL, text 912 * under the cursor will be drawn with foreground and background colors 913 * reversed. 914 * 915 * Params: 916 * cursorBackground = the new color to use for the text cursor, or %NULL 917 */ 918 public void setColorCursor(RGBA cursorBackground) 919 { 920 vte_terminal_set_color_cursor(vteTerminal, (cursorBackground is null) ? null : cursorBackground.getRGBAStruct()); 921 } 922 923 /** 924 * Sets the foreground color for text which is under the cursor. If %NULL, text 925 * under the cursor will be drawn with foreground and background colors 926 * reversed. 927 * 928 * Params: 929 * cursorForeground = the new color to use for the text cursor, or %NULL 930 * 931 * Since: 0.44 932 */ 933 public void setColorCursorForeground(RGBA cursorForeground) 934 { 935 vte_terminal_set_color_cursor_foreground(vteTerminal, (cursorForeground is null) ? null : cursorForeground.getRGBAStruct()); 936 } 937 938 /** 939 * Sets the foreground color used to draw normal text. 940 * 941 * Params: 942 * foreground = the new foreground color 943 */ 944 public void setColorForeground(RGBA foreground) 945 { 946 vte_terminal_set_color_foreground(vteTerminal, (foreground is null) ? null : foreground.getRGBAStruct()); 947 } 948 949 /** 950 * Sets the background color for text which is highlighted. If %NULL, 951 * it is unset. If neither highlight background nor highlight foreground are set, 952 * highlighted text (which is usually highlighted because it is selected) will 953 * be drawn with foreground and background colors reversed. 954 * 955 * Params: 956 * highlightBackground = the new color to use for highlighted text, or %NULL 957 */ 958 public void setColorHighlight(RGBA highlightBackground) 959 { 960 vte_terminal_set_color_highlight(vteTerminal, (highlightBackground is null) ? null : highlightBackground.getRGBAStruct()); 961 } 962 963 /** 964 * Sets the foreground color for text which is highlighted. If %NULL, 965 * it is unset. If neither highlight background nor highlight foreground are set, 966 * highlighted text (which is usually highlighted because it is selected) will 967 * be drawn with foreground and background colors reversed. 968 * 969 * Params: 970 * highlightForeground = the new color to use for highlighted text, or %NULL 971 */ 972 public void setColorHighlightForeground(RGBA highlightForeground) 973 { 974 vte_terminal_set_color_highlight_foreground(vteTerminal, (highlightForeground is null) ? null : highlightForeground.getRGBAStruct()); 975 } 976 977 /** 978 * @palette specifies the new values for the 256 palette colors: 8 standard colors, 979 * their 8 bright counterparts, 6x6x6 color cube, and 24 grayscale colors. 980 * Omitted entries will default to a hardcoded value. 981 * 982 * @palette_size must be 0, 8, 16, 232 or 256. 983 * 984 * If @foreground is %NULL and @palette_size is greater than 0, the new foreground 985 * color is taken from @palette[7]. If @background is %NULL and @palette_size is 986 * greater than 0, the new background color is taken from @palette[0]. 987 * 988 * Params: 989 * foreground = the new foreground color, or %NULL 990 * background = the new background color, or %NULL 991 * palette = the color palette 992 * paletteSize = the number of entries in @palette 993 */ 994 public void setColors(RGBA foreground, RGBA background, RGBA[] palette) 995 { 996 GdkRGBA[] paletteArray = new GdkRGBA[palette.length]; 997 for ( int i = 0; i < palette.length; i++ ) 998 { 999 paletteArray[i] = *(palette[i].getRGBAStruct()); 1000 } 1001 1002 vte_terminal_set_colors(vteTerminal, (foreground is null) ? null : foreground.getRGBAStruct(), (background is null) ? null : background.getRGBAStruct(), paletteArray.ptr, cast(size_t)palette.length); 1003 } 1004 1005 /** 1006 * Sets whether or not the cursor will blink. Using %VTE_CURSOR_BLINK_SYSTEM 1007 * will use the #GtkSettings::gtk-cursor-blink setting. 1008 * 1009 * Params: 1010 * mode = the #VteCursorBlinkMode to use 1011 */ 1012 public void setCursorBlinkMode(VteCursorBlinkMode mode) 1013 { 1014 vte_terminal_set_cursor_blink_mode(vteTerminal, mode); 1015 } 1016 1017 /** 1018 * Sets the shape of the cursor drawn. 1019 * 1020 * Params: 1021 * shape = the #VteCursorShape to use 1022 */ 1023 public void setCursorShape(VteCursorShape shape) 1024 { 1025 vte_terminal_set_cursor_shape(vteTerminal, shape); 1026 } 1027 1028 /** 1029 * Reset the terminal palette to reasonable compiled-in default color. 1030 */ 1031 public void setDefaultColors() 1032 { 1033 vte_terminal_set_default_colors(vteTerminal); 1034 } 1035 1036 /** 1037 * Modifies the terminal's delete key binding, which controls what 1038 * string or control sequence the terminal sends to its child when the user 1039 * presses the delete key. 1040 * 1041 * Params: 1042 * binding = a #VteEraseBinding for the delete key 1043 */ 1044 public void setDeleteBinding(VteEraseBinding binding) 1045 { 1046 vte_terminal_set_delete_binding(vteTerminal, binding); 1047 } 1048 1049 /** 1050 * Changes the encoding the terminal will expect data from the child to 1051 * be encoded with. For certain terminal types, applications executing in the 1052 * terminal can change the encoding. If @codeset is %NULL, it uses "UTF-8". 1053 * 1054 * Params: 1055 * codeset = a valid #GIConv target, or %NULL to use UTF-8 1056 * 1057 * Return: %TRUE if the encoding could be changed to the specified one, 1058 * or %FALSE with @error set to %G_CONVERT_ERROR_NO_CONVERSION. 1059 * 1060 * Throws: GException on failure. 1061 */ 1062 public bool setEncoding(string codeset) 1063 { 1064 GError* err = null; 1065 1066 auto p = vte_terminal_set_encoding(vteTerminal, Str.toStringz(codeset), &err) != 0; 1067 1068 if (err !is null) 1069 { 1070 throw new GException( new ErrorG(err) ); 1071 } 1072 1073 return p; 1074 } 1075 1076 /** 1077 * Sets the font used for rendering all text displayed by the terminal, 1078 * overriding any fonts set using gtk_widget_modify_font(). The terminal 1079 * will immediately attempt to load the desired font, retrieve its 1080 * metrics, and attempt to resize itself to keep the same number of rows 1081 * and columns. The font scale is applied to the specified font. 1082 * 1083 * Params: 1084 * fontDesc = a #PangoFontDescription for the desired font, or %NULL 1085 */ 1086 public void setFont(PgFontDescription fontDesc) 1087 { 1088 vte_terminal_set_font(vteTerminal, (fontDesc is null) ? null : fontDesc.getPgFontDescriptionStruct()); 1089 } 1090 1091 /** 1092 * Sets the terminal's font scale to @scale. 1093 * 1094 * Params: 1095 * scale = the font scale 1096 */ 1097 public void setFontScale(double scale) 1098 { 1099 vte_terminal_set_font_scale(vteTerminal, scale); 1100 } 1101 1102 /** 1103 * Sets @terminal as @window's geometry widget. See 1104 * gtk_window_set_geometry_hints() for more information. 1105 * 1106 * @terminal must be realized (see gtk_widget_get_realized()). 1107 * 1108 * Params: 1109 * window = a #GtkWindow 1110 */ 1111 public void setGeometryHintsForWindow(Window window) 1112 { 1113 vte_terminal_set_geometry_hints_for_window(vteTerminal, (window is null) ? null : window.getWindowStruct()); 1114 } 1115 1116 /** 1117 * Enables or disables user input. When user input is disabled, 1118 * the terminal's child will not receive any key press, or mouse button 1119 * press or motion events sent to it. 1120 * 1121 * Params: 1122 * enabled = whether to enable user input 1123 */ 1124 public void setInputEnabled(bool enabled) 1125 { 1126 vte_terminal_set_input_enabled(vteTerminal, enabled); 1127 } 1128 1129 /** 1130 * Changes the value of the terminal's mouse autohide setting. When autohiding 1131 * is enabled, the mouse cursor will be hidden when the user presses a key and 1132 * shown when the user moves the mouse. This setting can be read using 1133 * vte_terminal_get_mouse_autohide(). 1134 * 1135 * Params: 1136 * setting = whether the mouse pointer should autohide 1137 */ 1138 public void setMouseAutohide(bool setting) 1139 { 1140 vte_terminal_set_mouse_autohide(vteTerminal, setting); 1141 } 1142 1143 /** 1144 * Sets @pty as the PTY to use in @terminal. 1145 * Use %NULL to unset the PTY. 1146 * 1147 * Params: 1148 * pty = a #VtePty, or %NULL 1149 */ 1150 public void setPty(Pty pty) 1151 { 1152 vte_terminal_set_pty(vteTerminal, (pty is null) ? null : pty.getPtyStruct()); 1153 } 1154 1155 /** 1156 * Controls whether or not the terminal will rewrap its contents, including 1157 * the scrollback history, whenever the terminal's width changes. 1158 * 1159 * Params: 1160 * rewrap = %TRUE if the terminal should rewrap on resize 1161 */ 1162 public void setRewrapOnResize(bool rewrap) 1163 { 1164 vte_terminal_set_rewrap_on_resize(vteTerminal, rewrap); 1165 } 1166 1167 /** 1168 * Controls whether or not the terminal will forcibly scroll to the bottom of 1169 * the viewable history when the user presses a key. Modifier keys do not 1170 * trigger this behavior. 1171 * 1172 * Params: 1173 * scroll = whether the terminal should scroll on keystrokes 1174 */ 1175 public void setScrollOnKeystroke(bool scroll) 1176 { 1177 vte_terminal_set_scroll_on_keystroke(vteTerminal, scroll); 1178 } 1179 1180 /** 1181 * Controls whether or not the terminal will forcibly scroll to the bottom of 1182 * the viewable history when the new data is received from the child. 1183 * 1184 * Params: 1185 * scroll = whether the terminal should scroll on output 1186 */ 1187 public void setScrollOnOutput(bool scroll) 1188 { 1189 vte_terminal_set_scroll_on_output(vteTerminal, scroll); 1190 } 1191 1192 /** 1193 * Sets the length of the scrollback buffer used by the terminal. The size of 1194 * the scrollback buffer will be set to the larger of this value and the number 1195 * of visible rows the widget can display, so 0 can safely be used to disable 1196 * scrollback. 1197 * 1198 * A negative value means "infinite scrollback". 1199 * 1200 * Note that this setting only affects the normal screen buffer. 1201 * No scrollback is allowed on the alternate screen buffer. 1202 * 1203 * Params: 1204 * lines = the length of the history buffer 1205 */ 1206 public void setScrollbackLines(glong lines) 1207 { 1208 vte_terminal_set_scrollback_lines(vteTerminal, lines); 1209 } 1210 1211 /** 1212 * Attempts to change the terminal's size in terms of rows and columns. If 1213 * the attempt succeeds, the widget will resize itself to the proper size. 1214 * 1215 * Params: 1216 * columns = the desired number of columns 1217 * rows = the desired number of rows 1218 */ 1219 public void setSize(glong columns, glong rows) 1220 { 1221 vte_terminal_set_size(vteTerminal, columns, rows); 1222 } 1223 1224 /** 1225 * With this function you can provide a set of characters which will 1226 * be considered parts of a word when doing word-wise selection, in 1227 * addition to the default which only considers alphanumeric characters 1228 * part of a word. 1229 * 1230 * The characters in @exceptions must be non-alphanumeric, each character 1231 * must occur only once, and if @exceptions contains the character 1232 * U+002D HYPHEN-MINUS, it must be at the start of the string. 1233 * 1234 * Use %NULL to reset the set of exception characters to the default. 1235 * 1236 * Params: 1237 * exceptions = a string of ASCII punctuation characters, or %NULL 1238 * 1239 * Since: 0.40 1240 */ 1241 public void setWordCharExceptions(string exceptions) 1242 { 1243 vte_terminal_set_word_char_exceptions(vteTerminal, Str.toStringz(exceptions)); 1244 } 1245 1246 /** 1247 * Starts the specified command under a newly-allocated controlling 1248 * pseudo-terminal. The @argv and @envv lists should be %NULL-terminated. 1249 * The "TERM" environment variable is automatically set to a default value, 1250 * but can be overridden from @envv. 1251 * @pty_flags controls logging the session to the specified system log files. 1252 * 1253 * Note that %G_SPAWN_DO_NOT_REAP_CHILD will always be added to @spawn_flags. 1254 * 1255 * Note that all open file descriptors will be closed in the child. If you want 1256 * to keep some file descriptor open for use in the child process, you need to 1257 * use a child setup function that unsets the FD_CLOEXEC flag on that file 1258 * descriptor. 1259 * 1260 * See vte_pty_new(), g_spawn_async() and vte_terminal_watch_child() for more information. 1261 * 1262 * Params: 1263 * ptyFlags = flags from #VtePtyFlags 1264 * workingDirectory = the name of a directory the command should start 1265 * in, or %NULL to use the current working directory 1266 * argv = child's argument vector 1267 * envv = a list of environment 1268 * variables to be added to the environment before starting the process, or %NULL 1269 * spawnFlags = flags from #GSpawnFlags 1270 * childSetup = an extra child setup function to run in the child just before exec(), or %NULL 1271 * childSetupData = user data for @child_setup 1272 * childPid = a location to store the child PID, or %NULL 1273 * cancellable = a #GCancellable, or %NULL 1274 * 1275 * Return: %TRUE on success, or %FALSE on error with @error filled in 1276 * 1277 * Throws: GException on failure. 1278 */ 1279 public bool spawnSync(VtePtyFlags ptyFlags, string workingDirectory, string[] argv, string[] envv, GSpawnFlags spawnFlags, GSpawnChildSetupFunc childSetup, void* childSetupData, out GPid childPid, Cancellable cancellable) 1280 { 1281 GError* err = null; 1282 1283 auto p = vte_terminal_spawn_sync(vteTerminal, ptyFlags, Str.toStringz(workingDirectory), Str.toStringzArray(argv), Str.toStringzArray(envv), spawnFlags, childSetup, childSetupData, &childPid, (cancellable is null) ? null : cancellable.getCancellableStruct(), &err) != 0; 1284 1285 if (err !is null) 1286 { 1287 throw new GException( new ErrorG(err) ); 1288 } 1289 1290 return p; 1291 } 1292 1293 /** 1294 * Clears the current selection. 1295 */ 1296 public void unselectAll() 1297 { 1298 vte_terminal_unselect_all(vteTerminal); 1299 } 1300 1301 /** 1302 * Watches @child_pid. When the process exists, the #VteTerminal::child-exited 1303 * signal will be called with the child's exit status. 1304 * 1305 * Prior to calling this function, a #VtePty must have been set in @terminal 1306 * using vte_terminal_set_pty(). 1307 * When the child exits, the terminal's #VtePty will be set to %NULL. 1308 * 1309 * Note: g_child_watch_add() or g_child_watch_add_full() must not have 1310 * been called for @child_pid, nor a #GSource for it been created with 1311 * g_child_watch_source_new(). 1312 * 1313 * Note: when using the g_spawn_async() family of functions, 1314 * the %G_SPAWN_DO_NOT_REAP_CHILD flag MUST have been passed. 1315 * 1316 * Params: 1317 * childPid = a #GPid 1318 */ 1319 public void watchChild(GPid childPid) 1320 { 1321 vte_terminal_watch_child(vteTerminal, childPid); 1322 } 1323 1324 /** 1325 * Write contents of the current contents of @terminal (including any 1326 * scrollback history) to @stream according to @flags. 1327 * 1328 * If @cancellable is not %NULL, then the operation can be cancelled by triggering 1329 * the cancellable object from another thread. If the operation was cancelled, 1330 * the error %G_IO_ERROR_CANCELLED will be returned in @error. 1331 * 1332 * This is a synchronous operation and will make the widget (and input 1333 * processing) during the write operation, which may take a long time 1334 * depending on scrollback history and @stream availability for writing. 1335 * 1336 * Params: 1337 * stream = a #GOutputStream to write to 1338 * flags = a set of #VteWriteFlags 1339 * cancellable = a #GCancellable object, or %NULL 1340 * 1341 * Return: %TRUE on success, %FALSE if there was an error 1342 * 1343 * Throws: GException on failure. 1344 */ 1345 public bool writeContentsSync(OutputStream stream, VteWriteFlags flags, Cancellable cancellable) 1346 { 1347 GError* err = null; 1348 1349 auto p = vte_terminal_write_contents_sync(vteTerminal, (stream is null) ? null : stream.getOutputStreamStruct(), flags, (cancellable is null) ? null : cancellable.getCancellableStruct(), &err) != 0; 1350 1351 if (err !is null) 1352 { 1353 throw new GException( new ErrorG(err) ); 1354 } 1355 1356 return p; 1357 } 1358 1359 int[string] connectedSignals; 1360 1361 void delegate(Terminal)[] onBellListeners; 1362 /** 1363 * This signal is emitted when the a child sends a bell request to the 1364 * terminal. 1365 */ 1366 void addOnBell(void delegate(Terminal) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 1367 { 1368 if ( "bell" !in connectedSignals ) 1369 { 1370 Signals.connectData( 1371 this, 1372 "bell", 1373 cast(GCallback)&callBackBell, 1374 cast(void*)this, 1375 null, 1376 connectFlags); 1377 connectedSignals["bell"] = 1; 1378 } 1379 onBellListeners ~= dlg; 1380 } 1381 extern(C) static void callBackBell(VteTerminal* terminalStruct, Terminal _terminal) 1382 { 1383 foreach ( void delegate(Terminal) dlg; _terminal.onBellListeners ) 1384 { 1385 dlg(_terminal); 1386 } 1387 } 1388 1389 void delegate(uint, uint, Terminal)[] onCharSizeChangedListeners; 1390 /** 1391 * Emitted whenever selection of a new font causes the values of the 1392 * %char_width or %char_height fields to change. 1393 * 1394 * Params: 1395 * width = the new character cell width 1396 * height = the new character cell height 1397 */ 1398 void addOnCharSizeChanged(void delegate(uint, uint, Terminal) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 1399 { 1400 if ( "char-size-changed" !in connectedSignals ) 1401 { 1402 Signals.connectData( 1403 this, 1404 "char-size-changed", 1405 cast(GCallback)&callBackCharSizeChanged, 1406 cast(void*)this, 1407 null, 1408 connectFlags); 1409 connectedSignals["char-size-changed"] = 1; 1410 } 1411 onCharSizeChangedListeners ~= dlg; 1412 } 1413 extern(C) static void callBackCharSizeChanged(VteTerminal* terminalStruct, uint width, uint height, Terminal _terminal) 1414 { 1415 foreach ( void delegate(uint, uint, Terminal) dlg; _terminal.onCharSizeChangedListeners ) 1416 { 1417 dlg(width, height, _terminal); 1418 } 1419 } 1420 1421 void delegate(int, Terminal)[] onChildExitedListeners; 1422 /** 1423 * This signal is emitted when the terminal detects that a child 1424 * watched using vte_terminal_watch_child() has exited. 1425 * 1426 * Params: 1427 * status = the child's exit status 1428 */ 1429 void addOnChildExited(void delegate(int, Terminal) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 1430 { 1431 if ( "child-exited" !in connectedSignals ) 1432 { 1433 Signals.connectData( 1434 this, 1435 "child-exited", 1436 cast(GCallback)&callBackChildExited, 1437 cast(void*)this, 1438 null, 1439 connectFlags); 1440 connectedSignals["child-exited"] = 1; 1441 } 1442 onChildExitedListeners ~= dlg; 1443 } 1444 extern(C) static void callBackChildExited(VteTerminal* terminalStruct, int status, Terminal _terminal) 1445 { 1446 foreach ( void delegate(int, Terminal) dlg; _terminal.onChildExitedListeners ) 1447 { 1448 dlg(status, _terminal); 1449 } 1450 } 1451 1452 void delegate(string, uint, Terminal)[] onCommitListeners; 1453 /** 1454 * Emitted whenever the terminal receives input from the user and 1455 * prepares to send it to the child process. The signal is emitted even 1456 * when there is no child process. 1457 * 1458 * Params: 1459 * text = a string of text 1460 * size = the length of that string of text 1461 */ 1462 void addOnCommit(void delegate(string, uint, Terminal) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 1463 { 1464 if ( "commit" !in connectedSignals ) 1465 { 1466 Signals.connectData( 1467 this, 1468 "commit", 1469 cast(GCallback)&callBackCommit, 1470 cast(void*)this, 1471 null, 1472 connectFlags); 1473 connectedSignals["commit"] = 1; 1474 } 1475 onCommitListeners ~= dlg; 1476 } 1477 extern(C) static void callBackCommit(VteTerminal* terminalStruct, char* text, uint size, Terminal _terminal) 1478 { 1479 foreach ( void delegate(string, uint, Terminal) dlg; _terminal.onCommitListeners ) 1480 { 1481 dlg(Str.toString(text), size, _terminal); 1482 } 1483 } 1484 1485 void delegate(Terminal)[] onContentsChangedListeners; 1486 /** 1487 * Emitted whenever the visible appearance of the terminal has changed. 1488 * Used primarily by #VteTerminalAccessible. 1489 */ 1490 void addOnContentsChanged(void delegate(Terminal) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 1491 { 1492 if ( "contents-changed" !in connectedSignals ) 1493 { 1494 Signals.connectData( 1495 this, 1496 "contents-changed", 1497 cast(GCallback)&callBackContentsChanged, 1498 cast(void*)this, 1499 null, 1500 connectFlags); 1501 connectedSignals["contents-changed"] = 1; 1502 } 1503 onContentsChangedListeners ~= dlg; 1504 } 1505 extern(C) static void callBackContentsChanged(VteTerminal* terminalStruct, Terminal _terminal) 1506 { 1507 foreach ( void delegate(Terminal) dlg; _terminal.onContentsChangedListeners ) 1508 { 1509 dlg(_terminal); 1510 } 1511 } 1512 1513 void delegate(Terminal)[] onCopyClipboardListeners; 1514 /** 1515 * Emitted whenever vte_terminal_copy_clipboard() is called. 1516 */ 1517 void addOnCopyClipboard(void delegate(Terminal) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 1518 { 1519 if ( "copy-clipboard" !in connectedSignals ) 1520 { 1521 Signals.connectData( 1522 this, 1523 "copy-clipboard", 1524 cast(GCallback)&callBackCopyClipboard, 1525 cast(void*)this, 1526 null, 1527 connectFlags); 1528 connectedSignals["copy-clipboard"] = 1; 1529 } 1530 onCopyClipboardListeners ~= dlg; 1531 } 1532 extern(C) static void callBackCopyClipboard(VteTerminal* terminalStruct, Terminal _terminal) 1533 { 1534 foreach ( void delegate(Terminal) dlg; _terminal.onCopyClipboardListeners ) 1535 { 1536 dlg(_terminal); 1537 } 1538 } 1539 1540 void delegate(Terminal)[] onCurrentDirectoryUriChangedListeners; 1541 /** 1542 * Emitted when the current directory URI is modified. 1543 */ 1544 void addOnCurrentDirectoryUriChanged(void delegate(Terminal) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 1545 { 1546 if ( "current-directory-uri-changed" !in connectedSignals ) 1547 { 1548 Signals.connectData( 1549 this, 1550 "current-directory-uri-changed", 1551 cast(GCallback)&callBackCurrentDirectoryUriChanged, 1552 cast(void*)this, 1553 null, 1554 connectFlags); 1555 connectedSignals["current-directory-uri-changed"] = 1; 1556 } 1557 onCurrentDirectoryUriChangedListeners ~= dlg; 1558 } 1559 extern(C) static void callBackCurrentDirectoryUriChanged(VteTerminal* terminalStruct, Terminal _terminal) 1560 { 1561 foreach ( void delegate(Terminal) dlg; _terminal.onCurrentDirectoryUriChangedListeners ) 1562 { 1563 dlg(_terminal); 1564 } 1565 } 1566 1567 void delegate(Terminal)[] onCurrentFileUriChangedListeners; 1568 /** 1569 * Emitted when the current file URI is modified. 1570 */ 1571 void addOnCurrentFileUriChanged(void delegate(Terminal) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 1572 { 1573 if ( "current-file-uri-changed" !in connectedSignals ) 1574 { 1575 Signals.connectData( 1576 this, 1577 "current-file-uri-changed", 1578 cast(GCallback)&callBackCurrentFileUriChanged, 1579 cast(void*)this, 1580 null, 1581 connectFlags); 1582 connectedSignals["current-file-uri-changed"] = 1; 1583 } 1584 onCurrentFileUriChangedListeners ~= dlg; 1585 } 1586 extern(C) static void callBackCurrentFileUriChanged(VteTerminal* terminalStruct, Terminal _terminal) 1587 { 1588 foreach ( void delegate(Terminal) dlg; _terminal.onCurrentFileUriChangedListeners ) 1589 { 1590 dlg(_terminal); 1591 } 1592 } 1593 1594 void delegate(Terminal)[] onCursorMovedListeners; 1595 /** 1596 * Emitted whenever the cursor moves to a new character cell. Used 1597 * primarily by #VteTerminalAccessible. 1598 */ 1599 void addOnCursorMoved(void delegate(Terminal) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 1600 { 1601 if ( "cursor-moved" !in connectedSignals ) 1602 { 1603 Signals.connectData( 1604 this, 1605 "cursor-moved", 1606 cast(GCallback)&callBackCursorMoved, 1607 cast(void*)this, 1608 null, 1609 connectFlags); 1610 connectedSignals["cursor-moved"] = 1; 1611 } 1612 onCursorMovedListeners ~= dlg; 1613 } 1614 extern(C) static void callBackCursorMoved(VteTerminal* terminalStruct, Terminal _terminal) 1615 { 1616 foreach ( void delegate(Terminal) dlg; _terminal.onCursorMovedListeners ) 1617 { 1618 dlg(_terminal); 1619 } 1620 } 1621 1622 void delegate(Terminal)[] onDecreaseFontSizeListeners; 1623 /** 1624 * Emitted when the user hits the '-' key while holding the Control key. 1625 */ 1626 void addOnDecreaseFontSize(void delegate(Terminal) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 1627 { 1628 if ( "decrease-font-size" !in connectedSignals ) 1629 { 1630 Signals.connectData( 1631 this, 1632 "decrease-font-size", 1633 cast(GCallback)&callBackDecreaseFontSize, 1634 cast(void*)this, 1635 null, 1636 connectFlags); 1637 connectedSignals["decrease-font-size"] = 1; 1638 } 1639 onDecreaseFontSizeListeners ~= dlg; 1640 } 1641 extern(C) static void callBackDecreaseFontSize(VteTerminal* terminalStruct, Terminal _terminal) 1642 { 1643 foreach ( void delegate(Terminal) dlg; _terminal.onDecreaseFontSizeListeners ) 1644 { 1645 dlg(_terminal); 1646 } 1647 } 1648 1649 void delegate(Terminal)[] onDeiconifyWindowListeners; 1650 /** 1651 * Emitted at the child application's request. 1652 */ 1653 void addOnDeiconifyWindow(void delegate(Terminal) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 1654 { 1655 if ( "deiconify-window" !in connectedSignals ) 1656 { 1657 Signals.connectData( 1658 this, 1659 "deiconify-window", 1660 cast(GCallback)&callBackDeiconifyWindow, 1661 cast(void*)this, 1662 null, 1663 connectFlags); 1664 connectedSignals["deiconify-window"] = 1; 1665 } 1666 onDeiconifyWindowListeners ~= dlg; 1667 } 1668 extern(C) static void callBackDeiconifyWindow(VteTerminal* terminalStruct, Terminal _terminal) 1669 { 1670 foreach ( void delegate(Terminal) dlg; _terminal.onDeiconifyWindowListeners ) 1671 { 1672 dlg(_terminal); 1673 } 1674 } 1675 1676 void delegate(Terminal)[] onEncodingChangedListeners; 1677 /** 1678 * Emitted whenever the terminal's current encoding has changed, either 1679 * as a result of receiving a control sequence which toggled between the 1680 * local and UTF-8 encodings, or at the parent application's request. 1681 */ 1682 void addOnEncodingChanged(void delegate(Terminal) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 1683 { 1684 if ( "encoding-changed" !in connectedSignals ) 1685 { 1686 Signals.connectData( 1687 this, 1688 "encoding-changed", 1689 cast(GCallback)&callBackEncodingChanged, 1690 cast(void*)this, 1691 null, 1692 connectFlags); 1693 connectedSignals["encoding-changed"] = 1; 1694 } 1695 onEncodingChangedListeners ~= dlg; 1696 } 1697 extern(C) static void callBackEncodingChanged(VteTerminal* terminalStruct, Terminal _terminal) 1698 { 1699 foreach ( void delegate(Terminal) dlg; _terminal.onEncodingChangedListeners ) 1700 { 1701 dlg(_terminal); 1702 } 1703 } 1704 1705 void delegate(Terminal)[] onEofListeners; 1706 /** 1707 * Emitted when the terminal receives an end-of-file from a child which 1708 * is running in the terminal. This signal is frequently (but not 1709 * always) emitted with a #VteTerminal::child-exited signal. 1710 */ 1711 void addOnEof(void delegate(Terminal) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 1712 { 1713 if ( "eof" !in connectedSignals ) 1714 { 1715 Signals.connectData( 1716 this, 1717 "eof", 1718 cast(GCallback)&callBackEof, 1719 cast(void*)this, 1720 null, 1721 connectFlags); 1722 connectedSignals["eof"] = 1; 1723 } 1724 onEofListeners ~= dlg; 1725 } 1726 extern(C) static void callBackEof(VteTerminal* terminalStruct, Terminal _terminal) 1727 { 1728 foreach ( void delegate(Terminal) dlg; _terminal.onEofListeners ) 1729 { 1730 dlg(_terminal); 1731 } 1732 } 1733 1734 void delegate(Terminal)[] onIconTitleChangedListeners; 1735 /** 1736 * Emitted when the terminal's %icon_title field is modified. 1737 */ 1738 void addOnIconTitleChanged(void delegate(Terminal) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 1739 { 1740 if ( "icon-title-changed" !in connectedSignals ) 1741 { 1742 Signals.connectData( 1743 this, 1744 "icon-title-changed", 1745 cast(GCallback)&callBackIconTitleChanged, 1746 cast(void*)this, 1747 null, 1748 connectFlags); 1749 connectedSignals["icon-title-changed"] = 1; 1750 } 1751 onIconTitleChangedListeners ~= dlg; 1752 } 1753 extern(C) static void callBackIconTitleChanged(VteTerminal* terminalStruct, Terminal _terminal) 1754 { 1755 foreach ( void delegate(Terminal) dlg; _terminal.onIconTitleChangedListeners ) 1756 { 1757 dlg(_terminal); 1758 } 1759 } 1760 1761 void delegate(Terminal)[] onIconifyWindowListeners; 1762 /** 1763 * Emitted at the child application's request. 1764 */ 1765 void addOnIconifyWindow(void delegate(Terminal) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 1766 { 1767 if ( "iconify-window" !in connectedSignals ) 1768 { 1769 Signals.connectData( 1770 this, 1771 "iconify-window", 1772 cast(GCallback)&callBackIconifyWindow, 1773 cast(void*)this, 1774 null, 1775 connectFlags); 1776 connectedSignals["iconify-window"] = 1; 1777 } 1778 onIconifyWindowListeners ~= dlg; 1779 } 1780 extern(C) static void callBackIconifyWindow(VteTerminal* terminalStruct, Terminal _terminal) 1781 { 1782 foreach ( void delegate(Terminal) dlg; _terminal.onIconifyWindowListeners ) 1783 { 1784 dlg(_terminal); 1785 } 1786 } 1787 1788 void delegate(Terminal)[] onIncreaseFontSizeListeners; 1789 /** 1790 * Emitted when the user hits the '+' key while holding the Control key. 1791 */ 1792 void addOnIncreaseFontSize(void delegate(Terminal) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 1793 { 1794 if ( "increase-font-size" !in connectedSignals ) 1795 { 1796 Signals.connectData( 1797 this, 1798 "increase-font-size", 1799 cast(GCallback)&callBackIncreaseFontSize, 1800 cast(void*)this, 1801 null, 1802 connectFlags); 1803 connectedSignals["increase-font-size"] = 1; 1804 } 1805 onIncreaseFontSizeListeners ~= dlg; 1806 } 1807 extern(C) static void callBackIncreaseFontSize(VteTerminal* terminalStruct, Terminal _terminal) 1808 { 1809 foreach ( void delegate(Terminal) dlg; _terminal.onIncreaseFontSizeListeners ) 1810 { 1811 dlg(_terminal); 1812 } 1813 } 1814 1815 void delegate(Terminal)[] onLowerWindowListeners; 1816 /** 1817 * Emitted at the child application's request. 1818 */ 1819 void addOnLowerWindow(void delegate(Terminal) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 1820 { 1821 if ( "lower-window" !in connectedSignals ) 1822 { 1823 Signals.connectData( 1824 this, 1825 "lower-window", 1826 cast(GCallback)&callBackLowerWindow, 1827 cast(void*)this, 1828 null, 1829 connectFlags); 1830 connectedSignals["lower-window"] = 1; 1831 } 1832 onLowerWindowListeners ~= dlg; 1833 } 1834 extern(C) static void callBackLowerWindow(VteTerminal* terminalStruct, Terminal _terminal) 1835 { 1836 foreach ( void delegate(Terminal) dlg; _terminal.onLowerWindowListeners ) 1837 { 1838 dlg(_terminal); 1839 } 1840 } 1841 1842 void delegate(Terminal)[] onMaximizeWindowListeners; 1843 /** 1844 * Emitted at the child application's request. 1845 */ 1846 void addOnMaximizeWindow(void delegate(Terminal) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 1847 { 1848 if ( "maximize-window" !in connectedSignals ) 1849 { 1850 Signals.connectData( 1851 this, 1852 "maximize-window", 1853 cast(GCallback)&callBackMaximizeWindow, 1854 cast(void*)this, 1855 null, 1856 connectFlags); 1857 connectedSignals["maximize-window"] = 1; 1858 } 1859 onMaximizeWindowListeners ~= dlg; 1860 } 1861 extern(C) static void callBackMaximizeWindow(VteTerminal* terminalStruct, Terminal _terminal) 1862 { 1863 foreach ( void delegate(Terminal) dlg; _terminal.onMaximizeWindowListeners ) 1864 { 1865 dlg(_terminal); 1866 } 1867 } 1868 1869 void delegate(uint, uint, Terminal)[] onMoveWindowListeners; 1870 /** 1871 * Emitted at the child application's request. 1872 * 1873 * Params: 1874 * x = the terminal's desired location, X coordinate 1875 * y = the terminal's desired location, Y coordinate 1876 */ 1877 void addOnMoveWindow(void delegate(uint, uint, Terminal) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 1878 { 1879 if ( "move-window" !in connectedSignals ) 1880 { 1881 Signals.connectData( 1882 this, 1883 "move-window", 1884 cast(GCallback)&callBackMoveWindow, 1885 cast(void*)this, 1886 null, 1887 connectFlags); 1888 connectedSignals["move-window"] = 1; 1889 } 1890 onMoveWindowListeners ~= dlg; 1891 } 1892 extern(C) static void callBackMoveWindow(VteTerminal* terminalStruct, uint x, uint y, Terminal _terminal) 1893 { 1894 foreach ( void delegate(uint, uint, Terminal) dlg; _terminal.onMoveWindowListeners ) 1895 { 1896 dlg(x, y, _terminal); 1897 } 1898 } 1899 1900 void delegate(Terminal)[] onPasteClipboardListeners; 1901 /** 1902 * Emitted whenever vte_terminal_paste_clipboard() is called. 1903 */ 1904 void addOnPasteClipboard(void delegate(Terminal) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 1905 { 1906 if ( "paste-clipboard" !in connectedSignals ) 1907 { 1908 Signals.connectData( 1909 this, 1910 "paste-clipboard", 1911 cast(GCallback)&callBackPasteClipboard, 1912 cast(void*)this, 1913 null, 1914 connectFlags); 1915 connectedSignals["paste-clipboard"] = 1; 1916 } 1917 onPasteClipboardListeners ~= dlg; 1918 } 1919 extern(C) static void callBackPasteClipboard(VteTerminal* terminalStruct, Terminal _terminal) 1920 { 1921 foreach ( void delegate(Terminal) dlg; _terminal.onPasteClipboardListeners ) 1922 { 1923 dlg(_terminal); 1924 } 1925 } 1926 1927 void delegate(Terminal)[] onRaiseWindowListeners; 1928 /** 1929 * Emitted at the child application's request. 1930 */ 1931 void addOnRaiseWindow(void delegate(Terminal) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 1932 { 1933 if ( "raise-window" !in connectedSignals ) 1934 { 1935 Signals.connectData( 1936 this, 1937 "raise-window", 1938 cast(GCallback)&callBackRaiseWindow, 1939 cast(void*)this, 1940 null, 1941 connectFlags); 1942 connectedSignals["raise-window"] = 1; 1943 } 1944 onRaiseWindowListeners ~= dlg; 1945 } 1946 extern(C) static void callBackRaiseWindow(VteTerminal* terminalStruct, Terminal _terminal) 1947 { 1948 foreach ( void delegate(Terminal) dlg; _terminal.onRaiseWindowListeners ) 1949 { 1950 dlg(_terminal); 1951 } 1952 } 1953 1954 void delegate(Terminal)[] onRefreshWindowListeners; 1955 /** 1956 * Emitted at the child application's request. 1957 */ 1958 void addOnRefreshWindow(void delegate(Terminal) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 1959 { 1960 if ( "refresh-window" !in connectedSignals ) 1961 { 1962 Signals.connectData( 1963 this, 1964 "refresh-window", 1965 cast(GCallback)&callBackRefreshWindow, 1966 cast(void*)this, 1967 null, 1968 connectFlags); 1969 connectedSignals["refresh-window"] = 1; 1970 } 1971 onRefreshWindowListeners ~= dlg; 1972 } 1973 extern(C) static void callBackRefreshWindow(VteTerminal* terminalStruct, Terminal _terminal) 1974 { 1975 foreach ( void delegate(Terminal) dlg; _terminal.onRefreshWindowListeners ) 1976 { 1977 dlg(_terminal); 1978 } 1979 } 1980 1981 void delegate(uint, uint, Terminal)[] onResizeWindowListeners; 1982 /** 1983 * Emitted at the child application's request. 1984 * 1985 * Params: 1986 * width = the desired number of columns 1987 * height = the desired number of rows 1988 */ 1989 void addOnResizeWindow(void delegate(uint, uint, Terminal) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 1990 { 1991 if ( "resize-window" !in connectedSignals ) 1992 { 1993 Signals.connectData( 1994 this, 1995 "resize-window", 1996 cast(GCallback)&callBackResizeWindow, 1997 cast(void*)this, 1998 null, 1999 connectFlags); 2000 connectedSignals["resize-window"] = 1; 2001 } 2002 onResizeWindowListeners ~= dlg; 2003 } 2004 extern(C) static void callBackResizeWindow(VteTerminal* terminalStruct, uint width, uint height, Terminal _terminal) 2005 { 2006 foreach ( void delegate(uint, uint, Terminal) dlg; _terminal.onResizeWindowListeners ) 2007 { 2008 dlg(width, height, _terminal); 2009 } 2010 } 2011 2012 void delegate(Terminal)[] onRestoreWindowListeners; 2013 /** 2014 * Emitted at the child application's request. 2015 */ 2016 void addOnRestoreWindow(void delegate(Terminal) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 2017 { 2018 if ( "restore-window" !in connectedSignals ) 2019 { 2020 Signals.connectData( 2021 this, 2022 "restore-window", 2023 cast(GCallback)&callBackRestoreWindow, 2024 cast(void*)this, 2025 null, 2026 connectFlags); 2027 connectedSignals["restore-window"] = 1; 2028 } 2029 onRestoreWindowListeners ~= dlg; 2030 } 2031 extern(C) static void callBackRestoreWindow(VteTerminal* terminalStruct, Terminal _terminal) 2032 { 2033 foreach ( void delegate(Terminal) dlg; _terminal.onRestoreWindowListeners ) 2034 { 2035 dlg(_terminal); 2036 } 2037 } 2038 2039 void delegate(Terminal)[] onSelectionChangedListeners; 2040 /** 2041 * Emitted whenever the contents of terminal's selection changes. 2042 */ 2043 void addOnSelectionChanged(void delegate(Terminal) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 2044 { 2045 if ( "selection-changed" !in connectedSignals ) 2046 { 2047 Signals.connectData( 2048 this, 2049 "selection-changed", 2050 cast(GCallback)&callBackSelectionChanged, 2051 cast(void*)this, 2052 null, 2053 connectFlags); 2054 connectedSignals["selection-changed"] = 1; 2055 } 2056 onSelectionChangedListeners ~= dlg; 2057 } 2058 extern(C) static void callBackSelectionChanged(VteTerminal* terminalStruct, Terminal _terminal) 2059 { 2060 foreach ( void delegate(Terminal) dlg; _terminal.onSelectionChangedListeners ) 2061 { 2062 dlg(_terminal); 2063 } 2064 } 2065 2066 void delegate(Terminal)[] onTextDeletedListeners; 2067 /** 2068 * An internal signal used for communication between the terminal and 2069 * its accessibility peer. May not be emitted under certain 2070 * circumstances. 2071 */ 2072 void addOnTextDeleted(void delegate(Terminal) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 2073 { 2074 if ( "text-deleted" !in connectedSignals ) 2075 { 2076 Signals.connectData( 2077 this, 2078 "text-deleted", 2079 cast(GCallback)&callBackTextDeleted, 2080 cast(void*)this, 2081 null, 2082 connectFlags); 2083 connectedSignals["text-deleted"] = 1; 2084 } 2085 onTextDeletedListeners ~= dlg; 2086 } 2087 extern(C) static void callBackTextDeleted(VteTerminal* terminalStruct, Terminal _terminal) 2088 { 2089 foreach ( void delegate(Terminal) dlg; _terminal.onTextDeletedListeners ) 2090 { 2091 dlg(_terminal); 2092 } 2093 } 2094 2095 void delegate(Terminal)[] onTextInsertedListeners; 2096 /** 2097 * An internal signal used for communication between the terminal and 2098 * its accessibility peer. May not be emitted under certain 2099 * circumstances. 2100 */ 2101 void addOnTextInserted(void delegate(Terminal) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 2102 { 2103 if ( "text-inserted" !in connectedSignals ) 2104 { 2105 Signals.connectData( 2106 this, 2107 "text-inserted", 2108 cast(GCallback)&callBackTextInserted, 2109 cast(void*)this, 2110 null, 2111 connectFlags); 2112 connectedSignals["text-inserted"] = 1; 2113 } 2114 onTextInsertedListeners ~= dlg; 2115 } 2116 extern(C) static void callBackTextInserted(VteTerminal* terminalStruct, Terminal _terminal) 2117 { 2118 foreach ( void delegate(Terminal) dlg; _terminal.onTextInsertedListeners ) 2119 { 2120 dlg(_terminal); 2121 } 2122 } 2123 2124 void delegate(Terminal)[] onTextModifiedListeners; 2125 /** 2126 * An internal signal used for communication between the terminal and 2127 * its accessibility peer. May not be emitted under certain 2128 * circumstances. 2129 */ 2130 void addOnTextModified(void delegate(Terminal) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 2131 { 2132 if ( "text-modified" !in connectedSignals ) 2133 { 2134 Signals.connectData( 2135 this, 2136 "text-modified", 2137 cast(GCallback)&callBackTextModified, 2138 cast(void*)this, 2139 null, 2140 connectFlags); 2141 connectedSignals["text-modified"] = 1; 2142 } 2143 onTextModifiedListeners ~= dlg; 2144 } 2145 extern(C) static void callBackTextModified(VteTerminal* terminalStruct, Terminal _terminal) 2146 { 2147 foreach ( void delegate(Terminal) dlg; _terminal.onTextModifiedListeners ) 2148 { 2149 dlg(_terminal); 2150 } 2151 } 2152 2153 void delegate(int, Terminal)[] onTextScrolledListeners; 2154 /** 2155 * An internal signal used for communication between the terminal and 2156 * its accessibility peer. May not be emitted under certain 2157 * circumstances. 2158 * 2159 * Params: 2160 * delta = the number of lines scrolled 2161 */ 2162 void addOnTextScrolled(void delegate(int, Terminal) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 2163 { 2164 if ( "text-scrolled" !in connectedSignals ) 2165 { 2166 Signals.connectData( 2167 this, 2168 "text-scrolled", 2169 cast(GCallback)&callBackTextScrolled, 2170 cast(void*)this, 2171 null, 2172 connectFlags); 2173 connectedSignals["text-scrolled"] = 1; 2174 } 2175 onTextScrolledListeners ~= dlg; 2176 } 2177 extern(C) static void callBackTextScrolled(VteTerminal* terminalStruct, int delta, Terminal _terminal) 2178 { 2179 foreach ( void delegate(int, Terminal) dlg; _terminal.onTextScrolledListeners ) 2180 { 2181 dlg(delta, _terminal); 2182 } 2183 } 2184 2185 void delegate(Terminal)[] onWindowTitleChangedListeners; 2186 /** 2187 * Emitted when the terminal's %window_title field is modified. 2188 */ 2189 void addOnWindowTitleChanged(void delegate(Terminal) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 2190 { 2191 if ( "window-title-changed" !in connectedSignals ) 2192 { 2193 Signals.connectData( 2194 this, 2195 "window-title-changed", 2196 cast(GCallback)&callBackWindowTitleChanged, 2197 cast(void*)this, 2198 null, 2199 connectFlags); 2200 connectedSignals["window-title-changed"] = 1; 2201 } 2202 onWindowTitleChangedListeners ~= dlg; 2203 } 2204 extern(C) static void callBackWindowTitleChanged(VteTerminal* terminalStruct, Terminal _terminal) 2205 { 2206 foreach ( void delegate(Terminal) dlg; _terminal.onWindowTitleChangedListeners ) 2207 { 2208 dlg(_terminal); 2209 } 2210 } 2211 2212 /** 2213 * Gets the user's shell, or %NULL. In the latter case, the 2214 * system default (usually "/bin/sh") should be used. 2215 * 2216 * Return: a newly allocated string with the 2217 * user's shell, or %NULL 2218 */ 2219 public static string getUserShell() 2220 { 2221 auto retStr = vte_get_user_shell(); 2222 2223 scope(exit) Str.freeString(retStr); 2224 return Str.toString(retStr); 2225 } 2226 }