Tab.cs 972 B

123456789101112131415161718192021222324252627282930313233343536
  1. #nullable enable
  2. using System.Net.Security;
  3. namespace Terminal.Gui;
  4. /// <summary>A single tab in a <see cref="TabView"/>.</summary>
  5. public class Tab : View
  6. {
  7. private string? _displayText;
  8. /// <summary>Creates a new unnamed tab with no controls inside.</summary>
  9. public Tab ()
  10. {
  11. BorderStyle = LineStyle.Rounded;
  12. CanFocus = true;
  13. TabStop = TabBehavior.TabStop;
  14. Width = Dim.Auto (DimAutoStyle.Text);
  15. SuperViewRendersLineCanvas = true;
  16. }
  17. /// <summary>The text to display in a <see cref="TabView"/>.</summary>
  18. /// <value></value>
  19. public string DisplayText
  20. {
  21. get => _displayText ?? "Unnamed";
  22. set
  23. {
  24. _displayText = value;
  25. SetNeedsDraw ();
  26. }
  27. }
  28. /// <summary>The View that will be made visible in the <see cref="TabView"/> content area when the tab is selected.</summary>
  29. /// <value></value>
  30. public View? View { get; set; }
  31. }