4 changed files with 6 additions and 63 deletions
@ -0,0 +1,6 @@ |
|||||
|
namespace Avalonia.iOS; |
||||
|
|
||||
|
public class AvaloniaUIResponder |
||||
|
{ |
||||
|
|
||||
|
} |
||||
@ -1,32 +0,0 @@ |
|||||
using Avalonia.Input; |
|
||||
using Avalonia.Input.Raw; |
|
||||
using Foundation; |
|
||||
using ObjCRuntime; |
|
||||
using UIKit; |
|
||||
|
|
||||
namespace Avalonia.iOS |
|
||||
{ |
|
||||
[Adopts("UIKeyInput")] |
|
||||
public partial class AvaloniaView |
|
||||
{ |
|
||||
public override bool CanBecomeFirstResponder => true; |
|
||||
|
|
||||
[Export("hasText")] public bool HasText => false; |
|
||||
|
|
||||
[Export("insertText:")] |
|
||||
public void InsertText(string text) => |
|
||||
_topLevelImpl.Input?.Invoke(new RawTextInputEventArgs(KeyboardDevice.Instance, |
|
||||
0, InputRoot, text)); |
|
||||
|
|
||||
[Export("deleteBackward")] |
|
||||
public void DeleteBackward() |
|
||||
{ |
|
||||
// TODO: pass this through IME infrastructure instead of emulating a backspace press
|
|
||||
_topLevelImpl.Input?.Invoke(new RawKeyEventArgs(KeyboardDevice.Instance, |
|
||||
0, InputRoot, RawKeyEventType.KeyDown, Key.Back, RawInputModifiers.None)); |
|
||||
|
|
||||
_topLevelImpl.Input?.Invoke(new RawKeyEventArgs(KeyboardDevice.Instance, |
|
||||
0, InputRoot, RawKeyEventType.KeyUp, Key.Back, RawInputModifiers.None)); |
|
||||
} |
|
||||
} |
|
||||
} |
|
||||
@ -1,24 +0,0 @@ |
|||||
using Avalonia.Controls; |
|
||||
using Avalonia.Input; |
|
||||
|
|
||||
namespace Avalonia.iOS |
|
||||
{ |
|
||||
public class SoftKeyboardHelper |
|
||||
{ |
|
||||
private AvaloniaView _oldView; |
|
||||
|
|
||||
public void UpdateKeyboard(IInputElement focusedElement) |
|
||||
{ |
|
||||
if (_oldView?.IsFirstResponder == true) |
|
||||
_oldView?.ResignFirstResponder(); |
|
||||
_oldView = null; |
|
||||
|
|
||||
//TODO: Raise a routed event to determine if any control wants to become the text input handler
|
|
||||
if (focusedElement is TextBox) |
|
||||
{ |
|
||||
var view = ((focusedElement.VisualRoot as TopLevel)?.PlatformImpl as AvaloniaView.TopLevelImpl)?.View; |
|
||||
view?.BecomeFirstResponder(); |
|
||||
} |
|
||||
} |
|
||||
} |
|
||||
} |
|
||||
Loading…
Reference in new issue