Application.cs 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. using System;
  2. using System.Collections.Generic;
  3. namespace Terminal {
  4. public struct Rect {
  5. public int X, Y, Width, Height;
  6. public Rect (int x, int y, int width, int height)
  7. {
  8. X = x;
  9. Y = y;
  10. Width = width;
  11. Height = height;
  12. }
  13. public override string ToString() => $"[{X},{Y}:{Width},{Height}]";
  14. }
  15. public class View {
  16. public static ConsoleDriver Driver = Application.Driver;
  17. View [] subviews;
  18. public View [] Subviews => subviews == null ? Array.Empty<View> () : subviews;
  19. Rect frame;
  20. public View (Rect frame)
  21. {
  22. this.frame = frame;
  23. }
  24. }
  25. public class Window : View {
  26. public Window (Rect frame) : base (frame)
  27. {
  28. }
  29. public static Window Toplevel ()
  30. {
  31. return new Window (new Rect (0, 0, Driver.Cols, Driver.Rows));
  32. }
  33. }
  34. public class Application {
  35. public static ConsoleDriver Driver = new CursesDriver ();
  36. public void Init ()
  37. {
  38. }
  39. }
  40. }