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