Merge pull request #43 from irihitech/hotkey
Add new Control: KeyGestureInput
This commit is contained in:
49
src/Ursa.Themes.Semi/Controls/KeyGestureInput.axaml
Normal file
49
src/Ursa.Themes.Semi/Controls/KeyGestureInput.axaml
Normal file
@@ -0,0 +1,49 @@
|
||||
<ResourceDictionary
|
||||
xmlns="https://github.com/avaloniaui"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:converters="using:Avalonia.Controls.Converters"
|
||||
xmlns:u="https://irihi.tech/ursa">
|
||||
<converters:PlatformKeyGestureConverter x:Key="KeyGestureConverter" />
|
||||
|
||||
<ControlTheme x:Key="{x:Type u:KeyGestureInput}" TargetType="u:KeyGestureInput">
|
||||
<Setter Property="Width" Value="{DynamicResource KeyGestureInputWidth}" />
|
||||
<Setter Property="Height" Value="{DynamicResource KeyGestureInputHeight}" />
|
||||
<Setter Property="Background" Value="{DynamicResource KeyGestureInputBackground}" />
|
||||
<Setter Property="BorderBrush" Value="{DynamicResource KeyGestureInputBorderBrush}" />
|
||||
<Setter Property="BorderThickness" Value="{DynamicResource KeyGestureInputBorderThickness}" />
|
||||
<Setter Property="CornerRadius" Value="{DynamicResource KeyGestureInputCornerRadius}" />
|
||||
|
||||
<Setter Property="Template">
|
||||
<ControlTemplate TargetType="u:KeyGestureInput">
|
||||
<Border
|
||||
Name="Background"
|
||||
HorizontalAlignment="Stretch"
|
||||
VerticalAlignment="Stretch"
|
||||
Background="{TemplateBinding Background}"
|
||||
BorderBrush="{TemplateBinding BorderBrush}"
|
||||
BorderThickness="{TemplateBinding BorderThickness}"
|
||||
CornerRadius="{TemplateBinding CornerRadius}">
|
||||
<SelectableTextBlock
|
||||
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
|
||||
VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
|
||||
Text="{TemplateBinding Gesture,
|
||||
Converter={StaticResource KeyGestureConverter}}" />
|
||||
</Border>
|
||||
</ControlTemplate>
|
||||
</Setter>
|
||||
<Style Selector="^:pointerover /template/ Border#Background">
|
||||
<Setter Property="Background" Value="{DynamicResource KeyGestureInputPointeroverBackground}" />
|
||||
</Style>
|
||||
<Style Selector="^:pressed /template/ Border#Background">
|
||||
<Setter Property="Background" Value="{DynamicResource KeyGestureInputPressedBackground}" />
|
||||
</Style>
|
||||
<Style Selector="^:focus /template/ Border#Background">
|
||||
<Setter Property="Background" Value="{DynamicResource KeyGestureInputPressedBackground}" />
|
||||
<Setter Property="BorderBrush" Value="{DynamicResource KeyGestureInputFocusBorderBrush}" />
|
||||
</Style>
|
||||
<Style Selector="^:focus-within /template/ Border#Background">
|
||||
<Setter Property="Background" Value="{DynamicResource KeyGestureInputPressedBackground}" />
|
||||
<Setter Property="BorderBrush" Value="{DynamicResource KeyGestureInputFocusBorderBrush}" />
|
||||
</Style>
|
||||
</ControlTheme>
|
||||
</ResourceDictionary>
|
||||
@@ -7,6 +7,7 @@
|
||||
<ResourceInclude Source="Divider.axaml" />
|
||||
<ResourceInclude Source="DualBadge.axaml" />
|
||||
<ResourceInclude Source="IPv4Box.axaml" />
|
||||
<ResourceInclude Source="KeyGestureInput.axaml" />
|
||||
<ResourceInclude Source="Loading.axaml" />
|
||||
<ResourceInclude Source="Navigation.axaml" />
|
||||
<ResourceInclude Source="Pagination.axaml" />
|
||||
|
||||
9
src/Ursa.Themes.Semi/Themes/Dark/KeyGestureInput.axaml
Normal file
9
src/Ursa.Themes.Semi/Themes/Dark/KeyGestureInput.axaml
Normal file
@@ -0,0 +1,9 @@
|
||||
<ResourceDictionary xmlns="https://github.com/avaloniaui" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
|
||||
<!-- Add Resources Here -->
|
||||
<SolidColorBrush x:Key="KeyGestureInputBackground" Opacity="0.12" Color="White" />
|
||||
<SolidColorBrush x:Key="KeyGestureInputPointeroverBackground" Opacity="0.16" Color="White" />
|
||||
<SolidColorBrush x:Key="KeyGestureInputPressedBackground" Opacity="0.2" Color="White" />
|
||||
<SolidColorBrush x:Key="KeyGestureInputBorderBrush" Color="Transparent" />
|
||||
<SolidColorBrush x:Key="KeyGestureInputDisabledBackground" Opacity="0.04" Color="#E6E8EA" />
|
||||
<SolidColorBrush x:Key="KeyGestureInputFocusBorderBrush" Color="#FF54A9FF" />
|
||||
</ResourceDictionary>
|
||||
@@ -7,6 +7,7 @@
|
||||
<MergeResourceInclude Source="Divider.axaml" />
|
||||
<MergeResourceInclude Source="DualBadge.axaml" />
|
||||
<MergeResourceInclude Source="IPv4Box.axaml" />
|
||||
<MergeResourceInclude Source="KeyGestureInput.axaml" />
|
||||
<MergeResourceInclude Source="Loading.axaml" />
|
||||
<MergeResourceInclude Source="NavigationMenu.axaml" />
|
||||
<MergeResourceInclude Source="Pagination.axaml" />
|
||||
|
||||
9
src/Ursa.Themes.Semi/Themes/Light/KeyGestureInput.axaml
Normal file
9
src/Ursa.Themes.Semi/Themes/Light/KeyGestureInput.axaml
Normal file
@@ -0,0 +1,9 @@
|
||||
<ResourceDictionary xmlns="https://github.com/avaloniaui" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
|
||||
<!-- Add Resources Here -->
|
||||
<SolidColorBrush x:Key="KeyGestureInputBackground" Opacity="0.05" Color="#FF2E3238" />
|
||||
<SolidColorBrush x:Key="KeyGestureInputPointeroverBackground" Opacity="0.09" Color="#FF2E3238" />
|
||||
<SolidColorBrush x:Key="KeyGestureInputPressedBackground" Opacity="0.13" Color="#FF2E3238" />
|
||||
<SolidColorBrush x:Key="KeyGestureInputBorderBrush" Color="Transparent" />
|
||||
<SolidColorBrush x:Key="KeyGestureInputDisabledBackground" Opacity="0.02" Color="#2E3238" />
|
||||
<SolidColorBrush x:Key="KeyGestureInputFocusBorderBrush" Color="#FF0077FA" />
|
||||
</ResourceDictionary>
|
||||
@@ -7,6 +7,7 @@
|
||||
<MergeResourceInclude Source="Divider.axaml" />
|
||||
<MergeResourceInclude Source="DualBadge.axaml" />
|
||||
<MergeResourceInclude Source="IPv4Box.axaml" />
|
||||
<MergeResourceInclude Source="KeyGestureInput.axaml" />
|
||||
<MergeResourceInclude Source="Loading.axaml" />
|
||||
<MergeResourceInclude Source="NavigationMenu.axaml" />
|
||||
<MergeResourceInclude Source="Pagination.axaml" />
|
||||
|
||||
7
src/Ursa.Themes.Semi/Themes/Shared/KeyGestureInput.axaml
Normal file
7
src/Ursa.Themes.Semi/Themes/Shared/KeyGestureInput.axaml
Normal file
@@ -0,0 +1,7 @@
|
||||
<ResourceDictionary xmlns="https://github.com/avaloniaui" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
|
||||
<!-- Add Resources Here -->
|
||||
<x:Double x:Key="KeyGestureInputWidth">80</x:Double>
|
||||
<x:Double x:Key="KeyGestureInputHeight">32</x:Double>
|
||||
<CornerRadius x:Key="KeyGestureInputCornerRadius">3</CornerRadius>
|
||||
<Thickness x:Key="KeyGestureInputBorderThickness">1</Thickness>
|
||||
</ResourceDictionary>
|
||||
@@ -7,6 +7,7 @@
|
||||
<MergeResourceInclude Source="Divider.axaml" />
|
||||
<MergeResourceInclude Source="DualBadge.axaml" />
|
||||
<MergeResourceInclude Source="IPv4Box.axaml" />
|
||||
<MergeResourceInclude Source="KeyGestureInput.axaml" />
|
||||
<MergeResourceInclude Source="NavigationMenu.axaml" />
|
||||
<MergeResourceInclude Source="Pagination.axaml" />
|
||||
<MergeResourceInclude Source="TagInput.axaml" />
|
||||
|
||||
Reference in New Issue
Block a user