demo.cs 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  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. new Label (3, 18, "Press ESC and 9 to activate the menubar")
  22. );
  23. }
  24. static void Main ()
  25. {
  26. Application.Init ();
  27. var top = Application.Top;
  28. var tframe = top.Frame;
  29. var win = new Window (new Rect (0, 1, tframe.Width, tframe.Height-1), "Hello");
  30. var menu = new MenuBar (new MenuBarItem [] {
  31. new MenuBarItem ("_File", new MenuItem [] {
  32. new MenuItem ("_New", "Creates new file", null),
  33. new MenuItem ("_Open", "", null),
  34. new MenuItem ("_Close", "", null),
  35. new MenuItem ("_Quit", "", null)
  36. }),
  37. new MenuBarItem ("_Edit", new MenuItem [] {
  38. new MenuItem ("_Copy", "", null),
  39. new MenuItem ("C_ut", "", null),
  40. new MenuItem ("_Paste", "", null)
  41. })
  42. });
  43. ShowEntries (win);
  44. // ShowTextAlignments (win);
  45. top.Add (win);
  46. top.Add (menu);
  47. Application.Run ();
  48. }
  49. }