HexViewEventArgs.cs 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. //
  2. // HexView.cs: A hexadecimal viewer
  3. //
  4. // TODO:
  5. // - Support searching and highlighting of the search result
  6. // - Bug showing the last line
  7. //
  8. namespace Terminal.Gui;
  9. /// <summary>Defines the event arguments for <see cref="HexView.PositionChanged"/> event.</summary>
  10. public class HexViewEventArgs : EventArgs
  11. {
  12. /// <summary>Initializes a new instance of <see cref="HexViewEventArgs"/></summary>
  13. /// <param name="pos">The character position.</param>
  14. /// <param name="cursor">The cursor position.</param>
  15. /// <param name="lineLength">Line bytes length.</param>
  16. public HexViewEventArgs (long pos, Point cursor, int lineLength)
  17. {
  18. Position = pos;
  19. CursorPosition = cursor;
  20. BytesPerLine = lineLength;
  21. }
  22. /// <summary>The bytes length per line.</summary>
  23. public int BytesPerLine { get; private set; }
  24. /// <summary>Gets the current cursor position starting at one for both, line and column.</summary>
  25. public Point CursorPosition { get; private set; }
  26. /// <summary>Gets the current character position starting at one, related to the <see cref="Stream"/>.</summary>
  27. public long Position { get; private set; }
  28. }
  29. /// <summary>Defines the event arguments for <see cref="HexView.Edited"/> event.</summary>
  30. public class HexViewEditEventArgs : EventArgs
  31. {
  32. /// <summary>Creates a new instance of the <see cref="HexViewEditEventArgs"/> class.</summary>
  33. /// <param name="position"></param>
  34. /// <param name="newValue"></param>
  35. public HexViewEditEventArgs (long position, byte newValue)
  36. {
  37. Position = position;
  38. NewValue = newValue;
  39. }
  40. /// <summary>Gets the new value for that <see cref="Position"/>.</summary>
  41. public byte NewValue { get; }
  42. /// <summary>Gets the location of the edit.</summary>
  43. public long Position { get; }
  44. }