A cross-platform UI framework for .NET
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

71 lines
2.9 KiB

#nullable enable
using Avalonia.Input.TextInput;
using Foundation;
using UIKit;
namespace Avalonia.iOS;
partial class AvaloniaView
{
partial class TextInputResponder
{
[Export("autocapitalizationType")]
public UITextAutocapitalizationType AutocapitalizationType { get; private set; }
[Export("autocorrectionType")]
public UITextAutocorrectionType AutocorrectionType => UITextAutocorrectionType.Yes;
[Export("keyboardType")]
public UIKeyboardType KeyboardType =>
_view._options == null ?
UIKeyboardType.Default :
_view._options.ContentType switch
{
TextInputContentType.Alpha => UIKeyboardType.AsciiCapable,
TextInputContentType.Digits or TextInputContentType.Number => UIKeyboardType.NumberPad,
TextInputContentType.Pin => UIKeyboardType.NumberPad,
TextInputContentType.Email => UIKeyboardType.EmailAddress,
TextInputContentType.Url => UIKeyboardType.Url,
TextInputContentType.Name => UIKeyboardType.NamePhonePad,
TextInputContentType.Social => UIKeyboardType.Twitter,
TextInputContentType.Search => UIKeyboardType.WebSearch,
_ => UIKeyboardType.Default
};
[Export("keyboardAppearance")]
public UIKeyboardAppearance KeyboardAppearance => UIKeyboardAppearance.Alert;
[Export("returnKeyType")] public UIReturnKeyType ReturnKeyType => (UIReturnKeyType)(_view._options?.ReturnKeyType ?? TextInputReturnKeyType.Default);
[Export("enablesReturnKeyAutomatically")]
public bool EnablesReturnKeyAutomatically { get; set; }
[Export("isSecureTextEntry")] public bool IsSecureEntry =>
_view._options?.ContentType is TextInputContentType.Password or TextInputContentType.Pin
|| (_view._options?.IsSensitive ?? false);
[Export("spellCheckingType")] public UITextSpellCheckingType SpellCheckingType => UITextSpellCheckingType.Yes;
[Export("textContentType")] public NSString TextContentType { get; set; } = new NSString("text/plain");
[Export("smartQuotesType")]
public UITextSmartQuotesType SmartQuotesType { get; set; } = UITextSmartQuotesType.Default;
[Export("smartDashesType")]
public UITextSmartDashesType SmartDashesType { get; set; } = UITextSmartDashesType.Default;
[Export("smartInsertDeleteType")]
public UITextSmartInsertDeleteType SmartInsertDeleteType { get; set; } = UITextSmartInsertDeleteType.Default;
[Export("passwordRules")] public UITextInputPasswordRules PasswordRules { get; set; } = null!;
public NSObject? WeakInputDelegate
{
get;
set;
}
NSObject IUITextInput.WeakTokenizer => _tokenizer;
}
}