DrawTreeViewLineEventArgs.cs 2.0 KB

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