-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathHexViewExtensions.cs
More file actions
34 lines (31 loc) · 1.22 KB
/
Copy pathHexViewExtensions.cs
File metadata and controls
34 lines (31 loc) · 1.22 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
using Terminal.Gui.Views;
namespace TerminalGui.Extensions.Extensions.ViewExtensions;
/// <summary>
/// Extension methods for <see cref="HexView" />.
/// </summary>
public static class HexViewExtensions
{
extension(HexView hexView)
{
/// <summary>
/// Subscribes to the <see cref="HexView.Edited" /> event.
/// </summary>
/// <param name="callback">The callback to invoke with the <see cref="HexViewEditEventArgs" />.</param>
/// <returns>The <see cref="HexView" /> instance.</returns>
public HexView OnEdited(Action<HexViewEditEventArgs> callback)
{
hexView.Edited += (_, e) => callback(e);
return hexView;
}
/// <summary>
/// Subscribes to the <see cref="HexView.PositionChanged" /> event.
/// </summary>
/// <param name="callback">The callback to invoke with the <see cref="HexViewEventArgs" />.</param>
/// <returns>The <see cref="HexView" /> instance.</returns>
public HexView OnPositionChanged(Action<HexViewEventArgs> callback)
{
hexView.PositionChanged += (_, e) => callback(e);
return hexView;
}
}
}