-
Notifications
You must be signed in to change notification settings - Fork 0
/
DelegateImplementation.cs
42 lines (33 loc) · 1.26 KB
/
DelegateImplementation.cs
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
35
36
37
38
39
40
41
42
using System;
using System.Collections.Generic;
namespace Thuja
{
public abstract class DelegateIWidget : IWidget
{
protected abstract IWidget WidgetImplementation { get; }
public virtual void Render(RenderContext context)
{
WidgetImplementation.Render(context);
}
}
public abstract class DelegateIFocusable : DelegateIWidget, IFocusable
{
protected override IWidget WidgetImplementation => FocusableImplementation;
protected abstract IFocusable FocusableImplementation { get; }
public virtual bool CanFocus => FocusableImplementation.CanFocus;
public virtual void FocusChange(bool isFocused)
{
FocusableImplementation.FocusChange(isFocused);
}
public virtual bool BubbleDown(ConsoleKeyInfo key)
{
return FocusableImplementation.BubbleDown(key);
}
}
public abstract class DelegateIKeyHandler : DelegateIFocusable, IKeyHandler
{
protected override IFocusable FocusableImplementation => KeyHandlerImplementation;
protected abstract IKeyHandler KeyHandlerImplementation { get; }
public virtual Dictionary<HashSet<KeySelector>, Action> Actions => KeyHandlerImplementation.Actions;
}
}