FileDialogRootTreeNode.cs 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. using System.Collections.Generic;
  2. using System.IO;
  3. namespace Terminal.Gui {
  4. /// <summary>
  5. /// Delegate for providing an implementation that returns all <see cref="FileDialogRootTreeNode"/>
  6. /// that should be shown in a <see cref="FileDialog"/> (in the collapse-able tree area of the dialog).
  7. /// </summary>
  8. /// <returns></returns>
  9. public delegate IEnumerable<FileDialogRootTreeNode> FileDialogTreeRootGetter ();
  10. /// <summary>
  11. /// Describes a top level directory that should be offered to the user in the
  12. /// tree view section of a <see cref="FileDialog"/>. For example "Desktop",
  13. /// "Downloads", "Documents" etc.
  14. /// </summary>
  15. public class FileDialogRootTreeNode {
  16. /// <summary>
  17. /// Creates a new instance of the <see cref="FileDialogRootTreeNode"/> class
  18. /// </summary>
  19. /// <param name="displayName"></param>
  20. /// <param name="path"></param>
  21. public FileDialogRootTreeNode (string displayName, DirectoryInfo path)
  22. {
  23. this.DisplayName = displayName;
  24. this.Path = path;
  25. }
  26. /// <summary>
  27. /// Gets the text that should be displayed in the tree for this item.
  28. /// </summary>
  29. public string DisplayName { get; }
  30. /// <summary>
  31. /// Gets the path that should be shown/explored when selecting this node
  32. /// of the tree.
  33. /// </summary>
  34. public DirectoryInfo Path { get; }
  35. /// <summary>
  36. /// Returns a string representation of this instance (<see cref="DisplayName"/>).
  37. /// </summary>
  38. /// <returns></returns>
  39. public override string ToString ()
  40. {
  41. return this.DisplayName;
  42. }
  43. }
  44. }