Margin.cs 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. namespace Terminal.Gui;
  2. /// <summary>The Margin for a <see cref="View"/>.</summary>
  3. /// <remarks>
  4. /// <para>See the <see cref="Adornment"/> class.</para>
  5. /// </remarks>
  6. public class Margin : Adornment
  7. {
  8. /// <inheritdoc/>
  9. public Margin ()
  10. { /* Do nothing; A parameter-less constructor is required to support all views unit tests. */
  11. }
  12. /// <inheritdoc/>
  13. public Margin (View parent) : base (parent)
  14. {
  15. /* Do nothing; View.CreateAdornment requires a constructor that takes a parent */
  16. }
  17. /// <summary>
  18. /// The color scheme for the Margin. If set to <see langword="null"/>, gets the <see cref="Adornment.Parent"/>'s
  19. /// <see cref="View.SuperView"/> scheme. color scheme.
  20. /// </summary>
  21. public override ColorScheme ColorScheme
  22. {
  23. get
  24. {
  25. if (base.ColorScheme is { })
  26. {
  27. return base.ColorScheme;
  28. }
  29. return Parent?.SuperView?.ColorScheme ?? Colors.ColorSchemes ["TopLevel"];
  30. }
  31. set
  32. {
  33. base.ColorScheme = value;
  34. Parent?.SetNeedsDisplay ();
  35. }
  36. }
  37. }