Application.Toplevel.cs 842 B

12345678910111213141516171819202122232425262728
  1. #nullable enable
  2. using System.Collections.Concurrent;
  3. namespace Terminal.Gui.App;
  4. public static partial class Application // Toplevel handling
  5. {
  6. // BUGBUG: Technically, this is not the full lst of TopLevels. There be dragons here, e.g. see how Toplevel.Id is used. What
  7. private static readonly ConcurrentStack<Toplevel> _topLevels = new ();
  8. private static readonly object _topLevelsLock = new ();
  9. /// <summary>Holds the stack of TopLevel views.</summary>
  10. internal static ConcurrentStack<Toplevel> TopLevels
  11. {
  12. get
  13. {
  14. lock (_topLevelsLock)
  15. {
  16. return _topLevels;
  17. }
  18. }
  19. }
  20. /// <summary>The <see cref="Toplevel"/> that is currently active.</summary>
  21. /// <value>The top.</value>
  22. public static Toplevel? Top { get; internal set; }
  23. }