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