DrawTreeViewLineEventArgs.cs 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. // This code is based on http://objectlistview.sourceforge.net (GPLv3 tree/list controls
  2. // by [email protected]). Phillip has explicitly granted permission for his design
  3. // and code to be used in this library under the MIT license.
  4. using System.Collections.Generic;
  5. namespace Terminal.Gui {
  6. /// <summary>
  7. /// Event args for the <see cref="TreeView{T}.DrawLine"/> event
  8. /// </summary>
  9. /// <typeparam name="T"></typeparam>
  10. public class DrawTreeViewLineEventArgs<T> where T : class {
  11. /// <summary>
  12. /// The object at this line in the tree
  13. /// </summary>
  14. public T Model { get; init; }
  15. /// <summary>
  16. /// The <see cref="TreeView{T}"/> that is performing the
  17. /// rendering.
  18. /// </summary>
  19. public TreeView<T> Tree { get; init; }
  20. /// <summary>
  21. /// The line within tree view bounds that is being rendered
  22. /// </summary>
  23. public int Y { get; init; }
  24. /// <summary>
  25. /// Set to true to cancel drawing (e.g. if you have already manually
  26. /// drawn content).
  27. /// </summary>
  28. public bool Handled { get; set; }
  29. /// <summary>
  30. /// The rune and color of each symbol that will be rendered. Note
  31. /// that only <see cref="ColorScheme.Normal"/> is respected. You
  32. /// can modify these to change what is rendered.
  33. /// </summary>
  34. /// <remarks>
  35. /// Changing the length of this collection may result in corrupt rendering
  36. /// </remarks>
  37. public List<RuneCell> RuneCells { get; init; }
  38. /// <summary>
  39. /// The notional index in <see cref="RuneCells"/> which contains the first
  40. /// character of the <see cref="TreeView{T}.AspectGetter"/> text (i.e.
  41. /// after all branch lines and expansion/collapse sybmols).
  42. /// </summary>
  43. /// <remarks>
  44. /// May be negative or outside of bounds of <see cref="RuneCells"/> if the view
  45. /// has been scrolled horizontally.
  46. /// </remarks>
  47. public int IndexOfModelText { get; init; }
  48. /// <summary>
  49. /// If line contains a branch that can be expanded/collapsed then this is
  50. /// the index in <see cref="RuneCells"/> at which the symbol is (or null for
  51. /// leaf elements).
  52. /// </summary>
  53. public int? IndexOfExpandCollapseSymbol { get; init; }
  54. }
  55. }