IClipboard.cs 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. using System;
  2. namespace Terminal.Gui {
  3. /// <summary>
  4. /// Definition to interact with the OS clipboard.
  5. /// </summary>
  6. public interface IClipboard {
  7. /// <summary>
  8. /// Returns true if the environmental dependencies are in place to interact with the OS clipboard.
  9. /// </summary>
  10. bool IsSupported { get; }
  11. /// <summary>
  12. /// Get the operation system clipboard.
  13. /// </summary>
  14. /// <exception cref="NotSupportedException">Thrown if it was not possible to read the clipboard contents.</exception>
  15. string GetClipboardData ();
  16. /// <summary>
  17. /// Gets the operation system clipboard if possible.
  18. /// </summary>
  19. /// <param name="result">Clipboard contents read</param>
  20. /// <returns>true if it was possible to read the OS clipboard.</returns>
  21. bool TryGetClipboardData (out string result);
  22. /// <summary>
  23. /// Sets the operation system clipboard.
  24. /// </summary>
  25. /// <param name="text"></param>
  26. /// <exception cref="NotSupportedException">Thrown if it was not possible to set the clipboard contents.</exception>
  27. void SetClipboardData (string text);
  28. /// <summary>
  29. /// Sets the operation system clipboard if possible.
  30. /// </summary>
  31. /// <param name="text"></param>
  32. /// <returns>True if the clipboard content was set successfully.</returns>
  33. bool TrySetClipboardData (string text);
  34. }
  35. }