vte-sharp 2.0.0.0 Gtk# is thread aware, but not thread safe; See the Gtk# Thread Programming for details. A terminal widget implementation. A is a terminal emulator implemented as a . using System; using System.Collections; using Gtk; using Gnome; using Vte; class T { static void Main (string[] args) { new T (args); } T (string[] args) { Program program = new Program ("vte-sharp-test", "0.0", Modules.UI, args); App app = new App ("vte-sharp-test", "Test for vte widget"); app.SetDefaultSize (600, 450); app.DeleteEvent += new DeleteEventHandler (OnAppDelete); HBox hbox = new HBox (); Terminal term = new Terminal (); term.EncodingChanged += new EventHandler (OnEncodingChanged); term.CursorBlinks = true; term.MouseAutohide = true; term.ScrollOnKeystroke = true; term.DeleteBinding = TerminalEraseBinding.Auto; term.BackspaceBinding = TerminalEraseBinding.Auto; term.Encoding = "UTF-8"; term.FontFromString = "Monospace 12"; term.TextDeleted += new EventHandler (OnTextDeleted); term.ChildExited += new EventHandler (OnChildExited); VScrollbar vscroll = new VScrollbar (term.Adjustment); hbox.PackStart (term); hbox.PackStart (vscroll); Gdk.Color white = new Gdk.Color (); Gdk.Color.Parse ("white", ref white); Gdk.Color black = new Gdk.Color (); Gdk.Color.Parse ("black", ref black); term.SetColors (black, white, white, 16); string[] argv = Environment.GetCommandLineArgs (); // wants an array of "variable=value" string[] envv = new string [Environment.GetEnvironmentVariables ().Count]; int i = 0; foreach (DictionaryEntry e in Environment.GetEnvironmentVariables ()) { if (e.Key == "" || e.Value == "") continue; string tmp = String.Format ("{0}={1}", e.Key, e.Value); envv[i] = tmp; i ++; } int pid = term.ForkCommand ( Environment.GetEnvironmentVariable ("SHELL"), argv, envv, Environment.CurrentDirectory, false, true, true); Console.WriteLine ("Child pid: {0}", pid); app.Contents = hbox; app.ShowAll (); program.Run (); } private void OnTextDeleted (object o, EventArgs args) { Console.WriteLine ("text deleted"); } private void OnEncodingChanged (object o, EventArgs args) { Console.WriteLine ("encoding changed"); } private void OnTextInserted (object o, EventArgs args) { Console.WriteLine ("text inserted"); } private void OnChildExited (object o, EventArgs args) { // optionally we could just reset instead of quitting Console.WriteLine ("child exited"); Application.Quit (); } private void OnAppDelete (object o, DeleteEventArgs args) { Application.Quit (); } } Gtk.Widget Method System.Void Default handler for the event. Override this method in a subclass to provide a default handler for the event. Method System.Void Default handler for the event. Override this method in a subclass to provide a default handler for the event. Method System.Void Default handler for the event. Override this method in a subclass to provide a default handler for the event. Method System.Void Default handler for the event. Override this method in a subclass to provide a default handler for the event. Method System.Void Default handler for the event. Override this method in a subclass to provide a default handler for the event. Method System.Void Default handler for the event. Override this method in a subclass to provide a default handler for the event. Method System.Void Default handler for the event. Override this method in a subclass to provide a default handler for the event. Method System.Void Default handler for the event. Override this method in a subclass to provide a default handler for the event. Method System.Void Default handler for the event. Override this method in a subclass to provide a default handler for the event. Method System.Void Default handler for the event. Override this method in a subclass to provide a default handler for the event. Method System.Void Default handler for the event. Override this method in a subclass to provide a default handler for the event. Method System.Void Default handler for the event. a a Override this method in a subclass to provide a default handler for the event. Method System.Void Default handler for the event. Override this method in a subclass to provide a default handler for the event. Method System.Void Default handler for the event. Override this method in a subclass to provide a default handler for the event. Method System.Void Default handler for the event. Override this method in a subclass to provide a default handler for the event. Method System.Void Default handler for the event. Override this method in a subclass to provide a default handler for the event. Method System.Void Default handler for the event. a Override this method in a subclass to provide a default handler for the event. Method System.Void Default handler for the event. a a Override this method in a subclass to provide a default handler for the event. Method System.Void Default handler for the event. Override this method in a subclass to provide a default handler for the event. Method System.Void Default handler for the event. Override this method in a subclass to provide a default handler for the event. Method System.Void Default handler for the event. Override this method in a subclass to provide a default handler for the event. Method System.Void Default handler for the event. Override this method in a subclass to provide a default handler for the event. Method System.Void Default handler for the event. Override this method in a subclass to provide a default handler for the event. Method System.Void Default handler for the event. Override this method in a subclass to provide a default handler for the event. Method System.Void Default handler for the event. Override this method in a subclass to provide a default handler for the event. Method System.Void Default handler for the event. a a Override this method in a subclass to provide a default handler for the event. Method System.Void Default handler for the event. a a Override this method in a subclass to provide a default handler for the event. Method System.Void To be added a a To be added Method System.Void Appends menu items for various input methods to the given menu. a The user can select one of these items to modify the input method used by the terminal. Method System.Void Resets as much of the terminal's internal state as possible. to reset tabstops to empty the terminal's scrollback buffer Resets as much of the terminal's internal state as possible, discarding any unprocessed input data, resetting character attributes, cursor state, national character set state, status line, terminal modes (insert/delete), selection state, and encoding. Method System.String Extracts a view of the visible part of the terminal. a callback user data to be passed to the callback location for storing text attributes a If is not , characters will only be read if returns after being passed the column and row, respectively. A structure is added to attributes for each byte added to the returned string detailing the character's position, colors, and other characteristics. Method System.Void To be added a a To be added Method System.Void Places the selected text in the terminal in the GDK_SELECTION_PRIMARY selection. Method System.Void Change the colors of the the new foreground color, or the new background color, or the color palette the number of entries in The terminal widget uses a 28-color model comprised of the default foreground and background colors, the bold foreground color, the dim foreground color, an eight color palette, and bold versions of the eight color palette, and a dim version of the the eight color palette. must be either 0, 8, 16, or 24. If is and is greater than 0, the new foreground color is taken from palette[7]. If is and is greater than 0, the new background color is taken from palette[0]. If is 8 or 16, the third (dim) and possibly second (bold) 8-color palette is extrapolated from the new background color and the items in palette. Method System.Void Reads the location of the insertion cursor and returns it. long which will hold the column long which will hold the row The row coordinate is absolute. Method System.Void Determines the amount of additional space the widget is using to pad the edges of its visible area. a in which to store left/right-edge padding a in which to store top/bottom-edge ypadding This is necessary for cases where characters in the selected font do not themselves include a padding area and the text itself would be contiguous with the window border. Applications which use the widget's row_count, column_count, char_height, and char_width fields to set geometry hints using gtk_window_set_geometry_hints() will need to add this value to the base size. The values returned in xpad and ypad are the total padding used in each direction, and do not need to be doubled. Method System.Void Places the selected text in the terminal in the GDK_SELECTION_CLIPBOARD selection. Method System.String Checks if the text in and around the specified position matches any of the regular expressions previously set using . the text column the text row pointer to an integer a string which matches one of the previously set regular expressions If a match exists, the text string is returned and if is not , the number associated with the matched regular expression will be stored in tag. If more than one regular expression has been set with , then expressions are checked in the order in which they were added. Method System.String Extracts a view of the visible part of the string. first row to search for data first column to search for data last row to search for data last column to search for data a callback user data to be passed to the callback location for storing text attributes a If is not , characters will only be read if returns after being passed the column and row, respectively. A structure is added to attributes for each byte added to the returned string detailing the character's position, colors, and other characteristics. The entire scrollback buffer is scanned, so it is possible to read the entire contents of the buffer using this function. Method System.Void Clears the list of regular expressions the terminal uses to highlight text when the user moves the mouse cursor. Method System.Int32 Adds a regular expression to the list of matching expressions. a regular expression an integer associated with this expression When the user moves the mouse cursor over a section of displayed text which matches this expression, the text will be highlighted. Method System.Void Sends a block of UTF-8 text to the child as if it were entered by the user at the keyboard. a Method System.Void Removes the regular expression which is associated with the given from the list of expressions which the terminal will highlight when the user moves the mouse cursor over matching text. the tag of the regex to remove Method System.Void Reset the terminal palette to reasonable compiled-in defaults. Method System.Void Attempts to change the terminal's size in terms of rows and columns. the desired number of columns the desired number of rows If the attempt succeeds, the widget will resize itself to the proper size. Method System.Void Sends the contents of the GDK_SELECTION_CLIPBOARD selection to the terminal's child. If necessary, the data is converted from UTF-8 to the terminal's current encoding. Method System.Void Sends the contents of the GDK_SELECTION_PRIMARY selection to the terminal's child. If necessary, the data is converted from UTF-8 to the terminal's current encoding. The terminal will call also paste the GDK_SELECTION_PRIMARY selection when the user clicks with the the second mouse button. Method System.Void Interprets as if it were data received from a child process. a This can either be used to drive the terminal without a child process, or just to mess with your users. Constructor Internal Constructor. a This should not be called by normal applications. System.Obsolete(Message=null, IsError=False) Constructor Internal Constructor. a This should not be called by normal user code. Constructor Default Constructor Property GLib.GType GType Property. a Returns the native value for . Property System.Int64 An accessor function provided for the benefit of language bindings. the contents of terminal's char_ascent field Property Gtk.Adjustment An accessor function provided for the benefit of language bindings. the contents of terminal's adjustment field Property System.Int64 An accessor function provided for the benefit of language bindings. the contents of terminal's column_count field Property Gdk.Color Sets the background color for text which does not have a specific background color assigned. the new background color Only has effect when no background image is set and when the terminal is not transparent. Property System.Boolean Controls whether or not the terminal will forcibly scroll to the bottom of the viewable history when the user presses a key. if the terminal should scroll on keystrokes Modifier keys do not trigger this behavior. Property System.Int64 An accessor function provided for the benefit of language bindings. a the contents of terminal's char_width field Property System.Int64 An accessor function provided for the benefit of language bindings. the contents of terminal's char_descent field Property System.Boolean Controls whether or not the terminal will present a visible bell to the user when the child outputs the "bl" sequence. if visible bell is enabled, if not The terminal will clear itself to the default foreground color and then repaint itself. Property System.Boolean Sets whether or not the cursor will blink. if the cursor should blink The length of the blinking cycle is controlled by the "gtk-cursor-blink-time" GTK+ setting. Property System.String A convenience function which converts name into a PangoFontDescription and passes it to . A string describing the font. Property System.String Sets what type of terminal the widget attempts to emulate by scanning for control sequences defined in the system's termcap file. the name of a terminal description Unless you are interested in this feature, always use "xterm". Property System.Boolean Whether a is using Xft to draw text. if the terminal is using Xft to render, if the terminal is using Pango or Xlib. This function allows an application to determine which mode the widget is in. This setting cannot be changed by the caller, but in practice usually matches the behavior of Gtk itself. Property Vte.TerminalEraseBinding Modifies the terminal's backspace key binding, which controls what string or control sequence the terminal sends to its child when the user presses the backspace key. a for the backspace key Property System.String An accessor function provided for the benefit of language bindings. the contents of terminal's icon_title field Property System.Boolean Controls whether or not the terminal will forcibly scroll to the bottom of the viewable history when the new data is received from the child. if the terminal should scroll on output Property System.Boolean Sets the terminal's background image to the pixmap stored in the root window, adjusted so that if there are no windows below your application, the widget will appear to be transparent. if the terminal should fake transparency Property Gdk.Color To be added a To be added Property Vte.TerminalEraseBinding Modifies the terminal's delete key binding, which controls what string or control sequence the terminal sends to its child when the user presses the delete key. a for the delete key Property System.String The encoding the terminal will expect data from the child to be encoded with. a valid gconv target For certain terminal types, applications executing in the terminal can change the encoding. The default encoding is defined by the application's locale settings. Property System.Boolean Controls whether or not the terminal will attempt to draw bold text by repainting text with a different offset. if the terminal should attempt to draw bold text Property Gdk.Pixbuf Sets a background image for the widget. to use, or to cancel Text which would otherwise be drawn using the default background color will instead be drawn over the specified image. If necessary, the image will be tiled to cover the widget's entire visible area. Property System.String When the user double-clicks to start selection, the terminal will extend the selection on word boundaries. a specification When the user double-clicks to start selection, the terminal will extend the selection on word boundaries. It will treat characters passed in as parts of words, and all other characters as word separators. Ranges of characters can be specified by separating them with a hyphen. As a special case, if set to or the empty string, the terminal will treat all graphic non-punctuation characters as word characters. Property System.Int64 An accessor function provided for the benefit of language bindings. the contents of terminal's row_count field Property System.String Some terminal emulations specify a status line which is separate from the main display area, and define a means for applications to move the cursor to the status line and back. The current contents of the terminal's status line. For terminals like "xterm", this will usually be the empty string. The string must not be modified or freed by the caller. Property System.Boolean To be added a To be added Property Gdk.Color Sets the color used to draw dim text in the default foreground color. the new dim color Property System.Int64 Sets the length of the scrollback buffer used by the terminal. the length of the history buffer The size of the scrollback buffer will be set to the larger of this value and the number of visible rows the widget can display, so 0 can safely be used to disable scrollback. Note that this setting only affects the normal screen buffer. For terminal types which have an alternate screen buffer, no scrollback is allowed. Property System.Int64 An accessor function provided for the benefit of language bindings. the contents of terminal's char_height field Property System.String Sets a background image for the widget. a If specified by , the terminal will make its in-memory copy of the image darker for its own use. This is a convenience wrapper for . If your application intends to create multiple terminal widgets using the same background, performing this step yourself and just using will reduce memory consumption. Property Gdk.Color Sets the color used to draw bold text in the default foreground color. the new bold color Property System.Double Adjust the brightness of the background image. a If a background image has been set using , , or , the terminal will adjust the brightness of the image before drawing the image. To do so, the terminal will create a copy of the background image (or snapshot of the root window) and modify its pixel values. If your application intends to create multiple terminal widgets with the same settings, performing this step yourself and just using will save memory. Property System.String An accessor function provided for the benefit of language bindings. the contents of terminal's window_title field the contents of terminal's window_title field Property System.Boolean The value of the terminal's mouse autohide setting. if the autohide should be enabled When autohiding is enabled, the mouse cursor will be hidden when the user presses a key and shown when the user moves the mouse. Property Gdk.Color Sets the foreground color used to draw normal text the new foreground color Property System.Boolean Controls whether or not the terminal will beep when the child outputs the "bl" sequence. a if the terminal should beep Property System.Boolean Checks if the terminal currently contains selected text. if part of the text in the terminal is selected. Note that this is different from determining if the terminal is the owner of any items. Event System.EventHandler Emitted at the child application's request. GLib.Signal(CName="restore-window") Event System.EventHandler Emitted at the child application's request. GLib.Signal(CName="lower-window") Event System.EventHandler Emitted at the child application's request. GLib.Signal(CName="maximize-window") Event System.EventHandler Emitted when the user hits the '+' key while holding the Control key. GLib.Signal(CName="increase-font-size") Event System.EventHandler An internal signal used for communication between the terminal and its accessibility peer. May not be emitted under certain circumstances. GLib.Signal(CName="text-modified") Event System.EventHandler Emitted at the child application's request. GLib.Signal(CName="raise-window") Event System.EventHandler An internal signal used for communication between the terminal and its accessibility peer. May not be emitted under certain circumstances. GLib.Signal(CName="text-inserted") Event System.EventHandler Emitted whenever the contents of the status line are modified or cleared. GLib.Signal(CName="status-line-changed") Event System.EventHandler Emitted at the child application's request. GLib.Signal(CName="iconify-window") Event System.EventHandler This signal is emitted when the terminal detects that a child started using has exited. GLib.Signal(CName="child-exited") Event System.EventHandler An internal signal used for communication between the terminal and its accessibility peer. May not be emitted under certain circumstances. GLib.Signal(CName="text-deleted") Event Vte.MoveWindowHandler Emitted at the child application's request. GLib.Signal(CName="move-window") Event System.EventHandler Emitted at the child application's request. GLib.Signal(CName="refresh-window") Event System.EventHandler Emitted at the child application's request. GLib.Signal(CName="deiconify-window") Event System.EventHandler Emitted when the terminal's icon_title field is modified. GLib.Signal(CName="icon-title-changed") Event System.EventHandler Emitted when the user hits the '-' key while holding the Control key. GLib.Signal(CName="decrease-font-size") Event Vte.TextScrolledHandler An internal signal used for communication between the terminal and its accessibility peer. May not be emitted under certain circumstances. GLib.Signal(CName="text-scrolled") Event Vte.CharSizeChangedHandler Emitted whenever selection of a new font causes the values of the char_width or char_height fields to change. GLib.Signal(CName="char-size-changed") Event System.EventHandler Emitted when the terminals encoding type is changed. GLib.Signal(CName="encoding-changed") Event System.EventHandler Emitted when the terminal's window_title field is modified. GLib.Signal(CName="window-title-changed") Event System.EventHandler Emitted whenever the visible appearance of the terminal has changed. Used primarily by . GLib.Signal(CName="contents-changed") Event System.EventHandler Emitted whenever the cursor moves to a new character cell. Used primarily by . GLib.Signal(CName="cursor-moved") Event System.EventHandler Emitted whenever the contents of terminal's selection changes. GLib.Signal(CName="selection-changed") Event System.EventHandler To be added GLib.Signal(CName="eof") Event System.EventHandler Emitted when the terminal emulation type is changed. GLib.Signal(CName="emulation-changed") Event Vte.ResizeWindowHandler Emitted at the child application's request. GLib.Signal(CName="resize-window") Event Vte.CommitHandler Emitted whenever the terminal receives input from the user and prepares to send it to the child process. The signal is emitted even when there is no child process. GLib.Signal(CName="commit") Property Pango.FontDescription The font used for rendering all text displayed by the terminal, overriding any fonts set using . The of the desired font. The terminal will immediately attempt to load the desired font, retrieve its metrics, and attempts to resize itself to keep the same number of rows and columns. Method System.Int32 Starts the specified command under a newly-allocated control pseudo-terminal. the name of a binary to run the argument list to be passed to a list of environment variables to be added to the environment before starting the name of a directory the command should start in, or if the session should be logged to the lastlog if the session should be logged to the utmp/utmpx log if the session should be logged to the wtmp/wtmpx log the ID of the new process TERM is automatically set to reflect the terminal widget's emulation setting. If lastlog, utmp, or wtmp are , logs the session to the specified system log files. Method System.Boolean Determines if a character is considered to be part of a word a if is considered to be a word character according to the current value of .