committed by
GitHub
41 changed files with 489 additions and 532 deletions
@ -1,15 +0,0 @@ |
|||||
using Avalonia.iOS; |
|
||||
using Foundation; |
|
||||
using UIKit; |
|
||||
|
|
||||
namespace ControlCatalog.iOS.Legacy |
|
||||
{ |
|
||||
// The UIApplicationDelegate for the application. This class is responsible for launching the
|
|
||||
// User Interface of the application, as well as listening (and optionally responding) to
|
|
||||
// application events from iOS.
|
|
||||
[Register("AppDelegate")] |
|
||||
public partial class AppDelegate : AvaloniaAppDelegate<App> |
|
||||
{ |
|
||||
|
|
||||
} |
|
||||
} |
|
||||
@ -1,117 +0,0 @@ |
|||||
{ |
|
||||
"images": [ |
|
||||
{ |
|
||||
"scale": "2x", |
|
||||
"size": "20x20", |
|
||||
"idiom": "iphone", |
|
||||
"filename": "Icon40.png" |
|
||||
}, |
|
||||
{ |
|
||||
"scale": "3x", |
|
||||
"size": "20x20", |
|
||||
"idiom": "iphone", |
|
||||
"filename": "Icon60.png" |
|
||||
}, |
|
||||
{ |
|
||||
"scale": "2x", |
|
||||
"size": "29x29", |
|
||||
"idiom": "iphone", |
|
||||
"filename": "Icon58.png" |
|
||||
}, |
|
||||
{ |
|
||||
"scale": "3x", |
|
||||
"size": "29x29", |
|
||||
"idiom": "iphone", |
|
||||
"filename": "Icon87.png" |
|
||||
}, |
|
||||
{ |
|
||||
"scale": "2x", |
|
||||
"size": "40x40", |
|
||||
"idiom": "iphone", |
|
||||
"filename": "Icon80.png" |
|
||||
}, |
|
||||
{ |
|
||||
"scale": "3x", |
|
||||
"size": "40x40", |
|
||||
"idiom": "iphone", |
|
||||
"filename": "Icon120.png" |
|
||||
}, |
|
||||
{ |
|
||||
"scale": "2x", |
|
||||
"size": "60x60", |
|
||||
"idiom": "iphone", |
|
||||
"filename": "Icon120.png" |
|
||||
}, |
|
||||
{ |
|
||||
"scale": "3x", |
|
||||
"size": "60x60", |
|
||||
"idiom": "iphone", |
|
||||
"filename": "Icon180.png" |
|
||||
}, |
|
||||
{ |
|
||||
"scale": "1x", |
|
||||
"size": "20x20", |
|
||||
"idiom": "ipad", |
|
||||
"filename": "Icon20.png" |
|
||||
}, |
|
||||
{ |
|
||||
"scale": "2x", |
|
||||
"size": "20x20", |
|
||||
"idiom": "ipad", |
|
||||
"filename": "Icon40.png" |
|
||||
}, |
|
||||
{ |
|
||||
"scale": "1x", |
|
||||
"size": "29x29", |
|
||||
"idiom": "ipad", |
|
||||
"filename": "Icon29.png" |
|
||||
}, |
|
||||
{ |
|
||||
"scale": "2x", |
|
||||
"size": "29x29", |
|
||||
"idiom": "ipad", |
|
||||
"filename": "Icon58.png" |
|
||||
}, |
|
||||
{ |
|
||||
"scale": "1x", |
|
||||
"size": "40x40", |
|
||||
"idiom": "ipad", |
|
||||
"filename": "Icon40.png" |
|
||||
}, |
|
||||
{ |
|
||||
"scale": "2x", |
|
||||
"size": "40x40", |
|
||||
"idiom": "ipad", |
|
||||
"filename": "Icon80.png" |
|
||||
}, |
|
||||
{ |
|
||||
"scale": "1x", |
|
||||
"size": "76x76", |
|
||||
"idiom": "ipad", |
|
||||
"filename": "Icon76.png" |
|
||||
}, |
|
||||
{ |
|
||||
"scale": "2x", |
|
||||
"size": "76x76", |
|
||||
"idiom": "ipad", |
|
||||
"filename": "Icon152.png" |
|
||||
}, |
|
||||
{ |
|
||||
"scale": "2x", |
|
||||
"size": "83.5x83.5", |
|
||||
"idiom": "ipad", |
|
||||
"filename": "Icon167.png" |
|
||||
}, |
|
||||
{ |
|
||||
"scale": "1x", |
|
||||
"size": "1024x1024", |
|
||||
"idiom": "ios-marketing", |
|
||||
"filename": "Icon1024.png" |
|
||||
} |
|
||||
], |
|
||||
"properties": {}, |
|
||||
"info": { |
|
||||
"version": 1, |
|
||||
"author": "xcode" |
|
||||
} |
|
||||
} |
|
||||
@ -1,99 +0,0 @@ |
|||||
<Project Sdk="Xamarin.Legacy.Sdk"> |
|
||||
<PropertyGroup> |
|
||||
<TargetFramework>xamarin.ios10</TargetFramework> |
|
||||
<SupportedOSPlatformVersion>15.0</SupportedOSPlatformVersion> |
|
||||
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects> |
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> |
|
||||
<Platform Condition=" '$(Platform)' == '' ">iPhoneSimulator</Platform> |
|
||||
<ProjectGuid>{3AF75F00-B497-4517-9491-922173DE216E}</ProjectGuid> |
|
||||
<ProjectTypeGuids>{FEACFBD2-3405-455C-9665-78FE426C6842};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids> |
|
||||
<OutputType>Exe</OutputType> |
|
||||
<RootNamespace>ControlCatalog.iOS.Legacy</RootNamespace> |
|
||||
<IPhoneResourcePrefix>Resources</IPhoneResourcePrefix> |
|
||||
<AssemblyName>ControlCatalog.iOS.Legacy</AssemblyName> |
|
||||
<MtouchHttpClientHandler>NSUrlSessionHandler</MtouchHttpClientHandler> |
|
||||
<ProvisioningType>manual</ProvisioningType> |
|
||||
<MtouchInterpreter>-all</MtouchInterpreter> |
|
||||
</PropertyGroup> |
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|iPhoneSimulator' "> |
|
||||
<DebugSymbols>true</DebugSymbols> |
|
||||
<DebugType>full</DebugType> |
|
||||
<Optimize>false</Optimize> |
|
||||
<OutputPath>bin\iPhoneSimulator\Debug</OutputPath> |
|
||||
<DefineConstants>DEBUG</DefineConstants> |
|
||||
<ErrorReport>prompt</ErrorReport> |
|
||||
<WarningLevel>4</WarningLevel> |
|
||||
<ConsolePause>false</ConsolePause> |
|
||||
<MtouchArch>x86_64</MtouchArch> |
|
||||
<MtouchLink>None</MtouchLink> |
|
||||
<MtouchDebug>true</MtouchDebug> |
|
||||
</PropertyGroup> |
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|iPhoneSimulator' "> |
|
||||
<DebugType>none</DebugType> |
|
||||
<Optimize>true</Optimize> |
|
||||
<OutputPath>bin\iPhoneSimulator\Release</OutputPath> |
|
||||
<ErrorReport>prompt</ErrorReport> |
|
||||
<WarningLevel>4</WarningLevel> |
|
||||
<MtouchLink>None</MtouchLink> |
|
||||
<MtouchArch>x86_64</MtouchArch> |
|
||||
<ConsolePause>false</ConsolePause> |
|
||||
</PropertyGroup> |
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|iPhone' "> |
|
||||
<DebugSymbols>true</DebugSymbols> |
|
||||
<DebugType>full</DebugType> |
|
||||
<Optimize>false</Optimize> |
|
||||
<OutputPath>bin\iPhone\Debug</OutputPath> |
|
||||
<DefineConstants>DEBUG</DefineConstants> |
|
||||
<ErrorReport>prompt</ErrorReport> |
|
||||
<WarningLevel>4</WarningLevel> |
|
||||
<ConsolePause>false</ConsolePause> |
|
||||
<MtouchArch>ARM64</MtouchArch> |
|
||||
<CodesignEntitlements>Entitlements.plist</CodesignEntitlements> |
|
||||
<MtouchDebug>true</MtouchDebug> |
|
||||
</PropertyGroup> |
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|iPhone' "> |
|
||||
<DebugType>none</DebugType> |
|
||||
<Optimize>true</Optimize> |
|
||||
<OutputPath>bin\iPhone\Release</OutputPath> |
|
||||
<ErrorReport>prompt</ErrorReport> |
|
||||
<WarningLevel>4</WarningLevel> |
|
||||
<CodesignEntitlements>Entitlements.plist</CodesignEntitlements> |
|
||||
<MtouchArch>ARM64</MtouchArch> |
|
||||
<ConsolePause>false</ConsolePause> |
|
||||
</PropertyGroup> |
|
||||
<ItemGroup> |
|
||||
<None Include="Info.plist" /> |
|
||||
<Content Include="Entitlements.plist" /> |
|
||||
</ItemGroup> |
|
||||
<ItemGroup> |
|
||||
<Reference Include="System" /> |
|
||||
<Reference Include="System.Xml" /> |
|
||||
<Reference Include="System.Core" /> |
|
||||
<Reference Include="Xamarin.iOS" /> |
|
||||
</ItemGroup> |
|
||||
<ItemGroup> |
|
||||
<ImageAsset Include="Assets.xcassets\AppIcon.appiconset\Contents.json"> |
|
||||
<Visible>false</Visible> |
|
||||
</ImageAsset> |
|
||||
</ItemGroup> |
|
||||
<ItemGroup> |
|
||||
<Folder Include="Resources\" /> |
|
||||
</ItemGroup> |
|
||||
<ItemGroup> |
|
||||
<ProjectReference Include="..\..\src\Avalonia.Controls\Avalonia.Controls.csproj"> |
|
||||
<Project>{d2221c82-4a25-4583-9b43-d791e3f6820c}</Project> |
|
||||
<Name>Avalonia.Controls</Name> |
|
||||
</ProjectReference> |
|
||||
<ProjectReference Include="..\..\src\iOS\Avalonia.iOS\Avalonia.iOS.csproj"> |
|
||||
<Project>{4488ad85-1495-4809-9aa4-ddfe0a48527e}</Project> |
|
||||
<Name>Avalonia.iOS</Name> |
|
||||
</ProjectReference> |
|
||||
<ProjectReference Include="..\ControlCatalog\ControlCatalog.csproj"> |
|
||||
<Project>{d0a739b9-3c68-4ba6-a328-41606954b6bd}</Project> |
|
||||
<Name>ControlCatalog</Name> |
|
||||
</ProjectReference> |
|
||||
</ItemGroup> |
|
||||
<!-- <Import Project="..\..\build\LegacyProject.targets" />--> |
|
||||
<!-- <Import Project="..\..\build\SkiaSharp.props" />--> |
|
||||
<!-- <Import Project="..\..\build\HarfBuzzSharp.props" />--> |
|
||||
</Project> |
|
||||
@ -1,6 +0,0 @@ |
|||||
<?xml version="1.0" encoding="UTF-8"?> |
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> |
|
||||
<plist version="1.0"> |
|
||||
<dict> |
|
||||
</dict> |
|
||||
</plist> |
|
||||
@ -1,47 +0,0 @@ |
|||||
<?xml version="1.0" encoding="UTF-8"?> |
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> |
|
||||
<plist version="1.0"> |
|
||||
<dict> |
|
||||
<key>CFBundleDisplayName</key> |
|
||||
<string>ControlCatalog</string> |
|
||||
<key>CFBundleIdentifier</key> |
|
||||
<string>com.companyname.ControlCatalog.iOS</string> |
|
||||
<key>CFBundleShortVersionString</key> |
|
||||
<string>1.0</string> |
|
||||
<key>CFBundleVersion</key> |
|
||||
<string>1.0</string> |
|
||||
<key>LSRequiresIPhoneOS</key> |
|
||||
<true/> |
|
||||
<key>MinimumOSVersion</key> |
|
||||
<string>15.0</string> |
|
||||
<key>UIDeviceFamily</key> |
|
||||
<array> |
|
||||
<integer>1</integer><integer>2</integer> |
|
||||
</array> |
|
||||
<key>UILaunchStoryboardName</key> |
|
||||
<string>LaunchScreen</string> |
|
||||
<key>UIRequiredDeviceCapabilities</key> |
|
||||
<array> |
|
||||
<string>armv7</string> |
|
||||
</array> |
|
||||
<key>UISupportedInterfaceOrientations</key> |
|
||||
<array> |
|
||||
<string>UIInterfaceOrientationPortrait</string> |
|
||||
<string>UIInterfaceOrientationLandscapeLeft</string> |
|
||||
<string>UIInterfaceOrientationLandscapeRight</string> |
|
||||
</array> |
|
||||
<key>UISupportedInterfaceOrientations~ipad</key> |
|
||||
<array> |
|
||||
<string>UIInterfaceOrientationPortrait</string> |
|
||||
<string>UIInterfaceOrientationPortraitUpsideDown</string> |
|
||||
<string>UIInterfaceOrientationLandscapeLeft</string> |
|
||||
<string>UIInterfaceOrientationLandscapeRight</string> |
|
||||
</array> |
|
||||
<key>XSAppIconAssets</key> |
|
||||
<string>Assets.xcassets/AppIcon.appiconset</string> |
|
||||
<key>UIStatusBarHidden</key> |
|
||||
<true/> |
|
||||
<key>UIViewControllerBasedStatusBarAppearance</key> |
|
||||
<false/> |
|
||||
</dict> |
|
||||
</plist> |
|
||||
@ -1,15 +0,0 @@ |
|||||
using UIKit; |
|
||||
|
|
||||
namespace ControlCatalog.iOS.Legacy |
|
||||
{ |
|
||||
public class Application |
|
||||
{ |
|
||||
// This is the main entry point of the application.
|
|
||||
static void Main(string[] args) |
|
||||
{ |
|
||||
// if you want to use a different Application Delegate class from "AppDelegate"
|
|
||||
// you can specify it here.
|
|
||||
UIApplication.Main(args, null, "AppDelegate"); |
|
||||
} |
|
||||
} |
|
||||
} |
|
||||
@ -1,43 +0,0 @@ |
|||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?> |
|
||||
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="6214" systemVersion="14A314h" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" launchScreen="YES" useTraitCollections="YES"> |
|
||||
<dependencies> |
|
||||
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="6207" /> |
|
||||
<capability name="Constraints with non-1.0 multipliers" minToolsVersion="5.1" /> |
|
||||
</dependencies> |
|
||||
<objects> |
|
||||
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner" /> |
|
||||
<placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder" /> |
|
||||
<view contentMode="scaleToFill" id="iN0-l3-epB"> |
|
||||
<rect key="frame" x="0.0" y="0.0" width="480" height="480" /> |
|
||||
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES" /> |
|
||||
<subviews> |
|
||||
<label opaque="NO" clipsSubviews="YES" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text=" Copyright (c) 2022 " textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" |
|
||||
minimumFontSize="9" translatesAutoresizingMaskIntoConstraints="NO" id="8ie-xW-0ye"> |
|
||||
<rect key="frame" x="20" y="439" width="441" height="21" /> |
|
||||
<fontDescription key="fontDescription" type="system" pointSize="17" /> |
|
||||
<color key="textColor" cocoaTouchSystemColor="darkTextColor" /> |
|
||||
<nil key="highlightedColor" /> |
|
||||
</label> |
|
||||
<label opaque="NO" clipsSubviews="YES" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="ControlCatalog.iOS.Legacy" textAlignment="center" lineBreakMode="middleTruncation" baselineAdjustment="alignBaselines" |
|
||||
minimumFontSize="18" translatesAutoresizingMaskIntoConstraints="NO" id="kId-c2-rCX"> |
|
||||
<rect key="frame" x="20" y="140" width="441" height="43" /> |
|
||||
<fontDescription key="fontDescription" type="boldSystem" pointSize="36" /> |
|
||||
<color key="textColor" cocoaTouchSystemColor="darkTextColor" /> |
|
||||
<nil key="highlightedColor" /> |
|
||||
</label> |
|
||||
</subviews> |
|
||||
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="calibratedWhite" /> |
|
||||
<constraints> |
|
||||
<constraint firstItem="kId-c2-rCX" firstAttribute="centerY" secondItem="iN0-l3-epB" secondAttribute="bottom" multiplier="1/3" constant="1" id="5cJ-9S-tgC" /> |
|
||||
<constraint firstAttribute="centerX" secondItem="kId-c2-rCX" secondAttribute="centerX" id="Koa-jz-hwk" /> |
|
||||
<constraint firstAttribute="bottom" secondItem="8ie-xW-0ye" secondAttribute="bottom" constant="20" id="Kzo-t9-V3l" /> |
|
||||
<constraint firstItem="8ie-xW-0ye" firstAttribute="leading" secondItem="iN0-l3-epB" secondAttribute="leading" constant="20" symbolic="YES" id="MfP-vx-nX0" /> |
|
||||
<constraint firstAttribute="centerX" secondItem="8ie-xW-0ye" secondAttribute="centerX" id="ZEH-qu-HZ9" /> |
|
||||
<constraint firstItem="kId-c2-rCX" firstAttribute="leading" secondItem="iN0-l3-epB" secondAttribute="leading" constant="20" symbolic="YES" id="fvb-Df-36g" /> |
|
||||
</constraints> |
|
||||
<nil key="simulatedStatusBarMetrics" /> |
|
||||
<freeformSimulatedSizeMetrics key="simulatedDestinationMetrics" /> |
|
||||
<point key="canvasLocation" x="548" y="455" /> |
|
||||
</view> |
|
||||
</objects> |
|
||||
</document> |
|
||||
@ -0,0 +1 @@ |
|||||
|
Total Issues: 0 |
||||
@ -0,0 +1 @@ |
|||||
|
Total Issues: 0 |
||||
@ -1,12 +1,62 @@ |
|||||
namespace Avalonia.Input.TextInput |
namespace Avalonia.Input.TextInput |
||||
{ |
{ |
||||
public enum TextInputContentType |
public enum TextInputContentType |
||||
{ |
{ |
||||
|
/// <summary>
|
||||
|
/// Default keyboard for the users configured input method.
|
||||
|
/// </summary>
|
||||
Normal = 0, |
Normal = 0, |
||||
Email = 1, |
|
||||
Phone = 2, |
/// <summary>
|
||||
Number = 3, |
/// Display a keyboard that only has alphabetic characters.
|
||||
Url = 4, |
/// </summary>
|
||||
Password = 5 |
Alpha, |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// Display a numeric keypad only capable of numbers. i.e. Phone number
|
||||
|
/// </summary>
|
||||
|
Digits, |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// Display a numeric keypad for inputting a PIN.
|
||||
|
/// </summary>
|
||||
|
Pin, |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// Display a numeric keypad capable of inputting numbers including decimal seperator and sign.
|
||||
|
/// </summary>
|
||||
|
Number, |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// Display a keyboard for entering an email address.
|
||||
|
/// </summary>
|
||||
|
Email, |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// Display a keyboard for entering a URL.
|
||||
|
/// </summary>
|
||||
|
Url, |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// Display a keyboard for entering a persons name.
|
||||
|
/// </summary>
|
||||
|
Name, |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// Display a keyboard for entering sensitive data.
|
||||
|
/// </summary>
|
||||
|
Password, |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// Display a keyboard suitable for #tag and @mentions.
|
||||
|
/// Not available on all platforms, will fallback to a suitable keyboard
|
||||
|
/// when not available.
|
||||
|
/// </summary>
|
||||
|
Social, |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// Display a keyboard for entering a search keyword.
|
||||
|
/// </summary>
|
||||
|
Search |
||||
} |
} |
||||
} |
} |
||||
|
|||||
@ -0,0 +1,220 @@ |
|||||
|
namespace Avalonia.Input.TextInput; |
||||
|
|
||||
|
public class TextInputOptions |
||||
|
{ |
||||
|
public static TextInputOptions FromStyledElement(StyledElement avaloniaObject) |
||||
|
{ |
||||
|
var result = new TextInputOptions |
||||
|
{ |
||||
|
ContentType = GetContentType(avaloniaObject), |
||||
|
Multiline = GetMultiline(avaloniaObject), |
||||
|
AutoCapitalization = GetAutoCapitalization(avaloniaObject), |
||||
|
IsSensitive = GetIsSensitive(avaloniaObject), |
||||
|
Lowercase = GetLowercase(avaloniaObject), |
||||
|
Uppercase = GetUppercase(avaloniaObject) |
||||
|
}; |
||||
|
|
||||
|
return result; |
||||
|
} |
||||
|
|
||||
|
public static readonly TextInputOptions Default = new(); |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// Defines the <see cref="ContentType"/> property.
|
||||
|
/// </summary>
|
||||
|
public static readonly AttachedProperty<TextInputContentType> ContentTypeProperty = |
||||
|
AvaloniaProperty.RegisterAttached<TextInputOptions, StyledElement, TextInputContentType>( |
||||
|
"ContentType", |
||||
|
defaultValue: TextInputContentType.Normal, |
||||
|
inherits: true); |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// Sets the value of the attached <see cref="ContentTypeProperty"/> on a control.
|
||||
|
/// </summary>
|
||||
|
/// <param name="avaloniaObject">The control.</param>
|
||||
|
/// <param name="value">The property value to set.</param>
|
||||
|
public static void SetContentType(StyledElement avaloniaObject, TextInputContentType value) |
||||
|
{ |
||||
|
avaloniaObject.SetValue(ContentTypeProperty, value); |
||||
|
} |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// Gets the value of the attached <see cref="ContentTypeProperty"/>.
|
||||
|
/// </summary>
|
||||
|
/// <param name="avaloniaObject">The target.</param>
|
||||
|
/// <returns>TextInputContentType</returns>
|
||||
|
public static TextInputContentType GetContentType(StyledElement avaloniaObject) |
||||
|
{ |
||||
|
return avaloniaObject.GetValue(ContentTypeProperty); |
||||
|
} |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// The content type (mostly for determining the shape of the virtual keyboard)
|
||||
|
/// </summary>
|
||||
|
public TextInputContentType ContentType { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// Defines the <see cref="Multiline"/> property.
|
||||
|
/// </summary>
|
||||
|
public static readonly AttachedProperty<bool> MultilineProperty = |
||||
|
AvaloniaProperty.RegisterAttached<TextInputOptions, StyledElement, bool>( |
||||
|
"Multiline", |
||||
|
inherits: true); |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// Sets the value of the attached <see cref="MultilineProperty"/> on a control.
|
||||
|
/// </summary>
|
||||
|
/// <param name="avaloniaObject">The control.</param>
|
||||
|
/// <param name="value">The property value to set.</param>
|
||||
|
public static void SetMultiline(StyledElement avaloniaObject, bool value) |
||||
|
{ |
||||
|
avaloniaObject.SetValue(MultilineProperty, value); |
||||
|
} |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// Gets the value of the attached <see cref="MultilineProperty"/>.
|
||||
|
/// </summary>
|
||||
|
/// <param name="avaloniaObject">The target.</param>
|
||||
|
/// <returns>true if multiline</returns>
|
||||
|
public static bool GetMultiline(StyledElement avaloniaObject) |
||||
|
{ |
||||
|
return avaloniaObject.GetValue(MultilineProperty); |
||||
|
} |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// Text is multiline
|
||||
|
/// </summary>
|
||||
|
public bool Multiline { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// Defines the <see cref="Lowercase"/> property.
|
||||
|
/// </summary>
|
||||
|
public static readonly AttachedProperty<bool> LowercaseProperty = |
||||
|
AvaloniaProperty.RegisterAttached<TextInputOptions, StyledElement, bool>( |
||||
|
"Lowercase", |
||||
|
inherits: true); |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// Sets the value of the attached <see cref="LowercaseProperty"/> on a control.
|
||||
|
/// </summary>
|
||||
|
/// <param name="avaloniaObject">The control.</param>
|
||||
|
/// <param name="value">The property value to set.</param>
|
||||
|
public static void SetLowercase(StyledElement avaloniaObject, bool value) |
||||
|
{ |
||||
|
avaloniaObject.SetValue(LowercaseProperty, value); |
||||
|
} |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// Gets the value of the attached <see cref="LowercaseProperty"/>.
|
||||
|
/// </summary>
|
||||
|
/// <param name="avaloniaObject">The target.</param>
|
||||
|
/// <returns>true if Lowercase</returns>
|
||||
|
public static bool GetLowercase(StyledElement avaloniaObject) |
||||
|
{ |
||||
|
return avaloniaObject.GetValue(LowercaseProperty); |
||||
|
} |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// Text is in lower case
|
||||
|
/// </summary>
|
||||
|
public bool Lowercase { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// Defines the <see cref="Uppercase"/> property.
|
||||
|
/// </summary>
|
||||
|
public static readonly AttachedProperty<bool> UppercaseProperty = |
||||
|
AvaloniaProperty.RegisterAttached<TextInputOptions, StyledElement, bool>( |
||||
|
"Uppercase", |
||||
|
inherits: true); |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// Sets the value of the attached <see cref="UppercaseProperty"/> on a control.
|
||||
|
/// </summary>
|
||||
|
/// <param name="avaloniaObject">The control.</param>
|
||||
|
/// <param name="value">The property value to set.</param>
|
||||
|
public static void SetUppercase(StyledElement avaloniaObject, bool value) |
||||
|
{ |
||||
|
avaloniaObject.SetValue(UppercaseProperty, value); |
||||
|
} |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// Gets the value of the attached <see cref="UppercaseProperty"/>.
|
||||
|
/// </summary>
|
||||
|
/// <param name="avaloniaObject">The target.</param>
|
||||
|
/// <returns>true if Uppercase</returns>
|
||||
|
public static bool GetUppercase(StyledElement avaloniaObject) |
||||
|
{ |
||||
|
return avaloniaObject.GetValue(UppercaseProperty); |
||||
|
} |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// Text is in upper case
|
||||
|
/// </summary>
|
||||
|
public bool Uppercase { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// Defines the <see cref="AutoCapitalization"/> property.
|
||||
|
/// </summary>
|
||||
|
public static readonly AttachedProperty<bool> AutoCapitalizationProperty = |
||||
|
AvaloniaProperty.RegisterAttached<TextInputOptions, StyledElement, bool>( |
||||
|
"AutoCapitalization", |
||||
|
inherits: true); |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// Sets the value of the attached <see cref="AutoCapitalizationProperty"/> on a control.
|
||||
|
/// </summary>
|
||||
|
/// <param name="avaloniaObject">The control.</param>
|
||||
|
/// <param name="value">The property value to set.</param>
|
||||
|
public static void SetAutoCapitalization(StyledElement avaloniaObject, bool value) |
||||
|
{ |
||||
|
avaloniaObject.SetValue(AutoCapitalizationProperty, value); |
||||
|
} |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// Gets the value of the attached <see cref="AutoCapitalizationProperty"/>.
|
||||
|
/// </summary>
|
||||
|
/// <param name="avaloniaObject">The target.</param>
|
||||
|
/// <returns>true if AutoCapitalization</returns>
|
||||
|
public static bool GetAutoCapitalization(StyledElement avaloniaObject) |
||||
|
{ |
||||
|
return avaloniaObject.GetValue(AutoCapitalizationProperty); |
||||
|
} |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// Automatically capitalize letters at the start of the sentence
|
||||
|
/// </summary>
|
||||
|
public bool AutoCapitalization { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// Defines the <see cref="IsSensitive"/> property.
|
||||
|
/// </summary>
|
||||
|
public static readonly AttachedProperty<bool> IsSensitiveProperty = |
||||
|
AvaloniaProperty.RegisterAttached<TextInputOptions, StyledElement, bool>( |
||||
|
"IsSensitive", |
||||
|
inherits: true); |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// Sets the value of the attached <see cref="IsSensitiveProperty"/> on a control.
|
||||
|
/// </summary>
|
||||
|
/// <param name="avaloniaObject">The control.</param>
|
||||
|
/// <param name="value">The property value to set.</param>
|
||||
|
public static void SetIsSensitive(StyledElement avaloniaObject, bool value) |
||||
|
{ |
||||
|
avaloniaObject.SetValue(IsSensitiveProperty, value); |
||||
|
} |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// Gets the value of the attached <see cref="IsSensitiveProperty"/>.
|
||||
|
/// </summary>
|
||||
|
/// <param name="avaloniaObject">The target.</param>
|
||||
|
/// <returns>true if IsSensitive</returns>
|
||||
|
public static bool GetIsSensitive(StyledElement avaloniaObject) |
||||
|
{ |
||||
|
return avaloniaObject.GetValue(IsSensitiveProperty); |
||||
|
} |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// Text contains sensitive data like card numbers and should not be stored
|
||||
|
/// </summary>
|
||||
|
public bool IsSensitive { get; set; } |
||||
|
} |
||||
@ -1,32 +0,0 @@ |
|||||
using Avalonia.Interactivity; |
|
||||
|
|
||||
namespace Avalonia.Input.TextInput |
|
||||
{ |
|
||||
public class TextInputOptionsQueryEventArgs : RoutedEventArgs |
|
||||
{ |
|
||||
/// <summary>
|
|
||||
/// The content type (mostly for determining the shape of the virtual keyboard)
|
|
||||
/// </summary>
|
|
||||
public TextInputContentType ContentType { get; set; } |
|
||||
/// <summary>
|
|
||||
/// Text is multiline
|
|
||||
/// </summary>
|
|
||||
public bool Multiline { get; set; } |
|
||||
/// <summary>
|
|
||||
/// Text is in lower case
|
|
||||
/// </summary>
|
|
||||
public bool Lowercase { get; set; } |
|
||||
/// <summary>
|
|
||||
/// Text is in upper case
|
|
||||
/// </summary>
|
|
||||
public bool Uppercase { get; set; } |
|
||||
/// <summary>
|
|
||||
/// Automatically capitalize letters at the start of the sentence
|
|
||||
/// </summary>
|
|
||||
public bool AutoCapitalization { get; set; } |
|
||||
/// <summary>
|
|
||||
/// Text contains sensitive data like card numbers and should not be stored
|
|
||||
/// </summary>
|
|
||||
public bool IsSensitive { get; set; } |
|
||||
} |
|
||||
} |
|
||||
@ -0,0 +1 @@ |
|||||
|
Total Issues: 0 |
||||
@ -0,0 +1 @@ |
|||||
|
Total Issues: 0 |
||||
@ -0,0 +1 @@ |
|||||
|
Total Issues: 0 |
||||
@ -0,0 +1 @@ |
|||||
|
Total Issues: 0 |
||||
@ -0,0 +1 @@ |
|||||
|
Total Issues: 0 |
||||
@ -0,0 +1 @@ |
|||||
|
Total Issues: 0 |
||||
@ -0,0 +1 @@ |
|||||
|
Total Issues: 0 |
||||
@ -1,32 +1,146 @@ |
|||||
using Avalonia.Input; |
|
||||
using Avalonia.Input.Raw; |
|
||||
using Foundation; |
using Foundation; |
||||
using ObjCRuntime; |
using ObjCRuntime; |
||||
|
using Avalonia.Input.TextInput; |
||||
|
using Avalonia.Input; |
||||
|
using Avalonia.Input.Raw; |
||||
using UIKit; |
using UIKit; |
||||
|
|
||||
namespace Avalonia.iOS |
namespace Avalonia.iOS; |
||||
|
|
||||
|
#nullable enable |
||||
|
|
||||
|
[Adopts("UITextInputTraits")] |
||||
|
[Adopts("UIKeyInput")] |
||||
|
public partial class AvaloniaView : ITextInputMethodImpl |
||||
{ |
{ |
||||
[Adopts("UIKeyInput")] |
private ITextInputMethodClient? _currentClient; |
||||
public partial class AvaloniaView |
|
||||
|
public override bool CanResignFirstResponder => true; |
||||
|
public override bool CanBecomeFirstResponder => true; |
||||
|
|
||||
|
[Export("hasText")] |
||||
|
public bool HasText |
||||
{ |
{ |
||||
public override bool CanBecomeFirstResponder => true; |
get |
||||
|
{ |
||||
|
if (_currentClient is { } && _currentClient.SupportsSurroundingText && |
||||
|
_currentClient.SurroundingText.Text.Length > 0) |
||||
|
{ |
||||
|
return true; |
||||
|
} |
||||
|
|
||||
|
return false; |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
[Export("keyboardType")] public UIKeyboardType KeyboardType { get; private set; } = UIKeyboardType.Default; |
||||
|
|
||||
[Export("hasText")] public bool HasText => false; |
[Export("isSecureTextEntry")] public bool IsSecureEntry { get; private set; } |
||||
|
|
||||
[Export("insertText:")] |
[Export("insertText:")] |
||||
public void InsertText(string text) => |
public void InsertText(string text) |
||||
|
{ |
||||
|
if (KeyboardDevice.Instance is { }) |
||||
|
{ |
||||
_topLevelImpl.Input?.Invoke(new RawTextInputEventArgs(KeyboardDevice.Instance, |
_topLevelImpl.Input?.Invoke(new RawTextInputEventArgs(KeyboardDevice.Instance, |
||||
0, InputRoot, text)); |
0, InputRoot, text)); |
||||
|
} |
||||
|
} |
||||
|
|
||||
[Export("deleteBackward")] |
[Export("deleteBackward")] |
||||
public void DeleteBackward() |
public void DeleteBackward() |
||||
|
{ |
||||
|
if (KeyboardDevice.Instance is { }) |
||||
{ |
{ |
||||
// TODO: pass this through IME infrastructure instead of emulating a backspace press
|
// TODO: pass this through IME infrastructure instead of emulating a backspace press
|
||||
_topLevelImpl.Input?.Invoke(new RawKeyEventArgs(KeyboardDevice.Instance, |
_topLevelImpl.Input?.Invoke(new RawKeyEventArgs(KeyboardDevice.Instance, |
||||
0, InputRoot, RawKeyEventType.KeyDown, Key.Back, RawInputModifiers.None)); |
0, InputRoot, RawKeyEventType.KeyDown, Key.Back, RawInputModifiers.None)); |
||||
|
|
||||
_topLevelImpl.Input?.Invoke(new RawKeyEventArgs(KeyboardDevice.Instance, |
_topLevelImpl.Input?.Invoke(new RawKeyEventArgs(KeyboardDevice.Instance, |
||||
0, InputRoot, RawKeyEventType.KeyUp, Key.Back, RawInputModifiers.None)); |
0, InputRoot, RawKeyEventType.KeyUp, Key.Back, RawInputModifiers.None)); |
||||
} |
} |
||||
} |
} |
||||
} |
|
||||
|
void ITextInputMethodImpl.SetClient(ITextInputMethodClient? client) |
||||
|
{ |
||||
|
_currentClient = client; |
||||
|
|
||||
|
if (client is { }) |
||||
|
{ |
||||
|
BecomeFirstResponder(); |
||||
|
} |
||||
|
else |
||||
|
{ |
||||
|
ResignFirstResponder(); |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
void ITextInputMethodImpl.SetCursorRect(Rect rect) |
||||
|
{ |
||||
|
|
||||
|
} |
||||
|
|
||||
|
void ITextInputMethodImpl.SetOptions(TextInputOptions options) |
||||
|
{ |
||||
|
IsSecureEntry = false; |
||||
|
|
||||
|
switch (options.ContentType) |
||||
|
{ |
||||
|
case TextInputContentType.Normal: |
||||
|
KeyboardType = UIKeyboardType.Default; |
||||
|
break; |
||||
|
|
||||
|
case TextInputContentType.Alpha: |
||||
|
KeyboardType = UIKeyboardType.AsciiCapable; |
||||
|
break; |
||||
|
|
||||
|
case TextInputContentType.Digits: |
||||
|
KeyboardType = UIKeyboardType.PhonePad; |
||||
|
break; |
||||
|
|
||||
|
case TextInputContentType.Pin: |
||||
|
KeyboardType = UIKeyboardType.NumberPad; |
||||
|
IsSecureEntry = true; |
||||
|
break; |
||||
|
|
||||
|
case TextInputContentType.Number: |
||||
|
KeyboardType = UIKeyboardType.PhonePad; |
||||
|
break; |
||||
|
|
||||
|
case TextInputContentType.Email: |
||||
|
KeyboardType = UIKeyboardType.EmailAddress; |
||||
|
break; |
||||
|
|
||||
|
case TextInputContentType.Url: |
||||
|
KeyboardType = UIKeyboardType.Url; |
||||
|
break; |
||||
|
|
||||
|
case TextInputContentType.Name: |
||||
|
KeyboardType = UIKeyboardType.NamePhonePad; |
||||
|
break; |
||||
|
|
||||
|
case TextInputContentType.Password: |
||||
|
KeyboardType = UIKeyboardType.Default; |
||||
|
IsSecureEntry = true; |
||||
|
break; |
||||
|
|
||||
|
case TextInputContentType.Social: |
||||
|
KeyboardType = UIKeyboardType.Twitter; |
||||
|
break; |
||||
|
|
||||
|
case TextInputContentType.Search: |
||||
|
KeyboardType = UIKeyboardType.WebSearch; |
||||
|
break; |
||||
|
} |
||||
|
|
||||
|
if (options.IsSensitive) |
||||
|
{ |
||||
|
IsSecureEntry = true; |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
void ITextInputMethodImpl.Reset() |
||||
|
{ |
||||
|
ResignFirstResponder(); |
||||
|
} |
||||
|
} |
||||
|
|||||
@ -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