-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTabViewExtensions.cs
More file actions
34 lines (31 loc) · 1.26 KB
/
Copy pathTabViewExtensions.cs
File metadata and controls
34 lines (31 loc) · 1.26 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="TabView" />.
/// </summary>
public static class TabViewExtensions
{
extension(TabView tabView)
{
/// <summary>
/// Subscribes to the <see cref="TabView.SelectedTabChanged" /> event.
/// </summary>
/// <param name="callback">The callback to invoke with the <see cref="TabChangedEventArgs" /> containing old and new tabs.</param>
/// <returns>The <see cref="TabView" /> instance.</returns>
public TabView OnSelectedTabChanged(Action<TabChangedEventArgs> callback)
{
tabView.SelectedTabChanged += (_, e) => callback(e);
return tabView;
}
/// <summary>
/// Subscribes to the <see cref="TabView.TabClicked" /> event.
/// </summary>
/// <param name="callback">The callback to invoke with the <see cref="TabMouseEventArgs" />.</param>
/// <returns>The <see cref="TabView" /> instance.</returns>
public TabView OnTabClicked(Action<TabMouseEventArgs> callback)
{
tabView.TabClicked += (_, e) => callback(e);
return tabView;
}
}
}