DrawTreeViewLineEventArgs.cs 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  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. namespace Terminal.Gui;
  5. /// <summary>Event args for the <see cref="TreeView{T}.DrawLine"/> event</summary>
  6. /// <typeparam name="T"></typeparam>
  7. public class DrawTreeViewLineEventArgs<T> where T : class
  8. {
  9. /// <summary>Set to true to cancel drawing (e.g. if you have already manually drawn content).</summary>
  10. public bool Handled { get; set; }
  11. /// <summary>
  12. /// If line contains a branch that can be expanded/collapsed then this is the index in <see cref="RuneCells"/> at
  13. /// which the symbol is (or null for leaf elements).
  14. /// </summary>
  15. public int? IndexOfExpandCollapseSymbol { get; init; }
  16. /// <summary>
  17. /// The notional index in <see cref="RuneCells"/> which contains the first character of the
  18. /// <see cref="TreeView{T}.AspectGetter"/> text (i.e. after all branch lines and expansion/collapse symbols).
  19. /// </summary>
  20. /// <remarks>May be negative or outside of bounds of <see cref="RuneCells"/> if the view has been scrolled horizontally.</remarks>
  21. public int IndexOfModelText { get; init; }
  22. /// <summary>The object at this line in the tree</summary>
  23. public T Model { get; init; }
  24. /// <summary>
  25. /// The rune and color of each symbol that will be rendered. Note that only <see cref="ColorScheme.Normal"/> is
  26. /// respected. You can modify these to change what is rendered.
  27. /// </summary>
  28. /// <remarks>Changing the length of this collection may result in corrupt rendering</remarks>
  29. public List<RuneCell> RuneCells { get; init; }
  30. /// <summary>The <see cref="TreeView{T}"/> that is performing the rendering.</summary>
  31. public TreeView<T> Tree { get; init; }
  32. /// <summary>The line within tree view bounds that is being rendered</summary>
  33. public int Y { get; init; }
  34. }