2004-01-17 22:47:35 +00:00
|
|
|
using System;
|
|
|
|
using Gtk;
|
|
|
|
using Gnome;
|
|
|
|
using Vte;
|
|
|
|
|
|
|
|
class T
|
|
|
|
{
|
|
|
|
static void Main (string[] args)
|
|
|
|
{
|
|
|
|
new T (args);
|
|
|
|
}
|
|
|
|
|
|
|
|
T (string[] args)
|
|
|
|
{
|
2004-04-04 21:18:56 +00:00
|
|
|
Program program = new Program ("vte-sharp-test", "0.0", Modules.UI, args);
|
|
|
|
App app = new App ("vte-sharp-test", "Test for vte widget");
|
2004-01-17 22:47:35 +00:00
|
|
|
app.SetDefaultSize (600, 450);
|
|
|
|
app.DeleteEvent += new DeleteEventHandler (OnAppDelete);
|
|
|
|
|
|
|
|
ScrolledWindow sw = new ScrolledWindow ();
|
|
|
|
Terminal term = new Terminal ();
|
2004-01-29 01:08:46 +00:00
|
|
|
term.EncodingChanged += new EventHandler (OnEncodingChanged);
|
2004-01-17 22:47:35 +00:00
|
|
|
term.CursorBlinks = true;
|
2004-01-18 00:54:08 +00:00
|
|
|
term.MouseAutohide = true;
|
|
|
|
term.ScrollOnKeystroke = true;
|
2004-01-29 01:08:46 +00:00
|
|
|
term.DeleteBinding = TerminalEraseBinding.Auto;
|
2004-04-04 21:18:56 +00:00
|
|
|
term.BackspaceBinding = TerminalEraseBinding.Auto;
|
2004-01-17 22:47:35 +00:00
|
|
|
term.Encoding = "UTF-8";
|
2004-04-04 21:18:56 +00:00
|
|
|
term.FontFromString = "Monospace 12";
|
2004-01-29 01:08:46 +00:00
|
|
|
term.TextDeleted += new EventHandler (OnTextDeleted);
|
2004-04-04 21:18:56 +00:00
|
|
|
term.ChildExited += new EventHandler (OnChildExited);
|
2004-01-29 01:08:46 +00:00
|
|
|
|
|
|
|
Gdk.Color white = new Gdk.Color ();
|
|
|
|
Gdk.Color.Parse ("white", ref white);
|
2004-04-04 21:18:56 +00:00
|
|
|
// FIXME: following line is broken
|
|
|
|
//term.ColorBackground = white;
|
|
|
|
|
|
|
|
Gdk.Color black = new Gdk.Color ();
|
|
|
|
Gdk.Color.Parse ("black", ref black);
|
|
|
|
// FIXME: following line is broken
|
|
|
|
//term.ColorForeground = black;
|
|
|
|
term.SetColors (black, white, white, 16);
|
2004-01-17 22:47:35 +00:00
|
|
|
|
|
|
|
Console.WriteLine (term.UsingXft);
|
|
|
|
Console.WriteLine (term.Encoding);
|
|
|
|
Console.WriteLine (term.StatusLine);
|
2004-01-18 00:54:08 +00:00
|
|
|
|
2004-04-04 21:18:56 +00:00
|
|
|
string[] argv = Environment.GetCommandLineArgs ();
|
2004-01-18 00:54:08 +00:00
|
|
|
|
2004-04-04 21:18:56 +00:00
|
|
|
string[] envv = new string[] {""};
|
2004-01-18 00:54:08 +00:00
|
|
|
// FIXME: send the env vars to ForkCommand
|
|
|
|
Console.WriteLine (Environment.GetEnvironmentVariables ().Count);
|
2004-01-29 01:08:46 +00:00
|
|
|
Console.WriteLine (Environment.CurrentDirectory);
|
2004-01-18 00:54:08 +00:00
|
|
|
|
2004-04-04 21:18:56 +00:00
|
|
|
int pid = term.ForkCommand ("/bin/bash", argv, envv, Environment.CurrentDirectory, false, true, true);
|
|
|
|
Console.WriteLine ("Child pid: " + pid);
|
2004-01-18 22:10:03 +00:00
|
|
|
|
2004-01-17 22:47:35 +00:00
|
|
|
sw.AddWithViewport (term);
|
|
|
|
|
|
|
|
app.Contents = sw;
|
|
|
|
app.ShowAll ();
|
|
|
|
program.Run ();
|
|
|
|
}
|
2004-01-29 01:08:46 +00:00
|
|
|
|
|
|
|
private void OnTextDeleted (object o, EventArgs args)
|
|
|
|
{
|
|
|
|
Console.WriteLine ("text deleted");
|
|
|
|
}
|
|
|
|
|
|
|
|
private void OnEncodingChanged (object o, EventArgs args)
|
|
|
|
{
|
|
|
|
Console.WriteLine ("encoding changed");
|
|
|
|
}
|
2004-01-17 22:47:35 +00:00
|
|
|
|
|
|
|
private void OnTextInserted (object o, EventArgs args)
|
|
|
|
{
|
2004-04-04 21:18:56 +00:00
|
|
|
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 ();
|
2004-01-17 22:47:35 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
private void OnAppDelete (object o, DeleteEventArgs args)
|
|
|
|
{
|
2004-04-04 21:18:56 +00:00
|
|
|
Application.Quit ();
|
2004-01-17 22:47:35 +00:00
|
|
|
}
|
|
|
|
}
|