commit 28afe26ba22aafd128f0f53c3322993c02291aab Author: Miguel de Icaza Date: Sun Dec 10 22:24:13 2017 -0500 First commit diff --git a/.gitignore b/.gitignore new file mode 100644 index 000000000..1746e3269 --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +bin +obj diff --git a/Application.cs b/Application.cs new file mode 100644 index 000000000..b200552e9 --- /dev/null +++ b/Application.cs @@ -0,0 +1,51 @@ +using System; +using System.Collections.Generic; + +namespace Terminal { + public struct Rect { + public int X, Y, Width, Height; + + public Rect (int x, int y, int width, int height) + { + X = x; + Y = y; + Width = width; + Height = height; + } + + public override string ToString() => $"[{X},{Y}:{Width},{Height}]"; + } + + public class View { + public static ConsoleDriver Driver = Application.Driver; + View [] subviews; + public View [] Subviews => subviews == null ? Array.Empty () : subviews; + + Rect frame; + + public View (Rect frame) + { + this.frame = frame; + } + } + + public class Window : View { + public Window (Rect frame) : base (frame) + { + } + + public static Window Toplevel () + { + return new Window (new Rect (0, 0, Driver.Cols, Driver.Rows)); + } + } + + public class Application { + public static ConsoleDriver Driver = new CursesDriver (); + + public void Init () + { + + } + } +} \ No newline at end of file diff --git a/Terminal.csproj b/Terminal.csproj new file mode 100644 index 000000000..e8015c55e --- /dev/null +++ b/Terminal.csproj @@ -0,0 +1,44 @@ + + + + Debug + x86 + {B0A602CD-E176-449D-8663-64238D54F857} + Exe + Terminal + Terminal + v4.6.1 + + + true + full + false + bin\Debug + DEBUG; + prompt + 4 + true + x86 + + + true + bin\Release + prompt + 4 + true + x86 + + + + + + + + + + + ../mono-curses/mono-curses.dll + + + + diff --git a/driver.cs b/driver.cs new file mode 100644 index 000000000..89dc9f84e --- /dev/null +++ b/driver.cs @@ -0,0 +1,16 @@ +using System; +using System.Collections.Generic; +using Mono.Terminal; + +namespace Terminal { + + public abstract class ConsoleDriver { + public virtual int Cols {get;} + public virtual int Rows {get;} + } + + public class CursesDriver : ConsoleDriver { + public override int Cols => Curses.Cols; + public override int Rows => Curses.Lines; + } +} \ No newline at end of file