vte-sharpGtk# is thread aware, but not thread safe; See the Gtk# Thread Programming for details.Gtk.WidgetA 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 ();
}
}
ConstructorDefault ConstructorConstructor
a Internal Constructor.This should not be called by normal applications.System.ObsoleteConstructor
a Internal Constructor.This should not be called by normal user code.PropertyGtk.AdjustmentAn accessor function provided for the benefit of language bindings. the contents of terminal's adjustment fieldPropertySystem.BooleanControls 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 textPropertySystem.BooleanControls whether or not the terminal will beep when the child outputs the "bl" sequence.a if the terminal should beepPropertyGdk.PixbufSets a background image for the widget. to use, or to cancelText 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.PropertySystem.StringSets 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.
PropertySystem.DoubleAdjust 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.
PropertyGdk.ColorTo be addeda To be addedPropertySystem.BooleanSets 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 transparencyPropertyVte.TerminalEraseBindingModifies 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 keyPropertySystem.Int64An accessor function provided for the benefit of language bindings. the contents of terminal's char_ascent fieldPropertySystem.Int64An accessor function provided for the benefit of language bindings.the contents of terminal's char_descent fieldPropertySystem.Int64An accessor function provided for the benefit of language bindings. the contents of terminal's char_height fieldEventVte.CharSizeChangedHandlerEmitted whenever selection of a new font causes the values of the char_width or char_height fields to change.GLib.Signal("char-size-changed")PropertySystem.Int64An accessor function provided for the benefit of language bindings.a the contents of terminal's char_width fieldEventSystem.EventHandlerThis signal is emitted when the terminal detects that a child started using has exited.GLib.Signal("child-exited")EventGLib.Signal("copy-clipboard")System.EventHandlerTo be added.To be added.EventGLib.Signal("paste-clipboard")System.EventHandlerTo be added.To be added.PropertyGdk.ColorSets the background color for text which does not have a specific background color assigned. the new background colorOnly has effect when no background image is set and when the terminal is not transparent.PropertyGdk.ColorSets the color used to draw bold text in the default foreground color. the new bold colorPropertyGdk.ColorTo be added.To be added.To be added.PropertyGdk.ColorSets the color used to draw dim text in the default foreground color. the new dim colorPropertyGdk.ColorSets the foreground color used to draw normal text the new foreground colorPropertyGdk.ColorTo be added.To be added.To be added.PropertySystem.Int64An accessor function provided for the benefit of language bindings. the contents of terminal's column_count fieldEventVte.CommitHandlerEmitted 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("commit")EventSystem.EventHandlerEmitted whenever the visible appearance of the terminal has changed.Used primarily by .GLib.Signal("contents-changed")MethodSystem.VoidPlaces the selected text in the terminal in the GDK_SELECTION_CLIPBOARD selection.MethodSystem.VoidPlaces the selected text in the terminal in the GDK_SELECTION_PRIMARY selection.PropertySystem.BooleanSets whether or not the cursor will blink. if the cursor should blinkThe length of the blinking cycle is controlled by the "gtk-cursor-blink-time" GTK+ setting.EventSystem.EventHandlerEmitted whenever the cursor moves to a new character cell.Used primarily by .GLib.Signal("cursor-moved")EventSystem.EventHandlerEmitted when the user hits the '-' key while holding the Control key.GLib.Signal("decrease-font-size")PropertySystem.StringTo be added.To be added.To be added.EventSystem.EventHandlerEmitted at the child application's request.GLib.Signal("deiconify-window")PropertyVte.TerminalEraseBindingModifies 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 keyPropertySystem.StringSets 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 descriptionUnless you are interested in this feature, always use "xterm".EventSystem.EventHandlerEmitted when the terminal emulation type is changed.GLib.Signal("emulation-changed")PropertySystem.StringThe encoding the terminal will expect data from the child to be encoded with. a valid gconv targetFor certain terminal types, applications executing in the terminal can change the encoding. The default encoding is defined by the application's locale settings.EventSystem.EventHandlerEmitted when the terminals encoding type is changed.GLib.Signal("encoding-changed")EventSystem.EventHandlerTo be addedGLib.Signal("eof")MethodSystem.Void
a Interprets as if it were data received from a child process.This can either be used to drive the terminal without a child process, or just to mess with your users.MethodSystem.Void
a Sends a block of UTF-8 text to the child as if it were entered by the user at the keyboard.MethodSystem.Void
To be added.
To be added.To be added.PropertyPango.FontDescriptionThe 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.PropertySystem.StringA convenience function which converts name into a PangoFontDescription and passes it to . A string describing the font.MethodSystem.Int32
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
Starts the specified command under a newly-allocated control pseudo-terminal. the ID of the new processTERM 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.MethodSystem.Void
long which will hold the column
long which will hold the row
Reads the location of the insertion cursor and returns it.The row coordinate is absolute.MethodSystem.Void
a in which to store left/right-edge padding
a in which to store top/bottom-edge ypadding
Determines the amount of additional space the widget is using to pad the edges of its visible area.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.MethodSystem.String
a callback
user data to be passed to the callback
location for storing text attributes
Extracts a view of the visible part of the terminal.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.MethodSystem.String
To be added.
To be added.
To be added.
To be added.To be added.To be added.MethodSystem.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
Extracts a view of the visible part of the string.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.PropertyGLib.GTypeGType Property.a Returns the native value for .PropertySystem.BooleanChecks 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.EventSystem.EventHandlerEmitted at the child application's request.GLib.Signal("iconify-window")PropertySystem.StringAn accessor function provided for the benefit of language bindings. the contents of terminal's icon_title fieldEventSystem.EventHandlerEmitted when the terminal's icon_title field is modified.GLib.Signal("icon-title-changed")MethodSystem.Void
a Appends menu items for various input methods to the given menu.The user can select one of these items to modify the input method used by the terminal.EventSystem.EventHandlerEmitted when the user hits the '+' key while holding the Control key.GLib.Signal("increase-font-size")MethodSystem.Boolean
a Determines if a character is considered to be part of a word if is considered to be a word character according to the current value of .EventSystem.EventHandlerEmitted at the child application's request.GLib.Signal("lower-window")MethodSystem.Int32
a regular expression
Adds a regular expression to the list of matching expressions. an integer associated with this expressionWhen the user moves the mouse cursor over a section of displayed text which matches this expression, the text will be highlighted.MethodSystem.String
the text column
the text row
pointer to an integer
Checks if the text in and around the specified position matches any of the regular expressions previously set using . a string which matches one of the previously set regular expressionsIf 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.MethodSystem.VoidClears the list of regular expressions the terminal uses to highlight text when the user moves the mouse cursor.MethodSystem.Void
the tag of the regex to remove
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.MethodSystem.Void
a
a To be addedTo be addedMethodSystem.Void
a
a To be addedTo be addedEventSystem.EventHandlerEmitted at the child application's request.GLib.Signal("maximize-window")PropertySystem.BooleanThe value of the terminal's mouse autohide setting. if the autohide should be enabledWhen autohiding is enabled, the mouse cursor will be hidden when the user presses a key and shown when the user moves the mouse.EventVte.MoveWindowHandlerEmitted at the child application's request.GLib.Signal("move-window")MethodSystem.Void
a
a Default handler for the event.Override this method in a subclass to provide a default handler for the event.GLib.DefaultSignalHandler(ConnectionMethod="OverrideCharSizeChanged", Type=typeof(Vte.Terminal))MethodSystem.VoidDefault handler for the event.Override this method in a subclass to provide a default handler for the event.GLib.DefaultSignalHandler(ConnectionMethod="OverrideChildExited", Type=typeof(Vte.Terminal))MethodSystem.VoidTo be added.To be added.GLib.DefaultSignalHandler(ConnectionMethod="OverrideClipboardCopied", Type=typeof(Vte.Terminal))MethodSystem.VoidTo be added.To be added.GLib.DefaultSignalHandler(ConnectionMethod="OverrideClipboardPasted", Type=typeof(Vte.Terminal))MethodSystem.Void
a Representing the input data to commit. This can be a single character or a string.
a The length of P0.
Default handler for the event.Override this method in a subclass to provide a default handler for the event.
P0 can contain control characters. Every key the user presses will emmit a commit signal. About the only thing that will send a sring in P0 will be if the users pasts in some text. Also you must call the parent or base class OnCommit or things will get ugly.GLib.DefaultSignalHandler(ConnectionMethod="OverrideCommit", Type=typeof(Vte.Terminal))MethodSystem.VoidDefault handler for the event.Override this method in a subclass to provide a default handler for the event.GLib.DefaultSignalHandler(ConnectionMethod="OverrideContentsChanged", Type=typeof(Vte.Terminal))MethodSystem.VoidDefault handler for the event.Override this method in a subclass to provide a default handler for the event.GLib.DefaultSignalHandler(ConnectionMethod="OverrideCursorMoved", Type=typeof(Vte.Terminal))MethodSystem.VoidDefault handler for the event.Override this method in a subclass to provide a default handler for the event.GLib.DefaultSignalHandler(ConnectionMethod="OverrideDecreaseFontSize", Type=typeof(Vte.Terminal))MethodSystem.VoidDefault handler for the event.Override this method in a subclass to provide a default handler for the event.GLib.DefaultSignalHandler(ConnectionMethod="OverrideDeiconifyWindow", Type=typeof(Vte.Terminal))MethodSystem.VoidDefault handler for the event.Override this method in a subclass to provide a default handler for the event.GLib.DefaultSignalHandler(ConnectionMethod="OverrideEmulationChanged", Type=typeof(Vte.Terminal))MethodSystem.VoidDefault handler for the event.Override this method in a subclass to provide a default handler for the event.GLib.DefaultSignalHandler(ConnectionMethod="OverrideEncodingChanged", Type=typeof(Vte.Terminal))MethodSystem.VoidDefault handler for the event.Override this method in a subclass to provide a default handler for the event.GLib.DefaultSignalHandler(ConnectionMethod="OverrideEof", Type=typeof(Vte.Terminal))MethodSystem.VoidDefault handler for the event.Override this method in a subclass to provide a default handler for the event.GLib.DefaultSignalHandler(ConnectionMethod="OverrideIconifyWindow", Type=typeof(Vte.Terminal))MethodSystem.VoidDefault handler for the event.Override this method in a subclass to provide a default handler for the event.GLib.DefaultSignalHandler(ConnectionMethod="OverrideIconTitleChanged", Type=typeof(Vte.Terminal))MethodSystem.VoidDefault handler for the event.Override this method in a subclass to provide a default handler for the event.GLib.DefaultSignalHandler(ConnectionMethod="OverrideIncreaseFontSize", Type=typeof(Vte.Terminal))MethodSystem.VoidDefault handler for the event.Override this method in a subclass to provide a default handler for the event.GLib.DefaultSignalHandler(ConnectionMethod="OverrideLowerWindow", Type=typeof(Vte.Terminal))MethodSystem.VoidDefault handler for the event.Override this method in a subclass to provide a default handler for the event.GLib.DefaultSignalHandler(ConnectionMethod="OverrideMaximizeWindow", Type=typeof(Vte.Terminal))MethodSystem.Void
a
a Default handler for the event.Override this method in a subclass to provide a default handler for the event.GLib.DefaultSignalHandler(ConnectionMethod="OverrideMoveWindow", Type=typeof(Vte.Terminal))MethodSystem.VoidDefault handler for the event.Override this method in a subclass to provide a default handler for the event.GLib.DefaultSignalHandler(ConnectionMethod="OverrideRaiseWindow", Type=typeof(Vte.Terminal))MethodSystem.VoidDefault handler for the event.Override this method in a subclass to provide a default handler for the event.GLib.DefaultSignalHandler(ConnectionMethod="OverrideRefreshWindow", Type=typeof(Vte.Terminal))MethodSystem.Void
a
a Default handler for the event.Override this method in a subclass to provide a default handler for the event.GLib.DefaultSignalHandler(ConnectionMethod="OverrideResizeWindow", Type=typeof(Vte.Terminal))MethodSystem.VoidDefault handler for the event.Override this method in a subclass to provide a default handler for the event.GLib.DefaultSignalHandler(ConnectionMethod="OverrideRestoreWindow", Type=typeof(Vte.Terminal))MethodSystem.VoidDefault handler for the event.Override this method in a subclass to provide a default handler for the event.GLib.DefaultSignalHandler(ConnectionMethod="OverrideSelectionChanged", Type=typeof(Vte.Terminal))MethodSystem.VoidDefault handler for the event.Override this method in a subclass to provide a default handler for the event.GLib.DefaultSignalHandler(ConnectionMethod="OverrideStatusLineChanged", Type=typeof(Vte.Terminal))MethodSystem.VoidDefault handler for the event.Override this method in a subclass to provide a default handler for the event.GLib.DefaultSignalHandler(ConnectionMethod="OverrideTextDeleted", Type=typeof(Vte.Terminal))MethodSystem.VoidDefault handler for the event.Override this method in a subclass to provide a default handler for the event.GLib.DefaultSignalHandler(ConnectionMethod="OverrideTextInserted", Type=typeof(Vte.Terminal))MethodSystem.VoidDefault handler for the event.Override this method in a subclass to provide a default handler for the event.GLib.DefaultSignalHandler(ConnectionMethod="OverrideTextModified", Type=typeof(Vte.Terminal))MethodSystem.Void
a Default handler for the event.Override this method in a subclass to provide a default handler for the event.GLib.DefaultSignalHandler(ConnectionMethod="OverrideTextScrolled", Type=typeof(Vte.Terminal))MethodSystem.VoidDefault handler for the event.Override this method in a subclass to provide a default handler for the event.GLib.DefaultSignalHandler(ConnectionMethod="OverrideWindowTitleChanged", Type=typeof(Vte.Terminal))PropertySystem.UInt16To be added.To be added.To be added.MethodSystem.VoidSends 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.MethodSystem.VoidSends 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.PropertySystem.Int32To be added.To be added.To be added.EventSystem.EventHandlerEmitted at the child application's request.GLib.Signal("raise-window")EventSystem.EventHandlerEmitted at the child application's request.GLib.Signal("refresh-window")MethodSystem.Void to reset tabstops
to empty the terminal's scrollback buffer
Resets as much of the terminal's internal state as possible.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.EventVte.ResizeWindowHandlerEmitted at the child application's request.GLib.Signal("resize-window")EventSystem.EventHandlerEmitted at the child application's request.GLib.Signal("restore-window")PropertySystem.Int64An accessor function provided for the benefit of language bindings. the contents of terminal's row_count fieldPropertySystem.BooleanTo be addeda To be addedPropertySystem.Int64Sets the length of the scrollback buffer used by the terminal.the length of the history bufferThe 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.PropertySystem.BooleanControls 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 keystrokesModifier keys do not trigger this behavior.PropertySystem.BooleanControls 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 outputMethodSystem.VoidTo be added.To be added.EventSystem.EventHandlerEmitted whenever the contents of terminal's selection changes.GLib.Signal("selection-changed")MethodSystem.VoidTo be added.To be added.MethodSystem.Void
the new foreground color, or
the new background color, or
the color palette
the number of entries in Change the colors of the
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.
MethodSystem.VoidReset the terminal palette to reasonable compiled-in defaults.MethodSystem.Void
To be added.
To be added.
To be added.To be added.MethodSystem.Void
To be added.
To be added.
To be added.To be added.MethodSystem.Void
the desired number of columns
the desired number of rows
Attempts to change the terminal's size in terms of rows and columns.If the attempt succeeds, the widget will resize itself to the proper size.PropertySystem.StringSome 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.EventSystem.EventHandlerEmitted whenever the contents of the status line are modified or cleared.GLib.Signal("status-line-changed")EventSystem.EventHandlerAn internal signal used for communication between the terminal and its accessibility peer.May not be emitted under certain circumstances.GLib.Signal("text-deleted")EventSystem.EventHandlerAn internal signal used for communication between the terminal and its accessibility peer.May not be emitted under certain circumstances.GLib.Signal("text-inserted")EventSystem.EventHandlerAn internal signal used for communication between the terminal and its accessibility peer.May not be emitted under certain circumstances.GLib.Signal("text-modified")EventVte.TextScrolledHandlerAn internal signal used for communication between the terminal and its accessibility peer.May not be emitted under certain circumstances.GLib.Signal("text-scrolled")PropertySystem.BooleanWhether 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.PropertySystem.BooleanControls 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 notThe terminal will clear itself to the default foreground color and then repaint itself.PropertySystem.StringAn accessor function provided for the benefit of language bindings. the contents of terminal's window_title field the contents of terminal's window_title fieldEventSystem.EventHandlerEmitted when the terminal's window_title field is modified.GLib.Signal("window-title-changed")PropertySystem.StringWhen the user double-clicks to start selection, the terminal will extend the selection on word boundaries. a specificationWhen 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.