/ src / Ryujinx / UI / Helpers / OffscreenTextBox.cs
OffscreenTextBox.cs
 1  using Avalonia.Controls;
 2  using Avalonia.Input;
 3  using Avalonia.Interactivity;
 4  using System;
 5  
 6  namespace Ryujinx.Ava.UI.Helpers
 7  {
 8      public class OffscreenTextBox : TextBox
 9      {
10          protected override Type StyleKeyOverride => typeof(TextBox);
11  
12          public static RoutedEvent<KeyEventArgs> GetKeyDownRoutedEvent()
13          {
14              return KeyDownEvent;
15          }
16  
17          public static RoutedEvent<KeyEventArgs> GetKeyUpRoutedEvent()
18          {
19              return KeyUpEvent;
20          }
21  
22          public void SendKeyDownEvent(KeyEventArgs keyEvent)
23          {
24              OnKeyDown(keyEvent);
25          }
26  
27          public void SendKeyUpEvent(KeyEventArgs keyEvent)
28          {
29              OnKeyUp(keyEvent);
30          }
31  
32          public void SendText(string text)
33          {
34              OnTextInput(new TextInputEventArgs
35              {
36                  Text = text,
37                  Source = this,
38                  RoutedEvent = TextInputEvent,
39              });
40          }
41      }
42  }