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