demo.cs 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. using Terminal;
  2. class Demo {
  3. static void ShowTextAlignments (View container)
  4. {
  5. container.Add (
  6. new Label (new Rect (0, 0, 40, 3), "1-Hello world, how are you doing today") { TextAlignment = TextAlignment.Left },
  7. new Label (new Rect (0, 4, 40, 3), "2-Hello world, how are you doing today") { TextAlignment = TextAlignment.Right },
  8. new Label (new Rect (0, 8, 40, 3), "3-Hello world, how are you doing today") { TextAlignment = TextAlignment.Centered },
  9. new Label (new Rect (0, 12, 40, 3), "4-Hello world, how are you doing today") { TextAlignment = TextAlignment.Justified });
  10. }
  11. static void ShowEntries (View container)
  12. {
  13. container.Add (
  14. new Label (3, 2, "Login: "),
  15. new TextField (14, 2, 40, ""),
  16. new Label (3, 4, "Password: "),
  17. new TextField (14, 4, 40, "") { Secret = true },
  18. new CheckBox (3, 6, "Remember me"),
  19. new Button (3, 8, "Ok"),
  20. new Button (10, 8, "Cancel")
  21. );
  22. }
  23. static void Main ()
  24. {
  25. Application.Init ();
  26. var top = Application.Top;
  27. var tframe = top.Frame;
  28. var win = new Window (new Rect (0, 1, tframe.Width, tframe.Height-1), "Hello");
  29. var menu = new MenuBar (new MenuBarItem [] {
  30. new MenuBarItem ("File", new MenuItem [] {
  31. new MenuItem ("New", "", null),
  32. new MenuItem ("Open", "", null),
  33. new MenuItem ("Close", "", null),
  34. new MenuItem ("Quit", "", null)
  35. }),
  36. new MenuBarItem ("Edit", new MenuItem [] {
  37. new MenuItem ("Copy", "", null),
  38. new MenuItem ("Cut", "", null),
  39. new MenuItem ("Paste", "", null)
  40. })
  41. });
  42. ShowEntries (win);
  43. // ShowTextAlignments (win);
  44. top.Add (win);
  45. top.Add (menu);
  46. Application.Run ();
  47. }
  48. }