mirror of
https://gitee.com/chinware/atomui.git
synced 2024-11-29 18:38:16 +08:00
Refactor Icon generator
This commit is contained in:
parent
95905bc890
commit
4768ea0e36
@ -10,24 +10,24 @@
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup Condition=" '$(Configuration)' == 'DEBUG' ">
|
||||
<ProjectReference Include="../../src/AtomUI.Base/AtomUI.Base.csproj" />
|
||||
<ProjectReference Include="../../src/AtomUI.Controls/AtomUI.Controls.csproj" />
|
||||
<ProjectReference Include="../../src/AtomUI.Icon/AtomUI.Icon.csproj" />
|
||||
<ProjectReference Include="../../src/AtomUI.Icon.AntDesign/AtomUI.Icon.AntDesign.csproj" />
|
||||
<ProjectReference Include="../../src/AtomUI.Theme/AtomUI.Theme.csproj" />
|
||||
<ProjectReference Include="..\..\src\AtomUI.Base\AtomUI.Base.csproj" />
|
||||
<ProjectReference Include="..\..\src\AtomUI.Controls\AtomUI.Controls.csproj" />
|
||||
<ProjectReference Include="..\..\src\AtomUI.IconPkg\AtomUI.IconPkg.csproj" />
|
||||
<ProjectReference Include="..\..\src\AtomUI.IconPkg.AntDesign\AtomUI.IconPkg.AntDesign.csproj" />
|
||||
<ProjectReference Include="..\..\src\AtomUI.Theme\AtomUI.Theme.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup Condition=" '$(Configuration)' == 'DEBUG' And $([MSBuild]::IsOSPlatform('Windows')) ">
|
||||
<ProjectReference Include="../../src/AtomUI.Platform.Win32/AtomUI.Platform.Win32.csproj" />
|
||||
<ProjectReference Include="..\..\src\AtomUI.Platform.Win32\AtomUI.Platform.Win32.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup Condition=" '$(Configuration)' == 'RELEASE' ">
|
||||
<Reference Include="../../_output/Bin/Release/AtomUI.Base.dll" />
|
||||
<Reference Include="../../_output/Bin/Release/AtomUI.Controls.dll" />
|
||||
<Reference Include="../../_output/Bin/Release/AtomUI.Icon.dll" />
|
||||
<Reference Include="../../_output/Bin/Release/AtomUI.Icon.AntDesign.dll" />
|
||||
<Reference Include="../../_output/Bin/Release/AtomUI.Theme.dll" />
|
||||
<Reference Include="../../_output/Bin/Release/AtomUI.Platform.Win32.dll" />
|
||||
<Reference Include="..\..\_output\Bin\Release\AtomUI.Base.dll" />
|
||||
<Reference Include="..\..\_output\Bin\Release\AtomUI.Controls.dll" />
|
||||
<Reference Include="..\..\_output\Bin\Release\AtomUI.Icon.dll" />
|
||||
<Reference Include="..\..\_output\Bin\Release\AtomUI.Icon.AntDesign.dll" />
|
||||
<Reference Include="..\..\_output\Bin\Release\AtomUI.Theme.dll" />
|
||||
<Reference Include="..\..\_output\Bin\Release\AtomUI.Platform.Win32.dll" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup Condition=" '$(Configuration)' == 'RELEASE' ">
|
||||
|
@ -1,7 +1,7 @@
|
||||
using AtomUI.Data;
|
||||
using AtomUI.IconPkg;
|
||||
using AtomUI.Theme.Data;
|
||||
using AtomUI.Theme.Styling;
|
||||
using AtomUI.Utils;
|
||||
using Avalonia;
|
||||
using Avalonia.Controls;
|
||||
using Avalonia.Controls.Metadata;
|
||||
@ -185,7 +185,7 @@ public class AddOnDecoratedBox : ContentControl
|
||||
|
||||
if (change.Property == LeftAddOnProperty || change.Property == RightAddOnProperty)
|
||||
{
|
||||
if (change.NewValue is PathIcon icon)
|
||||
if (change.NewValue is Icon icon)
|
||||
{
|
||||
SetupIconTypeAddOnSize(icon);
|
||||
}
|
||||
@ -201,19 +201,19 @@ public class AddOnDecoratedBox : ContentControl
|
||||
|
||||
if (change.Property == SizeTypeProperty)
|
||||
{
|
||||
if (LeftAddOn is PathIcon leftIconAddOn)
|
||||
if (LeftAddOn is Icon leftIconAddOn)
|
||||
{
|
||||
SetupIconTypeAddOnSize(leftIconAddOn);
|
||||
}
|
||||
|
||||
if (RightAddOn is PathIcon rightIconAddOn)
|
||||
if (RightAddOn is Icon rightIconAddOn)
|
||||
{
|
||||
SetupIconTypeAddOnSize(rightIconAddOn);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void SetupIconTypeAddOnSize(PathIcon icon)
|
||||
private void SetupIconTypeAddOnSize(Icon icon)
|
||||
{
|
||||
if (SizeType == SizeType.Large)
|
||||
{
|
||||
|
@ -1,4 +1,6 @@
|
||||
using AtomUI.Media;
|
||||
using AtomUI.IconPkg;
|
||||
using AtomUI.IconPkg.AntDesign;
|
||||
using AtomUI.Media;
|
||||
using AtomUI.Theme;
|
||||
using AtomUI.Theme.Data;
|
||||
using AtomUI.Theme.Styling;
|
||||
@ -185,10 +187,7 @@ internal class AddOnDecoratedInnerBoxTheme : BaseControlTheme
|
||||
|
||||
protected virtual void BuildClearButton(StackPanel addOnLayout, INameScope scope)
|
||||
{
|
||||
var closeIcon = new PathIcon
|
||||
{
|
||||
Kind = "CloseCircleFilled"
|
||||
};
|
||||
var closeIcon = AntDesignIconPackage.CloseCircleFilled();
|
||||
var clearButton = new IconButton
|
||||
{
|
||||
Name = ClearButtonPart,
|
||||
@ -199,11 +198,11 @@ internal class AddOnDecoratedInnerBoxTheme : BaseControlTheme
|
||||
GlobalTokenResourceKey.IconSize);
|
||||
TokenResourceBinder.CreateGlobalTokenBinding(clearButton, IconButton.IconWidthProperty,
|
||||
GlobalTokenResourceKey.IconSize);
|
||||
TokenResourceBinder.CreateGlobalTokenBinding(closeIcon, PathIcon.NormalFilledBrushProperty,
|
||||
TokenResourceBinder.CreateGlobalTokenBinding(closeIcon, Icon.NormalFilledBrushProperty,
|
||||
GlobalTokenResourceKey.ColorTextQuaternary);
|
||||
TokenResourceBinder.CreateGlobalTokenBinding(closeIcon, PathIcon.ActiveFilledBrushProperty,
|
||||
TokenResourceBinder.CreateGlobalTokenBinding(closeIcon, Icon.ActiveFilledBrushProperty,
|
||||
GlobalTokenResourceKey.ColorTextTertiary);
|
||||
TokenResourceBinder.CreateGlobalTokenBinding(closeIcon, PathIcon.SelectedFilledBrushProperty,
|
||||
TokenResourceBinder.CreateGlobalTokenBinding(closeIcon, Icon.SelectedFilledBrushProperty,
|
||||
GlobalTokenResourceKey.ColorText);
|
||||
|
||||
clearButton.RegisterInNameScope(scope);
|
||||
@ -241,7 +240,7 @@ internal class AddOnDecoratedInnerBoxTheme : BaseControlTheme
|
||||
largeStyle.Add(innerBoxContentStyle);
|
||||
}
|
||||
{
|
||||
var iconStyle = new Style(selector => selector.Nesting().Template().Descendant().OfType<PathIcon>());
|
||||
var iconStyle = new Style(selector => selector.Nesting().Template().Descendant().OfType<Icon>());
|
||||
iconStyle.Add(Layoutable.WidthProperty, GlobalTokenResourceKey.IconSizeLG);
|
||||
iconStyle.Add(Layoutable.HeightProperty, GlobalTokenResourceKey.IconSizeLG);
|
||||
largeStyle.Add(iconStyle);
|
||||
@ -259,7 +258,7 @@ internal class AddOnDecoratedInnerBoxTheme : BaseControlTheme
|
||||
middleStyle.Add(innerBoxContentStyle);
|
||||
}
|
||||
{
|
||||
var iconStyle = new Style(selector => selector.Nesting().Template().Descendant().OfType<PathIcon>());
|
||||
var iconStyle = new Style(selector => selector.Nesting().Template().Descendant().OfType<Icon>());
|
||||
iconStyle.Add(Layoutable.WidthProperty, GlobalTokenResourceKey.IconSize);
|
||||
iconStyle.Add(Layoutable.HeightProperty, GlobalTokenResourceKey.IconSize);
|
||||
middleStyle.Add(iconStyle);
|
||||
@ -277,7 +276,7 @@ internal class AddOnDecoratedInnerBoxTheme : BaseControlTheme
|
||||
smallStyle.Add(innerBoxContentStyle);
|
||||
}
|
||||
{
|
||||
var iconStyle = new Style(selector => selector.Nesting().Template().Descendant().OfType<PathIcon>());
|
||||
var iconStyle = new Style(selector => selector.Nesting().Template().Descendant().OfType<Icon>());
|
||||
iconStyle.Add(Layoutable.WidthProperty, GlobalTokenResourceKey.IconSizeSM);
|
||||
iconStyle.Add(Layoutable.HeightProperty, GlobalTokenResourceKey.IconSizeSM);
|
||||
smallStyle.Add(iconStyle);
|
||||
@ -511,8 +510,8 @@ internal class AddOnDecoratedInnerBoxTheme : BaseControlTheme
|
||||
selector.Nesting().PropertyEquals(AddOnDecoratedInnerBox.StatusProperty, AddOnDecoratedStatus.Error));
|
||||
{
|
||||
var iconStyle = new Style(selector => Selectors.Or(selector.Nesting().Template().Name(LeftAddOnPart),
|
||||
selector.Nesting().Template().Name(RightAddOnPart)).Nesting().Descendant().OfType<PathIcon>());
|
||||
iconStyle.Add(PathIcon.NormalFilledBrushProperty, GlobalTokenResourceKey.ColorError);
|
||||
selector.Nesting().Template().Name(RightAddOnPart)).Nesting().Descendant().OfType<Icon>());
|
||||
iconStyle.Add(Icon.NormalFilledBrushProperty, GlobalTokenResourceKey.ColorError);
|
||||
errorStyle.Add(iconStyle);
|
||||
}
|
||||
Add(errorStyle);
|
||||
@ -523,8 +522,8 @@ internal class AddOnDecoratedInnerBoxTheme : BaseControlTheme
|
||||
selector.Nesting().PropertyEquals(AddOnDecoratedInnerBox.StatusProperty, AddOnDecoratedStatus.Warning));
|
||||
{
|
||||
var iconStyle = new Style(selector => Selectors.Or(selector.Nesting().Template().Name(LeftAddOnPart),
|
||||
selector.Nesting().Template().Name(RightAddOnPart)).Nesting().Descendant().OfType<PathIcon>());
|
||||
iconStyle.Add(PathIcon.NormalFilledBrushProperty, GlobalTokenResourceKey.ColorWarning);
|
||||
selector.Nesting().Template().Name(RightAddOnPart)).Nesting().Descendant().OfType<Icon>());
|
||||
iconStyle.Add(Icon.NormalFilledBrushProperty, GlobalTokenResourceKey.ColorWarning);
|
||||
warningStyle.Add(iconStyle);
|
||||
}
|
||||
Add(warningStyle);
|
||||
|
@ -1,6 +1,7 @@
|
||||
using AtomUI.Theme.Data;
|
||||
using AtomUI.IconPkg;
|
||||
using AtomUI.IconPkg.AntDesign;
|
||||
using AtomUI.Theme.Data;
|
||||
using AtomUI.Theme.Styling;
|
||||
using AtomUI.Utils;
|
||||
using Avalonia;
|
||||
using Avalonia.Controls;
|
||||
using Avalonia.Controls.Primitives;
|
||||
@ -33,8 +34,8 @@ public class Alert : TemplatedControl
|
||||
public static readonly StyledProperty<bool> IsClosableProperty =
|
||||
AvaloniaProperty.Register<Alert, bool>(nameof(IsClosable));
|
||||
|
||||
public static readonly StyledProperty<PathIcon?> CloseIconProperty =
|
||||
AvaloniaProperty.Register<Alert, PathIcon?>(nameof(CloseIcon));
|
||||
public static readonly StyledProperty<Icon?> CloseIconProperty =
|
||||
AvaloniaProperty.Register<Alert, Icon?>(nameof(CloseIcon));
|
||||
|
||||
public static readonly StyledProperty<string> MessageProperty =
|
||||
AvaloniaProperty.Register<Alert, string>(nameof(Message));
|
||||
@ -69,7 +70,7 @@ public class Alert : TemplatedControl
|
||||
set => SetValue(IsClosableProperty, value);
|
||||
}
|
||||
|
||||
public PathIcon? CloseIcon
|
||||
public Icon? CloseIcon
|
||||
{
|
||||
get => GetValue(CloseIconProperty);
|
||||
set => SetValue(CloseIconProperty, value);
|
||||
@ -144,13 +145,10 @@ public class Alert : TemplatedControl
|
||||
{
|
||||
if (CloseIcon is null)
|
||||
{
|
||||
CloseIcon = new PathIcon
|
||||
{
|
||||
Kind = "CloseOutlined"
|
||||
};
|
||||
TokenResourceBinder.CreateTokenBinding(CloseIcon, PathIcon.NormalFilledBrushProperty,
|
||||
CloseIcon = AntDesignIconPackage.CloseOutlined();
|
||||
TokenResourceBinder.CreateTokenBinding(CloseIcon, Icon.NormalFilledBrushProperty,
|
||||
GlobalTokenResourceKey.ColorIcon);
|
||||
TokenResourceBinder.CreateTokenBinding(CloseIcon, PathIcon.ActiveFilledBrushProperty,
|
||||
TokenResourceBinder.CreateTokenBinding(CloseIcon, Icon.ActiveFilledBrushProperty,
|
||||
GlobalTokenResourceKey.ColorIconHover);
|
||||
}
|
||||
}
|
||||
|
@ -1,4 +1,6 @@
|
||||
using AtomUI.Data;
|
||||
using AtomUI.IconPkg;
|
||||
using AtomUI.IconPkg.AntDesign;
|
||||
using AtomUI.Theme;
|
||||
using AtomUI.Theme.Data;
|
||||
using AtomUI.Theme.Styling;
|
||||
@ -142,13 +144,13 @@ internal class AlertTheme : BaseControlTheme
|
||||
|
||||
private void BuildInfoIconStyle()
|
||||
{
|
||||
var infoIconSelector = default(Selector).Nesting().Template().OfType<PathIcon>().Name(InfoIconPart);
|
||||
var infoIconSelector = default(Selector).Nesting().Template().OfType<Icon>().Name(InfoIconPart);
|
||||
{
|
||||
var successStyle = new Style(selector =>
|
||||
selector.Nesting().PropertyEquals(Alert.TypeProperty, AlertType.Success));
|
||||
var infoIconStyle = new Style(selector => infoIconSelector);
|
||||
infoIconStyle.Add(PathIcon.KindProperty, "CheckCircleFilled");
|
||||
infoIconStyle.Add(PathIcon.NormalFilledBrushProperty, GlobalTokenResourceKey.ColorSuccess);
|
||||
infoIconStyle.Add(Icon.IconInfoProperty, AntDesignIconPackage.Current.GetIconInfo(AntDesignIconKind.CheckCircleFilled));
|
||||
infoIconStyle.Add(Icon.NormalFilledBrushProperty, GlobalTokenResourceKey.ColorSuccess);
|
||||
successStyle.Add(infoIconStyle);
|
||||
Add(successStyle);
|
||||
}
|
||||
@ -157,8 +159,8 @@ internal class AlertTheme : BaseControlTheme
|
||||
var infoStyle = new Style(selector =>
|
||||
selector.Nesting().PropertyEquals(Alert.TypeProperty, AlertType.Info));
|
||||
var infoIconStyle = new Style(selector => infoIconSelector);
|
||||
infoIconStyle.Add(PathIcon.KindProperty, "InfoCircleFilled");
|
||||
infoIconStyle.Add(PathIcon.NormalFilledBrushProperty, GlobalTokenResourceKey.ColorPrimary);
|
||||
infoIconStyle.Add(Icon.IconInfoProperty, AntDesignIconPackage.Current.GetIconInfo(AntDesignIconKind.InfoCircleFilled));
|
||||
infoIconStyle.Add(Icon.NormalFilledBrushProperty, GlobalTokenResourceKey.ColorPrimary);
|
||||
infoStyle.Add(infoIconStyle);
|
||||
Add(infoStyle);
|
||||
}
|
||||
@ -167,8 +169,8 @@ internal class AlertTheme : BaseControlTheme
|
||||
var warningStyle = new Style(selector =>
|
||||
selector.Nesting().PropertyEquals(Alert.TypeProperty, AlertType.Warning));
|
||||
var infoIconStyle = new Style(selector => infoIconSelector);
|
||||
infoIconStyle.Add(PathIcon.KindProperty, "ExclamationCircleFilled");
|
||||
infoIconStyle.Add(PathIcon.NormalFilledBrushProperty, GlobalTokenResourceKey.ColorWarning);
|
||||
infoIconStyle.Add(Icon.IconInfoProperty, AntDesignIconPackage.Current.GetIconInfo(AntDesignIconKind.ExclamationCircleFilled));
|
||||
infoIconStyle.Add(Icon.NormalFilledBrushProperty, GlobalTokenResourceKey.ColorWarning);
|
||||
warningStyle.Add(infoIconStyle);
|
||||
Add(warningStyle);
|
||||
}
|
||||
@ -177,8 +179,8 @@ internal class AlertTheme : BaseControlTheme
|
||||
var errorStyle = new Style(selector =>
|
||||
selector.Nesting().PropertyEquals(Alert.TypeProperty, AlertType.Error));
|
||||
var infoIconStyle = new Style(selector => infoIconSelector);
|
||||
infoIconStyle.Add(PathIcon.KindProperty, "CloseCircleFilled");
|
||||
infoIconStyle.Add(PathIcon.NormalFilledBrushProperty, GlobalTokenResourceKey.ColorError);
|
||||
infoIconStyle.Add(Icon.IconInfoProperty, AntDesignIconPackage.Current.GetIconInfo(AntDesignIconKind.CloseCircleFilled));
|
||||
infoIconStyle.Add(Icon.NormalFilledBrushProperty, GlobalTokenResourceKey.ColorError);
|
||||
errorStyle.Add(infoIconStyle);
|
||||
Add(errorStyle);
|
||||
}
|
||||
@ -311,9 +313,9 @@ internal class AlertTheme : BaseControlTheme
|
||||
return closeBtn;
|
||||
}
|
||||
|
||||
private PathIcon CreateInfoIcon(INameScope scope)
|
||||
private Icon CreateInfoIcon(INameScope scope)
|
||||
{
|
||||
var infoIcon = new PathIcon
|
||||
var infoIcon = new Icon
|
||||
{
|
||||
Name = InfoIconPart
|
||||
};
|
||||
|
@ -21,6 +21,7 @@
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\AtomUI.IconPkg.AntDesign\AtomUI.IconPkg.AntDesign.csproj" />
|
||||
<ProjectReference Include="..\AtomUI.Theme\AtomUI.Theme.csproj"/>
|
||||
<ProjectReference Include="..\AtomUI.Generator\AtomUI.Generator.csproj" OutputItemType="Analyzer" ReferenceOutputAssembly="false"/>
|
||||
</ItemGroup>
|
||||
|
@ -1,8 +1,9 @@
|
||||
using AtomUI.Media;
|
||||
using AtomUI.IconPkg;
|
||||
using AtomUI.IconPkg.AntDesign;
|
||||
using AtomUI.Media;
|
||||
using AtomUI.Theme;
|
||||
using AtomUI.Theme.Data;
|
||||
using AtomUI.Theme.Styling;
|
||||
using AtomUI.Theme.Utils;
|
||||
using AtomUI.Utils;
|
||||
using Avalonia.Animation;
|
||||
using Avalonia.Controls;
|
||||
@ -104,15 +105,12 @@ internal class ButtonSpinnerTheme : BaseControlTheme
|
||||
|
||||
TokenResourceBinder.CreateTokenBinding(spinnerLayout, Layoutable.WidthProperty,
|
||||
ButtonSpinnerTokenResourceKey.HandleWidth);
|
||||
|
||||
var increaseButtonIcon = AntDesignIconPackage.UpOutlined();
|
||||
|
||||
var increaseButtonIcon = new PathIcon
|
||||
{
|
||||
Kind = "UpOutlined"
|
||||
};
|
||||
|
||||
TokenResourceBinder.CreateGlobalTokenBinding(increaseButtonIcon, PathIcon.ActiveFilledBrushProperty,
|
||||
TokenResourceBinder.CreateGlobalTokenBinding(increaseButtonIcon, Icon.ActiveFilledBrushProperty,
|
||||
ButtonSpinnerTokenResourceKey.HandleHoverColor);
|
||||
TokenResourceBinder.CreateGlobalTokenBinding(increaseButtonIcon, PathIcon.SelectedFilledBrushProperty,
|
||||
TokenResourceBinder.CreateGlobalTokenBinding(increaseButtonIcon, Icon.SelectedFilledBrushProperty,
|
||||
GlobalTokenResourceKey.ColorPrimaryActive);
|
||||
|
||||
var increaseButton = new IconButton
|
||||
@ -140,14 +138,11 @@ internal class ButtonSpinnerTheme : BaseControlTheme
|
||||
ButtonSpinnerTokenResourceKey.HandleIconSize);
|
||||
increaseButton.RegisterInNameScope(scope);
|
||||
|
||||
var decreaseButtonIcon = new PathIcon
|
||||
{
|
||||
Kind = "DownOutlined"
|
||||
};
|
||||
var decreaseButtonIcon = AntDesignIconPackage.DownOutlined();
|
||||
|
||||
TokenResourceBinder.CreateGlobalTokenBinding(decreaseButtonIcon, PathIcon.ActiveFilledBrushProperty,
|
||||
TokenResourceBinder.CreateGlobalTokenBinding(decreaseButtonIcon, Icon.ActiveFilledBrushProperty,
|
||||
ButtonSpinnerTokenResourceKey.HandleHoverColor);
|
||||
TokenResourceBinder.CreateGlobalTokenBinding(decreaseButtonIcon, PathIcon.SelectedFilledBrushProperty,
|
||||
TokenResourceBinder.CreateGlobalTokenBinding(decreaseButtonIcon, Icon.SelectedFilledBrushProperty,
|
||||
GlobalTokenResourceKey.ColorPrimaryActive);
|
||||
|
||||
var decreaseButton = new IconButton
|
||||
|
@ -1,4 +1,5 @@
|
||||
using AtomUI.Icon;
|
||||
using AtomUI.IconPkg;
|
||||
using AtomUI.IconPkg.AntDesign;
|
||||
using AtomUI.Theme;
|
||||
using AtomUI.Theme.Styling;
|
||||
using Avalonia;
|
||||
@ -31,12 +32,9 @@ internal abstract class BaseButtonTheme : BaseControlTheme
|
||||
{
|
||||
return new FuncControlTemplate<Button>((button, scope) =>
|
||||
{
|
||||
var loadingIcon = new PathIcon
|
||||
{
|
||||
Kind = "LoadingOutlined",
|
||||
Name = LoadingIconPart
|
||||
};
|
||||
|
||||
var loadingIcon = AntDesignIconPackage.LoadingOutlined();
|
||||
loadingIcon.Name = LoadingIconPart;
|
||||
|
||||
loadingIcon.RegisterInNameScope(scope);
|
||||
|
||||
CreateTemplateParentBinding(loadingIcon, Layoutable.WidthProperty, Button.IconSizeProperty);
|
||||
@ -271,7 +269,7 @@ internal abstract class BaseButtonTheme : BaseControlTheme
|
||||
|
||||
var loadingIconStyle = new Style(selector => selector.Nesting().Template().Name(LoadingIconPart));
|
||||
loadingIconStyle.Add(Visual.IsVisibleProperty, true);
|
||||
loadingIconStyle.Add(PathIcon.LoadingAnimationProperty, IconAnimation.Spin);
|
||||
loadingIconStyle.Add(Icon.LoadingAnimationProperty, IconAnimation.Spin);
|
||||
loadingStyle.Add(loadingIconStyle);
|
||||
}
|
||||
loadingStyle.Add(Visual.OpacityProperty, GlobalTokenResourceKey.OpacityLoading);
|
||||
|
@ -1,6 +1,6 @@
|
||||
using AtomUI.Controls.Utils;
|
||||
using AtomUI.Data;
|
||||
using AtomUI.Icon;
|
||||
using AtomUI.IconPkg;
|
||||
using AtomUI.Media;
|
||||
using AtomUI.Theme.Data;
|
||||
using AtomUI.Theme.Styling;
|
||||
@ -64,8 +64,8 @@ public class Button : AvaloniaButton,
|
||||
public static readonly StyledProperty<ButtonSizeType> SizeTypeProperty =
|
||||
AvaloniaProperty.Register<Button, ButtonSizeType>(nameof(SizeType), ButtonSizeType.Middle);
|
||||
|
||||
public static readonly StyledProperty<PathIcon?> IconProperty
|
||||
= AvaloniaProperty.Register<Button, PathIcon?>(nameof(Icon));
|
||||
public static readonly StyledProperty<Icon?> IconProperty
|
||||
= AvaloniaProperty.Register<Button, Icon?>(nameof(Icon));
|
||||
|
||||
public static readonly StyledProperty<string?> TextProperty
|
||||
= AvaloniaProperty.Register<Button, string?>(nameof(Text));
|
||||
@ -109,7 +109,7 @@ public class Button : AvaloniaButton,
|
||||
set => SetValue(SizeTypeProperty, value);
|
||||
}
|
||||
|
||||
public PathIcon? Icon
|
||||
public Icon? Icon
|
||||
{
|
||||
get => GetValue(IconProperty);
|
||||
set => SetValue(IconProperty, value);
|
||||
@ -214,7 +214,7 @@ public class Button : AvaloniaButton,
|
||||
|
||||
protected ControlStyleState _styleState;
|
||||
private bool _initialized;
|
||||
private PathIcon? _loadingIcon;
|
||||
private Icon? _loadingIcon;
|
||||
|
||||
static Button()
|
||||
{
|
||||
@ -316,7 +316,6 @@ public class Button : AvaloniaButton,
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
_initialized = true;
|
||||
}
|
||||
}
|
||||
@ -381,24 +380,28 @@ public class Button : AvaloniaButton,
|
||||
UpdatePseudoClasses();
|
||||
}
|
||||
|
||||
if (e.Property == IconProperty)
|
||||
{
|
||||
SetupIcon();
|
||||
}
|
||||
|
||||
if (e.Property == IsDangerProperty ||
|
||||
e.Property == IsGhostProperty ||
|
||||
e.Property == ButtonTypeProperty)
|
||||
{
|
||||
SetupIconBrush();
|
||||
}
|
||||
|
||||
if (e.Property == BorderBrushProperty ||
|
||||
e.Property == ButtonTypeProperty ||
|
||||
e.Property == IsEnabledProperty)
|
||||
{
|
||||
SetupEffectiveBorderThickness();
|
||||
}
|
||||
|
||||
if (VisualRoot is not null)
|
||||
{
|
||||
if (e.Property == IconProperty)
|
||||
{
|
||||
SetupIcon();
|
||||
SetupIconBrush();
|
||||
}
|
||||
|
||||
if (e.Property == IsDangerProperty ||
|
||||
e.Property == IsGhostProperty ||
|
||||
e.Property == ButtonTypeProperty)
|
||||
{
|
||||
SetupIconBrush();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void SetupControlTheme()
|
||||
@ -477,7 +480,7 @@ public class Button : AvaloniaButton,
|
||||
protected override void OnApplyTemplate(TemplateAppliedEventArgs e)
|
||||
{
|
||||
base.OnApplyTemplate(e);
|
||||
_loadingIcon = e.NameScope.Find<PathIcon>(BaseButtonTheme.LoadingIconPart);
|
||||
_loadingIcon = e.NameScope.Find<Icon>(BaseButtonTheme.LoadingIconPart);
|
||||
HandleTemplateApplied(e.NameScope);
|
||||
SetupTransitions();
|
||||
}
|
||||
@ -618,44 +621,38 @@ public class Button : AvaloniaButton,
|
||||
else if (ButtonType == ButtonType.Link)
|
||||
{
|
||||
normalFilledBrushKey = GlobalTokenResourceKey.ColorLink;
|
||||
selectedFilledBrushKey = ButtonTokenResourceKey.DefaultActiveColor;
|
||||
activeFilledBrushKey = ButtonTokenResourceKey.DefaultHoverColor;
|
||||
if (IsGhost)
|
||||
{
|
||||
normalFilledBrushKey = GlobalTokenResourceKey.ColorLink;
|
||||
selectedFilledBrushKey = GlobalTokenResourceKey.ColorPrimaryActive;
|
||||
activeFilledBrushKey = GlobalTokenResourceKey.ColorPrimaryHover;
|
||||
}
|
||||
selectedFilledBrushKey = GlobalTokenResourceKey.ColorLinkActive;
|
||||
activeFilledBrushKey = GlobalTokenResourceKey.ColorLinkHover;
|
||||
|
||||
if (IsDanger)
|
||||
{
|
||||
normalFilledBrushKey = GlobalTokenResourceKey.ColorError;
|
||||
selectedFilledBrushKey = GlobalTokenResourceKey.ColorErrorActive;
|
||||
activeFilledBrushKey = GlobalTokenResourceKey.ColorErrorBorderHover;
|
||||
activeFilledBrushKey = GlobalTokenResourceKey.ColorErrorHover;
|
||||
}
|
||||
}
|
||||
|
||||
if (Icon is not null)
|
||||
{
|
||||
TokenResourceBinder.CreateGlobalTokenBinding(Icon, PathIcon.NormalFilledBrushProperty,
|
||||
TokenResourceBinder.CreateTokenBinding(Icon, Icon.NormalFilledBrushProperty,
|
||||
normalFilledBrushKey);
|
||||
TokenResourceBinder.CreateGlobalTokenBinding(Icon, PathIcon.SelectedFilledBrushProperty,
|
||||
TokenResourceBinder.CreateTokenBinding(Icon, Icon.SelectedFilledBrushProperty,
|
||||
selectedFilledBrushKey);
|
||||
TokenResourceBinder.CreateGlobalTokenBinding(Icon, PathIcon.ActiveFilledBrushProperty,
|
||||
TokenResourceBinder.CreateTokenBinding(Icon, Icon.ActiveFilledBrushProperty,
|
||||
activeFilledBrushKey);
|
||||
TokenResourceBinder.CreateGlobalTokenBinding(Icon, PathIcon.DisabledFilledBrushProperty,
|
||||
TokenResourceBinder.CreateTokenBinding(Icon, Icon.DisabledFilledBrushProperty,
|
||||
disabledFilledBrushKey);
|
||||
}
|
||||
|
||||
if (_loadingIcon is not null)
|
||||
{
|
||||
TokenResourceBinder.CreateGlobalTokenBinding(_loadingIcon, PathIcon.NormalFilledBrushProperty,
|
||||
TokenResourceBinder.CreateTokenBinding(_loadingIcon, Icon.NormalFilledBrushProperty,
|
||||
normalFilledBrushKey);
|
||||
TokenResourceBinder.CreateGlobalTokenBinding(_loadingIcon, PathIcon.SelectedFilledBrushProperty,
|
||||
TokenResourceBinder.CreateTokenBinding(_loadingIcon, Icon.SelectedFilledBrushProperty,
|
||||
selectedFilledBrushKey);
|
||||
TokenResourceBinder.CreateGlobalTokenBinding(_loadingIcon, PathIcon.ActiveFilledBrushProperty,
|
||||
TokenResourceBinder.CreateTokenBinding(_loadingIcon, Icon.ActiveFilledBrushProperty,
|
||||
activeFilledBrushKey);
|
||||
TokenResourceBinder.CreateGlobalTokenBinding(_loadingIcon, PathIcon.DisabledFilledBrushProperty,
|
||||
TokenResourceBinder.CreateTokenBinding(_loadingIcon, Icon.DisabledFilledBrushProperty,
|
||||
disabledFilledBrushKey);
|
||||
}
|
||||
|
||||
|
@ -1,5 +1,6 @@
|
||||
using AtomUI.Data;
|
||||
using AtomUI.Icon;
|
||||
using AtomUI.IconPkg;
|
||||
using AtomUI.IconPkg.AntDesign;
|
||||
using AtomUI.Theme.Data;
|
||||
using AtomUI.Theme.Styling;
|
||||
using AtomUI.Theme.TokenSystem;
|
||||
@ -129,7 +130,7 @@ public class DropdownButton : Button
|
||||
|
||||
#endregion
|
||||
|
||||
private PathIcon? _openIndicatorIcon;
|
||||
private Icon? _openIndicatorIcon;
|
||||
private MenuFlyoutPresenter? _menuFlyoutPresenter;
|
||||
private readonly FlyoutStateHelper _flyoutStateHelper;
|
||||
|
||||
@ -160,12 +161,10 @@ public class DropdownButton : Button
|
||||
|
||||
protected override void OnApplyTemplate(TemplateAppliedEventArgs e)
|
||||
{
|
||||
_openIndicatorIcon = new PathIcon
|
||||
{
|
||||
Kind = "DownOutlined"
|
||||
};
|
||||
BindUtils.RelayBind(this, IconSizeProperty, _openIndicatorIcon, WidthProperty);
|
||||
BindUtils.RelayBind(this, IconSizeProperty, _openIndicatorIcon, HeightProperty);
|
||||
_openIndicatorIcon = AntDesignIconPackage.DownOutlined();
|
||||
|
||||
TokenResourceBinder.CreateGlobalTokenBinding(_openIndicatorIcon, Icon.WidthProperty, GlobalTokenResourceKey.IconSizeSM);
|
||||
TokenResourceBinder.CreateGlobalTokenBinding(_openIndicatorIcon, Icon.HeightProperty, GlobalTokenResourceKey.IconSizeSM);
|
||||
|
||||
base.OnApplyTemplate(e);
|
||||
TokenResourceBinder.CreateGlobalTokenBinding(this, MarginToAnchorProperty, GlobalTokenResourceKey.MarginXXS);
|
||||
@ -264,13 +263,13 @@ public class DropdownButton : Button
|
||||
{
|
||||
if (_openIndicatorIcon is not null)
|
||||
{
|
||||
TokenResourceBinder.CreateGlobalTokenBinding(_openIndicatorIcon, PathIcon.NormalFilledBrushProperty,
|
||||
TokenResourceBinder.CreateGlobalTokenBinding(_openIndicatorIcon, Icon.NormalFilledBrushProperty,
|
||||
normalFilledBrushKey);
|
||||
TokenResourceBinder.CreateGlobalTokenBinding(_openIndicatorIcon, PathIcon.SelectedFilledBrushProperty,
|
||||
TokenResourceBinder.CreateGlobalTokenBinding(_openIndicatorIcon, Icon.SelectedFilledBrushProperty,
|
||||
selectedFilledBrushKey);
|
||||
TokenResourceBinder.CreateGlobalTokenBinding(_openIndicatorIcon, PathIcon.ActiveFilledBrushProperty,
|
||||
TokenResourceBinder.CreateGlobalTokenBinding(_openIndicatorIcon, Icon.ActiveFilledBrushProperty,
|
||||
activeFilledBrushKey);
|
||||
TokenResourceBinder.CreateGlobalTokenBinding(_openIndicatorIcon, PathIcon.DisabledFilledBrushProperty,
|
||||
TokenResourceBinder.CreateGlobalTokenBinding(_openIndicatorIcon, Icon.DisabledFilledBrushProperty,
|
||||
disabledFilledBrushKey);
|
||||
}
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
using AtomUI.Data;
|
||||
using AtomUI.Icon;
|
||||
using AtomUI.IconPkg;
|
||||
using AtomUI.Theme.Styling;
|
||||
using Avalonia;
|
||||
using Avalonia.Controls;
|
||||
@ -15,14 +15,14 @@ public class IconButton : AvaloniaButton, ICustomHitTest
|
||||
{
|
||||
#region 公共属性定义
|
||||
|
||||
public static readonly StyledProperty<PathIcon?> IconProperty
|
||||
= AvaloniaProperty.Register<IconButton, PathIcon?>(nameof(Icon));
|
||||
public static readonly StyledProperty<Icon?> IconProperty
|
||||
= AvaloniaProperty.Register<IconButton, Icon?>(nameof(Icon));
|
||||
|
||||
public static readonly StyledProperty<IconAnimation> LoadingAnimationProperty =
|
||||
PathIcon.LoadingAnimationProperty.AddOwner<IconButton>();
|
||||
Icon.LoadingAnimationProperty.AddOwner<IconButton>();
|
||||
|
||||
public static readonly StyledProperty<TimeSpan> LoadingAnimationDurationProperty =
|
||||
PathIcon.LoadingAnimationDurationProperty.AddOwner<IconButton>();
|
||||
Icon.LoadingAnimationDurationProperty.AddOwner<IconButton>();
|
||||
|
||||
public static readonly StyledProperty<double> IconWidthProperty
|
||||
= AvaloniaProperty.Register<IconButton, double>(nameof(IconWidth));
|
||||
@ -33,7 +33,7 @@ public class IconButton : AvaloniaButton, ICustomHitTest
|
||||
public static readonly StyledProperty<bool> IsEnableHoverEffectProperty
|
||||
= AvaloniaProperty.Register<IconButton, bool>(nameof(IsEnableHoverEffect));
|
||||
|
||||
public PathIcon? Icon
|
||||
public Icon? Icon
|
||||
{
|
||||
get => GetValue(IconProperty);
|
||||
set => SetValue(IconProperty, value);
|
||||
@ -97,7 +97,7 @@ public class IconButton : AvaloniaButton, ICustomHitTest
|
||||
{
|
||||
if (e.Property == IconProperty)
|
||||
{
|
||||
var oldIcon = e.GetOldValue<PathIcon?>();
|
||||
var oldIcon = e.GetOldValue<Icon?>();
|
||||
if (oldIcon is not null)
|
||||
{
|
||||
((ISetLogicalParent)oldIcon).SetParent(null);
|
||||
@ -118,9 +118,9 @@ public class IconButton : AvaloniaButton, ICustomHitTest
|
||||
{
|
||||
if (Icon is not null)
|
||||
{
|
||||
BindUtils.RelayBind(this, LoadingAnimationProperty, Icon, PathIcon.LoadingAnimationProperty);
|
||||
BindUtils.RelayBind(this, LoadingAnimationProperty, Icon, Icon.LoadingAnimationProperty);
|
||||
BindUtils.RelayBind(this, LoadingAnimationDurationProperty, Icon,
|
||||
PathIcon.LoadingAnimationDurationProperty);
|
||||
Icon.LoadingAnimationDurationProperty);
|
||||
BindUtils.RelayBind(this, IconHeightProperty, Icon, HeightProperty);
|
||||
BindUtils.RelayBind(this, IconWidthProperty, Icon, WidthProperty);
|
||||
}
|
||||
|
@ -1,4 +1,5 @@
|
||||
using AtomUI.Controls.Utils;
|
||||
using AtomUI.IconPkg;
|
||||
using AtomUI.Media;
|
||||
using AtomUI.Theme;
|
||||
using AtomUI.Theme.Styling;
|
||||
@ -65,7 +66,7 @@ internal class IconButtonTheme : BaseControlTheme
|
||||
|
||||
protected override void BuildInstanceStyles(Control control)
|
||||
{
|
||||
var iconStyle = new Style(selector => selector.Name(IconContentPart).Child().OfType<PathIcon>());
|
||||
var iconStyle = new Style(selector => selector.Name(IconContentPart).Child().OfType<Icon>());
|
||||
iconStyle.Add(Layoutable.HorizontalAlignmentProperty, HorizontalAlignment.Center);
|
||||
iconStyle.Add(Layoutable.VerticalAlignmentProperty, VerticalAlignment.Center);
|
||||
control.Styles.Add(iconStyle);
|
||||
|
@ -31,37 +31,31 @@ internal class LinkButtonTheme : BaseButtonTheme
|
||||
{
|
||||
var enabledStyle = new Style(selector => selector.Nesting());
|
||||
// 正常状态
|
||||
enabledStyle.Add(TemplatedControl.BackgroundProperty,
|
||||
new DynamicResourceExtension(ButtonTokenResourceKey.DefaultBg));
|
||||
enabledStyle.Add(TemplatedControl.ForegroundProperty,
|
||||
new DynamicResourceExtension(GlobalTokenResourceKey.ColorLink));
|
||||
enabledStyle.Add(TemplatedControl.BackgroundProperty, ButtonTokenResourceKey.DefaultBg);
|
||||
enabledStyle.Add(TemplatedControl.ForegroundProperty, GlobalTokenResourceKey.ColorLink);
|
||||
|
||||
// 正常 hover
|
||||
{
|
||||
var hoverStyle = new Style(selector => selector.Nesting().Class(StdPseudoClass.PointerOver));
|
||||
hoverStyle.Add(TemplatedControl.ForegroundProperty,
|
||||
new DynamicResourceExtension(GlobalTokenResourceKey.ColorLinkHover));
|
||||
hoverStyle.Add(TemplatedControl.ForegroundProperty, GlobalTokenResourceKey.ColorLinkHover);
|
||||
enabledStyle.Add(hoverStyle);
|
||||
}
|
||||
// 正常按下
|
||||
{
|
||||
var pressedStyle = new Style(selector =>
|
||||
selector.Nesting().Class(StdPseudoClass.PointerOver).Class(StdPseudoClass.Pressed));
|
||||
pressedStyle.Add(TemplatedControl.ForegroundProperty,
|
||||
new DynamicResourceExtension(GlobalTokenResourceKey.ColorLinkActive));
|
||||
pressedStyle.Add(TemplatedControl.ForegroundProperty, GlobalTokenResourceKey.ColorLinkActive);
|
||||
enabledStyle.Add(pressedStyle);
|
||||
}
|
||||
|
||||
// 危险按钮状态
|
||||
var dangerStyle = new Style(selector => selector.Nesting().PropertyEquals(Button.IsDangerProperty, true));
|
||||
dangerStyle.Add(TemplatedControl.ForegroundProperty,
|
||||
new DynamicResourceExtension(GlobalTokenResourceKey.ColorError));
|
||||
dangerStyle.Add(TemplatedControl.ForegroundProperty, GlobalTokenResourceKey.ColorError);
|
||||
|
||||
// 危险状态 hover
|
||||
{
|
||||
var hoverStyle = new Style(selector => selector.Nesting().Class(StdPseudoClass.PointerOver));
|
||||
hoverStyle.Add(TemplatedControl.ForegroundProperty,
|
||||
new DynamicResourceExtension(GlobalTokenResourceKey.ColorErrorHover));
|
||||
hoverStyle.Add(TemplatedControl.ForegroundProperty, GlobalTokenResourceKey.ColorErrorHover);
|
||||
dangerStyle.Add(hoverStyle);
|
||||
}
|
||||
|
||||
@ -69,8 +63,7 @@ internal class LinkButtonTheme : BaseButtonTheme
|
||||
{
|
||||
var pressedStyle = new Style(selector =>
|
||||
selector.Nesting().Class(StdPseudoClass.PointerOver).Class(StdPseudoClass.Pressed));
|
||||
pressedStyle.Add(TemplatedControl.ForegroundProperty,
|
||||
new DynamicResourceExtension(GlobalTokenResourceKey.ColorErrorActive));
|
||||
pressedStyle.Add(TemplatedControl.ForegroundProperty, GlobalTokenResourceKey.ColorErrorActive);
|
||||
dangerStyle.Add(pressedStyle);
|
||||
}
|
||||
enabledStyle.Add(dangerStyle);
|
||||
@ -84,8 +77,7 @@ internal class LinkButtonTheme : BaseButtonTheme
|
||||
{
|
||||
var ghostStyle = new Style(selector => selector.Nesting().PropertyEquals(Button.IsGhostProperty, true));
|
||||
// 正常状态
|
||||
ghostStyle.Add(TemplatedControl.BackgroundProperty,
|
||||
new DynamicResourceExtension(GlobalTokenResourceKey.ColorTransparent));
|
||||
ghostStyle.Add(TemplatedControl.BackgroundProperty, GlobalTokenResourceKey.ColorTransparent);
|
||||
|
||||
Add(ghostStyle);
|
||||
}
|
||||
@ -93,8 +85,7 @@ internal class LinkButtonTheme : BaseButtonTheme
|
||||
private void BuildDisabledStyle()
|
||||
{
|
||||
var disabledStyle = new Style(selector => selector.Nesting().Class(StdPseudoClass.Disabled));
|
||||
disabledStyle.Add(TemplatedControl.ForegroundProperty,
|
||||
new DynamicResourceExtension(GlobalTokenResourceKey.ColorTextDisabled));
|
||||
disabledStyle.Add(TemplatedControl.ForegroundProperty, GlobalTokenResourceKey.ColorTextDisabled);
|
||||
Add(disabledStyle);
|
||||
}
|
||||
}
|
@ -1,5 +1,7 @@
|
||||
using System.Windows.Input;
|
||||
using AtomUI.Data;
|
||||
using AtomUI.IconPkg;
|
||||
using AtomUI.IconPkg.AntDesign;
|
||||
using AtomUI.Input;
|
||||
using AtomUI.Theme.Data;
|
||||
using AtomUI.Theme.Styling;
|
||||
@ -78,11 +80,11 @@ public class SplitButton : ContentControl, ICommandSource, ISizeTypeAware
|
||||
public static readonly StyledProperty<SizeType> SizeTypeProperty =
|
||||
Button.SizeTypeProperty.AddOwner<SplitButton>();
|
||||
|
||||
public static readonly StyledProperty<PathIcon?> IconProperty
|
||||
public static readonly StyledProperty<Icon?> IconProperty
|
||||
= Button.IconProperty.AddOwner<SplitButton>();
|
||||
|
||||
public static readonly StyledProperty<PathIcon?> FlyoutButtonIconProperty
|
||||
= AvaloniaProperty.Register<SplitButton, PathIcon?>(nameof(FlyoutButtonIcon));
|
||||
public static readonly StyledProperty<Icon?> FlyoutButtonIconProperty
|
||||
= AvaloniaProperty.Register<SplitButton, Icon?>(nameof(FlyoutButtonIcon));
|
||||
|
||||
public static readonly StyledProperty<bool> IsDangerProperty =
|
||||
Button.IsDangerProperty.AddOwner<SplitButton>();
|
||||
@ -198,13 +200,13 @@ public class SplitButton : ContentControl, ICommandSource, ISizeTypeAware
|
||||
set => SetValue(SizeTypeProperty, value);
|
||||
}
|
||||
|
||||
public PathIcon? Icon
|
||||
public Icon? Icon
|
||||
{
|
||||
get => GetValue(IconProperty);
|
||||
set => SetValue(IconProperty, value);
|
||||
}
|
||||
|
||||
public PathIcon? FlyoutButtonIcon
|
||||
public Icon? FlyoutButtonIcon
|
||||
{
|
||||
get => GetValue(FlyoutButtonIconProperty);
|
||||
set => SetValue(FlyoutButtonIconProperty, value);
|
||||
@ -431,13 +433,7 @@ public class SplitButton : ContentControl, ICommandSource, ISizeTypeAware
|
||||
_primaryButton.Click += HandlePrimaryButtonClick;
|
||||
}
|
||||
|
||||
if (FlyoutButtonIcon is null)
|
||||
{
|
||||
FlyoutButtonIcon = new PathIcon
|
||||
{
|
||||
Kind = "EllipsisOutlined"
|
||||
};
|
||||
}
|
||||
FlyoutButtonIcon ??= AntDesignIconPackage.EllipsisOutlined();
|
||||
|
||||
SetupEffectiveButtonType();
|
||||
SetupFlyoutProperties();
|
||||
|
@ -1,6 +1,6 @@
|
||||
using AtomUI.Controls.Utils;
|
||||
using AtomUI.Data;
|
||||
using AtomUI.Icon;
|
||||
using AtomUI.IconPkg;
|
||||
using AtomUI.Theme.Styling;
|
||||
using Avalonia;
|
||||
using Avalonia.Controls.Primitives;
|
||||
@ -13,11 +13,11 @@ public class ToggleIconButton : ToggleButton
|
||||
{
|
||||
#region 公共属性定义
|
||||
|
||||
public static readonly StyledProperty<PathIcon?> CheckedIconProperty
|
||||
= AvaloniaProperty.Register<ToggleIconButton, PathIcon?>(nameof(CheckedIcon));
|
||||
public static readonly StyledProperty<Icon?> CheckedIconProperty
|
||||
= AvaloniaProperty.Register<ToggleIconButton, Icon?>(nameof(CheckedIcon));
|
||||
|
||||
public static readonly StyledProperty<PathIcon?> UnCheckedIconProperty
|
||||
= AvaloniaProperty.Register<ToggleIconButton, PathIcon?>(nameof(UnCheckedIcon));
|
||||
public static readonly StyledProperty<Icon?> UnCheckedIconProperty
|
||||
= AvaloniaProperty.Register<ToggleIconButton, Icon?>(nameof(UnCheckedIcon));
|
||||
|
||||
public static readonly StyledProperty<double> IconWidthProperty
|
||||
= AvaloniaProperty.Register<ToggleIconButton, double>(nameof(IconWidth));
|
||||
@ -25,13 +25,13 @@ public class ToggleIconButton : ToggleButton
|
||||
public static readonly StyledProperty<double> IconHeightProperty
|
||||
= AvaloniaProperty.Register<ToggleIconButton, double>(nameof(IconHeight));
|
||||
|
||||
public PathIcon? CheckedIcon
|
||||
public Icon? CheckedIcon
|
||||
{
|
||||
get => GetValue(CheckedIconProperty);
|
||||
set => SetValue(CheckedIconProperty, value);
|
||||
}
|
||||
|
||||
public PathIcon? UnCheckedIcon
|
||||
public Icon? UnCheckedIcon
|
||||
{
|
||||
get => GetValue(UnCheckedIconProperty);
|
||||
set => SetValue(UnCheckedIconProperty, value);
|
||||
@ -81,13 +81,13 @@ public class ToggleIconButton : ToggleButton
|
||||
ApplyIconToContent();
|
||||
}
|
||||
|
||||
protected virtual void ConfigureIcon(PathIcon icon)
|
||||
protected virtual void ConfigureIcon(Icon Icon)
|
||||
{
|
||||
icon.SetCurrentValue(HorizontalAlignmentProperty, HorizontalAlignment.Center);
|
||||
icon.SetCurrentValue(VerticalAlignmentProperty, VerticalAlignment.Center);
|
||||
UIStructureUtils.SetTemplateParent(icon, this);
|
||||
BindUtils.RelayBind(this, IconWidthProperty, icon, WidthProperty);
|
||||
BindUtils.RelayBind(this, IconHeightProperty, icon, HeightProperty);
|
||||
Icon.SetCurrentValue(HorizontalAlignmentProperty, HorizontalAlignment.Center);
|
||||
Icon.SetCurrentValue(VerticalAlignmentProperty, VerticalAlignment.Center);
|
||||
UIStructureUtils.SetTemplateParent(Icon, this);
|
||||
BindUtils.RelayBind(this, IconWidthProperty, Icon, WidthProperty);
|
||||
BindUtils.RelayBind(this, IconHeightProperty, Icon, HeightProperty);
|
||||
}
|
||||
|
||||
protected override void OnPropertyChanged(AvaloniaPropertyChangedEventArgs change)
|
||||
@ -103,24 +103,24 @@ public class ToggleIconButton : ToggleButton
|
||||
change.Property == IsPointerOverProperty)
|
||||
{
|
||||
CollectStyleState();
|
||||
var pathIcon = IsChecked.HasValue && IsChecked.Value ? CheckedIcon : UnCheckedIcon;
|
||||
if (pathIcon is not null)
|
||||
var Icon = IsChecked.HasValue && IsChecked.Value ? CheckedIcon : UnCheckedIcon;
|
||||
if (Icon is not null)
|
||||
{
|
||||
if (_styleState.HasFlag(ControlStyleState.Enabled))
|
||||
{
|
||||
pathIcon.IconMode = IconMode.Normal;
|
||||
Icon.IconMode = IconMode.Normal;
|
||||
if (_styleState.HasFlag(ControlStyleState.Sunken))
|
||||
{
|
||||
pathIcon.IconMode = IconMode.Selected;
|
||||
Icon.IconMode = IconMode.Selected;
|
||||
}
|
||||
else if (_styleState.HasFlag(ControlStyleState.MouseOver))
|
||||
{
|
||||
pathIcon.IconMode = IconMode.Active;
|
||||
Icon.IconMode = IconMode.Active;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
pathIcon.IconMode = IconMode.Disabled;
|
||||
Icon.IconMode = IconMode.Disabled;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -129,7 +129,7 @@ public class ToggleIconButton : ToggleButton
|
||||
if (change.Property == CheckedIconProperty ||
|
||||
change.Property == UnCheckedIconProperty)
|
||||
{
|
||||
if (change.NewValue is PathIcon newIcon)
|
||||
if (change.NewValue is Icon newIcon)
|
||||
{
|
||||
ConfigureIcon(newIcon);
|
||||
ApplyIconToContent();
|
||||
|
@ -1,4 +1,4 @@
|
||||
using AtomUI.Icon;
|
||||
using AtomUI.IconPkg;
|
||||
using AtomUI.Theme;
|
||||
using AtomUI.Theme.Styling;
|
||||
using Avalonia.Controls;
|
||||
@ -45,23 +45,23 @@ internal class ToggleIconButtonTheme : BaseControlTheme
|
||||
new Style(selector => selector.Nesting().PropertyEquals(InputElement.IsEnabledProperty, true));
|
||||
{
|
||||
{
|
||||
var iconStyle = new Style(selector => selector.Nesting().Template().OfType<PathIcon>());
|
||||
iconStyle.Add(PathIcon.IconModeProperty, IconMode.Normal);
|
||||
var iconStyle = new Style(selector => selector.Nesting().Template().OfType<Icon>());
|
||||
iconStyle.Add(Icon.IconModeProperty, IconMode.Normal);
|
||||
enabledStyle.Add(iconStyle);
|
||||
}
|
||||
|
||||
var hoverStyle = new Style(selector => selector.Nesting().Class(StdPseudoClass.Selected));
|
||||
{
|
||||
var iconStyle = new Style(selector => selector.Nesting().Template().OfType<PathIcon>());
|
||||
iconStyle.Add(PathIcon.IconModeProperty, IconMode.Active);
|
||||
var iconStyle = new Style(selector => selector.Nesting().Template().OfType<Icon>());
|
||||
iconStyle.Add(Icon.IconModeProperty, IconMode.Active);
|
||||
hoverStyle.Add(iconStyle);
|
||||
}
|
||||
enabledStyle.Add(hoverStyle);
|
||||
|
||||
var checkedStyle = new Style(selector => selector.Nesting().Class(StdPseudoClass.Selected));
|
||||
{
|
||||
var iconStyle = new Style(selector => selector.Nesting().Template().OfType<PathIcon>());
|
||||
iconStyle.Add(PathIcon.IconModeProperty, IconMode.Selected);
|
||||
var iconStyle = new Style(selector => selector.Nesting().Template().OfType<Icon>());
|
||||
iconStyle.Add(Icon.IconModeProperty, IconMode.Selected);
|
||||
checkedStyle.Add(iconStyle);
|
||||
}
|
||||
enabledStyle.Add(checkedStyle);
|
||||
@ -71,8 +71,8 @@ internal class ToggleIconButtonTheme : BaseControlTheme
|
||||
var disabledStyle =
|
||||
new Style(selector => selector.Nesting().PropertyEquals(InputElement.IsEnabledProperty, false));
|
||||
{
|
||||
var iconStyle = new Style(selector => selector.Nesting().Template().OfType<PathIcon>());
|
||||
iconStyle.Add(PathIcon.IconModeProperty, IconMode.Disabled);
|
||||
var iconStyle = new Style(selector => selector.Nesting().Template().OfType<Icon>());
|
||||
iconStyle.Add(Icon.IconModeProperty, IconMode.Disabled);
|
||||
disabledStyle.Add(iconStyle);
|
||||
}
|
||||
Add(disabledStyle);
|
||||
|
@ -1,4 +1,6 @@
|
||||
using AtomUI.Theme;
|
||||
using AtomUI.IconPkg;
|
||||
using AtomUI.IconPkg.AntDesign;
|
||||
using AtomUI.Theme;
|
||||
using AtomUI.Theme.Data;
|
||||
using AtomUI.Theme.Styling;
|
||||
using Avalonia.Controls;
|
||||
@ -112,15 +114,12 @@ internal class CalendarItemTheme : BaseControlTheme
|
||||
|
||||
protected virtual IconButton BuildPreviousButton()
|
||||
{
|
||||
var previousButtonIcon = new PathIcon
|
||||
{
|
||||
Kind = "DoubleLeftOutlined"
|
||||
};
|
||||
TokenResourceBinder.CreateGlobalTokenBinding(previousButtonIcon, PathIcon.NormalFilledBrushProperty,
|
||||
var previousButtonIcon = AntDesignIconPackage.DoubleLeftOutlined();
|
||||
TokenResourceBinder.CreateGlobalTokenBinding(previousButtonIcon, Icon.NormalFilledBrushProperty,
|
||||
GlobalTokenResourceKey.ColorTextDescription);
|
||||
TokenResourceBinder.CreateGlobalTokenBinding(previousButtonIcon, PathIcon.ActiveFilledBrushProperty,
|
||||
TokenResourceBinder.CreateGlobalTokenBinding(previousButtonIcon, Icon.ActiveFilledBrushProperty,
|
||||
GlobalTokenResourceKey.ColorText);
|
||||
TokenResourceBinder.CreateGlobalTokenBinding(previousButtonIcon, PathIcon.SelectedFilledBrushProperty,
|
||||
TokenResourceBinder.CreateGlobalTokenBinding(previousButtonIcon, Icon.SelectedFilledBrushProperty,
|
||||
GlobalTokenResourceKey.ColorText);
|
||||
|
||||
var previousButton = new IconButton
|
||||
@ -138,15 +137,12 @@ internal class CalendarItemTheme : BaseControlTheme
|
||||
|
||||
protected virtual IconButton BuildPreviousMonthButton()
|
||||
{
|
||||
var previousMonthButtonIcon = new PathIcon
|
||||
{
|
||||
Kind = "LeftOutlined"
|
||||
};
|
||||
TokenResourceBinder.CreateGlobalTokenBinding(previousMonthButtonIcon, PathIcon.NormalFilledBrushProperty,
|
||||
var previousMonthButtonIcon = AntDesignIconPackage.LeftOutlined();
|
||||
TokenResourceBinder.CreateGlobalTokenBinding(previousMonthButtonIcon, Icon.NormalFilledBrushProperty,
|
||||
GlobalTokenResourceKey.ColorTextDescription);
|
||||
TokenResourceBinder.CreateGlobalTokenBinding(previousMonthButtonIcon, PathIcon.ActiveFilledBrushProperty,
|
||||
TokenResourceBinder.CreateGlobalTokenBinding(previousMonthButtonIcon, Icon.ActiveFilledBrushProperty,
|
||||
GlobalTokenResourceKey.ColorText);
|
||||
TokenResourceBinder.CreateGlobalTokenBinding(previousMonthButtonIcon, PathIcon.SelectedFilledBrushProperty,
|
||||
TokenResourceBinder.CreateGlobalTokenBinding(previousMonthButtonIcon, Icon.SelectedFilledBrushProperty,
|
||||
GlobalTokenResourceKey.ColorText);
|
||||
|
||||
var previousMonthButton = new IconButton
|
||||
@ -164,15 +160,12 @@ internal class CalendarItemTheme : BaseControlTheme
|
||||
|
||||
protected virtual IconButton BuildNextButton()
|
||||
{
|
||||
var nextButtonIcon = new PathIcon
|
||||
{
|
||||
Kind = "DoubleRightOutlined"
|
||||
};
|
||||
TokenResourceBinder.CreateGlobalTokenBinding(nextButtonIcon, PathIcon.NormalFilledBrushProperty,
|
||||
var nextButtonIcon = AntDesignIconPackage.DoubleRightOutlined();
|
||||
TokenResourceBinder.CreateGlobalTokenBinding(nextButtonIcon, Icon.NormalFilledBrushProperty,
|
||||
GlobalTokenResourceKey.ColorTextDescription);
|
||||
TokenResourceBinder.CreateGlobalTokenBinding(nextButtonIcon, PathIcon.ActiveFilledBrushProperty,
|
||||
TokenResourceBinder.CreateGlobalTokenBinding(nextButtonIcon, Icon.ActiveFilledBrushProperty,
|
||||
GlobalTokenResourceKey.ColorText);
|
||||
TokenResourceBinder.CreateGlobalTokenBinding(nextButtonIcon, PathIcon.SelectedFilledBrushProperty,
|
||||
TokenResourceBinder.CreateGlobalTokenBinding(nextButtonIcon, Icon.SelectedFilledBrushProperty,
|
||||
GlobalTokenResourceKey.ColorText);
|
||||
|
||||
var nextButton = new IconButton
|
||||
@ -189,15 +182,12 @@ internal class CalendarItemTheme : BaseControlTheme
|
||||
|
||||
protected virtual IconButton BuildNextMonthButton()
|
||||
{
|
||||
var nextMonthButtonIcon = new PathIcon
|
||||
{
|
||||
Kind = "RightOutlined"
|
||||
};
|
||||
TokenResourceBinder.CreateGlobalTokenBinding(nextMonthButtonIcon, PathIcon.NormalFilledBrushProperty,
|
||||
var nextMonthButtonIcon = AntDesignIconPackage.RightOutlined();
|
||||
TokenResourceBinder.CreateGlobalTokenBinding(nextMonthButtonIcon, Icon.NormalFilledBrushProperty,
|
||||
GlobalTokenResourceKey.ColorTextDescription);
|
||||
TokenResourceBinder.CreateGlobalTokenBinding(nextMonthButtonIcon, PathIcon.ActiveFilledBrushProperty,
|
||||
TokenResourceBinder.CreateGlobalTokenBinding(nextMonthButtonIcon, Icon.ActiveFilledBrushProperty,
|
||||
GlobalTokenResourceKey.ColorText);
|
||||
TokenResourceBinder.CreateGlobalTokenBinding(nextMonthButtonIcon, PathIcon.SelectedFilledBrushProperty,
|
||||
TokenResourceBinder.CreateGlobalTokenBinding(nextMonthButtonIcon, Icon.SelectedFilledBrushProperty,
|
||||
GlobalTokenResourceKey.ColorText);
|
||||
var nextMonthButton = new IconButton
|
||||
{
|
||||
|
@ -1,4 +1,6 @@
|
||||
using AtomUI.Controls.Utils;
|
||||
using AtomUI.IconPkg;
|
||||
using AtomUI.IconPkg.AntDesign;
|
||||
using AtomUI.MotionScene;
|
||||
using AtomUI.Theme.Data;
|
||||
using AtomUI.Theme.Styling;
|
||||
@ -24,8 +26,8 @@ public class CollapseItem : HeaderedContentControl, ISelectable
|
||||
public static readonly StyledProperty<bool> IsShowExpandIconProperty =
|
||||
AvaloniaProperty.Register<CollapseItem, bool>(nameof(IsShowExpandIcon), true);
|
||||
|
||||
public static readonly StyledProperty<PathIcon?> ExpandIconProperty =
|
||||
AvaloniaProperty.Register<CollapseItem, PathIcon?>(nameof(ExpandIcon));
|
||||
public static readonly StyledProperty<Icon?> ExpandIconProperty =
|
||||
AvaloniaProperty.Register<CollapseItem, Icon?>(nameof(ExpandIcon));
|
||||
|
||||
public static readonly StyledProperty<object?> AddOnContentProperty =
|
||||
AvaloniaProperty.Register<CollapseItem, object?>(nameof(AddOnContent));
|
||||
@ -45,7 +47,7 @@ public class CollapseItem : HeaderedContentControl, ISelectable
|
||||
set => SetValue(IsShowExpandIconProperty, value);
|
||||
}
|
||||
|
||||
public PathIcon? ExpandIcon
|
||||
public Icon? ExpandIcon
|
||||
{
|
||||
get => GetValue(ExpandIconProperty);
|
||||
set => SetValue(ExpandIconProperty, value);
|
||||
@ -268,7 +270,7 @@ public class CollapseItem : HeaderedContentControl, ISelectable
|
||||
}
|
||||
else if (change.Property == ExpandIconProperty)
|
||||
{
|
||||
var oldExpandIcon = change.GetOldValue<PathIcon?>();
|
||||
var oldExpandIcon = change.GetOldValue<Icon?>();
|
||||
if (oldExpandIcon is not null)
|
||||
{
|
||||
UIStructureUtils.SetTemplateParent(oldExpandIcon, null);
|
||||
@ -343,11 +345,8 @@ public class CollapseItem : HeaderedContentControl, ISelectable
|
||||
{
|
||||
if (ExpandIcon is null)
|
||||
{
|
||||
ExpandIcon = new PathIcon
|
||||
{
|
||||
Kind = "RightOutlined"
|
||||
};
|
||||
TokenResourceBinder.CreateGlobalTokenBinding(ExpandIcon, PathIcon.DisabledFilledBrushProperty,
|
||||
ExpandIcon = AntDesignIconPackage.RightOutlined();
|
||||
TokenResourceBinder.CreateGlobalTokenBinding(ExpandIcon, Icon.DisabledFilledBrushProperty,
|
||||
GlobalTokenResourceKey.ColorTextDisabled);
|
||||
}
|
||||
|
||||
|
@ -1,4 +1,5 @@
|
||||
using AtomUI.MotionScene;
|
||||
using AtomUI.IconPkg;
|
||||
using AtomUI.MotionScene;
|
||||
using AtomUI.Theme;
|
||||
using AtomUI.Theme.Data;
|
||||
using AtomUI.Theme.Styling;
|
||||
@ -173,7 +174,7 @@ internal class CollapseItemTheme : BaseControlTheme
|
||||
|
||||
// ExpandIcon
|
||||
var expandIconStyle =
|
||||
new Style(selector => selector.Nesting().Template().Name(ExpandButtonPart).Descendant().OfType<PathIcon>());
|
||||
new Style(selector => selector.Nesting().Template().Name(ExpandButtonPart).Descendant().OfType<Icon>());
|
||||
expandIconStyle.Add(Layoutable.WidthProperty, GlobalTokenResourceKey.IconSizeSM);
|
||||
expandIconStyle.Add(Layoutable.HeightProperty, GlobalTokenResourceKey.IconSizeSM);
|
||||
commonStyle.Add(expandIconStyle);
|
||||
@ -334,7 +335,7 @@ internal class CollapseItemTheme : BaseControlTheme
|
||||
private void BuildAddOnContentStyle()
|
||||
{
|
||||
var addOnContentStyle = new Style(selector => selector.Nesting().Template().Name(AddOnContentPresenterPart)
|
||||
.Descendant().OfType<PathIcon>());
|
||||
.Descendant().OfType<Icon>());
|
||||
addOnContentStyle.Add(Layoutable.WidthProperty, GlobalTokenResourceKey.IconSize);
|
||||
addOnContentStyle.Add(Layoutable.HeightProperty, GlobalTokenResourceKey.IconSize);
|
||||
Add(addOnContentStyle);
|
||||
|
@ -1,4 +1,6 @@
|
||||
using AtomUI.Theme;
|
||||
using AtomUI.IconPkg;
|
||||
using AtomUI.IconPkg.AntDesign;
|
||||
using AtomUI.Theme;
|
||||
using AtomUI.Theme.Data;
|
||||
using AtomUI.Theme.Styling;
|
||||
using Avalonia;
|
||||
@ -97,14 +99,11 @@ internal class ComboBoxTheme : BaseControlTheme
|
||||
|
||||
spinnerHandleDecorator.RegisterInNameScope(scope);
|
||||
|
||||
var decreaseButtonIcon = new PathIcon
|
||||
{
|
||||
Kind = "DownOutlined"
|
||||
};
|
||||
var decreaseButtonIcon = AntDesignIconPackage.DownOutlined();
|
||||
|
||||
TokenResourceBinder.CreateGlobalTokenBinding(decreaseButtonIcon, PathIcon.ActiveFilledBrushProperty,
|
||||
TokenResourceBinder.CreateGlobalTokenBinding(decreaseButtonIcon, Icon.ActiveFilledBrushProperty,
|
||||
ButtonSpinnerTokenResourceKey.HandleHoverColor);
|
||||
TokenResourceBinder.CreateGlobalTokenBinding(decreaseButtonIcon, PathIcon.SelectedFilledBrushProperty,
|
||||
TokenResourceBinder.CreateGlobalTokenBinding(decreaseButtonIcon, Icon.SelectedFilledBrushProperty,
|
||||
GlobalTokenResourceKey.ColorPrimaryActive);
|
||||
|
||||
var openButton = new IconButton
|
||||
|
@ -1,4 +1,6 @@
|
||||
using AtomUI.Data;
|
||||
using AtomUI.IconPkg;
|
||||
using AtomUI.IconPkg.AntDesign;
|
||||
using AtomUI.Theme;
|
||||
using AtomUI.Theme.Data;
|
||||
using AtomUI.Theme.Styling;
|
||||
@ -164,15 +166,12 @@ internal class CalendarItemTheme : BaseControlTheme
|
||||
|
||||
protected virtual IconButton BuildPreviousButton(string name)
|
||||
{
|
||||
var previousButtonIcon = new PathIcon
|
||||
{
|
||||
Kind = "DoubleLeftOutlined"
|
||||
};
|
||||
TokenResourceBinder.CreateGlobalTokenBinding(previousButtonIcon, PathIcon.NormalFilledBrushProperty,
|
||||
var previousButtonIcon = AntDesignIconPackage.DoubleLeftOutlined();
|
||||
TokenResourceBinder.CreateGlobalTokenBinding(previousButtonIcon, Icon.NormalFilledBrushProperty,
|
||||
GlobalTokenResourceKey.ColorTextDescription);
|
||||
TokenResourceBinder.CreateGlobalTokenBinding(previousButtonIcon, PathIcon.ActiveFilledBrushProperty,
|
||||
TokenResourceBinder.CreateGlobalTokenBinding(previousButtonIcon, Icon.ActiveFilledBrushProperty,
|
||||
GlobalTokenResourceKey.ColorText);
|
||||
TokenResourceBinder.CreateGlobalTokenBinding(previousButtonIcon, PathIcon.SelectedFilledBrushProperty,
|
||||
TokenResourceBinder.CreateGlobalTokenBinding(previousButtonIcon, Icon.SelectedFilledBrushProperty,
|
||||
GlobalTokenResourceKey.ColorText);
|
||||
|
||||
var previousButton = new IconButton
|
||||
@ -190,15 +189,12 @@ internal class CalendarItemTheme : BaseControlTheme
|
||||
|
||||
protected virtual IconButton BuildPreviousMonthButton(string name)
|
||||
{
|
||||
var previousMonthButtonIcon = new PathIcon
|
||||
{
|
||||
Kind = "LeftOutlined"
|
||||
};
|
||||
TokenResourceBinder.CreateGlobalTokenBinding(previousMonthButtonIcon, PathIcon.NormalFilledBrushProperty,
|
||||
var previousMonthButtonIcon = AntDesignIconPackage.LeftOutlined();
|
||||
TokenResourceBinder.CreateGlobalTokenBinding(previousMonthButtonIcon, Icon.NormalFilledBrushProperty,
|
||||
GlobalTokenResourceKey.ColorTextDescription);
|
||||
TokenResourceBinder.CreateGlobalTokenBinding(previousMonthButtonIcon, PathIcon.ActiveFilledBrushProperty,
|
||||
TokenResourceBinder.CreateGlobalTokenBinding(previousMonthButtonIcon, Icon.ActiveFilledBrushProperty,
|
||||
GlobalTokenResourceKey.ColorText);
|
||||
TokenResourceBinder.CreateGlobalTokenBinding(previousMonthButtonIcon, PathIcon.SelectedFilledBrushProperty,
|
||||
TokenResourceBinder.CreateGlobalTokenBinding(previousMonthButtonIcon, Icon.SelectedFilledBrushProperty,
|
||||
GlobalTokenResourceKey.ColorText);
|
||||
|
||||
var previousMonthButton = new IconButton
|
||||
@ -216,15 +212,12 @@ internal class CalendarItemTheme : BaseControlTheme
|
||||
|
||||
protected virtual IconButton BuildNextButton(string name)
|
||||
{
|
||||
var nextButtonIcon = new PathIcon
|
||||
{
|
||||
Kind = "DoubleRightOutlined"
|
||||
};
|
||||
TokenResourceBinder.CreateGlobalTokenBinding(nextButtonIcon, PathIcon.NormalFilledBrushProperty,
|
||||
var nextButtonIcon = AntDesignIconPackage.DoubleRightOutlined();
|
||||
TokenResourceBinder.CreateGlobalTokenBinding(nextButtonIcon, Icon.NormalFilledBrushProperty,
|
||||
GlobalTokenResourceKey.ColorTextDescription);
|
||||
TokenResourceBinder.CreateGlobalTokenBinding(nextButtonIcon, PathIcon.ActiveFilledBrushProperty,
|
||||
TokenResourceBinder.CreateGlobalTokenBinding(nextButtonIcon, Icon.ActiveFilledBrushProperty,
|
||||
GlobalTokenResourceKey.ColorText);
|
||||
TokenResourceBinder.CreateGlobalTokenBinding(nextButtonIcon, PathIcon.SelectedFilledBrushProperty,
|
||||
TokenResourceBinder.CreateGlobalTokenBinding(nextButtonIcon, Icon.SelectedFilledBrushProperty,
|
||||
GlobalTokenResourceKey.ColorText);
|
||||
|
||||
var nextButton = new IconButton
|
||||
@ -241,15 +234,12 @@ internal class CalendarItemTheme : BaseControlTheme
|
||||
|
||||
protected virtual IconButton BuildNextMonthButton(string name)
|
||||
{
|
||||
var nextMonthButtonIcon = new PathIcon
|
||||
{
|
||||
Kind = "RightOutlined"
|
||||
};
|
||||
TokenResourceBinder.CreateGlobalTokenBinding(nextMonthButtonIcon, PathIcon.NormalFilledBrushProperty,
|
||||
var nextMonthButtonIcon = AntDesignIconPackage.RightOutlined();
|
||||
TokenResourceBinder.CreateGlobalTokenBinding(nextMonthButtonIcon, Icon.NormalFilledBrushProperty,
|
||||
GlobalTokenResourceKey.ColorTextDescription);
|
||||
TokenResourceBinder.CreateGlobalTokenBinding(nextMonthButtonIcon, PathIcon.ActiveFilledBrushProperty,
|
||||
TokenResourceBinder.CreateGlobalTokenBinding(nextMonthButtonIcon, Icon.ActiveFilledBrushProperty,
|
||||
GlobalTokenResourceKey.ColorText);
|
||||
TokenResourceBinder.CreateGlobalTokenBinding(nextMonthButtonIcon, PathIcon.SelectedFilledBrushProperty,
|
||||
TokenResourceBinder.CreateGlobalTokenBinding(nextMonthButtonIcon, Icon.SelectedFilledBrushProperty,
|
||||
GlobalTokenResourceKey.ColorText);
|
||||
var nextMonthButton = new IconButton
|
||||
{
|
||||
|
@ -1,4 +1,6 @@
|
||||
using AtomUI.Controls.Internal;
|
||||
using AtomUI.IconPkg;
|
||||
using AtomUI.IconPkg.AntDesign;
|
||||
using AtomUI.Theme.Styling;
|
||||
using Avalonia.Controls;
|
||||
using Avalonia.Styling;
|
||||
@ -12,12 +14,9 @@ internal class DatePickerTheme : InfoPickerInputTheme
|
||||
{
|
||||
}
|
||||
|
||||
protected override PathIcon BuildInfoIcon(InfoPickerInput infoPickerInput, INameScope scope)
|
||||
protected override Icon BuildInfoIcon(InfoPickerInput infoPickerInput, INameScope scope)
|
||||
{
|
||||
return new PathIcon()
|
||||
{
|
||||
Kind = "CalendarOutlined"
|
||||
};
|
||||
return AntDesignIconPackage.CalendarOutlined();
|
||||
}
|
||||
|
||||
protected override void BuildStyles()
|
||||
|
@ -1,4 +1,6 @@
|
||||
using AtomUI.Controls.Internal;
|
||||
using AtomUI.IconPkg;
|
||||
using AtomUI.IconPkg.AntDesign;
|
||||
using AtomUI.Theme.Styling;
|
||||
using Avalonia.Controls;
|
||||
using Avalonia.Styling;
|
||||
@ -12,12 +14,9 @@ internal class RangeDatePickerTheme : RangeInfoPickerInputTheme
|
||||
{
|
||||
}
|
||||
|
||||
protected override PathIcon BuildInfoIcon(InfoPickerInput infoPickerInput, INameScope scope)
|
||||
protected override Icon BuildInfoIcon(InfoPickerInput infoPickerInput, INameScope scope)
|
||||
{
|
||||
return new PathIcon()
|
||||
{
|
||||
Kind = "CalendarOutlined"
|
||||
};
|
||||
return AntDesignIconPackage.CalendarOutlined();
|
||||
}
|
||||
|
||||
protected override void BuildStyles()
|
||||
|
@ -63,14 +63,12 @@ internal class EmptyIndicatorTheme : BaseControlTheme
|
||||
var sizeSmallAndMiddleStyle = new Style(selector => Selectors.Or(
|
||||
selector.Nesting().PropertyEquals(EmptyIndicator.SizeTypeProperty, SizeType.Middle),
|
||||
selector.Nesting().PropertyEquals(EmptyIndicator.SizeTypeProperty, SizeType.Small)));
|
||||
sizeSmallAndMiddleStyle.Add(EmptyIndicator.DescriptionMarginProperty,
|
||||
new DynamicResourceExtension(GlobalTokenResourceKey.MarginXS));
|
||||
sizeSmallAndMiddleStyle.Add(EmptyIndicator.DescriptionMarginProperty, GlobalTokenResourceKey.MarginXS);
|
||||
Add(sizeSmallAndMiddleStyle);
|
||||
|
||||
var sizeLargeStyle = new Style(selector =>
|
||||
selector.Nesting().PropertyEquals(EmptyIndicator.SizeTypeProperty, SizeType.Large));
|
||||
sizeLargeStyle.Add(EmptyIndicator.DescriptionMarginProperty,
|
||||
new DynamicResourceExtension(GlobalTokenResourceKey.MarginSM));
|
||||
sizeLargeStyle.Add(EmptyIndicator.DescriptionMarginProperty, GlobalTokenResourceKey.MarginSM);
|
||||
Add(sizeLargeStyle);
|
||||
|
||||
BuildSvgStyle();
|
||||
@ -83,8 +81,7 @@ internal class EmptyIndicatorTheme : BaseControlTheme
|
||||
var largeSizeStyle = new Style(selector =>
|
||||
selector.Nesting().PropertyEquals(EmptyIndicator.SizeTypeProperty, SizeType.Large));
|
||||
var svgStyle = new Style(selector => svgSelector);
|
||||
svgStyle.Add(Layoutable.HeightProperty,
|
||||
new DynamicResourceExtension(EmptyIndicatorTokenResourceKey.EmptyImgHeight));
|
||||
svgStyle.Add(Layoutable.HeightProperty, EmptyIndicatorTokenResourceKey.EmptyImgHeight);
|
||||
largeSizeStyle.Add(svgStyle);
|
||||
Add(largeSizeStyle);
|
||||
}
|
||||
@ -93,8 +90,7 @@ internal class EmptyIndicatorTheme : BaseControlTheme
|
||||
var middleSizeStyle = new Style(selector =>
|
||||
selector.Nesting().PropertyEquals(EmptyIndicator.SizeTypeProperty, SizeType.Middle));
|
||||
var svgStyle = new Style(selector => svgSelector);
|
||||
svgStyle.Add(Layoutable.HeightProperty,
|
||||
new DynamicResourceExtension(EmptyIndicatorTokenResourceKey.EmptyImgHeightMD));
|
||||
svgStyle.Add(Layoutable.HeightProperty, EmptyIndicatorTokenResourceKey.EmptyImgHeightMD);
|
||||
middleSizeStyle.Add(svgStyle);
|
||||
Add(middleSizeStyle);
|
||||
}
|
||||
@ -103,8 +99,7 @@ internal class EmptyIndicatorTheme : BaseControlTheme
|
||||
var smallSizeStyle = new Style(selector =>
|
||||
selector.Nesting().PropertyEquals(EmptyIndicator.SizeTypeProperty, SizeType.Small));
|
||||
var svgStyle = new Style(selector => svgSelector);
|
||||
svgStyle.Add(Layoutable.HeightProperty,
|
||||
new DynamicResourceExtension(EmptyIndicatorTokenResourceKey.EmptyImgHeightSM));
|
||||
svgStyle.Add(Layoutable.HeightProperty, EmptyIndicatorTokenResourceKey.EmptyImgHeightSM);
|
||||
smallSizeStyle.Add(svgStyle);
|
||||
Add(smallSizeStyle);
|
||||
}
|
||||
|
@ -1,8 +1,9 @@
|
||||
using AtomUI.Controls.Utils;
|
||||
using AtomUI.IconPkg;
|
||||
using AtomUI.IconPkg.AntDesign;
|
||||
using AtomUI.MotionScene;
|
||||
using AtomUI.Theme.Data;
|
||||
using AtomUI.Theme.Styling;
|
||||
using AtomUI.Utils;
|
||||
using Avalonia;
|
||||
using Avalonia.Animation.Easings;
|
||||
using Avalonia.Controls;
|
||||
@ -43,8 +44,8 @@ public class Expander : AvaloniaExpander
|
||||
public static readonly StyledProperty<bool> IsShowExpandIconProperty =
|
||||
AvaloniaProperty.Register<Expander, bool>(nameof(IsShowExpandIcon), true);
|
||||
|
||||
public static readonly StyledProperty<PathIcon?> ExpandIconProperty =
|
||||
AvaloniaProperty.Register<Expander, PathIcon?>(nameof(ExpandIcon));
|
||||
public static readonly StyledProperty<Icon?> ExpandIconProperty =
|
||||
AvaloniaProperty.Register<Expander, Icon?>(nameof(ExpandIcon));
|
||||
|
||||
public static readonly StyledProperty<object?> AddOnContentProperty =
|
||||
AvaloniaProperty.Register<Expander, object?>(nameof(AddOnContent));
|
||||
@ -76,7 +77,7 @@ public class Expander : AvaloniaExpander
|
||||
set => SetValue(IsShowExpandIconProperty, value);
|
||||
}
|
||||
|
||||
public PathIcon? ExpandIcon
|
||||
public Icon? ExpandIcon
|
||||
{
|
||||
get => GetValue(ExpandIconProperty);
|
||||
set => SetValue(ExpandIconProperty, value);
|
||||
@ -204,7 +205,7 @@ public class Expander : AvaloniaExpander
|
||||
base.OnPropertyChanged(change);
|
||||
if (change.Property == ExpandIconProperty)
|
||||
{
|
||||
var oldExpandIcon = change.GetOldValue<PathIcon?>();
|
||||
var oldExpandIcon = change.GetOldValue<Icon?>();
|
||||
if (oldExpandIcon is not null)
|
||||
{
|
||||
UIStructureUtils.SetTemplateParent(oldExpandIcon, null);
|
||||
@ -268,11 +269,8 @@ public class Expander : AvaloniaExpander
|
||||
{
|
||||
if (ExpandIcon is null)
|
||||
{
|
||||
ExpandIcon = new PathIcon
|
||||
{
|
||||
Kind = "RightOutlined"
|
||||
};
|
||||
TokenResourceBinder.CreateGlobalTokenBinding(ExpandIcon, PathIcon.DisabledFilledBrushProperty,
|
||||
ExpandIcon = AntDesignIconPackage.RightOutlined();
|
||||
TokenResourceBinder.CreateGlobalTokenBinding(ExpandIcon, Icon.DisabledFilledBrushProperty,
|
||||
GlobalTokenResourceKey.ColorTextDisabled);
|
||||
}
|
||||
|
||||
|
@ -1,4 +1,5 @@
|
||||
using AtomUI.MotionScene;
|
||||
using AtomUI.IconPkg;
|
||||
using AtomUI.MotionScene;
|
||||
using AtomUI.Theme;
|
||||
using AtomUI.Theme.Data;
|
||||
using AtomUI.Theme.Styling;
|
||||
@ -198,7 +199,7 @@ internal class ExpanderTheme : BaseControlTheme
|
||||
|
||||
// ExpandIcon
|
||||
var expandIconStyle = new Style(selector =>
|
||||
selector.Nesting().Template().Name(ExpandButtonPart).Descendant().OfType<PathIcon>());
|
||||
selector.Nesting().Template().Name(ExpandButtonPart).Descendant().OfType<Icon>());
|
||||
expandIconStyle.Add(Layoutable.WidthProperty, GlobalTokenResourceKey.IconSizeSM);
|
||||
expandIconStyle.Add(Layoutable.HeightProperty, GlobalTokenResourceKey.IconSizeSM);
|
||||
commonStyle.Add(expandIconStyle);
|
||||
@ -486,7 +487,7 @@ internal class ExpanderTheme : BaseControlTheme
|
||||
private void BuildAddOnContentStyle()
|
||||
{
|
||||
var addOnContentStyle = new Style(selector =>
|
||||
selector.Nesting().Template().Name(AddOnContentPresenterPart).Descendant().OfType<PathIcon>());
|
||||
selector.Nesting().Template().Name(AddOnContentPresenterPart).Descendant().OfType<Icon>());
|
||||
addOnContentStyle.Add(Layoutable.WidthProperty, GlobalTokenResourceKey.IconSize);
|
||||
addOnContentStyle.Add(Layoutable.HeightProperty, GlobalTokenResourceKey.IconSize);
|
||||
Add(addOnContentStyle);
|
||||
|
@ -1,7 +1,7 @@
|
||||
using AtomUI.Controls.Utils;
|
||||
using AtomUI.IconPkg;
|
||||
using AtomUI.Theme.Data;
|
||||
using AtomUI.Theme.Styling;
|
||||
using AtomUI.Utils;
|
||||
using Avalonia;
|
||||
using Avalonia.Controls;
|
||||
using Avalonia.Controls.Primitives;
|
||||
@ -28,8 +28,8 @@ public class GroupBox : ContentControl
|
||||
public static readonly StyledProperty<IBrush?> HeaderTitleColorProperty =
|
||||
AvaloniaProperty.Register<GroupBox, IBrush?>(nameof(HeaderTitleColor));
|
||||
|
||||
public static readonly StyledProperty<PathIcon?> HeaderIconProperty
|
||||
= AvaloniaProperty.Register<GroupBox, PathIcon?>(nameof(HeaderIcon));
|
||||
public static readonly StyledProperty<Icon?> HeaderIconProperty
|
||||
= AvaloniaProperty.Register<GroupBox, Icon?>(nameof(HeaderIcon));
|
||||
|
||||
public static readonly StyledProperty<GroupBoxTitlePosition> HeaderTitlePositionProperty =
|
||||
AvaloniaProperty.Register<GroupBox, GroupBoxTitlePosition>(nameof(HeaderTitlePosition));
|
||||
@ -55,7 +55,7 @@ public class GroupBox : ContentControl
|
||||
set => SetValue(HeaderTitleColorProperty, value);
|
||||
}
|
||||
|
||||
public PathIcon? HeaderIcon
|
||||
public Icon? HeaderIcon
|
||||
{
|
||||
get => GetValue(HeaderIconProperty);
|
||||
set => SetValue(HeaderIconProperty, value);
|
||||
|
@ -1,4 +1,5 @@
|
||||
using AtomUI.Theme;
|
||||
using AtomUI.IconPkg;
|
||||
using AtomUI.Theme;
|
||||
using AtomUI.Theme.Styling;
|
||||
using Avalonia;
|
||||
using Avalonia.Controls;
|
||||
@ -172,7 +173,7 @@ internal class GroupBoxTheme : BaseControlTheme
|
||||
|
||||
protected override void BuildInstanceStyles(Control control)
|
||||
{
|
||||
var iconStyle = new Style(selector => selector.Name(HeaderIconPart).Descendant().OfType<PathIcon>());
|
||||
var iconStyle = new Style(selector => selector.Name(HeaderIconPart).Descendant().OfType<Icon>());
|
||||
iconStyle.Add(Layoutable.WidthProperty, GlobalTokenResourceKey.IconSizeLG);
|
||||
iconStyle.Add(Layoutable.HeightProperty, GlobalTokenResourceKey.IconSizeLG);
|
||||
iconStyle.Add(Layoutable.VerticalAlignmentProperty, VerticalAlignment.Center);
|
||||
|
@ -1,4 +1,5 @@
|
||||
using AtomUI.Theme.Styling;
|
||||
using AtomUI.IconPkg.AntDesign;
|
||||
using AtomUI.Theme.Styling;
|
||||
using Avalonia;
|
||||
using Avalonia.Controls;
|
||||
using Avalonia.Controls.Primitives;
|
||||
@ -17,10 +18,7 @@ internal class SearchEditDecoratedBoxTheme : AddOnDecoratedBoxTheme
|
||||
|
||||
protected override void BuildRightAddOn(Grid layout, INameScope scope)
|
||||
{
|
||||
var searchIcon = new PathIcon
|
||||
{
|
||||
Kind = "SearchOutlined"
|
||||
};
|
||||
var searchIcon = AntDesignIconPackage.SearchOutlined();
|
||||
|
||||
var searchButton = new Button
|
||||
{
|
||||
|
@ -1,4 +1,5 @@
|
||||
using AtomUI.Data;
|
||||
using AtomUI.IconPkg;
|
||||
using AtomUI.Theme;
|
||||
using AtomUI.Theme.Styling;
|
||||
using Avalonia;
|
||||
@ -70,7 +71,7 @@ internal class InfoPickerInputTheme : BaseControlTheme
|
||||
return pickerInnerBox;
|
||||
}
|
||||
|
||||
protected virtual PathIcon? BuildInfoIcon(InfoPickerInput infoPickerInput, INameScope scope)
|
||||
protected virtual Icon? BuildInfoIcon(InfoPickerInput infoPickerInput, INameScope scope)
|
||||
{
|
||||
return default;
|
||||
}
|
||||
|
@ -1,4 +1,5 @@
|
||||
using Avalonia;
|
||||
using AtomUI.IconPkg;
|
||||
using Avalonia;
|
||||
using Avalonia.Controls;
|
||||
using Avalonia.Controls.Primitives;
|
||||
|
||||
@ -11,8 +12,8 @@ internal class PickerClearUpButton : TemplatedControl
|
||||
public static readonly StyledProperty<bool> IsInClearModeProperty =
|
||||
AvaloniaProperty.Register<PickerClearUpButton, bool>(nameof(IsInClearMode));
|
||||
|
||||
public static readonly StyledProperty<PathIcon?> IconProperty =
|
||||
AvaloniaProperty.Register<PickerClearUpButton, PathIcon?>(nameof(Icon));
|
||||
public static readonly StyledProperty<Icon?> IconProperty =
|
||||
AvaloniaProperty.Register<PickerClearUpButton, Icon?>(nameof(Icon));
|
||||
|
||||
public bool IsInClearMode
|
||||
{
|
||||
@ -20,7 +21,7 @@ internal class PickerClearUpButton : TemplatedControl
|
||||
set => SetValue(IsInClearModeProperty, value);
|
||||
}
|
||||
|
||||
public PathIcon? Icon
|
||||
public Icon? Icon
|
||||
{
|
||||
get => GetValue(IconProperty);
|
||||
set => SetValue(IconProperty, value);
|
||||
|
@ -1,4 +1,6 @@
|
||||
using AtomUI.Theme;
|
||||
using AtomUI.IconPkg;
|
||||
using AtomUI.IconPkg.AntDesign;
|
||||
using AtomUI.Theme;
|
||||
using AtomUI.Theme.Data;
|
||||
using AtomUI.Theme.Styling;
|
||||
using Avalonia;
|
||||
@ -48,10 +50,7 @@ internal class PickerClearUpButtonTheme : BaseControlTheme
|
||||
|
||||
private void BuildClearButton(Panel layout, INameScope scope)
|
||||
{
|
||||
var closeIcon = new PathIcon
|
||||
{
|
||||
Kind = "CloseCircleFilled"
|
||||
};
|
||||
var closeIcon = AntDesignIconPackage.CloseCircleFilled();
|
||||
var clearButton = new IconButton
|
||||
{
|
||||
Name = ClearButtonPart,
|
||||
@ -62,11 +61,11 @@ internal class PickerClearUpButtonTheme : BaseControlTheme
|
||||
GlobalTokenResourceKey.IconSize);
|
||||
TokenResourceBinder.CreateGlobalTokenBinding(clearButton, IconButton.IconWidthProperty,
|
||||
GlobalTokenResourceKey.IconSize);
|
||||
TokenResourceBinder.CreateGlobalTokenBinding(closeIcon, PathIcon.NormalFilledBrushProperty,
|
||||
TokenResourceBinder.CreateGlobalTokenBinding(closeIcon, Icon.NormalFilledBrushProperty,
|
||||
GlobalTokenResourceKey.ColorTextQuaternary);
|
||||
TokenResourceBinder.CreateGlobalTokenBinding(closeIcon, PathIcon.ActiveFilledBrushProperty,
|
||||
TokenResourceBinder.CreateGlobalTokenBinding(closeIcon, Icon.ActiveFilledBrushProperty,
|
||||
GlobalTokenResourceKey.ColorTextTertiary);
|
||||
TokenResourceBinder.CreateGlobalTokenBinding(closeIcon, PathIcon.SelectedFilledBrushProperty,
|
||||
TokenResourceBinder.CreateGlobalTokenBinding(closeIcon, Icon.SelectedFilledBrushProperty,
|
||||
GlobalTokenResourceKey.ColorText);
|
||||
|
||||
clearButton.RegisterInNameScope(scope);
|
||||
@ -77,10 +76,10 @@ internal class PickerClearUpButtonTheme : BaseControlTheme
|
||||
|
||||
protected override void BuildInstanceStyles(Control control)
|
||||
{
|
||||
var iconStyle = new Style(selector => selector.Name(InfoIconContentPart).Child().OfType<PathIcon>());
|
||||
iconStyle.Add(PathIcon.WidthProperty, GlobalTokenResourceKey.IconSize);
|
||||
iconStyle.Add(PathIcon.HeightProperty, GlobalTokenResourceKey.IconSize);
|
||||
iconStyle.Add(PathIcon.NormalFilledBrushProperty, GlobalTokenResourceKey.ColorTextQuaternary);
|
||||
var iconStyle = new Style(selector => selector.Name(InfoIconContentPart).Child().OfType<Icon>());
|
||||
iconStyle.Add(Icon.WidthProperty, GlobalTokenResourceKey.IconSize);
|
||||
iconStyle.Add(Icon.HeightProperty, GlobalTokenResourceKey.IconSize);
|
||||
iconStyle.Add(Icon.NormalFilledBrushProperty, GlobalTokenResourceKey.ColorTextQuaternary);
|
||||
control.Styles.Add(iconStyle);
|
||||
}
|
||||
}
|
@ -1,4 +1,6 @@
|
||||
using AtomUI.Theme.Data;
|
||||
using AtomUI.IconPkg;
|
||||
using AtomUI.IconPkg.AntDesign;
|
||||
using AtomUI.Theme.Data;
|
||||
using AtomUI.Theme.Styling;
|
||||
using Avalonia.Controls;
|
||||
using Avalonia.Controls.Shapes;
|
||||
@ -35,17 +37,14 @@ internal class RangeInfoPickerInputTheme : InfoPickerInputTheme
|
||||
}
|
||||
};
|
||||
|
||||
var arrowIcon = new PathIcon
|
||||
{
|
||||
Kind = "SwapRightOutlined",
|
||||
Name = RangePickerArrowPart
|
||||
};
|
||||
var arrowIcon = AntDesignIconPackage.SwapRightOutlined();
|
||||
arrowIcon.Name = RangePickerArrowPart;
|
||||
|
||||
TokenResourceBinder.CreateGlobalTokenBinding(arrowIcon, Layoutable.HeightProperty,
|
||||
GlobalTokenResourceKey.IconSize);
|
||||
TokenResourceBinder.CreateGlobalTokenBinding(arrowIcon, Layoutable.WidthProperty,
|
||||
GlobalTokenResourceKey.IconSize);
|
||||
TokenResourceBinder.CreateGlobalTokenBinding(arrowIcon, PathIcon.NormalFilledBrushProperty,
|
||||
TokenResourceBinder.CreateGlobalTokenBinding(arrowIcon, Icon.NormalFilledBrushProperty,
|
||||
GlobalTokenResourceKey.ColorTextQuaternary);
|
||||
|
||||
var rangeStartTextBox = BuildPickerTextBox(InfoInputBoxPart);
|
||||
|
@ -1,4 +1,5 @@
|
||||
using AtomUI.Controls.Utils;
|
||||
using AtomUI.IconPkg;
|
||||
using AtomUI.Utils;
|
||||
using Avalonia;
|
||||
using Avalonia.Animation;
|
||||
@ -24,8 +25,8 @@ public class LoadingIndicator : TemplatedControl, ISizeTypeAware
|
||||
public static readonly StyledProperty<bool> IsShowLoadingMsgProperty =
|
||||
AvaloniaProperty.Register<LoadingIndicator, bool>(nameof(IsShowLoadingMsg));
|
||||
|
||||
public static readonly StyledProperty<PathIcon?> CustomIndicatorIconProperty =
|
||||
AvaloniaProperty.Register<LoadingIndicator, PathIcon?>(nameof(CustomIndicatorIcon));
|
||||
public static readonly StyledProperty<Icon?> CustomIndicatorIconProperty =
|
||||
AvaloniaProperty.Register<LoadingIndicator, Icon?>(nameof(CustomIndicatorIcon));
|
||||
|
||||
public static readonly StyledProperty<TimeSpan?> MotionDurationProperty =
|
||||
AvaloniaProperty.Register<LoadingIndicator, TimeSpan?>(nameof(MotionDuration));
|
||||
@ -51,7 +52,7 @@ public class LoadingIndicator : TemplatedControl, ISizeTypeAware
|
||||
set => SetValue(IsShowLoadingMsgProperty, value);
|
||||
}
|
||||
|
||||
public PathIcon? CustomIndicatorIcon
|
||||
public Icon? CustomIndicatorIcon
|
||||
{
|
||||
get => GetValue(CustomIndicatorIconProperty);
|
||||
set => SetValue(CustomIndicatorIconProperty, value);
|
||||
@ -182,7 +183,7 @@ public class LoadingIndicator : TemplatedControl, ISizeTypeAware
|
||||
{
|
||||
if (VisualRoot is not null)
|
||||
{
|
||||
var oldCustomIcon = e.GetOldValue<PathIcon?>();
|
||||
var oldCustomIcon = e.GetOldValue<Icon?>();
|
||||
if (oldCustomIcon is not null)
|
||||
{
|
||||
_mainContainer?.Children.Remove(oldCustomIcon);
|
||||
|
@ -1,4 +1,4 @@
|
||||
using AtomUI.Icon;
|
||||
using AtomUI.IconPkg;
|
||||
using AtomUI.Theme;
|
||||
using AtomUI.Theme.Styling;
|
||||
using Avalonia.Animation.Easings;
|
||||
@ -63,15 +63,15 @@ internal class LoadingIndicatorTheme : BaseControlTheme
|
||||
|
||||
private void BuildCustomIconStyle()
|
||||
{
|
||||
var customIconStyle = new Style(selector => selector.Nesting().Template().OfType<PathIcon>());
|
||||
customIconStyle.Add(PathIcon.IconModeProperty, IconMode.Normal);
|
||||
var customIconStyle = new Style(selector => selector.Nesting().Template().OfType<Icon>());
|
||||
customIconStyle.Add(Icon.IconModeProperty, IconMode.Normal);
|
||||
customIconStyle.Add(Layoutable.VerticalAlignmentProperty, VerticalAlignment.Center);
|
||||
customIconStyle.Add(Layoutable.HorizontalAlignmentProperty, HorizontalAlignment.Center);
|
||||
Add(customIconStyle);
|
||||
|
||||
var largeSizeStyle = new Style(selector =>
|
||||
selector.Nesting().PropertyEquals(LoadingIndicator.SizeTypeProperty, SizeType.Large));
|
||||
var largeIconStyle = new Style(selector => selector.Nesting().Template().OfType<PathIcon>());
|
||||
var largeIconStyle = new Style(selector => selector.Nesting().Template().OfType<Icon>());
|
||||
largeIconStyle.Add(Layoutable.WidthProperty, LoadingIndicator.LARGE_INDICATOR_SIZE);
|
||||
largeIconStyle.Add(Layoutable.HeightProperty, LoadingIndicator.LARGE_INDICATOR_SIZE);
|
||||
largeSizeStyle.Add(largeIconStyle);
|
||||
@ -79,7 +79,7 @@ internal class LoadingIndicatorTheme : BaseControlTheme
|
||||
|
||||
var middleSizeStyle = new Style(selector =>
|
||||
selector.Nesting().PropertyEquals(LoadingIndicator.SizeTypeProperty, SizeType.Middle));
|
||||
var middleIconStyle = new Style(selector => selector.Nesting().Template().OfType<PathIcon>());
|
||||
var middleIconStyle = new Style(selector => selector.Nesting().Template().OfType<Icon>());
|
||||
middleIconStyle.Add(Layoutable.WidthProperty, LoadingIndicator.MIDDLE_INDICATOR_SIZE);
|
||||
middleIconStyle.Add(Layoutable.HeightProperty, LoadingIndicator.MIDDLE_INDICATOR_SIZE);
|
||||
middleSizeStyle.Add(middleIconStyle);
|
||||
@ -87,7 +87,7 @@ internal class LoadingIndicatorTheme : BaseControlTheme
|
||||
|
||||
var smallSizeStyle = new Style(selector =>
|
||||
selector.Nesting().PropertyEquals(LoadingIndicator.SizeTypeProperty, SizeType.Small));
|
||||
var smallIconStyle = new Style(selector => selector.Nesting().Template().OfType<PathIcon>());
|
||||
var smallIconStyle = new Style(selector => selector.Nesting().Template().OfType<Icon>());
|
||||
smallIconStyle.Add(Layoutable.WidthProperty, LoadingIndicator.SMALL_INDICATOR_SIZE);
|
||||
smallIconStyle.Add(Layoutable.HeightProperty, LoadingIndicator.SMALL_INDICATOR_SIZE);
|
||||
smallSizeStyle.Add(smallIconStyle);
|
||||
|
@ -1,4 +1,5 @@
|
||||
using AtomUI.Data;
|
||||
using AtomUI.IconPkg;
|
||||
using Avalonia;
|
||||
using Avalonia.Animation.Easings;
|
||||
using Avalonia.Controls;
|
||||
@ -21,7 +22,7 @@ public class LoadingMask : AvaloniaObject, IDisposable
|
||||
public static readonly StyledProperty<bool> IsShowLoadingMsgProperty =
|
||||
LoadingIndicator.IsShowLoadingMsgProperty.AddOwner<LoadingMask>();
|
||||
|
||||
public static readonly StyledProperty<PathIcon?> CustomIndicatorIconProperty =
|
||||
public static readonly StyledProperty<Icon?> CustomIndicatorIconProperty =
|
||||
LoadingIndicator.CustomIndicatorIconProperty.AddOwner<LoadingMask>();
|
||||
|
||||
public static readonly StyledProperty<TimeSpan?> MotionDurationProperty =
|
||||
@ -48,7 +49,7 @@ public class LoadingMask : AvaloniaObject, IDisposable
|
||||
set => SetValue(IsShowLoadingMsgProperty, value);
|
||||
}
|
||||
|
||||
public PathIcon? CustomIndicatorIcon
|
||||
public Icon? CustomIndicatorIcon
|
||||
{
|
||||
get => GetValue(CustomIndicatorIconProperty);
|
||||
set => SetValue(CustomIndicatorIconProperty, value);
|
||||
|
@ -1,5 +1,5 @@
|
||||
using AtomUI.Data;
|
||||
using AtomUI.Theme.Styling;
|
||||
using AtomUI.IconPkg;
|
||||
using Avalonia;
|
||||
using Avalonia.Animation.Easings;
|
||||
using Avalonia.Controls;
|
||||
@ -20,7 +20,7 @@ public class LoadingMaskHost : Control
|
||||
public static readonly StyledProperty<bool> IsShowLoadingMsgProperty =
|
||||
LoadingIndicator.IsShowLoadingMsgProperty.AddOwner<LoadingMaskHost>();
|
||||
|
||||
public static readonly StyledProperty<PathIcon?> CustomIndicatorIconProperty =
|
||||
public static readonly StyledProperty<Icon?> CustomIndicatorIconProperty =
|
||||
LoadingIndicator.CustomIndicatorIconProperty.AddOwner<LoadingMaskHost>();
|
||||
|
||||
public static readonly StyledProperty<TimeSpan?> MotionDurationProperty =
|
||||
@ -53,7 +53,7 @@ public class LoadingMaskHost : Control
|
||||
set => SetValue(IsShowLoadingMsgProperty, value);
|
||||
}
|
||||
|
||||
public PathIcon? CustomIndicatorIcon
|
||||
public Icon? CustomIndicatorIcon
|
||||
{
|
||||
get => GetValue(CustomIndicatorIconProperty);
|
||||
set => SetValue(CustomIndicatorIconProperty, value);
|
||||
|
@ -89,11 +89,11 @@ public class MenuItem : AvaloniaMenuItem
|
||||
}
|
||||
else if (e.Property == IconProperty)
|
||||
{
|
||||
if (Icon is not null && Icon is PathIcon pathIcon)
|
||||
if (Icon is not null && Icon is IconPkg.Icon icon)
|
||||
{
|
||||
TokenResourceBinder.CreateTokenBinding(pathIcon, WidthProperty, MenuTokenResourceKey.ItemIconSize);
|
||||
TokenResourceBinder.CreateTokenBinding(pathIcon, HeightProperty, MenuTokenResourceKey.ItemIconSize);
|
||||
TokenResourceBinder.CreateTokenBinding(pathIcon, PathIcon.NormalFilledBrushProperty,
|
||||
TokenResourceBinder.CreateTokenBinding(icon, WidthProperty, MenuTokenResourceKey.ItemIconSize);
|
||||
TokenResourceBinder.CreateTokenBinding(icon, HeightProperty, MenuTokenResourceKey.ItemIconSize);
|
||||
TokenResourceBinder.CreateTokenBinding(icon, IconPkg.Icon.NormalFilledBrushProperty,
|
||||
MenuTokenResourceKey.ItemColor);
|
||||
}
|
||||
}
|
||||
|
@ -1,4 +1,5 @@
|
||||
using AtomUI.Media;
|
||||
using AtomUI.IconPkg.AntDesign;
|
||||
using AtomUI.Media;
|
||||
using AtomUI.Theme;
|
||||
using AtomUI.Theme.Data;
|
||||
using AtomUI.Theme.Styling;
|
||||
@ -141,14 +142,12 @@ internal class MenuItemTheme : BaseControlTheme
|
||||
MenuItem.KeyGestureConverter);
|
||||
|
||||
inputGestureText.RegisterInNameScope(scope);
|
||||
|
||||
var menuIndicatorIcon = new PathIcon
|
||||
{
|
||||
Name = MenuIndicatorIconPart,
|
||||
HorizontalAlignment = HorizontalAlignment.Right,
|
||||
VerticalAlignment = VerticalAlignment.Center,
|
||||
Kind = "RightOutlined"
|
||||
};
|
||||
|
||||
var menuIndicatorIcon = AntDesignIconPackage.RightOutlined();
|
||||
menuIndicatorIcon.Name = MenuIndicatorIconPart;
|
||||
menuIndicatorIcon.HorizontalAlignment = HorizontalAlignment.Right;
|
||||
menuIndicatorIcon.VerticalAlignment = VerticalAlignment.Center;
|
||||
|
||||
TokenResourceBinder.CreateGlobalTokenBinding(menuIndicatorIcon, Layoutable.WidthProperty,
|
||||
GlobalTokenResourceKey.IconSizeXS);
|
||||
TokenResourceBinder.CreateGlobalTokenBinding(menuIndicatorIcon, Layoutable.HeightProperty,
|
||||
|
@ -1,9 +1,9 @@
|
||||
using AtomUI.Data;
|
||||
using AtomUI.IconPkg.AntDesign;
|
||||
using AtomUI.Media;
|
||||
using AtomUI.Theme;
|
||||
using AtomUI.Theme.Data;
|
||||
using AtomUI.Theme.Styling;
|
||||
using AtomUI.Theme.Utils;
|
||||
using AtomUI.Utils;
|
||||
using Avalonia.Animation;
|
||||
using Avalonia.Controls;
|
||||
@ -39,10 +39,7 @@ internal class MenuScrollViewerTheme : BaseControlTheme
|
||||
var scrollUpButton = new IconButton
|
||||
{
|
||||
Name = ScrollUpButtonPart,
|
||||
Icon = new PathIcon
|
||||
{
|
||||
Kind = "UpOutlined"
|
||||
},
|
||||
Icon = AntDesignIconPackage.UpOutlined(),
|
||||
HorizontalAlignment = HorizontalAlignment.Center,
|
||||
VerticalAlignment = VerticalAlignment.Center,
|
||||
Transitions = transitions,
|
||||
@ -58,10 +55,7 @@ internal class MenuScrollViewerTheme : BaseControlTheme
|
||||
var scrollDownButton = new IconButton
|
||||
{
|
||||
Name = ScrollDownButtonPart,
|
||||
Icon = new PathIcon
|
||||
{
|
||||
Kind = "DownOutlined"
|
||||
},
|
||||
Icon = AntDesignIconPackage.DownOutlined(),
|
||||
HorizontalAlignment = HorizontalAlignment.Center,
|
||||
VerticalAlignment = VerticalAlignment.Center,
|
||||
Transitions = transitions,
|
||||
|
@ -1,4 +1,6 @@
|
||||
namespace AtomUI.Controls;
|
||||
using AtomUI.IconPkg;
|
||||
|
||||
namespace AtomUI.Controls;
|
||||
|
||||
public interface IMessage
|
||||
{
|
||||
@ -10,7 +12,7 @@ public interface IMessage
|
||||
/// <summary>
|
||||
/// 自定义图标
|
||||
/// </summary>
|
||||
PathIcon? Icon { get; }
|
||||
Icon? Icon { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the <see cref="MessageType" /> of the notification.
|
||||
|
@ -1,16 +1,17 @@
|
||||
using System.ComponentModel;
|
||||
using System.Runtime.CompilerServices;
|
||||
using AtomUI.IconPkg;
|
||||
|
||||
namespace AtomUI.Controls;
|
||||
|
||||
public class Message : IMessage, INotifyPropertyChanged
|
||||
{
|
||||
private string _content;
|
||||
private PathIcon? _icon;
|
||||
private Icon? _icon;
|
||||
|
||||
public Message(string content,
|
||||
MessageType type = MessageType.Information,
|
||||
PathIcon? icon = null,
|
||||
Icon? icon = null,
|
||||
TimeSpan? expiration = null,
|
||||
Action? onClose = null)
|
||||
{
|
||||
@ -35,7 +36,7 @@ public class Message : IMessage, INotifyPropertyChanged
|
||||
}
|
||||
}
|
||||
|
||||
public PathIcon? Icon
|
||||
public Icon? Icon
|
||||
{
|
||||
get => _icon;
|
||||
|
||||
|
@ -1,4 +1,5 @@
|
||||
using AtomUI.Icon;
|
||||
using AtomUI.IconPkg;
|
||||
using AtomUI.IconPkg.AntDesign;
|
||||
using AtomUI.MotionScene;
|
||||
using AtomUI.Theme.Data;
|
||||
using AtomUI.Theme.Styling;
|
||||
@ -48,8 +49,8 @@ public class MessageCard : TemplatedControl
|
||||
public static readonly RoutedEvent<RoutedEventArgs> MessageClosedEvent =
|
||||
RoutedEvent.Register<MessageCard, RoutedEventArgs>(nameof(MessageClosed), RoutingStrategies.Bubble);
|
||||
|
||||
public static readonly StyledProperty<PathIcon?> IconProperty
|
||||
= AvaloniaProperty.Register<MessageCard, PathIcon?>(nameof(Icon));
|
||||
public static readonly StyledProperty<Icon?> IconProperty
|
||||
= AvaloniaProperty.Register<MessageCard, Icon?>(nameof(Icon));
|
||||
|
||||
public static readonly StyledProperty<string> MessageProperty =
|
||||
AvaloniaProperty.Register<NotificationCard, string>(nameof(Message));
|
||||
@ -90,7 +91,7 @@ public class MessageCard : TemplatedControl
|
||||
remove => RemoveHandler(MessageClosedEvent, value);
|
||||
}
|
||||
|
||||
public PathIcon? Icon
|
||||
public Icon? Icon
|
||||
{
|
||||
get => GetValue(IconProperty);
|
||||
set => SetValue(IconProperty, value);
|
||||
@ -248,69 +249,54 @@ public class MessageCard : TemplatedControl
|
||||
}
|
||||
}
|
||||
|
||||
private void SetupMessageIconColor(PathIcon icon)
|
||||
private void SetupMessageIconColor(Icon Icon)
|
||||
{
|
||||
if (MessageType == MessageType.Error)
|
||||
{
|
||||
TokenResourceBinder.CreateGlobalTokenBinding(icon, PathIcon.NormalFilledBrushProperty,
|
||||
TokenResourceBinder.CreateGlobalTokenBinding(Icon, Icon.NormalFilledBrushProperty,
|
||||
GlobalTokenResourceKey.ColorError);
|
||||
}
|
||||
else if (MessageType == MessageType.Information ||
|
||||
MessageType == MessageType.Loading)
|
||||
{
|
||||
TokenResourceBinder.CreateGlobalTokenBinding(icon, PathIcon.NormalFilledBrushProperty,
|
||||
TokenResourceBinder.CreateGlobalTokenBinding(Icon, Icon.NormalFilledBrushProperty,
|
||||
GlobalTokenResourceKey.ColorPrimary);
|
||||
}
|
||||
else if (MessageType == MessageType.Success)
|
||||
{
|
||||
TokenResourceBinder.CreateGlobalTokenBinding(icon, PathIcon.NormalFilledBrushProperty,
|
||||
TokenResourceBinder.CreateGlobalTokenBinding(Icon, Icon.NormalFilledBrushProperty,
|
||||
GlobalTokenResourceKey.ColorSuccess);
|
||||
}
|
||||
else if (MessageType == MessageType.Warning)
|
||||
{
|
||||
TokenResourceBinder.CreateGlobalTokenBinding(icon, PathIcon.NormalFilledBrushProperty,
|
||||
TokenResourceBinder.CreateGlobalTokenBinding(Icon, Icon.NormalFilledBrushProperty,
|
||||
GlobalTokenResourceKey.ColorWarning);
|
||||
}
|
||||
}
|
||||
|
||||
private void SetupMessageIcon()
|
||||
{
|
||||
PathIcon? icon = null;
|
||||
Icon? icon = null;
|
||||
if (MessageType == MessageType.Information)
|
||||
{
|
||||
icon = new PathIcon
|
||||
{
|
||||
Kind = "InfoCircleFilled"
|
||||
};
|
||||
icon = AntDesignIconPackage.InfoCircleFilled();
|
||||
}
|
||||
else if (MessageType == MessageType.Success)
|
||||
{
|
||||
icon = new PathIcon
|
||||
{
|
||||
Kind = "CheckCircleFilled"
|
||||
};
|
||||
icon = AntDesignIconPackage.CheckCircleFilled();
|
||||
}
|
||||
else if (MessageType == MessageType.Error)
|
||||
{
|
||||
icon = new PathIcon
|
||||
{
|
||||
Kind = "CloseCircleFilled"
|
||||
};
|
||||
icon = AntDesignIconPackage.CloseCircleFilled();
|
||||
}
|
||||
else if (MessageType == MessageType.Warning)
|
||||
{
|
||||
icon = new PathIcon
|
||||
{
|
||||
Kind = "ExclamationCircleFilled"
|
||||
};
|
||||
icon = AntDesignIconPackage.ExclamationCircleFilled();
|
||||
}
|
||||
else if (MessageType == MessageType.Loading)
|
||||
{
|
||||
icon = new PathIcon
|
||||
{
|
||||
Kind = "LoadingOutlined",
|
||||
LoadingAnimation = IconAnimation.Spin
|
||||
};
|
||||
icon = AntDesignIconPackage.LoadingOutlined();
|
||||
icon.LoadingAnimation = IconAnimation.Spin;
|
||||
}
|
||||
|
||||
if (icon is not null)
|
||||
|
@ -1,4 +1,5 @@
|
||||
using AtomUI.MotionScene;
|
||||
using AtomUI.IconPkg;
|
||||
using AtomUI.MotionScene;
|
||||
using AtomUI.Theme;
|
||||
using AtomUI.Theme.Data;
|
||||
using AtomUI.Theme.Styling;
|
||||
@ -143,7 +144,7 @@ internal class MessageCardTheme : BaseControlTheme
|
||||
|
||||
protected override void BuildInstanceStyles(Control control)
|
||||
{
|
||||
var iconStyle = new Style(selector => selector.Name(IconContentPart).Child().OfType<PathIcon>());
|
||||
var iconStyle = new Style(selector => selector.Name(IconContentPart).Child().OfType<Icon>());
|
||||
iconStyle.Add(Layoutable.WidthProperty, MessageTokenResourceKey.MessageIconSize);
|
||||
iconStyle.Add(Layoutable.HeightProperty, MessageTokenResourceKey.MessageIconSize);
|
||||
control.Styles.Add(iconStyle);
|
||||
|
@ -1,4 +1,5 @@
|
||||
using AtomUI.Icon;
|
||||
using AtomUI.IconPkg;
|
||||
using AtomUI.IconPkg.AntDesign;
|
||||
using AtomUI.Media;
|
||||
using AtomUI.Theme;
|
||||
using AtomUI.Theme.Data;
|
||||
@ -154,15 +155,12 @@ internal class BaseNavMenuItemTheme : BaseControlTheme
|
||||
|
||||
protected virtual Control BuildMenuIndicatorIcon(INameScope scope)
|
||||
{
|
||||
var menuIndicatorIcon = new PathIcon
|
||||
{
|
||||
Name = MenuIndicatorIconPart,
|
||||
HorizontalAlignment = HorizontalAlignment.Right,
|
||||
VerticalAlignment = VerticalAlignment.Center,
|
||||
Kind = "RightOutlined"
|
||||
};
|
||||
var menuIndicatorIcon = AntDesignIconPackage.RightOutlined();
|
||||
menuIndicatorIcon.Name = MenuIndicatorIconPart;
|
||||
menuIndicatorIcon.HorizontalAlignment = HorizontalAlignment.Right;
|
||||
menuIndicatorIcon.VerticalAlignment = VerticalAlignment.Center;
|
||||
|
||||
CreateTemplateParentBinding(menuIndicatorIcon, PathIcon.IsEnabledProperty, NavMenuItem.IsEnabledProperty);
|
||||
CreateTemplateParentBinding(menuIndicatorIcon, Icon.IsEnabledProperty, NavMenuItem.IsEnabledProperty);
|
||||
|
||||
TokenResourceBinder.CreateGlobalTokenBinding(menuIndicatorIcon, Layoutable.WidthProperty,
|
||||
NavMenuTokenResourceKey.MenuArrowSize);
|
||||
@ -290,43 +288,43 @@ internal class BaseNavMenuItemTheme : BaseControlTheme
|
||||
|
||||
private void BuildMenuIndicatorStyle()
|
||||
{
|
||||
{
|
||||
var menuIndicatorStyle = new Style(selector => selector.Nesting().Template().Name(MenuIndicatorIconPart));
|
||||
menuIndicatorStyle.Add(Visual.IsVisibleProperty, true);
|
||||
menuIndicatorStyle.Add(PathIcon.NormalFilledBrushProperty, NavMenuTokenResourceKey.ItemColor);
|
||||
menuIndicatorStyle.Add(PathIcon.SelectedFilledBrushProperty, NavMenuTokenResourceKey.ItemSelectedColor);
|
||||
menuIndicatorStyle.Add(PathIcon.DisabledFilledBrushProperty, NavMenuTokenResourceKey.ItemDisabledColor);
|
||||
// 设置颜色
|
||||
|
||||
Add(menuIndicatorStyle);
|
||||
}
|
||||
{
|
||||
var darkCommonStyle = new Style(selector => selector.Nesting().PropertyEquals(NavMenuItem.IsDarkStyleProperty, true));
|
||||
{
|
||||
var menuIndicatorStyle = new Style(selector => selector.Nesting().Template().Name(MenuIndicatorIconPart));
|
||||
menuIndicatorStyle.Add(PathIcon.NormalFilledBrushProperty, NavMenuTokenResourceKey.DarkItemColor);
|
||||
menuIndicatorStyle.Add(PathIcon.SelectedFilledBrushProperty, NavMenuTokenResourceKey.DarkItemSelectedColor);
|
||||
menuIndicatorStyle.Add(PathIcon.DisabledFilledBrushProperty, NavMenuTokenResourceKey.DarkItemDisabledColor);
|
||||
darkCommonStyle.Add(menuIndicatorStyle);
|
||||
}
|
||||
Add(darkCommonStyle);
|
||||
}
|
||||
|
||||
var selectedStyle = new Style(selector => selector.Nesting().Class(StdPseudoClass.Selected));
|
||||
{
|
||||
var menuIndicatorStyle = new Style(selector => selector.Nesting().Template().Name(MenuIndicatorIconPart));
|
||||
menuIndicatorStyle.Add(PathIcon.IconModeProperty, IconMode.Selected);
|
||||
selectedStyle.Add(menuIndicatorStyle);
|
||||
}
|
||||
Add(selectedStyle);
|
||||
|
||||
var hasNoSubMenuStyle = new Style(selector => selector.Nesting().PropertyEquals(NavMenuItem.HasSubMenuProperty, false));
|
||||
{
|
||||
var menuIndicatorStyle = new Style(selector => selector.Nesting().Template().Name(MenuIndicatorIconPart));
|
||||
menuIndicatorStyle.Add(Visual.IsVisibleProperty, false);
|
||||
hasNoSubMenuStyle.Add(menuIndicatorStyle);
|
||||
}
|
||||
Add(hasNoSubMenuStyle);
|
||||
// {
|
||||
// var menuIndicatorStyle = new Style(selector => selector.Nesting().Template().Name(MenuIndicatorIconPart));
|
||||
// menuIndicatorStyle.Add(Visual.IsVisibleProperty, true);
|
||||
// menuIndicatorStyle.Add(Icon.NormalFilledBrushProperty, NavMenuTokenResourceKey.ItemColor);
|
||||
// menuIndicatorStyle.Add(Icon.SelectedFilledBrushProperty, NavMenuTokenResourceKey.ItemSelectedColor);
|
||||
// menuIndicatorStyle.Add(Icon.DisabledFilledBrushProperty, NavMenuTokenResourceKey.ItemDisabledColor);
|
||||
// // 设置颜色
|
||||
//
|
||||
// Add(menuIndicatorStyle);
|
||||
// }
|
||||
// {
|
||||
// var darkCommonStyle = new Style(selector => selector.Nesting().PropertyEquals(NavMenuItem.IsDarkStyleProperty, true));
|
||||
// {
|
||||
// var menuIndicatorStyle = new Style(selector => selector.Nesting().Template().Name(MenuIndicatorIconPart));
|
||||
// menuIndicatorStyle.Add(Icon.NormalFilledBrushProperty, NavMenuTokenResourceKey.DarkItemColor);
|
||||
// menuIndicatorStyle.Add(Icon.SelectedFilledBrushProperty, NavMenuTokenResourceKey.DarkItemSelectedColor);
|
||||
// menuIndicatorStyle.Add(Icon.DisabledFilledBrushProperty, NavMenuTokenResourceKey.DarkItemDisabledColor);
|
||||
// darkCommonStyle.Add(menuIndicatorStyle);
|
||||
// }
|
||||
// Add(darkCommonStyle);
|
||||
// }
|
||||
//
|
||||
// var selectedStyle = new Style(selector => selector.Nesting().Class(StdPseudoClass.Selected));
|
||||
// {
|
||||
// var menuIndicatorStyle = new Style(selector => selector.Nesting().Template().Name(MenuIndicatorIconPart));
|
||||
// menuIndicatorStyle.Add(Icon.IconModeProperty, IconMode.Selected);
|
||||
// selectedStyle.Add(menuIndicatorStyle);
|
||||
// }
|
||||
// Add(selectedStyle);
|
||||
//
|
||||
// var hasNoSubMenuStyle = new Style(selector => selector.Nesting().PropertyEquals(NavMenuItem.HasSubMenuProperty, false));
|
||||
// {
|
||||
// var menuIndicatorStyle = new Style(selector => selector.Nesting().Template().Name(MenuIndicatorIconPart));
|
||||
// menuIndicatorStyle.Add(Visual.IsVisibleProperty, false);
|
||||
// hasNoSubMenuStyle.Add(menuIndicatorStyle);
|
||||
// }
|
||||
// Add(hasNoSubMenuStyle);
|
||||
}
|
||||
|
||||
private void BuildMenuIconStyle()
|
||||
|
@ -1,7 +1,7 @@
|
||||
using System.Windows.Input;
|
||||
using AtomUI.Controls.Utils;
|
||||
using AtomUI.Data;
|
||||
using AtomUI.Icon;
|
||||
using AtomUI.IconPkg;
|
||||
using AtomUI.Input;
|
||||
using AtomUI.Media;
|
||||
using AtomUI.MotionScene;
|
||||
@ -61,8 +61,8 @@ public class NavMenuItem : HeaderedSelectingItemsControl,
|
||||
/// <summary>
|
||||
/// Defines the <see cref="Icon"/> property.
|
||||
/// </summary>
|
||||
public static readonly StyledProperty<PathIcon?> IconProperty =
|
||||
AvaloniaProperty.Register<NavMenuItem, PathIcon?>(nameof(Icon));
|
||||
public static readonly StyledProperty<Icon?> IconProperty =
|
||||
AvaloniaProperty.Register<NavMenuItem, Icon?>(nameof(Icon));
|
||||
|
||||
/// <summary>
|
||||
/// Defines the <see cref="InputGesture"/> property.
|
||||
@ -126,7 +126,7 @@ public class NavMenuItem : HeaderedSelectingItemsControl,
|
||||
/// <summary>
|
||||
/// Gets or sets the icon that appears in a <see cref="NavMenuItem"/>.
|
||||
/// </summary>
|
||||
public PathIcon? Icon
|
||||
public Icon? Icon
|
||||
{
|
||||
get => GetValue(IconProperty);
|
||||
set => SetValue(IconProperty, value);
|
||||
@ -911,34 +911,34 @@ public class NavMenuItem : HeaderedSelectingItemsControl,
|
||||
|
||||
private void SetupItemIcon()
|
||||
{
|
||||
if (Icon is not null && Icon is PathIcon menuItemIcon)
|
||||
if (Icon is not null && Icon is Icon menuItemIcon)
|
||||
{
|
||||
BindUtils.RelayBind(this, IsEnabledProperty, menuItemIcon, PathIcon.IsEnabledProperty);
|
||||
TokenResourceBinder.CreateTokenBinding(menuItemIcon, PathIcon.WidthProperty,
|
||||
BindUtils.RelayBind(this, IsEnabledProperty, menuItemIcon, Icon.IsEnabledProperty);
|
||||
TokenResourceBinder.CreateTokenBinding(menuItemIcon, Icon.WidthProperty,
|
||||
NavMenuTokenResourceKey.ItemIconSize);
|
||||
TokenResourceBinder.CreateTokenBinding(menuItemIcon, PathIcon.HeightProperty,
|
||||
TokenResourceBinder.CreateTokenBinding(menuItemIcon, Icon.HeightProperty,
|
||||
NavMenuTokenResourceKey.ItemIconSize);
|
||||
|
||||
if (IsDarkStyle)
|
||||
{
|
||||
TokenResourceBinder.CreateTokenBinding(menuItemIcon, PathIcon.NormalFilledBrushProperty,
|
||||
TokenResourceBinder.CreateTokenBinding(menuItemIcon, Icon.NormalFilledBrushProperty,
|
||||
NavMenuTokenResourceKey.DarkItemColor);
|
||||
TokenResourceBinder.CreateTokenBinding(menuItemIcon, PathIcon.SelectedFilledBrushProperty,
|
||||
TokenResourceBinder.CreateTokenBinding(menuItemIcon, Icon.SelectedFilledBrushProperty,
|
||||
NavMenuTokenResourceKey.DarkItemSelectedColor);
|
||||
TokenResourceBinder.CreateTokenBinding(menuItemIcon, PathIcon.ActiveFilledBrushProperty,
|
||||
TokenResourceBinder.CreateTokenBinding(menuItemIcon, Icon.ActiveFilledBrushProperty,
|
||||
NavMenuTokenResourceKey.DarkItemHoverColor);
|
||||
TokenResourceBinder.CreateTokenBinding(menuItemIcon, PathIcon.DisabledFilledBrushProperty,
|
||||
TokenResourceBinder.CreateTokenBinding(menuItemIcon, Icon.DisabledFilledBrushProperty,
|
||||
NavMenuTokenResourceKey.DarkItemDisabledColor);
|
||||
}
|
||||
else
|
||||
{
|
||||
TokenResourceBinder.CreateTokenBinding(menuItemIcon, PathIcon.NormalFilledBrushProperty,
|
||||
TokenResourceBinder.CreateTokenBinding(menuItemIcon, Icon.NormalFilledBrushProperty,
|
||||
NavMenuTokenResourceKey.ItemColor);
|
||||
TokenResourceBinder.CreateTokenBinding(menuItemIcon, PathIcon.SelectedFilledBrushProperty,
|
||||
TokenResourceBinder.CreateTokenBinding(menuItemIcon, Icon.SelectedFilledBrushProperty,
|
||||
NavMenuTokenResourceKey.ItemSelectedColor);
|
||||
TokenResourceBinder.CreateTokenBinding(menuItemIcon, PathIcon.ActiveFilledBrushProperty,
|
||||
TokenResourceBinder.CreateTokenBinding(menuItemIcon, Icon.ActiveFilledBrushProperty,
|
||||
NavMenuTokenResourceKey.ItemHoverColor);
|
||||
TokenResourceBinder.CreateTokenBinding(menuItemIcon, PathIcon.DisabledFilledBrushProperty,
|
||||
TokenResourceBinder.CreateTokenBinding(menuItemIcon, Icon.DisabledFilledBrushProperty,
|
||||
NavMenuTokenResourceKey.ItemDisabledColor);
|
||||
}
|
||||
}
|
||||
@ -1003,7 +1003,7 @@ public class NavMenuItem : HeaderedSelectingItemsControl,
|
||||
/// <param name="e">The property change event.</param>
|
||||
private void IconChanged(AvaloniaPropertyChangedEventArgs e)
|
||||
{
|
||||
var (oldValue, newValue) = e.GetOldAndNewValue<PathIcon?>();
|
||||
var (oldValue, newValue) = e.GetOldAndNewValue<Icon?>();
|
||||
|
||||
if (oldValue is ILogical oldLogical)
|
||||
{
|
||||
@ -1031,15 +1031,15 @@ public class NavMenuItem : HeaderedSelectingItemsControl,
|
||||
Focus();
|
||||
}
|
||||
|
||||
if (Icon is not null && Icon is PathIcon menuIcon)
|
||||
if (Icon is not null && Icon is Icon menuIcon)
|
||||
{
|
||||
if (isSelected)
|
||||
{
|
||||
menuIcon.SetValue(PathIcon.IconModeProperty, IconMode.Selected);
|
||||
menuIcon.SetValue(Icon.IconModeProperty, IconMode.Selected);
|
||||
}
|
||||
else
|
||||
{
|
||||
menuIcon.SetValue(PathIcon.IconModeProperty, IconMode.Normal);
|
||||
menuIcon.SetValue(Icon.IconModeProperty, IconMode.Normal);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
using AtomUI.Icon;
|
||||
using AtomUI.IconPkg;
|
||||
using AtomUI.Media;
|
||||
using AtomUI.Theme;
|
||||
using AtomUI.Theme.Data;
|
||||
@ -237,15 +237,15 @@ internal class TopLevelHorizontalNavMenuItemTheme : BaseControlTheme
|
||||
protected override void BuildInstanceStyles(Control control)
|
||||
{
|
||||
var iconStyle = new Style(selector => selector.Name(ThemeConstants.ItemIconPart));
|
||||
iconStyle.Add(PathIcon.WidthProperty, NavMenuTokenResourceKey.ItemIconSize);
|
||||
iconStyle.Add(PathIcon.HeightProperty, NavMenuTokenResourceKey.ItemIconSize);
|
||||
iconStyle.Add(PathIcon.NormalFilledBrushProperty, GlobalTokenResourceKey.ColorText);
|
||||
iconStyle.Add(PathIcon.DisabledFilledBrushProperty, NavMenuTokenResourceKey.ItemDisabledColor);
|
||||
iconStyle.Add(PathIcon.SelectedFilledBrushProperty, GlobalTokenResourceKey.ColorPrimary);
|
||||
iconStyle.Add(Icon.WidthProperty, NavMenuTokenResourceKey.ItemIconSize);
|
||||
iconStyle.Add(Icon.HeightProperty, NavMenuTokenResourceKey.ItemIconSize);
|
||||
iconStyle.Add(Icon.NormalFilledBrushProperty, GlobalTokenResourceKey.ColorText);
|
||||
iconStyle.Add(Icon.DisabledFilledBrushProperty, NavMenuTokenResourceKey.ItemDisabledColor);
|
||||
iconStyle.Add(Icon.SelectedFilledBrushProperty, GlobalTokenResourceKey.ColorPrimary);
|
||||
control.Styles.Add(iconStyle);
|
||||
|
||||
var disabledIconStyle = new Style(selector => selector.OfType<PathIcon>().Class(StdPseudoClass.Disabled));
|
||||
disabledIconStyle.Add(PathIcon.IconModeProperty, IconMode.Disabled);
|
||||
var disabledIconStyle = new Style(selector => selector.OfType<Icon>().Class(StdPseudoClass.Disabled));
|
||||
disabledIconStyle.Add(Icon.IconModeProperty, IconMode.Disabled);
|
||||
control.Styles.Add(disabledIconStyle);
|
||||
}
|
||||
}
|
@ -1,4 +1,6 @@
|
||||
namespace AtomUI.Controls;
|
||||
using AtomUI.IconPkg;
|
||||
|
||||
namespace AtomUI.Controls;
|
||||
|
||||
public interface INotification
|
||||
{
|
||||
@ -15,7 +17,7 @@ public interface INotification
|
||||
/// <summary>
|
||||
/// 自定义图标
|
||||
/// </summary>
|
||||
PathIcon? Icon { get; }
|
||||
Icon? Icon { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the <see cref="NotificationType" /> of the notification.
|
||||
|
@ -1,5 +1,6 @@
|
||||
using System.ComponentModel;
|
||||
using System.Runtime.CompilerServices;
|
||||
using AtomUI.IconPkg;
|
||||
|
||||
namespace AtomUI.Controls;
|
||||
|
||||
@ -8,12 +9,12 @@ public class Notification : INotification, INotifyPropertyChanged
|
||||
private string _title;
|
||||
private object? _content;
|
||||
private bool _showProgress;
|
||||
private PathIcon? _icon;
|
||||
private Icon? _icon;
|
||||
|
||||
public Notification(string title,
|
||||
object? content,
|
||||
NotificationType type = NotificationType.Information,
|
||||
PathIcon? icon = null,
|
||||
Icon? icon = null,
|
||||
TimeSpan? expiration = null,
|
||||
bool showProgress = false,
|
||||
Action? onClick = null,
|
||||
@ -57,7 +58,7 @@ public class Notification : INotification, INotifyPropertyChanged
|
||||
}
|
||||
}
|
||||
|
||||
public PathIcon? Icon
|
||||
public Icon? Icon
|
||||
{
|
||||
get => _icon;
|
||||
|
||||
|
@ -1,4 +1,6 @@
|
||||
using AtomUI.MotionScene;
|
||||
using AtomUI.IconPkg;
|
||||
using AtomUI.IconPkg.AntDesign;
|
||||
using AtomUI.MotionScene;
|
||||
using AtomUI.Theme.Data;
|
||||
using AtomUI.Theme.Styling;
|
||||
using Avalonia;
|
||||
@ -56,8 +58,8 @@ public class NotificationCard : ContentControl
|
||||
public static readonly StyledProperty<string> TitleProperty =
|
||||
AvaloniaProperty.Register<NotificationCard, string>(nameof(Title));
|
||||
|
||||
public static readonly StyledProperty<PathIcon?> IconProperty
|
||||
= AvaloniaProperty.Register<NotificationCard, PathIcon?>(nameof(Icon));
|
||||
public static readonly StyledProperty<Icon?> IconProperty
|
||||
= AvaloniaProperty.Register<NotificationCard, Icon?>(nameof(Icon));
|
||||
|
||||
/// <summary>
|
||||
/// Determines if the notification is already closing.
|
||||
@ -98,7 +100,7 @@ public class NotificationCard : ContentControl
|
||||
set => SetValue(TitleProperty, value);
|
||||
}
|
||||
|
||||
public PathIcon? Icon
|
||||
public Icon? Icon
|
||||
{
|
||||
get => GetValue(IconProperty);
|
||||
set => SetValue(IconProperty, value);
|
||||
@ -402,26 +404,26 @@ public class NotificationCard : ContentControl
|
||||
}
|
||||
}
|
||||
|
||||
private void SetupNotificationIconColor(PathIcon icon)
|
||||
private void SetupNotificationIconColor(Icon icon)
|
||||
{
|
||||
if (NotificationType == NotificationType.Error)
|
||||
{
|
||||
TokenResourceBinder.CreateGlobalTokenBinding(icon, PathIcon.NormalFilledBrushProperty,
|
||||
TokenResourceBinder.CreateGlobalTokenBinding(icon, Icon.NormalFilledBrushProperty,
|
||||
GlobalTokenResourceKey.ColorError);
|
||||
}
|
||||
else if (NotificationType == NotificationType.Information)
|
||||
{
|
||||
TokenResourceBinder.CreateGlobalTokenBinding(icon, PathIcon.NormalFilledBrushProperty,
|
||||
TokenResourceBinder.CreateGlobalTokenBinding(icon, Icon.NormalFilledBrushProperty,
|
||||
GlobalTokenResourceKey.ColorPrimary);
|
||||
}
|
||||
else if (NotificationType == NotificationType.Success)
|
||||
{
|
||||
TokenResourceBinder.CreateGlobalTokenBinding(icon, PathIcon.NormalFilledBrushProperty,
|
||||
TokenResourceBinder.CreateGlobalTokenBinding(icon, Icon.NormalFilledBrushProperty,
|
||||
GlobalTokenResourceKey.ColorSuccess);
|
||||
}
|
||||
else if (NotificationType == NotificationType.Warning)
|
||||
{
|
||||
TokenResourceBinder.CreateGlobalTokenBinding(icon, PathIcon.NormalFilledBrushProperty,
|
||||
TokenResourceBinder.CreateGlobalTokenBinding(icon, Icon.NormalFilledBrushProperty,
|
||||
GlobalTokenResourceKey.ColorWarning);
|
||||
}
|
||||
}
|
||||
@ -444,34 +446,22 @@ public class NotificationCard : ContentControl
|
||||
|
||||
private void SetupNotificationIcon()
|
||||
{
|
||||
PathIcon? icon = null;
|
||||
Icon? icon = null;
|
||||
if (NotificationType == NotificationType.Information)
|
||||
{
|
||||
icon = new PathIcon
|
||||
{
|
||||
Kind = "InfoCircleFilled"
|
||||
};
|
||||
icon = AntDesignIconPackage.InfoCircleFilled();
|
||||
}
|
||||
else if (NotificationType == NotificationType.Success)
|
||||
{
|
||||
icon = new PathIcon
|
||||
{
|
||||
Kind = "CheckCircleFilled"
|
||||
};
|
||||
icon = AntDesignIconPackage.CheckCircleFilled();
|
||||
}
|
||||
else if (NotificationType == NotificationType.Error)
|
||||
{
|
||||
icon = new PathIcon
|
||||
{
|
||||
Kind = "CloseCircleFilled"
|
||||
};
|
||||
icon = AntDesignIconPackage.CloseCircleFilled();
|
||||
}
|
||||
else if (NotificationType == NotificationType.Warning)
|
||||
{
|
||||
icon = new PathIcon
|
||||
{
|
||||
Kind = "ExclamationCircleFilled"
|
||||
};
|
||||
icon = AntDesignIconPackage.ExclamationCircleFilled();
|
||||
}
|
||||
|
||||
if (icon is not null)
|
||||
|
@ -1,4 +1,6 @@
|
||||
using AtomUI.MotionScene;
|
||||
using AtomUI.IconPkg;
|
||||
using AtomUI.IconPkg.AntDesign;
|
||||
using AtomUI.MotionScene;
|
||||
using AtomUI.Theme;
|
||||
using AtomUI.Theme.Data;
|
||||
using AtomUI.Theme.Styling;
|
||||
@ -118,13 +120,11 @@ internal class NotificationCardTheme : BaseControlTheme
|
||||
GlobalTokenResourceKey.SelectionForeground);
|
||||
|
||||
CreateTemplateParentBinding(headerTitle, TextBlock.TextProperty, NotificationCard.TitleProperty);
|
||||
var closeIcon = new PathIcon
|
||||
{
|
||||
Kind = "CloseOutlined"
|
||||
};
|
||||
TokenResourceBinder.CreateTokenBinding(closeIcon, PathIcon.NormalFilledBrushProperty,
|
||||
|
||||
var closeIcon = AntDesignIconPackage.CloseOutlined();
|
||||
TokenResourceBinder.CreateTokenBinding(closeIcon, Icon.NormalFilledBrushProperty,
|
||||
GlobalTokenResourceKey.ColorIcon);
|
||||
TokenResourceBinder.CreateTokenBinding(closeIcon, PathIcon.ActiveFilledBrushProperty,
|
||||
TokenResourceBinder.CreateTokenBinding(closeIcon, Icon.ActiveFilledBrushProperty,
|
||||
GlobalTokenResourceKey.ColorIconHover);
|
||||
var closeIconButton = new IconButton
|
||||
{
|
||||
@ -315,7 +315,7 @@ internal class NotificationCardTheme : BaseControlTheme
|
||||
|
||||
protected override void BuildInstanceStyles(Control control)
|
||||
{
|
||||
var iconStyle = new Style(selector => selector.Name(IconContentPart).Child().OfType<PathIcon>());
|
||||
var iconStyle = new Style(selector => selector.Name(IconContentPart).Child().OfType<Icon>());
|
||||
iconStyle.Add(Layoutable.WidthProperty, NotificationTokenResourceKey.NotificationIconSize);
|
||||
iconStyle.Add(Layoutable.HeightProperty, NotificationTokenResourceKey.NotificationIconSize);
|
||||
control.Styles.Add(iconStyle);
|
||||
|
@ -1,660 +0,0 @@
|
||||
using AtomUI.Controls.Utils;
|
||||
using AtomUI.Icon;
|
||||
using AtomUI.Media;
|
||||
using Avalonia;
|
||||
using Avalonia.Animation;
|
||||
using Avalonia.Controls;
|
||||
using Avalonia.Layout;
|
||||
using Avalonia.LogicalTree;
|
||||
using Avalonia.Media;
|
||||
using Avalonia.Reactive;
|
||||
using Avalonia.Rendering;
|
||||
using Avalonia.Styling;
|
||||
|
||||
namespace AtomUI.Controls;
|
||||
|
||||
public sealed class PathIcon : Control, ICustomHitTest
|
||||
{
|
||||
public static readonly StyledProperty<string> KindProperty = AvaloniaProperty.Register<PathIcon, string>(
|
||||
nameof(Kind), string.Empty);
|
||||
|
||||
public static readonly StyledProperty<IconAnimation> LoadingAnimationProperty =
|
||||
AvaloniaProperty.Register<PathIcon, IconAnimation>(
|
||||
nameof(LoadingAnimation));
|
||||
|
||||
public static readonly StyledProperty<string?> PackageProviderProperty =
|
||||
AvaloniaProperty.Register<PathIcon, string?>(
|
||||
nameof(PackageProvider));
|
||||
|
||||
// Fill 和 Outline 支持的颜色
|
||||
public static readonly StyledProperty<IBrush?> NormalFilledBrushProperty =
|
||||
AvaloniaProperty.Register<PathIcon, IBrush?>(
|
||||
nameof(NormalFilledBrush));
|
||||
|
||||
public static readonly StyledProperty<IBrush?> ActiveFilledBrushProperty =
|
||||
AvaloniaProperty.Register<PathIcon, IBrush?>(
|
||||
nameof(ActiveFilledBrush));
|
||||
|
||||
public static readonly StyledProperty<IBrush?> SelectedFilledBrushProperty =
|
||||
AvaloniaProperty.Register<PathIcon, IBrush?>(
|
||||
nameof(SelectedFilledBrush));
|
||||
|
||||
public static readonly StyledProperty<IBrush?> DisabledFilledBrushProperty =
|
||||
AvaloniaProperty.Register<PathIcon, IBrush?>(
|
||||
nameof(DisabledFilledBrush));
|
||||
|
||||
// TwoTone 类型的颜色
|
||||
public static readonly StyledProperty<IBrush?> PrimaryFilledBrushProperty =
|
||||
AvaloniaProperty.Register<PathIcon, IBrush?>(
|
||||
nameof(PrimaryFilledBrush));
|
||||
|
||||
public static readonly StyledProperty<IBrush?> SecondaryFilledBrushProperty =
|
||||
AvaloniaProperty.Register<PathIcon, IBrush?>(
|
||||
nameof(SecondaryFilledBrush));
|
||||
|
||||
public static readonly StyledProperty<TimeSpan> LoadingAnimationDurationProperty =
|
||||
AvaloniaProperty.Register<PathIcon, TimeSpan>(
|
||||
nameof(LoadingAnimationDuration), TimeSpan.FromSeconds(1));
|
||||
|
||||
public static readonly StyledProperty<IconMode> IconModeProperty = AvaloniaProperty.Register<PathIcon, IconMode>(
|
||||
nameof(IconMode));
|
||||
|
||||
public string Kind
|
||||
{
|
||||
get => GetValue(KindProperty);
|
||||
set => SetValue(KindProperty, value);
|
||||
}
|
||||
|
||||
public string? PackageProvider
|
||||
{
|
||||
get => GetValue(PackageProviderProperty);
|
||||
set => SetValue(PackageProviderProperty, value);
|
||||
}
|
||||
|
||||
public IBrush? NormalFilledBrush
|
||||
{
|
||||
get => GetValue(NormalFilledBrushProperty);
|
||||
set => SetValue(NormalFilledBrushProperty, value);
|
||||
}
|
||||
|
||||
public IBrush? ActiveFilledBrush
|
||||
{
|
||||
get => GetValue(ActiveFilledBrushProperty);
|
||||
set => SetValue(ActiveFilledBrushProperty, value);
|
||||
}
|
||||
|
||||
public IBrush? SelectedFilledBrush
|
||||
{
|
||||
get => GetValue(SelectedFilledBrushProperty);
|
||||
set => SetValue(SelectedFilledBrushProperty, value);
|
||||
}
|
||||
|
||||
public IBrush? DisabledFilledBrush
|
||||
{
|
||||
get => GetValue(DisabledFilledBrushProperty);
|
||||
set => SetValue(DisabledFilledBrushProperty, value);
|
||||
}
|
||||
|
||||
public IBrush? PrimaryFilledBrush
|
||||
{
|
||||
get => GetValue(PrimaryFilledBrushProperty);
|
||||
set => SetValue(PrimaryFilledBrushProperty, value);
|
||||
}
|
||||
|
||||
public IBrush? SecondaryFilledBrush
|
||||
{
|
||||
get => GetValue(SecondaryFilledBrushProperty);
|
||||
set => SetValue(SecondaryFilledBrushProperty, value);
|
||||
}
|
||||
|
||||
public TimeSpan LoadingAnimationDuration
|
||||
{
|
||||
get => GetValue(LoadingAnimationDurationProperty);
|
||||
set => SetValue(LoadingAnimationDurationProperty, value);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// PathIcon 的模式,只对 Outlined 和 Filled 类型有效
|
||||
/// </summary>
|
||||
public IconMode IconMode
|
||||
{
|
||||
get => GetValue(IconModeProperty);
|
||||
set => SetValue(IconModeProperty, value);
|
||||
}
|
||||
|
||||
private static readonly StyledProperty<IBrush?> FilledBrushProperty
|
||||
= AvaloniaProperty.Register<ToggleSwitch, IBrush?>(
|
||||
nameof(IBrush));
|
||||
|
||||
/// <summary>
|
||||
/// 当是非 TwoTone icon 的时候,填充色是支持渐变的
|
||||
/// </summary>
|
||||
private IBrush? FilledBrush
|
||||
{
|
||||
get => GetValue(FilledBrushProperty);
|
||||
set => SetValue(FilledBrushProperty, value);
|
||||
}
|
||||
|
||||
public IconThemeType ThemeType => _iconInfo?.ThemeType ?? IconThemeType.Filled;
|
||||
|
||||
public IconAnimation LoadingAnimation
|
||||
{
|
||||
get => GetValue(LoadingAnimationProperty);
|
||||
set => SetValue(LoadingAnimationProperty, value);
|
||||
}
|
||||
|
||||
#region 内部属性定义
|
||||
|
||||
internal static readonly StyledProperty<double> AngleAnimationRotateProperty =
|
||||
AvaloniaProperty.Register<PathIcon, double>(
|
||||
nameof(AngleAnimationRotate));
|
||||
|
||||
internal double AngleAnimationRotate
|
||||
{
|
||||
get => GetValue(AngleAnimationRotateProperty);
|
||||
set => SetValue(AngleAnimationRotateProperty, value);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private Animation? _animation;
|
||||
private CancellationTokenSource? _animationCancellationTokenSource;
|
||||
private WeakReference<IIconPackageProvider>? _iconPackageRef;
|
||||
private readonly List<Matrix> _transforms;
|
||||
private readonly List<Geometry> _sourceGeometriesData;
|
||||
private IconInfo? _iconInfo;
|
||||
private Rect _viewBox;
|
||||
|
||||
static PathIcon()
|
||||
{
|
||||
AffectsGeometry(KindProperty, PackageProviderProperty);
|
||||
AffectsMeasure<PathIcon>(HeightProperty, WidthProperty);
|
||||
AffectsRender<PathIcon>(IconModeProperty,
|
||||
FilledBrushProperty,
|
||||
PrimaryFilledBrushProperty,
|
||||
SecondaryFilledBrushProperty);
|
||||
HorizontalAlignmentProperty.OverrideDefaultValue<PathIcon>(HorizontalAlignment.Left);
|
||||
VerticalAlignmentProperty.OverrideDefaultValue<PathIcon>(VerticalAlignment.Center);
|
||||
}
|
||||
|
||||
public PathIcon()
|
||||
{
|
||||
var rotateTransform = new RotateTransform();
|
||||
RenderTransform = rotateTransform;
|
||||
_sourceGeometriesData = new List<Geometry>();
|
||||
_transforms = new List<Matrix>();
|
||||
}
|
||||
|
||||
private void SetupTransitions()
|
||||
{
|
||||
if (Transitions is null)
|
||||
{
|
||||
var transitions = new Transitions();
|
||||
transitions.Add(AnimationUtils.CreateTransition<SolidColorBrushTransition>(FilledBrushProperty));
|
||||
Transitions = transitions;
|
||||
}
|
||||
}
|
||||
|
||||
protected override void OnPropertyChanged(AvaloniaPropertyChangedEventArgs change)
|
||||
{
|
||||
base.OnPropertyChanged(change);
|
||||
if (change.Property == KindProperty)
|
||||
{
|
||||
// TODO 这里不存在记录日志吗?暂时构造一个默认的
|
||||
if (VisualRoot is not null)
|
||||
{
|
||||
BuildSourceRenderData();
|
||||
}
|
||||
}
|
||||
else if (change.Property == IsEnabledProperty)
|
||||
{
|
||||
// TODO 这个地方需要优化一点,是否需要保存老的,当状态为 Enabled 的时候进行还原
|
||||
if (!IsEnabled)
|
||||
{
|
||||
IconMode = IconMode.Disabled;
|
||||
}
|
||||
}
|
||||
else if (change.Property == NormalFilledBrushProperty ||
|
||||
change.Property == ActiveFilledBrushProperty ||
|
||||
change.Property == SelectedFilledBrushProperty ||
|
||||
change.Property == DisabledFilledBrushProperty ||
|
||||
change.Property == PrimaryFilledBrushProperty ||
|
||||
change.Property == SecondaryFilledBrushProperty ||
|
||||
change.Property == IconModeProperty)
|
||||
{
|
||||
SetupFilledBrush();
|
||||
}
|
||||
else if (change.Property == AngleAnimationRotateProperty)
|
||||
{
|
||||
SetCurrentValue(RenderTransformProperty, new RotateTransform(AngleAnimationRotate));
|
||||
}
|
||||
|
||||
if (VisualRoot is not null)
|
||||
{
|
||||
if (change.Property == LoadingAnimationProperty)
|
||||
{
|
||||
SetupRotateAnimation();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void SetupRotateAnimation()
|
||||
{
|
||||
if (_animation is not null)
|
||||
{
|
||||
_animationCancellationTokenSource?.Cancel();
|
||||
_animation = null;
|
||||
_animationCancellationTokenSource = null;
|
||||
}
|
||||
|
||||
if (LoadingAnimation == IconAnimation.Spin || LoadingAnimation == IconAnimation.Pulse)
|
||||
{
|
||||
_animation = new Animation
|
||||
{
|
||||
Duration = LoadingAnimationDuration,
|
||||
IterationCount = new IterationCount(ulong.MaxValue),
|
||||
Children =
|
||||
{
|
||||
new KeyFrame
|
||||
{
|
||||
Cue = new Cue(0d),
|
||||
Setters = { new Setter(AngleAnimationRotateProperty, 0d) }
|
||||
},
|
||||
new KeyFrame
|
||||
{
|
||||
Cue = new Cue(1d),
|
||||
Setters = { new Setter(AngleAnimationRotateProperty, 360d) }
|
||||
}
|
||||
}
|
||||
};
|
||||
if (LoadingAnimation == IconAnimation.Pulse)
|
||||
{
|
||||
_animation.Easing = new PulseEasing();
|
||||
}
|
||||
|
||||
if (VisualRoot is not null)
|
||||
{
|
||||
_animationCancellationTokenSource = new CancellationTokenSource();
|
||||
_animation.RunAsync(this, _animationCancellationTokenSource.Token);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void SetupFilledBrush()
|
||||
{
|
||||
var colorInfo = _iconInfo?.ColorInfo;
|
||||
if (IconMode == IconMode.Normal)
|
||||
{
|
||||
if (NormalFilledBrush is not null)
|
||||
{
|
||||
FilledBrush = NormalFilledBrush;
|
||||
}
|
||||
else if (colorInfo.HasValue)
|
||||
{
|
||||
FilledBrush = new SolidColorBrush(colorInfo.Value.NormalColor);
|
||||
}
|
||||
}
|
||||
else if (IconMode == IconMode.Active)
|
||||
{
|
||||
if (ActiveFilledBrush is not null)
|
||||
{
|
||||
FilledBrush = ActiveFilledBrush;
|
||||
}
|
||||
else if (NormalFilledBrush is not null)
|
||||
{
|
||||
FilledBrush = NormalFilledBrush;
|
||||
}
|
||||
else if (colorInfo.HasValue)
|
||||
{
|
||||
FilledBrush = new SolidColorBrush(colorInfo.Value.ActiveColor);
|
||||
}
|
||||
}
|
||||
else if (IconMode == IconMode.Selected)
|
||||
{
|
||||
if (SelectedFilledBrush is not null)
|
||||
{
|
||||
FilledBrush = SelectedFilledBrush;
|
||||
}
|
||||
else if (NormalFilledBrush is not null)
|
||||
{
|
||||
FilledBrush = NormalFilledBrush;
|
||||
}
|
||||
else if (colorInfo.HasValue)
|
||||
{
|
||||
FilledBrush = new SolidColorBrush(colorInfo.Value.SelectedColor);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (DisabledFilledBrush is not null)
|
||||
{
|
||||
FilledBrush = DisabledFilledBrush;
|
||||
}
|
||||
else if (NormalFilledBrush is not null)
|
||||
{
|
||||
FilledBrush = NormalFilledBrush;
|
||||
}
|
||||
else if (colorInfo.HasValue)
|
||||
{
|
||||
FilledBrush = new SolidColorBrush(colorInfo.Value.DisabledColor);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Invalidates the geometry of this shape.
|
||||
/// </summary>
|
||||
private void InvalidateGeometry()
|
||||
{
|
||||
if (_animation is not null)
|
||||
{
|
||||
_animationCancellationTokenSource?.Cancel();
|
||||
}
|
||||
|
||||
_sourceGeometriesData.Clear();
|
||||
_transforms.Clear();
|
||||
_iconInfo = null;
|
||||
InvalidateMeasure();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Marks a property as affecting the shape's geometry.
|
||||
/// </summary>
|
||||
/// <param name="properties">The properties.</param>
|
||||
/// <remarks>
|
||||
/// After a call to this method in a control's static constructor, any change to the
|
||||
/// property will cause <see cref="InvalidateGeometry" /> to be called on the element.
|
||||
/// </remarks>
|
||||
private static void AffectsGeometry(params AvaloniaProperty[] properties)
|
||||
{
|
||||
foreach (var property in properties)
|
||||
{
|
||||
property.Changed.Subscribe(new AnonymousObserver<AvaloniaPropertyChangedEventArgs>(e =>
|
||||
{
|
||||
if (e.Sender is PathIcon icon)
|
||||
{
|
||||
AffectsGeometryInvalidate(icon, e);
|
||||
}
|
||||
}));
|
||||
}
|
||||
}
|
||||
|
||||
private static void AffectsGeometryInvalidate(PathIcon control, AvaloniaPropertyChangedEventArgs e)
|
||||
{
|
||||
// If the geometry is invalidated when Bounds changes, only invalidate when the Size
|
||||
// portion changes.
|
||||
if (e.Property == BoundsProperty)
|
||||
{
|
||||
var oldBounds = (Rect)e.OldValue!;
|
||||
var newBounds = (Rect)e.NewValue!;
|
||||
if (oldBounds.Size == newBounds.Size)
|
||||
{
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
control.InvalidateGeometry();
|
||||
}
|
||||
|
||||
private void BuildSourceRenderData()
|
||||
{
|
||||
if (_sourceGeometriesData.Count > 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
var manager = IconManager.Current;
|
||||
PackageProvider ??= manager.DefaultPackage;
|
||||
|
||||
var iconPackage = manager.GetIconProvider(PackageProvider);
|
||||
// 这里报错还是?
|
||||
if (iconPackage is not null)
|
||||
{
|
||||
_iconPackageRef = new WeakReference<IIconPackageProvider>(iconPackage);
|
||||
}
|
||||
|
||||
if (_iconPackageRef != null && _iconPackageRef.TryGetTarget(out var iconPackageProvider))
|
||||
{
|
||||
// TODO 这里可能需要优化,针对 IconInfo 的拷贝问题
|
||||
_iconInfo = iconPackageProvider.GetIcon(Kind) ?? new IconInfo();
|
||||
foreach (var geometryData in _iconInfo.Data)
|
||||
{
|
||||
_sourceGeometriesData.Add(Geometry.Parse(geometryData.PathData));
|
||||
}
|
||||
|
||||
_viewBox = _iconInfo!.ViewBox;
|
||||
// 先求最大的 bounds
|
||||
// 裁剪边距算法,暂时先注释掉
|
||||
Geometry? combined = null;
|
||||
foreach (var geometry in _sourceGeometriesData)
|
||||
{
|
||||
if (combined is null)
|
||||
{
|
||||
combined = geometry;
|
||||
}
|
||||
else
|
||||
{
|
||||
combined = new CombinedGeometry(combined, geometry);
|
||||
}
|
||||
}
|
||||
|
||||
var combinedBounds = combined!.Bounds;
|
||||
|
||||
var marginHorizontal = Math.Min(_iconInfo.ViewBox.Right - combinedBounds.Right, combinedBounds.X);
|
||||
var marginVertical = Math.Min(_iconInfo.ViewBox.Bottom - combinedBounds.Bottom, combinedBounds.Y);
|
||||
var margin = Math.Min(marginHorizontal, marginVertical);
|
||||
|
||||
var scaleX = 1 - margin / _viewBox.Width;
|
||||
var scaleY = 1 - margin / _viewBox.Height;
|
||||
|
||||
if (margin > 0)
|
||||
{
|
||||
for (var i = 0; i < _sourceGeometriesData.Count; i++)
|
||||
{
|
||||
var geometry = _sourceGeometriesData[i];
|
||||
var cloned = geometry.Clone();
|
||||
var offsetX = -margin / 2;
|
||||
var offsetY = -margin / 2;
|
||||
var matrix = Matrix.CreateTranslation(offsetX, offsetY);
|
||||
matrix = matrix * Matrix.CreateScale(scaleX, scaleY);
|
||||
cloned.Transform = new MatrixTransform(matrix);
|
||||
_sourceGeometriesData[i] = cloned;
|
||||
}
|
||||
|
||||
_viewBox = combined!.Bounds;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected override void OnAttachedToLogicalTree(LogicalTreeAttachmentEventArgs e)
|
||||
{
|
||||
base.OnAttachedToLogicalTree(e);
|
||||
SetupTransitions();
|
||||
SetupRotateAnimation();
|
||||
}
|
||||
|
||||
protected override void OnAttachedToVisualTree(VisualTreeAttachmentEventArgs e)
|
||||
{
|
||||
base.OnAttachedToVisualTree(e);
|
||||
if (_sourceGeometriesData.Count == 0)
|
||||
{
|
||||
BuildSourceRenderData();
|
||||
SetupFilledBrush();
|
||||
}
|
||||
if (_animation is not null && _animationCancellationTokenSource is null)
|
||||
{
|
||||
_animationCancellationTokenSource = new CancellationTokenSource();
|
||||
_animation.RunAsync(this, _animationCancellationTokenSource.Token);
|
||||
}
|
||||
}
|
||||
|
||||
protected override void OnDetachedFromVisualTree(VisualTreeAttachmentEventArgs e)
|
||||
{
|
||||
base.OnDetachedFromVisualTree(e);
|
||||
_animationCancellationTokenSource?.Cancel();
|
||||
_animationCancellationTokenSource = null;
|
||||
}
|
||||
|
||||
protected override Size MeasureOverride(Size availableSize)
|
||||
{
|
||||
if (_sourceGeometriesData.Count == 0)
|
||||
{
|
||||
return default;
|
||||
}
|
||||
|
||||
Size targetSize = default;
|
||||
for (var i = 0; i < _sourceGeometriesData.Count; i++)
|
||||
{
|
||||
var sourceGeometry = _sourceGeometriesData[i];
|
||||
var currentSize = CalculateSizeAndTransform(availableSize, sourceGeometry.Bounds).size;
|
||||
targetSize = new Size(Math.Max(targetSize.Width, currentSize.Width),
|
||||
Math.Min(targetSize.Height, currentSize.Height));
|
||||
}
|
||||
|
||||
return targetSize;
|
||||
}
|
||||
|
||||
protected override Size ArrangeOverride(Size finalSize)
|
||||
{
|
||||
_transforms.Clear();
|
||||
// This should probably use GetRenderBounds(strokeThickness) but then the calculations
|
||||
// will multiply the stroke thickness as well, which isn't correct.
|
||||
for (var i = 0; i < _sourceGeometriesData.Count; i++)
|
||||
{
|
||||
var sourceGeometry = _sourceGeometriesData[i];
|
||||
var (_, transform) = CalculateSizeAndTransform(finalSize, sourceGeometry.Bounds);
|
||||
_transforms.Insert(i, transform);
|
||||
}
|
||||
|
||||
return finalSize;
|
||||
}
|
||||
|
||||
public override void Render(DrawingContext context)
|
||||
{
|
||||
if (IsVisible &&
|
||||
_sourceGeometriesData.Count > 0 &&
|
||||
Bounds.Width > 0 &&
|
||||
Bounds.Width > 0)
|
||||
{
|
||||
for (var i = 0; i < _sourceGeometriesData.Count; i++)
|
||||
{
|
||||
var renderedGeometry = _sourceGeometriesData[i];
|
||||
var geometryData = _iconInfo!.Data[i];
|
||||
IBrush? fillBrush = null;
|
||||
if (_iconInfo.ThemeType == IconThemeType.TwoTone)
|
||||
{
|
||||
var colorInfo = _iconInfo.TwoToneColorInfo;
|
||||
if (colorInfo.HasValue)
|
||||
{
|
||||
if (geometryData.IsPrimary)
|
||||
{
|
||||
if (PrimaryFilledBrush is not null)
|
||||
{
|
||||
fillBrush = PrimaryFilledBrush;
|
||||
}
|
||||
else
|
||||
{
|
||||
fillBrush = new SolidColorBrush(colorInfo.Value.PrimaryColor);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (SecondaryFilledBrush is not null)
|
||||
{
|
||||
fillBrush = SecondaryFilledBrush;
|
||||
}
|
||||
else
|
||||
{
|
||||
fillBrush = new SolidColorBrush(colorInfo.Value.SecondaryColor);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
fillBrush = FilledBrush;
|
||||
}
|
||||
|
||||
using var state = context.PushTransform(_transforms[i]);
|
||||
context.DrawGeometry(fillBrush, null, renderedGeometry);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private (Size size, Matrix transform) CalculateSizeAndTransform(Size availableSize, Rect shapeBounds)
|
||||
{
|
||||
var shapeSize = new Size(shapeBounds.Width, shapeBounds.Height);
|
||||
var desiredX = availableSize.Width;
|
||||
var desiredY = availableSize.Height;
|
||||
var sx = 0.0;
|
||||
var sy = 0.0;
|
||||
var viewBoxWidth = _viewBox.Width;
|
||||
var viewBoxHeight = _viewBox.Height;
|
||||
|
||||
// 计算大小的比例因子
|
||||
var shapeWidthScale = shapeBounds.Width / viewBoxWidth;
|
||||
var shapeHeightScale = shapeBounds.Height / viewBoxHeight;
|
||||
|
||||
// 计算位移的比例因子
|
||||
var offsetXScale = Math.Floor(availableSize.Width / viewBoxWidth);
|
||||
var offsetYScale = Math.Floor(availableSize.Height / viewBoxHeight);
|
||||
|
||||
var offsetX = shapeBounds.X;
|
||||
var offsetY = shapeBounds.Y;
|
||||
|
||||
shapeSize = shapeBounds.Size;
|
||||
|
||||
if (double.IsInfinity(availableSize.Width))
|
||||
{
|
||||
desiredX = shapeSize.Width;
|
||||
}
|
||||
else
|
||||
{
|
||||
desiredX = availableSize.Width * shapeWidthScale;
|
||||
offsetX *= offsetXScale;
|
||||
}
|
||||
|
||||
if (double.IsInfinity(availableSize.Height))
|
||||
{
|
||||
desiredY = shapeSize.Height;
|
||||
}
|
||||
else
|
||||
{
|
||||
desiredY = availableSize.Height * shapeHeightScale;
|
||||
offsetY *= offsetYScale;
|
||||
}
|
||||
|
||||
var translate = Matrix.CreateTranslation(-offsetX, -offsetY);
|
||||
if (shapeBounds.Width > 0)
|
||||
{
|
||||
sx = desiredX / shapeSize.Width;
|
||||
}
|
||||
|
||||
if (shapeBounds.Height > 0)
|
||||
{
|
||||
sy = desiredY / shapeSize.Height;
|
||||
}
|
||||
|
||||
if (double.IsInfinity(availableSize.Width))
|
||||
{
|
||||
sx = sy;
|
||||
}
|
||||
|
||||
if (double.IsInfinity(availableSize.Height))
|
||||
{
|
||||
sy = sx;
|
||||
}
|
||||
|
||||
sx = sy = Math.Min(sx, sy);
|
||||
|
||||
translate = translate * Matrix.CreateScale(sx, sy);
|
||||
var size = new Size(shapeSize.Width * sx, shapeSize.Height * sy);
|
||||
return (size, translate);
|
||||
}
|
||||
|
||||
public bool HitTest(Point point)
|
||||
{
|
||||
var targetRect = new Rect(0, 0, DesiredSize.Width, DesiredSize.Height);
|
||||
return targetRect.Contains(point);
|
||||
}
|
||||
}
|
@ -1,5 +1,6 @@
|
||||
using AtomUI.Controls.PopupConfirmLang;
|
||||
using AtomUI.Data;
|
||||
using AtomUI.IconPkg;
|
||||
using AtomUI.IconPkg.AntDesign;
|
||||
using AtomUI.Theme.Data;
|
||||
using Avalonia;
|
||||
using Avalonia.Controls.Templates;
|
||||
@ -39,8 +40,8 @@ public class PopupConfirm : FlyoutHost
|
||||
public static readonly StyledProperty<IDataTemplate?> ConfirmContentTemplateProperty =
|
||||
AvaloniaProperty.Register<PopupConfirm, IDataTemplate?>(nameof(ConfirmContentTemplate));
|
||||
|
||||
public static readonly StyledProperty<PathIcon?> IconProperty
|
||||
= AvaloniaProperty.Register<PopupConfirm, PathIcon?>(nameof(Icon));
|
||||
public static readonly StyledProperty<Icon?> IconProperty
|
||||
= AvaloniaProperty.Register<PopupConfirm, Icon?>(nameof(Icon));
|
||||
|
||||
public static readonly StyledProperty<PopupConfirmStatus> ConfirmStatusProperty
|
||||
= AvaloniaProperty.Register<PopupConfirm, PopupConfirmStatus>(nameof(ConfirmStatus),
|
||||
@ -97,7 +98,7 @@ public class PopupConfirm : FlyoutHost
|
||||
set => SetValue(ConfirmContentTemplateProperty, value);
|
||||
}
|
||||
|
||||
public PathIcon? Icon
|
||||
public Icon? Icon
|
||||
{
|
||||
get => GetValue(IconProperty);
|
||||
set => SetValue(IconProperty, value);
|
||||
@ -136,13 +137,7 @@ public class PopupConfirm : FlyoutHost
|
||||
Flyout = new PopupConfirmFlyout(this);
|
||||
}
|
||||
|
||||
if (Icon is null)
|
||||
{
|
||||
Icon = new PathIcon
|
||||
{
|
||||
Kind = "ExclamationCircleFilled"
|
||||
};
|
||||
}
|
||||
Icon ??= AntDesignIconPackage.ExclamationCircleFilled();
|
||||
|
||||
LanguageResourceBinder.CreateBinding(this, OkTextProperty, PopupConfirmLangResourceKey.OkText);
|
||||
LanguageResourceBinder.CreateBinding(this, CancelTextProperty, PopupConfirmLangResourceKey.CancelText);
|
||||
|
@ -1,4 +1,5 @@
|
||||
using Avalonia;
|
||||
using AtomUI.IconPkg;
|
||||
using Avalonia;
|
||||
using Avalonia.Controls;
|
||||
using Avalonia.Controls.Primitives;
|
||||
using Avalonia.Controls.Templates;
|
||||
@ -31,7 +32,7 @@ internal class PopupConfirmContainer : TemplatedControl
|
||||
internal static readonly StyledProperty<IDataTemplate?> ConfirmContentTemplateProperty =
|
||||
PopupConfirm.ConfirmContentTemplateProperty.AddOwner<PopupConfirmContainer>();
|
||||
|
||||
internal static readonly StyledProperty<PathIcon?> IconProperty =
|
||||
internal static readonly StyledProperty<Icon?> IconProperty =
|
||||
PopupConfirm.IconProperty.AddOwner<PopupConfirmContainer>();
|
||||
|
||||
internal static readonly StyledProperty<PopupConfirmStatus> ConfirmStatusProperty
|
||||
@ -79,7 +80,7 @@ internal class PopupConfirmContainer : TemplatedControl
|
||||
set => SetValue(ConfirmContentTemplateProperty, value);
|
||||
}
|
||||
|
||||
public PathIcon? Icon
|
||||
public Icon? Icon
|
||||
{
|
||||
get => GetValue(IconProperty);
|
||||
set => SetValue(IconProperty, value);
|
||||
|
@ -1,4 +1,5 @@
|
||||
using AtomUI.Theme;
|
||||
using AtomUI.IconPkg;
|
||||
using AtomUI.Theme;
|
||||
using AtomUI.Theme.Data;
|
||||
using AtomUI.Theme.Styling;
|
||||
using Avalonia;
|
||||
@ -154,7 +155,7 @@ internal class PopupConfirmContainerTheme : BaseControlTheme
|
||||
protected override void BuildInstanceStyles(Control control)
|
||||
{
|
||||
{
|
||||
var iconStyle = new Style(selector => selector.Name(IconContentPart).Child().OfType<PathIcon>());
|
||||
var iconStyle = new Style(selector => selector.Name(IconContentPart).Child().OfType<Icon>());
|
||||
iconStyle.Add(Layoutable.WidthProperty, GlobalTokenResourceKey.IconSizeLG);
|
||||
iconStyle.Add(Layoutable.HeightProperty, GlobalTokenResourceKey.IconSizeLG);
|
||||
iconStyle.Add(Layoutable.VerticalAlignmentProperty, VerticalAlignment.Top);
|
||||
@ -163,22 +164,22 @@ internal class PopupConfirmContainerTheme : BaseControlTheme
|
||||
var infoStatusStyle = new Style(selector => selector
|
||||
.PropertyEquals(PopupConfirmContainer.ConfirmStatusProperty,
|
||||
PopupConfirmStatus.Info)
|
||||
.Descendant().Name(IconContentPart).Child().OfType<PathIcon>());
|
||||
infoStatusStyle.Add(PathIcon.NormalFilledBrushProperty, GlobalTokenResourceKey.ColorPrimary);
|
||||
.Descendant().Name(IconContentPart).Child().OfType<Icon>());
|
||||
infoStatusStyle.Add(Icon.NormalFilledBrushProperty, GlobalTokenResourceKey.ColorPrimary);
|
||||
control.Styles.Add(infoStatusStyle);
|
||||
|
||||
var warningStatusStyle = new Style(selector => selector
|
||||
.PropertyEquals(PopupConfirmContainer.ConfirmStatusProperty,
|
||||
PopupConfirmStatus.Warning)
|
||||
.Descendant().Name(IconContentPart).Child().OfType<PathIcon>());
|
||||
warningStatusStyle.Add(PathIcon.NormalFilledBrushProperty, GlobalTokenResourceKey.ColorWarning);
|
||||
.Descendant().Name(IconContentPart).Child().OfType<Icon>());
|
||||
warningStatusStyle.Add(Icon.NormalFilledBrushProperty, GlobalTokenResourceKey.ColorWarning);
|
||||
control.Styles.Add(warningStatusStyle);
|
||||
|
||||
var errorStatusStyle = new Style(selector => selector
|
||||
.PropertyEquals(PopupConfirmContainer.ConfirmStatusProperty,
|
||||
PopupConfirmStatus.Error)
|
||||
.Descendant().Name(IconContentPart).Child().OfType<PathIcon>());
|
||||
errorStatusStyle.Add(PathIcon.NormalFilledBrushProperty, GlobalTokenResourceKey.ColorError);
|
||||
.Descendant().Name(IconContentPart).Child().OfType<Icon>());
|
||||
errorStatusStyle.Add(Icon.NormalFilledBrushProperty, GlobalTokenResourceKey.ColorError);
|
||||
control.Styles.Add(errorStatusStyle);
|
||||
}
|
||||
|
||||
|
@ -1,4 +1,6 @@
|
||||
using AtomUI.Theme.Data;
|
||||
using AtomUI.IconPkg;
|
||||
using AtomUI.IconPkg.AntDesign;
|
||||
using AtomUI.Theme.Data;
|
||||
using AtomUI.Theme.Styling;
|
||||
using Avalonia;
|
||||
using Avalonia.Controls;
|
||||
@ -22,30 +24,26 @@ internal class AbstractCircleProgressTheme : AbstractProgressBarTheme
|
||||
|
||||
private void CreateCompletedIcons(INameScope scope, Canvas container)
|
||||
{
|
||||
var exceptionCompletedIcon = new PathIcon
|
||||
{
|
||||
Name = ExceptionCompletedIconPart,
|
||||
Kind = "CloseOutlined",
|
||||
HorizontalAlignment = HorizontalAlignment.Center,
|
||||
VerticalAlignment = VerticalAlignment.Center
|
||||
};
|
||||
var exceptionCompletedIcon = AntDesignIconPackage.CloseOutlined();
|
||||
exceptionCompletedIcon.Name = ExceptionCompletedIconPart;
|
||||
exceptionCompletedIcon.HorizontalAlignment = HorizontalAlignment.Center;
|
||||
exceptionCompletedIcon.VerticalAlignment = VerticalAlignment.Center;
|
||||
|
||||
exceptionCompletedIcon.RegisterInNameScope(scope);
|
||||
TokenResourceBinder.CreateGlobalTokenBinding(exceptionCompletedIcon, PathIcon.NormalFilledBrushProperty,
|
||||
TokenResourceBinder.CreateGlobalTokenBinding(exceptionCompletedIcon, Icon.NormalFilledBrushProperty,
|
||||
GlobalTokenResourceKey.ColorError);
|
||||
TokenResourceBinder.CreateGlobalTokenBinding(exceptionCompletedIcon, PathIcon.DisabledFilledBrushProperty,
|
||||
TokenResourceBinder.CreateGlobalTokenBinding(exceptionCompletedIcon, Icon.DisabledFilledBrushProperty,
|
||||
GlobalTokenResourceKey.ControlItemBgActiveDisabled);
|
||||
|
||||
var successCompletedIcon = new PathIcon
|
||||
{
|
||||
Name = SuccessCompletedIconPart,
|
||||
Kind = "CheckOutlined",
|
||||
HorizontalAlignment = HorizontalAlignment.Center,
|
||||
VerticalAlignment = VerticalAlignment.Center
|
||||
};
|
||||
var successCompletedIcon = AntDesignIconPackage.CheckOutlined();
|
||||
successCompletedIcon.Name = SuccessCompletedIconPart;
|
||||
successCompletedIcon.HorizontalAlignment = HorizontalAlignment.Center;
|
||||
successCompletedIcon.VerticalAlignment = VerticalAlignment.Center;
|
||||
|
||||
successCompletedIcon.RegisterInNameScope(scope);
|
||||
TokenResourceBinder.CreateGlobalTokenBinding(successCompletedIcon, PathIcon.NormalFilledBrushProperty,
|
||||
TokenResourceBinder.CreateGlobalTokenBinding(successCompletedIcon, Icon.NormalFilledBrushProperty,
|
||||
GlobalTokenResourceKey.ColorSuccess);
|
||||
TokenResourceBinder.CreateGlobalTokenBinding(successCompletedIcon, PathIcon.DisabledFilledBrushProperty,
|
||||
TokenResourceBinder.CreateGlobalTokenBinding(successCompletedIcon, Icon.DisabledFilledBrushProperty,
|
||||
GlobalTokenResourceKey.ControlItemBgActiveDisabled);
|
||||
|
||||
container.Children.Add(exceptionCompletedIcon);
|
||||
|
@ -1,3 +1,4 @@
|
||||
using AtomUI.IconPkg;
|
||||
using AtomUI.Media;
|
||||
using AtomUI.Utils;
|
||||
using Avalonia;
|
||||
@ -164,8 +165,8 @@ public abstract class AbstractLineProgress : AbstractProgressBar
|
||||
|
||||
protected override void NotifyTemplateApplied(INameScope scope)
|
||||
{
|
||||
_exceptionCompletedIcon = scope.Find<PathIcon>(AbstractProgressBarTheme.ExceptionCompletedIconPart);
|
||||
_successCompletedIcon = scope.Find<PathIcon>(AbstractProgressBarTheme.SuccessCompletedIconPart);
|
||||
_exceptionCompletedIcon = scope.Find<Icon>(AbstractProgressBarTheme.ExceptionCompletedIconPart);
|
||||
_successCompletedIcon = scope.Find<Icon>(AbstractProgressBarTheme.SuccessCompletedIconPart);
|
||||
base.NotifyTemplateApplied(scope);
|
||||
}
|
||||
|
||||
|
@ -1,4 +1,6 @@
|
||||
using AtomUI.Theme.Data;
|
||||
using AtomUI.IconPkg;
|
||||
using AtomUI.IconPkg.AntDesign;
|
||||
using AtomUI.Theme.Data;
|
||||
using AtomUI.Theme.Styling;
|
||||
using Avalonia.Controls;
|
||||
using Avalonia.Controls.Primitives;
|
||||
@ -22,28 +24,24 @@ internal class AbstractLineProgressTheme : AbstractProgressBarTheme
|
||||
|
||||
private void CreateCompletedIcons(INameScope scope, Canvas container)
|
||||
{
|
||||
var exceptionCompletedIcon = new PathIcon
|
||||
{
|
||||
Name = ExceptionCompletedIconPart,
|
||||
Kind = "CloseCircleFilled",
|
||||
HorizontalAlignment = HorizontalAlignment.Left
|
||||
};
|
||||
var exceptionCompletedIcon = AntDesignIconPackage.CloseCircleFilled();
|
||||
exceptionCompletedIcon.Name = ExceptionCompletedIconPart;
|
||||
exceptionCompletedIcon.HorizontalAlignment = HorizontalAlignment.Left;
|
||||
|
||||
exceptionCompletedIcon.RegisterInNameScope(scope);
|
||||
TokenResourceBinder.CreateGlobalTokenBinding(exceptionCompletedIcon, PathIcon.NormalFilledBrushProperty,
|
||||
TokenResourceBinder.CreateGlobalTokenBinding(exceptionCompletedIcon, Icon.NormalFilledBrushProperty,
|
||||
GlobalTokenResourceKey.ColorError);
|
||||
TokenResourceBinder.CreateGlobalTokenBinding(exceptionCompletedIcon, PathIcon.DisabledFilledBrushProperty,
|
||||
TokenResourceBinder.CreateGlobalTokenBinding(exceptionCompletedIcon, Icon.DisabledFilledBrushProperty,
|
||||
GlobalTokenResourceKey.ControlItemBgActiveDisabled);
|
||||
|
||||
var successCompletedIcon = new PathIcon
|
||||
{
|
||||
Name = SuccessCompletedIconPart,
|
||||
Kind = "CheckCircleFilled",
|
||||
HorizontalAlignment = HorizontalAlignment.Left
|
||||
};
|
||||
|
||||
var successCompletedIcon = AntDesignIconPackage.CheckCircleFilled();
|
||||
successCompletedIcon.Name = SuccessCompletedIconPart;
|
||||
successCompletedIcon.HorizontalAlignment = HorizontalAlignment.Left;
|
||||
|
||||
successCompletedIcon.RegisterInNameScope(scope);
|
||||
TokenResourceBinder.CreateGlobalTokenBinding(successCompletedIcon, PathIcon.NormalFilledBrushProperty,
|
||||
TokenResourceBinder.CreateGlobalTokenBinding(successCompletedIcon, Icon.NormalFilledBrushProperty,
|
||||
GlobalTokenResourceKey.ColorSuccess);
|
||||
TokenResourceBinder.CreateGlobalTokenBinding(successCompletedIcon, PathIcon.DisabledFilledBrushProperty,
|
||||
TokenResourceBinder.CreateGlobalTokenBinding(successCompletedIcon, Icon.DisabledFilledBrushProperty,
|
||||
GlobalTokenResourceKey.ControlItemBgActiveDisabled);
|
||||
|
||||
container.Children.Add(exceptionCompletedIcon);
|
||||
@ -70,7 +68,7 @@ internal class AbstractLineProgressTheme : AbstractProgressBarTheme
|
||||
ProgressBarTokenResourceKey.LineInfoIconSize);
|
||||
// icon
|
||||
{
|
||||
var completedIconsStyle = new Style(selector => selector.Nesting().Template().OfType<PathIcon>());
|
||||
var completedIconsStyle = new Style(selector => selector.Nesting().Template().OfType<Icon>());
|
||||
completedIconsStyle.Add(Layoutable.WidthProperty, ProgressBarTokenResourceKey.LineInfoIconSize);
|
||||
completedIconsStyle.Add(Layoutable.HeightProperty, ProgressBarTokenResourceKey.LineInfoIconSize);
|
||||
largeSizeTypeStyle.Add(completedIconsStyle);
|
||||
@ -85,7 +83,7 @@ internal class AbstractLineProgressTheme : AbstractProgressBarTheme
|
||||
ProgressBarTokenResourceKey.LineInfoIconSize);
|
||||
// icon
|
||||
{
|
||||
var completedIconsStyle = new Style(selector => selector.Nesting().Template().OfType<PathIcon>());
|
||||
var completedIconsStyle = new Style(selector => selector.Nesting().Template().OfType<Icon>());
|
||||
completedIconsStyle.Add(Layoutable.WidthProperty, ProgressBarTokenResourceKey.LineInfoIconSizeSM);
|
||||
completedIconsStyle.Add(Layoutable.HeightProperty, ProgressBarTokenResourceKey.LineInfoIconSizeSM);
|
||||
middleTypeStyle.Add(completedIconsStyle);
|
||||
@ -100,7 +98,7 @@ internal class AbstractLineProgressTheme : AbstractProgressBarTheme
|
||||
ProgressBarTokenResourceKey.LineInfoIconSizeSM);
|
||||
// icon
|
||||
{
|
||||
var completedIconsStyle = new Style(selector => selector.Nesting().Template().OfType<PathIcon>());
|
||||
var completedIconsStyle = new Style(selector => selector.Nesting().Template().OfType<Icon>());
|
||||
completedIconsStyle.Add(Layoutable.WidthProperty, ProgressBarTokenResourceKey.LineInfoIconSizeSM);
|
||||
completedIconsStyle.Add(Layoutable.HeightProperty, ProgressBarTokenResourceKey.LineInfoIconSizeSM);
|
||||
smallTypeStyle.Add(completedIconsStyle);
|
||||
|
@ -1,3 +1,4 @@
|
||||
using AtomUI.IconPkg;
|
||||
using AtomUI.Media;
|
||||
using AtomUI.Theme.Data;
|
||||
using AtomUI.Theme.Styling;
|
||||
@ -248,8 +249,8 @@ public abstract class AbstractProgressBar : RangeBase,
|
||||
protected ControlStyleState _styleState;
|
||||
protected LayoutTransformControl? _layoutTransformLabel;
|
||||
protected Label? _percentageLabel;
|
||||
protected PathIcon? _successCompletedIcon;
|
||||
protected PathIcon? _exceptionCompletedIcon;
|
||||
protected Icon? _successCompletedIcon;
|
||||
protected Icon? _exceptionCompletedIcon;
|
||||
|
||||
static AbstractProgressBar()
|
||||
{
|
||||
@ -314,8 +315,8 @@ public abstract class AbstractProgressBar : RangeBase,
|
||||
{
|
||||
_layoutTransformLabel = scope.Find<LayoutTransformControl>(AbstractProgressBarTheme.LayoutTransformControlPart);
|
||||
_percentageLabel = scope.Find<Label>(AbstractProgressBarTheme.PercentageLabelPart);
|
||||
_exceptionCompletedIcon = scope.Find<PathIcon>(AbstractProgressBarTheme.ExceptionCompletedIconPart);
|
||||
_successCompletedIcon = scope.Find<PathIcon>(AbstractProgressBarTheme.SuccessCompletedIconPart);
|
||||
_exceptionCompletedIcon = scope.Find<Icon>(AbstractProgressBarTheme.ExceptionCompletedIconPart);
|
||||
_successCompletedIcon = scope.Find<Icon>(AbstractProgressBarTheme.SuccessCompletedIconPart);
|
||||
CollectStyleState();
|
||||
SetupTokenBindings();
|
||||
NotifySetupUI();
|
||||
|
@ -1,4 +1,4 @@
|
||||
using AtomUI.Icon;
|
||||
using AtomUI.IconPkg;
|
||||
using AtomUI.Theme;
|
||||
using AtomUI.Theme.Styling;
|
||||
using Avalonia;
|
||||
@ -77,12 +77,12 @@ internal class AbstractProgressBarTheme : BaseControlTheme
|
||||
selector.Nesting().PropertyEquals(AbstractProgressBar.StatusProperty, ProgressStatus.Exception));
|
||||
{
|
||||
var exceptionIconStyle = new Style(selector =>
|
||||
selector.Nesting().Template().OfType<PathIcon>().Name(ExceptionCompletedIconPart));
|
||||
selector.Nesting().Template().OfType<Icon>().Name(ExceptionCompletedIconPart));
|
||||
exceptionIconStyle.Add(Visual.IsVisibleProperty, true);
|
||||
exceptionStatusStyle.Add(exceptionIconStyle);
|
||||
|
||||
var successIconStyle = new Style(selector =>
|
||||
selector.Nesting().Template().OfType<PathIcon>().Name(SuccessCompletedIconPart));
|
||||
selector.Nesting().Template().OfType<Icon>().Name(SuccessCompletedIconPart));
|
||||
successIconStyle.Add(Visual.IsVisibleProperty, false);
|
||||
exceptionStatusStyle.Add(successIconStyle);
|
||||
|
||||
@ -100,12 +100,12 @@ internal class AbstractProgressBarTheme : BaseControlTheme
|
||||
selector.Nesting().PropertyEquals(AbstractProgressBar.StatusProperty, ProgressStatus.Success));
|
||||
{
|
||||
var exceptionIconStyle = new Style(selector =>
|
||||
selector.Nesting().Template().OfType<PathIcon>().Name(ExceptionCompletedIconPart));
|
||||
selector.Nesting().Template().OfType<Icon>().Name(ExceptionCompletedIconPart));
|
||||
exceptionIconStyle.Add(Visual.IsVisibleProperty, false);
|
||||
successStatusStyle.Add(exceptionIconStyle);
|
||||
|
||||
var successIconStyle = new Style(selector =>
|
||||
selector.Nesting().Template().OfType<PathIcon>().Name(SuccessCompletedIconPart));
|
||||
selector.Nesting().Template().OfType<Icon>().Name(SuccessCompletedIconPart));
|
||||
successIconStyle.Add(Visual.IsVisibleProperty, true);
|
||||
successStatusStyle.Add(successIconStyle);
|
||||
|
||||
@ -125,13 +125,13 @@ internal class AbstractProgressBarTheme : BaseControlTheme
|
||||
{
|
||||
{
|
||||
var exceptionIconStyle = new Style(selector =>
|
||||
selector.Nesting().Template().OfType<PathIcon>().Name(ExceptionCompletedIconPart));
|
||||
selector.Nesting().Template().OfType<Icon>().Name(ExceptionCompletedIconPart));
|
||||
exceptionIconStyle.Add(Visual.IsVisibleProperty, false);
|
||||
normalOrActiveStatusStyle.Add(exceptionIconStyle);
|
||||
}
|
||||
{
|
||||
var successIconStyle = new Style(selector =>
|
||||
selector.Nesting().Template().OfType<PathIcon>().Name(SuccessCompletedIconPart));
|
||||
selector.Nesting().Template().OfType<Icon>().Name(SuccessCompletedIconPart));
|
||||
successIconStyle.Add(Visual.IsVisibleProperty, false);
|
||||
normalOrActiveStatusStyle.Add(successIconStyle);
|
||||
}
|
||||
@ -139,7 +139,7 @@ internal class AbstractProgressBarTheme : BaseControlTheme
|
||||
var completedStyle = new Style(selector => selector.Nesting().Class(AbstractProgressBar.CompletedPC));
|
||||
completedStyle.Add(AbstractProgressBar.IndicatorBarBrushProperty, GlobalTokenResourceKey.ColorSuccess);
|
||||
var successIconStyle = new Style(selector =>
|
||||
selector.Nesting().Template().OfType<PathIcon>().Name(SuccessCompletedIconPart));
|
||||
selector.Nesting().Template().OfType<Icon>().Name(SuccessCompletedIconPart));
|
||||
successIconStyle.Add(Visual.IsVisibleProperty, true);
|
||||
completedStyle.Add(successIconStyle);
|
||||
normalOrActiveStatusStyle.Add(completedStyle);
|
||||
@ -167,8 +167,8 @@ internal class AbstractProgressBarTheme : BaseControlTheme
|
||||
disableStyle.Add(AbstractProgressBar.IndicatorBarBrushProperty,
|
||||
GlobalTokenResourceKey.ControlItemBgActiveDisabled);
|
||||
disableStyle.Add(TemplatedControl.ForegroundProperty, GlobalTokenResourceKey.ColorTextDisabled);
|
||||
var statusIconStyle = new Style(selector => selector.Nesting().Template().OfType<PathIcon>());
|
||||
statusIconStyle.Add(PathIcon.IconModeProperty, IconMode.Disabled);
|
||||
var statusIconStyle = new Style(selector => selector.Nesting().Template().OfType<Icon>());
|
||||
statusIconStyle.Add(Icon.IconModeProperty, IconMode.Disabled);
|
||||
disableStyle.Add(statusIconStyle);
|
||||
Add(disableStyle);
|
||||
}
|
||||
|
@ -1,4 +1,5 @@
|
||||
using AtomUI.Theme.Styling;
|
||||
using AtomUI.IconPkg;
|
||||
using AtomUI.Theme.Styling;
|
||||
using Avalonia;
|
||||
using Avalonia.Controls;
|
||||
using Avalonia.Layout;
|
||||
@ -42,7 +43,7 @@ internal class ProgressBarTheme : AbstractLineProgressTheme
|
||||
Alignment = LinePercentAlignment.Start
|
||||
}));
|
||||
{
|
||||
var icons = new Style(selector => selector.Nesting().Template().OfType<PathIcon>());
|
||||
var icons = new Style(selector => selector.Nesting().Template().OfType<Icon>());
|
||||
icons.Add(Layoutable.HorizontalAlignmentProperty, HorizontalAlignment.Right);
|
||||
notInnerStartStyle.Add(icons);
|
||||
}
|
||||
@ -56,7 +57,7 @@ internal class ProgressBarTheme : AbstractLineProgressTheme
|
||||
Alignment = LinePercentAlignment.End
|
||||
}));
|
||||
{
|
||||
var icons = new Style(selector => selector.Nesting().Template().OfType<PathIcon>());
|
||||
var icons = new Style(selector => selector.Nesting().Template().OfType<Icon>());
|
||||
icons.Add(Layoutable.HorizontalAlignmentProperty, HorizontalAlignment.Left);
|
||||
notInnerEndStyle.Add(icons);
|
||||
}
|
||||
@ -69,7 +70,7 @@ internal class ProgressBarTheme : AbstractLineProgressTheme
|
||||
Alignment = LinePercentAlignment.Center
|
||||
}));
|
||||
{
|
||||
var icons = new Style(selector => selector.Nesting().Template().OfType<PathIcon>());
|
||||
var icons = new Style(selector => selector.Nesting().Template().OfType<Icon>());
|
||||
icons.Add(Layoutable.HorizontalAlignmentProperty, HorizontalAlignment.Center);
|
||||
notInnerCenterStyle.Add(icons);
|
||||
}
|
||||
@ -89,7 +90,7 @@ internal class ProgressBarTheme : AbstractLineProgressTheme
|
||||
Alignment = LinePercentAlignment.Start
|
||||
}));
|
||||
{
|
||||
var icons = new Style(selector => selector.Nesting().Template().OfType<PathIcon>());
|
||||
var icons = new Style(selector => selector.Nesting().Template().OfType<Icon>());
|
||||
icons.Add(Layoutable.VerticalAlignmentProperty, VerticalAlignment.Bottom);
|
||||
notInnerStartStyle.Add(icons);
|
||||
}
|
||||
@ -103,7 +104,7 @@ internal class ProgressBarTheme : AbstractLineProgressTheme
|
||||
Alignment = LinePercentAlignment.End
|
||||
}));
|
||||
{
|
||||
var icons = new Style(selector => selector.Nesting().Template().OfType<PathIcon>());
|
||||
var icons = new Style(selector => selector.Nesting().Template().OfType<Icon>());
|
||||
icons.Add(Layoutable.VerticalAlignmentProperty, VerticalAlignment.Top);
|
||||
notInnerEndStyle.Add(icons);
|
||||
}
|
||||
@ -116,7 +117,7 @@ internal class ProgressBarTheme : AbstractLineProgressTheme
|
||||
Alignment = LinePercentAlignment.Center
|
||||
}));
|
||||
{
|
||||
var icons = new Style(selector => selector.Nesting().Template().OfType<PathIcon>());
|
||||
var icons = new Style(selector => selector.Nesting().Template().OfType<Icon>());
|
||||
icons.Add(Layoutable.VerticalAlignmentProperty, VerticalAlignment.Center);
|
||||
notInnerCenterStyle.Add(icons);
|
||||
}
|
||||
@ -130,7 +131,7 @@ internal class ProgressBarTheme : AbstractLineProgressTheme
|
||||
private void BuildCompletedIconStyle()
|
||||
{
|
||||
var labelInnerStyle = new Style(selector => selector.Nesting().Class(ProgressBar.PercentLabelInnerPC));
|
||||
var icons = new Style(selector => selector.Nesting().Template().OfType<PathIcon>());
|
||||
var icons = new Style(selector => selector.Nesting().Template().OfType<Icon>());
|
||||
icons.Add(Visual.IsVisibleProperty, false);
|
||||
labelInnerStyle.Add(icons);
|
||||
var labelStyle = new Style(selector => selector.Nesting().Template().OfType<LayoutTransformControl>());
|
||||
|
@ -1,4 +1,5 @@
|
||||
using AtomUI.Theme.Styling;
|
||||
using AtomUI.IconPkg;
|
||||
using AtomUI.Theme.Styling;
|
||||
using Avalonia.Layout;
|
||||
using Avalonia.Styling;
|
||||
|
||||
@ -43,7 +44,7 @@ internal class StepsProgressBarTheme : AbstractLineProgressTheme
|
||||
selector.Nesting()
|
||||
.PropertyEquals(StepsProgressBar.PercentPositionProperty, LinePercentAlignment.Start));
|
||||
{
|
||||
var icons = new Style(selector => selector.Nesting().Template().OfType<PathIcon>());
|
||||
var icons = new Style(selector => selector.Nesting().Template().OfType<Icon>());
|
||||
icons.Add(Layoutable.HorizontalAlignmentProperty, HorizontalAlignment.Right);
|
||||
startStyle.Add(icons);
|
||||
}
|
||||
@ -53,7 +54,7 @@ internal class StepsProgressBarTheme : AbstractLineProgressTheme
|
||||
var endStyle = new Style(selector =>
|
||||
selector.Nesting().PropertyEquals(StepsProgressBar.PercentPositionProperty, LinePercentAlignment.End));
|
||||
{
|
||||
var icons = new Style(selector => selector.Nesting().Template().OfType<PathIcon>());
|
||||
var icons = new Style(selector => selector.Nesting().Template().OfType<Icon>());
|
||||
icons.Add(Layoutable.HorizontalAlignmentProperty, HorizontalAlignment.Left);
|
||||
endStyle.Add(icons);
|
||||
}
|
||||
@ -63,7 +64,7 @@ internal class StepsProgressBarTheme : AbstractLineProgressTheme
|
||||
selector.Nesting()
|
||||
.PropertyEquals(StepsProgressBar.PercentPositionProperty, LinePercentAlignment.Center));
|
||||
{
|
||||
var icons = new Style(selector => selector.Nesting().Template().OfType<PathIcon>());
|
||||
var icons = new Style(selector => selector.Nesting().Template().OfType<Icon>());
|
||||
icons.Add(Layoutable.HorizontalAlignmentProperty, HorizontalAlignment.Center);
|
||||
centerStyle.Add(icons);
|
||||
}
|
||||
@ -80,7 +81,7 @@ internal class StepsProgressBarTheme : AbstractLineProgressTheme
|
||||
selector.Nesting()
|
||||
.PropertyEquals(StepsProgressBar.PercentPositionProperty, LinePercentAlignment.Start));
|
||||
{
|
||||
var icons = new Style(selector => selector.Nesting().Template().OfType<PathIcon>());
|
||||
var icons = new Style(selector => selector.Nesting().Template().OfType<Icon>());
|
||||
icons.Add(Layoutable.VerticalAlignmentProperty, VerticalAlignment.Bottom);
|
||||
startStyle.Add(icons);
|
||||
}
|
||||
@ -90,7 +91,7 @@ internal class StepsProgressBarTheme : AbstractLineProgressTheme
|
||||
var endStyle = new Style(selector =>
|
||||
selector.Nesting().PropertyEquals(StepsProgressBar.PercentPositionProperty, LinePercentAlignment.End));
|
||||
{
|
||||
var icons = new Style(selector => selector.Nesting().Template().OfType<PathIcon>());
|
||||
var icons = new Style(selector => selector.Nesting().Template().OfType<Icon>());
|
||||
icons.Add(Layoutable.VerticalAlignmentProperty, VerticalAlignment.Top);
|
||||
endStyle.Add(icons);
|
||||
}
|
||||
@ -100,7 +101,7 @@ internal class StepsProgressBarTheme : AbstractLineProgressTheme
|
||||
selector.Nesting()
|
||||
.PropertyEquals(StepsProgressBar.PercentPositionProperty, LinePercentAlignment.Center));
|
||||
{
|
||||
var icons = new Style(selector => selector.Nesting().Template().OfType<PathIcon>());
|
||||
var icons = new Style(selector => selector.Nesting().Template().OfType<Icon>());
|
||||
icons.Add(Layoutable.VerticalAlignmentProperty, VerticalAlignment.Center);
|
||||
centerStyle.Add(icons);
|
||||
}
|
||||
|
@ -1,4 +1,5 @@
|
||||
using Avalonia.Metadata;
|
||||
|
||||
[assembly: XmlnsPrefix("https://atomui.net", "atom")]
|
||||
[assembly: XmlnsDefinition("https://atomui.net", "AtomUI.Controls")]
|
||||
[assembly: XmlnsDefinition("https://atomui.net", "AtomUI.Controls")]
|
||||
[assembly: XmlnsDefinition("https://atomui.net", "AtomUI.Controls.Utils")]
|
@ -1,4 +1,5 @@
|
||||
using AtomUI.Controls.Utils;
|
||||
using AtomUI.IconPkg;
|
||||
using AtomUI.Media;
|
||||
using AtomUI.Theme.Data;
|
||||
using AtomUI.Theme.Styling;
|
||||
@ -20,10 +21,10 @@ public class SegmentedItem : ContentControl, ISelectable
|
||||
public static readonly StyledProperty<bool> IsSelectedProperty =
|
||||
SelectingItemsControl.IsSelectedProperty.AddOwner<SegmentedItem>();
|
||||
|
||||
public static readonly StyledProperty<PathIcon?> IconProperty
|
||||
= AvaloniaProperty.Register<SegmentedItem, PathIcon?>(nameof(Icon));
|
||||
public static readonly StyledProperty<Icon?> IconProperty
|
||||
= AvaloniaProperty.Register<SegmentedItem, Icon?>(nameof(Icon));
|
||||
|
||||
public PathIcon? Icon
|
||||
public Icon? Icon
|
||||
{
|
||||
get => GetValue(IconProperty);
|
||||
set => SetValue(IconProperty, value);
|
||||
@ -99,11 +100,11 @@ public class SegmentedItem : ContentControl, ISelectable
|
||||
{
|
||||
if (Icon is not null)
|
||||
{
|
||||
TokenResourceBinder.CreateTokenBinding(Icon, PathIcon.NormalFilledBrushProperty,
|
||||
TokenResourceBinder.CreateTokenBinding(Icon, Icon.NormalFilledBrushProperty,
|
||||
SegmentedTokenResourceKey.ItemColor);
|
||||
TokenResourceBinder.CreateTokenBinding(Icon, PathIcon.ActiveFilledBrushProperty,
|
||||
TokenResourceBinder.CreateTokenBinding(Icon, Icon.ActiveFilledBrushProperty,
|
||||
SegmentedTokenResourceKey.ItemHoverColor);
|
||||
TokenResourceBinder.CreateTokenBinding(Icon, PathIcon.SelectedFilledBrushProperty,
|
||||
TokenResourceBinder.CreateTokenBinding(Icon, Icon.SelectedFilledBrushProperty,
|
||||
SegmentedTokenResourceKey.ItemSelectedColor);
|
||||
UIStructureUtils.SetTemplateParent(Icon, this);
|
||||
}
|
||||
|
@ -1,4 +1,5 @@
|
||||
using AtomUI.Theme;
|
||||
using AtomUI.IconPkg;
|
||||
using AtomUI.Theme;
|
||||
using AtomUI.Theme.Styling;
|
||||
using Avalonia;
|
||||
using Avalonia.Controls;
|
||||
@ -156,7 +157,7 @@ internal class SegmentedItemTheme : BaseControlTheme
|
||||
|
||||
Add(hasIconStyle);
|
||||
|
||||
var iconSelector = default(Selector).Nesting().Template().Name(IconContentPart).Child().OfType<PathIcon>();
|
||||
var iconSelector = default(Selector).Nesting().Template().Name(IconContentPart).Child().OfType<Icon>();
|
||||
var largeSizeStyle =
|
||||
new Style(selector => selector.Nesting().PropertyEquals(SegmentedItem.SizeTypeProperty, SizeType.Large));
|
||||
{
|
||||
|
@ -1,9 +1,8 @@
|
||||
using AtomUI.Controls.Switch;
|
||||
using AtomUI.Controls.Utils;
|
||||
using AtomUI.Icon;
|
||||
using AtomUI.IconPkg;
|
||||
using AtomUI.Media;
|
||||
using AtomUI.Theme.Styling;
|
||||
using AtomUI.Theme.Utils;
|
||||
using Avalonia;
|
||||
using Avalonia.Animation;
|
||||
using Avalonia.Controls;
|
||||
@ -402,7 +401,7 @@ public class ToggleSwitch : ToggleButton,
|
||||
{
|
||||
templatedControl.Padding = new Thickness(0);
|
||||
}
|
||||
else if (content is PathIcon iconControl)
|
||||
else if (content is Icon iconControl)
|
||||
{
|
||||
if (iconControl.ThemeType != IconThemeType.TwoTone)
|
||||
{
|
||||
|
@ -1,4 +1,6 @@
|
||||
using AtomUI.Media;
|
||||
using AtomUI.IconPkg;
|
||||
using AtomUI.IconPkg.AntDesign;
|
||||
using AtomUI.Media;
|
||||
using AtomUI.Theme;
|
||||
using AtomUI.Theme.Data;
|
||||
using AtomUI.Theme.Styling;
|
||||
@ -70,13 +72,10 @@ internal class BaseOverflowMenuItemTheme : BaseControlTheme
|
||||
HeaderedSelectingItemsControl.HeaderTemplateProperty);
|
||||
|
||||
itemTextPresenter.RegisterInNameScope(scope);
|
||||
|
||||
var menuCloseIcon = new PathIcon
|
||||
{
|
||||
HorizontalAlignment = HorizontalAlignment.Right,
|
||||
VerticalAlignment = VerticalAlignment.Center,
|
||||
Kind = "CloseOutlined"
|
||||
};
|
||||
|
||||
var menuCloseIcon = AntDesignIconPackage.CloseOutlined();
|
||||
menuCloseIcon.HorizontalAlignment = HorizontalAlignment.Right;
|
||||
menuCloseIcon.VerticalAlignment = VerticalAlignment.Center;
|
||||
|
||||
var closeButton = new IconButton
|
||||
{
|
||||
@ -87,9 +86,9 @@ internal class BaseOverflowMenuItemTheme : BaseControlTheme
|
||||
};
|
||||
|
||||
CreateTemplateParentBinding(closeButton, Visual.IsVisibleProperty, BaseOverflowMenuItem.IsClosableProperty);
|
||||
TokenResourceBinder.CreateGlobalTokenBinding(menuCloseIcon, PathIcon.NormalFilledBrushProperty,
|
||||
TokenResourceBinder.CreateGlobalTokenBinding(menuCloseIcon, Icon.NormalFilledBrushProperty,
|
||||
GlobalTokenResourceKey.ColorIcon);
|
||||
TokenResourceBinder.CreateGlobalTokenBinding(menuCloseIcon, PathIcon.ActiveFilledBrushProperty,
|
||||
TokenResourceBinder.CreateGlobalTokenBinding(menuCloseIcon, Icon.ActiveFilledBrushProperty,
|
||||
GlobalTokenResourceKey.ColorIconHover);
|
||||
|
||||
TokenResourceBinder.CreateGlobalTokenBinding(menuCloseIcon, Layoutable.WidthProperty,
|
||||
|
@ -1,4 +1,4 @@
|
||||
using AtomUI.Icon;
|
||||
using AtomUI.IconPkg;
|
||||
using AtomUI.Theme;
|
||||
using AtomUI.Theme.Data;
|
||||
using AtomUI.Theme.Styling;
|
||||
@ -92,7 +92,7 @@ internal class BaseTabItemTheme : BaseControlTheme
|
||||
hoverStyle.Add(TemplatedControl.ForegroundProperty, TabControlTokenResourceKey.ItemHoverColor);
|
||||
{
|
||||
var iconStyle = new Style(selector => selector.Nesting().Template().Name(ItemIconPart));
|
||||
iconStyle.Add(PathIcon.IconModeProperty, IconMode.Active);
|
||||
iconStyle.Add(Icon.IconModeProperty, IconMode.Active);
|
||||
hoverStyle.Add(iconStyle);
|
||||
}
|
||||
|
||||
@ -103,7 +103,7 @@ internal class BaseTabItemTheme : BaseControlTheme
|
||||
selectedStyle.Add(TemplatedControl.ForegroundProperty, TabControlTokenResourceKey.ItemSelectedColor);
|
||||
{
|
||||
var iconStyle = new Style(selector => selector.Nesting().Template().Name(ItemIconPart));
|
||||
iconStyle.Add(PathIcon.IconModeProperty, IconMode.Selected);
|
||||
iconStyle.Add(Icon.IconModeProperty, IconMode.Selected);
|
||||
selectedStyle.Add(iconStyle);
|
||||
}
|
||||
commonStyle.Add(selectedStyle);
|
||||
@ -164,7 +164,7 @@ internal class BaseTabItemTheme : BaseControlTheme
|
||||
// 上
|
||||
var topStyle = new Style(selector =>
|
||||
selector.Nesting().PropertyEquals(Avalonia.Controls.TabItem.TabStripPlacementProperty, Dock.Top));
|
||||
var iconStyle = new Style(selector => selector.Nesting().Template().OfType<PathIcon>());
|
||||
var iconStyle = new Style(selector => selector.Nesting().Template().OfType<Icon>());
|
||||
iconStyle.Add(Layoutable.VerticalAlignmentProperty, VerticalAlignment.Center);
|
||||
topStyle.Add(iconStyle);
|
||||
Add(topStyle);
|
||||
@ -174,7 +174,7 @@ internal class BaseTabItemTheme : BaseControlTheme
|
||||
// 右
|
||||
var rightStyle = new Style(selector =>
|
||||
selector.Nesting().PropertyEquals(Avalonia.Controls.TabItem.TabStripPlacementProperty, Dock.Right));
|
||||
var iconStyle = new Style(selector => selector.Nesting().Template().OfType<PathIcon>());
|
||||
var iconStyle = new Style(selector => selector.Nesting().Template().OfType<Icon>());
|
||||
iconStyle.Add(Layoutable.HorizontalAlignmentProperty, HorizontalAlignment.Left);
|
||||
iconStyle.Add(Layoutable.VerticalAlignmentProperty, VerticalAlignment.Center);
|
||||
rightStyle.Add(iconStyle);
|
||||
@ -185,7 +185,7 @@ internal class BaseTabItemTheme : BaseControlTheme
|
||||
var bottomStyle = new Style(selector =>
|
||||
selector.Nesting().PropertyEquals(Avalonia.Controls.TabItem.TabStripPlacementProperty, Dock.Bottom));
|
||||
|
||||
var iconStyle = new Style(selector => selector.Nesting().Template().OfType<PathIcon>());
|
||||
var iconStyle = new Style(selector => selector.Nesting().Template().OfType<Icon>());
|
||||
iconStyle.Add(Layoutable.VerticalAlignmentProperty, VerticalAlignment.Center);
|
||||
bottomStyle.Add(iconStyle);
|
||||
Add(bottomStyle);
|
||||
@ -194,7 +194,7 @@ internal class BaseTabItemTheme : BaseControlTheme
|
||||
// 左
|
||||
var leftStyle = new Style(selector =>
|
||||
selector.Nesting().PropertyEquals(Avalonia.Controls.TabItem.TabStripPlacementProperty, Dock.Left));
|
||||
var iconStyle = new Style(selector => selector.Nesting().Template().OfType<PathIcon>());
|
||||
var iconStyle = new Style(selector => selector.Nesting().Template().OfType<Icon>());
|
||||
iconStyle.Add(Layoutable.VerticalAlignmentProperty, VerticalAlignment.Center);
|
||||
iconStyle.Add(Layoutable.HorizontalAlignmentProperty, HorizontalAlignment.Left);
|
||||
leftStyle.Add(iconStyle);
|
||||
|
@ -1,8 +1,9 @@
|
||||
using AtomUI.Data;
|
||||
using AtomUI.IconPkg;
|
||||
using AtomUI.IconPkg.AntDesign;
|
||||
using AtomUI.Theme;
|
||||
using AtomUI.Theme.Data;
|
||||
using AtomUI.Theme.Styling;
|
||||
using AtomUI.Utils;
|
||||
using Avalonia.Controls;
|
||||
using Avalonia.Controls.Presenters;
|
||||
using Avalonia.Controls.Primitives;
|
||||
@ -42,15 +43,12 @@ internal class BaseTabScrollViewerTheme : BaseControlTheme
|
||||
{
|
||||
Name = ScrollViewLayoutPart
|
||||
};
|
||||
|
||||
var menuIndicatorIcon = AntDesignIconPackage.EllipsisOutlined();
|
||||
menuIndicatorIcon.HorizontalAlignment = HorizontalAlignment.Center;
|
||||
menuIndicatorIcon.VerticalAlignment = VerticalAlignment.Center;
|
||||
|
||||
var menuIndicatorIcon = new PathIcon
|
||||
{
|
||||
Kind = "EllipsisOutlined",
|
||||
HorizontalAlignment = HorizontalAlignment.Center,
|
||||
VerticalAlignment = VerticalAlignment.Center
|
||||
};
|
||||
|
||||
TokenResourceBinder.CreateTokenBinding(menuIndicatorIcon, PathIcon.NormalFilledBrushProperty,
|
||||
TokenResourceBinder.CreateTokenBinding(menuIndicatorIcon, Icon.NormalFilledBrushProperty,
|
||||
GlobalTokenResourceKey.ColorTextSecondary);
|
||||
|
||||
var menuIndicator = new IconButton
|
||||
|
@ -1,6 +1,7 @@
|
||||
using AtomUI.Theme.Data;
|
||||
using AtomUI.IconPkg;
|
||||
using AtomUI.IconPkg.AntDesign;
|
||||
using AtomUI.Theme.Data;
|
||||
using AtomUI.Theme.Styling;
|
||||
using AtomUI.Utils;
|
||||
using Avalonia;
|
||||
using Avalonia.Controls;
|
||||
using Avalonia.Controls.Presenters;
|
||||
@ -51,17 +52,14 @@ internal class CardTabControlTheme : BaseTabControlTheme
|
||||
var contentPanel = CreateTabStripContentPanel(scope);
|
||||
tabScrollViewer.Content = contentPanel;
|
||||
tabScrollViewer.TabControl = baseTabControl;
|
||||
|
||||
var addTabIcon = AntDesignIconPackage.PlusOutlined();
|
||||
|
||||
var addTabIcon = new PathIcon
|
||||
{
|
||||
Kind = "PlusOutlined"
|
||||
};
|
||||
|
||||
TokenResourceBinder.CreateTokenBinding(addTabIcon, PathIcon.NormalFilledBrushProperty,
|
||||
TokenResourceBinder.CreateTokenBinding(addTabIcon, Icon.NormalFilledBrushProperty,
|
||||
TabControlTokenResourceKey.ItemColor);
|
||||
TokenResourceBinder.CreateTokenBinding(addTabIcon, PathIcon.ActiveFilledBrushProperty,
|
||||
TokenResourceBinder.CreateTokenBinding(addTabIcon, Icon.ActiveFilledBrushProperty,
|
||||
TabControlTokenResourceKey.ItemHoverColor);
|
||||
TokenResourceBinder.CreateTokenBinding(addTabIcon, PathIcon.DisabledFilledBrushProperty,
|
||||
TokenResourceBinder.CreateTokenBinding(addTabIcon, Icon.DisabledFilledBrushProperty,
|
||||
GlobalTokenResourceKey.ColorTextDisabled);
|
||||
|
||||
var addTabButton = new IconButton
|
||||
|
@ -1,4 +1,5 @@
|
||||
using AtomUI.Controls.Utils;
|
||||
using AtomUI.IconPkg;
|
||||
using AtomUI.Media;
|
||||
using AtomUI.Theme.Styling;
|
||||
using Avalonia.Animation;
|
||||
@ -148,7 +149,7 @@ internal class CardTabItemTheme : BaseTabItemTheme
|
||||
// 上
|
||||
var topStyle = new Style(selector =>
|
||||
selector.Nesting().PropertyEquals(Avalonia.Controls.TabItem.TabStripPlacementProperty, Dock.Top));
|
||||
var iconStyle = new Style(selector => selector.Nesting().Template().OfType<PathIcon>());
|
||||
var iconStyle = new Style(selector => selector.Nesting().Template().OfType<Icon>());
|
||||
iconStyle.Add(Layoutable.VerticalAlignmentProperty, VerticalAlignment.Center);
|
||||
topStyle.Add(iconStyle);
|
||||
|
||||
@ -162,7 +163,7 @@ internal class CardTabItemTheme : BaseTabItemTheme
|
||||
// 右
|
||||
var rightStyle = new Style(selector =>
|
||||
selector.Nesting().PropertyEquals(Avalonia.Controls.TabItem.TabStripPlacementProperty, Dock.Right));
|
||||
var iconStyle = new Style(selector => selector.Nesting().Template().OfType<PathIcon>());
|
||||
var iconStyle = new Style(selector => selector.Nesting().Template().OfType<Icon>());
|
||||
iconStyle.Add(Layoutable.HorizontalAlignmentProperty, HorizontalAlignment.Center);
|
||||
rightStyle.Add(iconStyle);
|
||||
Add(rightStyle);
|
||||
@ -172,7 +173,7 @@ internal class CardTabItemTheme : BaseTabItemTheme
|
||||
var bottomStyle = new Style(selector =>
|
||||
selector.Nesting().PropertyEquals(Avalonia.Controls.TabItem.TabStripPlacementProperty, Dock.Bottom));
|
||||
|
||||
var iconStyle = new Style(selector => selector.Nesting().Template().OfType<PathIcon>());
|
||||
var iconStyle = new Style(selector => selector.Nesting().Template().OfType<Icon>());
|
||||
iconStyle.Add(Layoutable.VerticalAlignmentProperty, VerticalAlignment.Center);
|
||||
bottomStyle.Add(iconStyle);
|
||||
Add(bottomStyle);
|
||||
@ -181,7 +182,7 @@ internal class CardTabItemTheme : BaseTabItemTheme
|
||||
// 左
|
||||
var leftStyle = new Style(selector =>
|
||||
selector.Nesting().PropertyEquals(Avalonia.Controls.TabItem.TabStripPlacementProperty, Dock.Left));
|
||||
var iconStyle = new Style(selector => selector.Nesting().Template().OfType<PathIcon>());
|
||||
var iconStyle = new Style(selector => selector.Nesting().Template().OfType<Icon>());
|
||||
iconStyle.Add(Layoutable.HorizontalAlignmentProperty, HorizontalAlignment.Center);
|
||||
leftStyle.Add(iconStyle);
|
||||
Add(leftStyle);
|
||||
|
@ -1,5 +1,6 @@
|
||||
using AtomUI.Controls.Utils;
|
||||
using AtomUI.Icon;
|
||||
using AtomUI.IconPkg;
|
||||
using AtomUI.IconPkg.AntDesign;
|
||||
using AtomUI.Media;
|
||||
using AtomUI.Theme.Data;
|
||||
using AtomUI.Theme.Styling;
|
||||
@ -20,22 +21,22 @@ public class TabItem : AvaloniaTabItem, ICustomHitTest
|
||||
{
|
||||
#region 公共属性定义
|
||||
|
||||
public static readonly StyledProperty<PathIcon?> IconProperty =
|
||||
AvaloniaProperty.Register<TabItem, PathIcon?>(nameof(Icon));
|
||||
public static readonly StyledProperty<Icon?> IconProperty =
|
||||
AvaloniaProperty.Register<TabItem, Icon?>(nameof(Icon));
|
||||
|
||||
public static readonly StyledProperty<PathIcon?> CloseIconProperty =
|
||||
AvaloniaProperty.Register<TabItem, PathIcon?>(nameof(CloseIcon));
|
||||
public static readonly StyledProperty<Icon?> CloseIconProperty =
|
||||
AvaloniaProperty.Register<TabItem, Icon?>(nameof(CloseIcon));
|
||||
|
||||
public static readonly StyledProperty<bool> IsClosableProperty =
|
||||
AvaloniaProperty.Register<TabItem, bool>(nameof(IsClosable));
|
||||
|
||||
public PathIcon? Icon
|
||||
public Icon? Icon
|
||||
{
|
||||
get => GetValue(IconProperty);
|
||||
set => SetValue(IconProperty, value);
|
||||
}
|
||||
|
||||
public PathIcon? CloseIcon
|
||||
public Icon? CloseIcon
|
||||
{
|
||||
get => GetValue(CloseIconProperty);
|
||||
set => SetValue(CloseIconProperty, value);
|
||||
@ -82,13 +83,13 @@ public class TabItem : AvaloniaTabItem, ICustomHitTest
|
||||
Icon.Name = BaseTabItemTheme.ItemIconPart;
|
||||
if (Icon.ThemeType != IconThemeType.TwoTone)
|
||||
{
|
||||
TokenResourceBinder.CreateTokenBinding(Icon, PathIcon.NormalFilledBrushProperty,
|
||||
TokenResourceBinder.CreateTokenBinding(Icon, Icon.NormalFilledBrushProperty,
|
||||
TabControlTokenResourceKey.ItemColor);
|
||||
TokenResourceBinder.CreateTokenBinding(Icon, PathIcon.ActiveFilledBrushProperty,
|
||||
TokenResourceBinder.CreateTokenBinding(Icon, Icon.ActiveFilledBrushProperty,
|
||||
TabControlTokenResourceKey.ItemHoverColor);
|
||||
TokenResourceBinder.CreateTokenBinding(Icon, PathIcon.SelectedFilledBrushProperty,
|
||||
TokenResourceBinder.CreateTokenBinding(Icon, Icon.SelectedFilledBrushProperty,
|
||||
TabControlTokenResourceKey.ItemSelectedColor);
|
||||
TokenResourceBinder.CreateTokenBinding(Icon, PathIcon.DisabledFilledBrushProperty,
|
||||
TokenResourceBinder.CreateTokenBinding(Icon, Icon.DisabledFilledBrushProperty,
|
||||
GlobalTokenResourceKey.ColorTextDisabled);
|
||||
}
|
||||
|
||||
@ -103,10 +104,7 @@ public class TabItem : AvaloniaTabItem, ICustomHitTest
|
||||
{
|
||||
if (CloseIcon is null)
|
||||
{
|
||||
CloseIcon = new PathIcon
|
||||
{
|
||||
Kind = "CloseOutlined"
|
||||
};
|
||||
CloseIcon = AntDesignIconPackage.CloseOutlined();
|
||||
TokenResourceBinder.CreateGlobalResourceBinding(CloseIcon, WidthProperty,
|
||||
GlobalTokenResourceKey.IconSizeSM);
|
||||
TokenResourceBinder.CreateGlobalResourceBinding(CloseIcon, HeightProperty,
|
||||
@ -118,11 +116,11 @@ public class TabItem : AvaloniaTabItem, ICustomHitTest
|
||||
UIStructureUtils.SetTemplateParent(CloseIcon, this);
|
||||
if (CloseIcon.ThemeType != IconThemeType.TwoTone)
|
||||
{
|
||||
TokenResourceBinder.CreateTokenBinding(CloseIcon, PathIcon.NormalFilledBrushProperty,
|
||||
TokenResourceBinder.CreateTokenBinding(CloseIcon, Icon.NormalFilledBrushProperty,
|
||||
GlobalTokenResourceKey.ColorIcon);
|
||||
TokenResourceBinder.CreateTokenBinding(CloseIcon, PathIcon.ActiveFilledBrushProperty,
|
||||
TokenResourceBinder.CreateTokenBinding(CloseIcon, Icon.ActiveFilledBrushProperty,
|
||||
GlobalTokenResourceKey.ColorIconHover);
|
||||
TokenResourceBinder.CreateTokenBinding(CloseIcon, PathIcon.DisabledFilledBrushProperty,
|
||||
TokenResourceBinder.CreateTokenBinding(CloseIcon, Icon.DisabledFilledBrushProperty,
|
||||
GlobalTokenResourceKey.ColorTextDisabled);
|
||||
}
|
||||
}
|
||||
@ -186,7 +184,7 @@ public class TabItem : AvaloniaTabItem, ICustomHitTest
|
||||
{
|
||||
if (change.Property == IconProperty)
|
||||
{
|
||||
var oldIcon = change.GetOldValue<PathIcon?>();
|
||||
var oldIcon = change.GetOldValue<Icon?>();
|
||||
if (oldIcon != null)
|
||||
{
|
||||
UIStructureUtils.SetTemplateParent(oldIcon, null);
|
||||
@ -198,7 +196,7 @@ public class TabItem : AvaloniaTabItem, ICustomHitTest
|
||||
|
||||
if (change.Property == CloseIconProperty)
|
||||
{
|
||||
var oldIcon = change.GetOldValue<PathIcon?>();
|
||||
var oldIcon = change.GetOldValue<Icon?>();
|
||||
if (oldIcon != null)
|
||||
{
|
||||
UIStructureUtils.SetTemplateParent(oldIcon, null);
|
||||
|
@ -1,4 +1,4 @@
|
||||
using AtomUI.Icon;
|
||||
using AtomUI.IconPkg;
|
||||
using AtomUI.Theme;
|
||||
using AtomUI.Theme.Data;
|
||||
using AtomUI.Theme.Styling;
|
||||
@ -91,7 +91,7 @@ internal class BaseTabStripItemTheme : BaseControlTheme
|
||||
hoverStyle.Add(TemplatedControl.ForegroundProperty, TabControlTokenResourceKey.ItemHoverColor);
|
||||
{
|
||||
var iconStyle = new Style(selector => selector.Nesting().Template().Name(ItemIconPart));
|
||||
iconStyle.Add(PathIcon.IconModeProperty, IconMode.Active);
|
||||
iconStyle.Add(Icon.IconModeProperty, IconMode.Active);
|
||||
hoverStyle.Add(iconStyle);
|
||||
}
|
||||
|
||||
@ -102,7 +102,7 @@ internal class BaseTabStripItemTheme : BaseControlTheme
|
||||
selectedStyle.Add(TemplatedControl.ForegroundProperty, TabControlTokenResourceKey.ItemSelectedColor);
|
||||
{
|
||||
var iconStyle = new Style(selector => selector.Nesting().Template().Name(ItemIconPart));
|
||||
iconStyle.Add(PathIcon.IconModeProperty, IconMode.Selected);
|
||||
iconStyle.Add(Icon.IconModeProperty, IconMode.Selected);
|
||||
selectedStyle.Add(iconStyle);
|
||||
}
|
||||
commonStyle.Add(selectedStyle);
|
||||
@ -163,7 +163,7 @@ internal class BaseTabStripItemTheme : BaseControlTheme
|
||||
// 上
|
||||
var topStyle = new Style(selector =>
|
||||
selector.Nesting().PropertyEquals(TabStripItem.TabStripPlacementProperty, Dock.Top));
|
||||
var iconStyle = new Style(selector => selector.Nesting().Template().OfType<PathIcon>());
|
||||
var iconStyle = new Style(selector => selector.Nesting().Template().OfType<Icon>());
|
||||
iconStyle.Add(Layoutable.VerticalAlignmentProperty, VerticalAlignment.Center);
|
||||
topStyle.Add(iconStyle);
|
||||
Add(topStyle);
|
||||
@ -173,7 +173,7 @@ internal class BaseTabStripItemTheme : BaseControlTheme
|
||||
// 右
|
||||
var rightStyle = new Style(selector =>
|
||||
selector.Nesting().PropertyEquals(TabStripItem.TabStripPlacementProperty, Dock.Right));
|
||||
var iconStyle = new Style(selector => selector.Nesting().Template().OfType<PathIcon>());
|
||||
var iconStyle = new Style(selector => selector.Nesting().Template().OfType<Icon>());
|
||||
iconStyle.Add(Layoutable.HorizontalAlignmentProperty, HorizontalAlignment.Left);
|
||||
iconStyle.Add(Layoutable.VerticalAlignmentProperty, VerticalAlignment.Center);
|
||||
rightStyle.Add(iconStyle);
|
||||
@ -184,7 +184,7 @@ internal class BaseTabStripItemTheme : BaseControlTheme
|
||||
var bottomStyle = new Style(selector =>
|
||||
selector.Nesting().PropertyEquals(TabStripItem.TabStripPlacementProperty, Dock.Bottom));
|
||||
|
||||
var iconStyle = new Style(selector => selector.Nesting().Template().OfType<PathIcon>());
|
||||
var iconStyle = new Style(selector => selector.Nesting().Template().OfType<Icon>());
|
||||
iconStyle.Add(Layoutable.VerticalAlignmentProperty, VerticalAlignment.Center);
|
||||
bottomStyle.Add(iconStyle);
|
||||
Add(bottomStyle);
|
||||
@ -193,7 +193,7 @@ internal class BaseTabStripItemTheme : BaseControlTheme
|
||||
// 左
|
||||
var leftStyle = new Style(selector =>
|
||||
selector.Nesting().PropertyEquals(TabStripItem.TabStripPlacementProperty, Dock.Left));
|
||||
var iconStyle = new Style(selector => selector.Nesting().Template().OfType<PathIcon>());
|
||||
var iconStyle = new Style(selector => selector.Nesting().Template().OfType<Icon>());
|
||||
iconStyle.Add(Layoutable.VerticalAlignmentProperty, VerticalAlignment.Center);
|
||||
iconStyle.Add(Layoutable.HorizontalAlignmentProperty, HorizontalAlignment.Left);
|
||||
leftStyle.Add(iconStyle);
|
||||
|
@ -1,4 +1,5 @@
|
||||
using AtomUI.Controls.Utils;
|
||||
using AtomUI.IconPkg;
|
||||
using AtomUI.Media;
|
||||
using AtomUI.Theme.Styling;
|
||||
using Avalonia.Animation;
|
||||
@ -148,7 +149,7 @@ internal class CardTabStripItemTheme : BaseTabStripItemTheme
|
||||
// 上
|
||||
var topStyle = new Style(selector =>
|
||||
selector.Nesting().PropertyEquals(TabStripItem.TabStripPlacementProperty, Dock.Top));
|
||||
var iconStyle = new Style(selector => selector.Nesting().Template().OfType<PathIcon>());
|
||||
var iconStyle = new Style(selector => selector.Nesting().Template().OfType<Icon>());
|
||||
iconStyle.Add(Layoutable.VerticalAlignmentProperty, VerticalAlignment.Center);
|
||||
topStyle.Add(iconStyle);
|
||||
|
||||
@ -162,7 +163,7 @@ internal class CardTabStripItemTheme : BaseTabStripItemTheme
|
||||
// 右
|
||||
var rightStyle = new Style(selector =>
|
||||
selector.Nesting().PropertyEquals(TabStripItem.TabStripPlacementProperty, Dock.Right));
|
||||
var iconStyle = new Style(selector => selector.Nesting().Template().OfType<PathIcon>());
|
||||
var iconStyle = new Style(selector => selector.Nesting().Template().OfType<Icon>());
|
||||
iconStyle.Add(Layoutable.HorizontalAlignmentProperty, HorizontalAlignment.Center);
|
||||
rightStyle.Add(iconStyle);
|
||||
Add(rightStyle);
|
||||
@ -172,7 +173,7 @@ internal class CardTabStripItemTheme : BaseTabStripItemTheme
|
||||
var bottomStyle = new Style(selector =>
|
||||
selector.Nesting().PropertyEquals(TabStripItem.TabStripPlacementProperty, Dock.Bottom));
|
||||
|
||||
var iconStyle = new Style(selector => selector.Nesting().Template().OfType<PathIcon>());
|
||||
var iconStyle = new Style(selector => selector.Nesting().Template().OfType<Icon>());
|
||||
iconStyle.Add(Layoutable.VerticalAlignmentProperty, VerticalAlignment.Center);
|
||||
bottomStyle.Add(iconStyle);
|
||||
Add(bottomStyle);
|
||||
@ -181,7 +182,7 @@ internal class CardTabStripItemTheme : BaseTabStripItemTheme
|
||||
// 左
|
||||
var leftStyle = new Style(selector =>
|
||||
selector.Nesting().PropertyEquals(TabStripItem.TabStripPlacementProperty, Dock.Left));
|
||||
var iconStyle = new Style(selector => selector.Nesting().Template().OfType<PathIcon>());
|
||||
var iconStyle = new Style(selector => selector.Nesting().Template().OfType<Icon>());
|
||||
iconStyle.Add(Layoutable.HorizontalAlignmentProperty, HorizontalAlignment.Center);
|
||||
leftStyle.Add(iconStyle);
|
||||
Add(leftStyle);
|
||||
|
@ -1,6 +1,7 @@
|
||||
using AtomUI.Theme.Data;
|
||||
using AtomUI.IconPkg;
|
||||
using AtomUI.IconPkg.AntDesign;
|
||||
using AtomUI.Theme.Data;
|
||||
using AtomUI.Theme.Styling;
|
||||
using AtomUI.Utils;
|
||||
using Avalonia;
|
||||
using Avalonia.Controls;
|
||||
using Avalonia.Controls.Presenters;
|
||||
@ -46,17 +47,14 @@ internal class CardTabStripTheme : BaseTabStripTheme
|
||||
var contentPanel = CreateTabStripContentPanel(scope);
|
||||
tabScrollViewer.Content = contentPanel;
|
||||
tabScrollViewer.TabStrip = baseTabStrip;
|
||||
|
||||
var addTabIcon = AntDesignIconPackage.PlusOutlined();
|
||||
|
||||
var addTabIcon = new PathIcon
|
||||
{
|
||||
Kind = "PlusOutlined"
|
||||
};
|
||||
|
||||
TokenResourceBinder.CreateTokenBinding(addTabIcon, PathIcon.NormalFilledBrushProperty,
|
||||
TokenResourceBinder.CreateTokenBinding(addTabIcon, Icon.NormalFilledBrushProperty,
|
||||
TabControlTokenResourceKey.ItemColor);
|
||||
TokenResourceBinder.CreateTokenBinding(addTabIcon, PathIcon.ActiveFilledBrushProperty,
|
||||
TokenResourceBinder.CreateTokenBinding(addTabIcon, Icon.ActiveFilledBrushProperty,
|
||||
TabControlTokenResourceKey.ItemHoverColor);
|
||||
TokenResourceBinder.CreateTokenBinding(addTabIcon, PathIcon.DisabledFilledBrushProperty,
|
||||
TokenResourceBinder.CreateTokenBinding(addTabIcon, Icon.DisabledFilledBrushProperty,
|
||||
GlobalTokenResourceKey.ColorTextDisabled);
|
||||
|
||||
TokenResourceBinder.CreateGlobalResourceBinding(addTabIcon, Layoutable.WidthProperty,
|
||||
|
@ -1,5 +1,6 @@
|
||||
using AtomUI.Controls.Utils;
|
||||
using AtomUI.Icon;
|
||||
using AtomUI.IconPkg;
|
||||
using AtomUI.IconPkg.AntDesign;
|
||||
using AtomUI.Media;
|
||||
using AtomUI.Theme.Data;
|
||||
using AtomUI.Theme.Styling;
|
||||
@ -29,11 +30,11 @@ public class TabStripItem : AvaloniaTabStripItem, ICustomHitTest
|
||||
public static readonly StyledProperty<SizeType> SizeTypeProperty =
|
||||
BaseTabStrip.SizeTypeProperty.AddOwner<TabStripItem>();
|
||||
|
||||
public static readonly StyledProperty<PathIcon?> IconProperty =
|
||||
AvaloniaProperty.Register<TabStripItem, PathIcon?>(nameof(Icon));
|
||||
public static readonly StyledProperty<Icon?> IconProperty =
|
||||
AvaloniaProperty.Register<TabStripItem, Icon?>(nameof(Icon));
|
||||
|
||||
public static readonly StyledProperty<PathIcon?> CloseIconProperty =
|
||||
AvaloniaProperty.Register<TabStripItem, PathIcon?>(nameof(CloseIcon));
|
||||
public static readonly StyledProperty<Icon?> CloseIconProperty =
|
||||
AvaloniaProperty.Register<TabStripItem, Icon?>(nameof(CloseIcon));
|
||||
|
||||
public static readonly StyledProperty<bool> IsClosableProperty =
|
||||
AvaloniaProperty.Register<TabStripItem, bool>(nameof(IsClosable));
|
||||
@ -47,13 +48,13 @@ public class TabStripItem : AvaloniaTabStripItem, ICustomHitTest
|
||||
set => SetValue(SizeTypeProperty, value);
|
||||
}
|
||||
|
||||
public PathIcon? Icon
|
||||
public Icon? Icon
|
||||
{
|
||||
get => GetValue(IconProperty);
|
||||
set => SetValue(IconProperty, value);
|
||||
}
|
||||
|
||||
public PathIcon? CloseIcon
|
||||
public Icon? CloseIcon
|
||||
{
|
||||
get => GetValue(CloseIconProperty);
|
||||
set => SetValue(CloseIconProperty, value);
|
||||
@ -99,13 +100,13 @@ public class TabStripItem : AvaloniaTabStripItem, ICustomHitTest
|
||||
Icon.Name = BaseTabStripItemTheme.ItemIconPart;
|
||||
if (Icon.ThemeType != IconThemeType.TwoTone)
|
||||
{
|
||||
TokenResourceBinder.CreateTokenBinding(Icon, PathIcon.NormalFilledBrushProperty,
|
||||
TokenResourceBinder.CreateTokenBinding(Icon, Icon.NormalFilledBrushProperty,
|
||||
TabControlTokenResourceKey.ItemColor);
|
||||
TokenResourceBinder.CreateTokenBinding(Icon, PathIcon.ActiveFilledBrushProperty,
|
||||
TokenResourceBinder.CreateTokenBinding(Icon, Icon.ActiveFilledBrushProperty,
|
||||
TabControlTokenResourceKey.ItemHoverColor);
|
||||
TokenResourceBinder.CreateTokenBinding(Icon, PathIcon.SelectedFilledBrushProperty,
|
||||
TokenResourceBinder.CreateTokenBinding(Icon, Icon.SelectedFilledBrushProperty,
|
||||
TabControlTokenResourceKey.ItemSelectedColor);
|
||||
TokenResourceBinder.CreateTokenBinding(Icon, PathIcon.DisabledFilledBrushProperty,
|
||||
TokenResourceBinder.CreateTokenBinding(Icon, Icon.DisabledFilledBrushProperty,
|
||||
GlobalTokenResourceKey.ColorTextDisabled);
|
||||
}
|
||||
|
||||
@ -120,10 +121,7 @@ public class TabStripItem : AvaloniaTabStripItem, ICustomHitTest
|
||||
{
|
||||
if (CloseIcon is null)
|
||||
{
|
||||
CloseIcon = new PathIcon
|
||||
{
|
||||
Kind = "CloseOutlined"
|
||||
};
|
||||
CloseIcon = AntDesignIconPackage.CloseOutlined();
|
||||
TokenResourceBinder.CreateGlobalResourceBinding(CloseIcon, WidthProperty,
|
||||
GlobalTokenResourceKey.IconSizeSM);
|
||||
TokenResourceBinder.CreateGlobalResourceBinding(CloseIcon, HeightProperty,
|
||||
@ -135,11 +133,11 @@ public class TabStripItem : AvaloniaTabStripItem, ICustomHitTest
|
||||
UIStructureUtils.SetTemplateParent(CloseIcon, this);
|
||||
if (CloseIcon.ThemeType != IconThemeType.TwoTone)
|
||||
{
|
||||
TokenResourceBinder.CreateTokenBinding(CloseIcon, PathIcon.NormalFilledBrushProperty,
|
||||
TokenResourceBinder.CreateTokenBinding(CloseIcon, Icon.NormalFilledBrushProperty,
|
||||
GlobalTokenResourceKey.ColorIcon);
|
||||
TokenResourceBinder.CreateTokenBinding(CloseIcon, PathIcon.ActiveFilledBrushProperty,
|
||||
TokenResourceBinder.CreateTokenBinding(CloseIcon, Icon.ActiveFilledBrushProperty,
|
||||
GlobalTokenResourceKey.ColorIconHover);
|
||||
TokenResourceBinder.CreateTokenBinding(CloseIcon, PathIcon.DisabledFilledBrushProperty,
|
||||
TokenResourceBinder.CreateTokenBinding(CloseIcon, Icon.DisabledFilledBrushProperty,
|
||||
GlobalTokenResourceKey.ColorTextDisabled);
|
||||
}
|
||||
}
|
||||
@ -203,7 +201,7 @@ public class TabStripItem : AvaloniaTabStripItem, ICustomHitTest
|
||||
{
|
||||
if (change.Property == IconProperty)
|
||||
{
|
||||
var oldIcon = change.GetOldValue<PathIcon?>();
|
||||
var oldIcon = change.GetOldValue<Icon?>();
|
||||
if (oldIcon != null)
|
||||
{
|
||||
UIStructureUtils.SetTemplateParent(oldIcon, null);
|
||||
@ -215,7 +213,7 @@ public class TabStripItem : AvaloniaTabStripItem, ICustomHitTest
|
||||
|
||||
if (change.Property == CloseIconProperty)
|
||||
{
|
||||
var oldIcon = change.GetOldValue<PathIcon?>();
|
||||
var oldIcon = change.GetOldValue<Icon?>();
|
||||
if (oldIcon != null)
|
||||
{
|
||||
UIStructureUtils.SetTemplateParent(oldIcon, null);
|
||||
|
@ -1,4 +1,6 @@
|
||||
using AtomUI.Controls.Utils;
|
||||
using AtomUI.IconPkg;
|
||||
using AtomUI.IconPkg.AntDesign;
|
||||
using AtomUI.Theme;
|
||||
using AtomUI.Theme.Data;
|
||||
using AtomUI.Theme.Palette;
|
||||
@ -51,11 +53,11 @@ public class Tag : TemplatedControl
|
||||
public static readonly StyledProperty<bool> BorderedProperty
|
||||
= AvaloniaProperty.Register<Tag, bool>(nameof(Bordered), true);
|
||||
|
||||
public static readonly StyledProperty<PathIcon?> IconProperty
|
||||
= AvaloniaProperty.Register<Tag, PathIcon?>(nameof(Icon));
|
||||
public static readonly StyledProperty<Icon?> IconProperty
|
||||
= AvaloniaProperty.Register<Tag, Icon?>(nameof(Icon));
|
||||
|
||||
public static readonly StyledProperty<PathIcon?> CloseIconProperty
|
||||
= AvaloniaProperty.Register<Tag, PathIcon?>(nameof(CloseIcon));
|
||||
public static readonly StyledProperty<Icon?> CloseIconProperty
|
||||
= AvaloniaProperty.Register<Tag, Icon?>(nameof(CloseIcon));
|
||||
|
||||
public static readonly StyledProperty<string?> TagTextProperty
|
||||
= AvaloniaProperty.Register<Tag, string?>(
|
||||
@ -79,13 +81,13 @@ public class Tag : TemplatedControl
|
||||
set => SetValue(BorderedProperty, value);
|
||||
}
|
||||
|
||||
public PathIcon? Icon
|
||||
public Icon? Icon
|
||||
{
|
||||
get => GetValue(IconProperty);
|
||||
set => SetValue(IconProperty, value);
|
||||
}
|
||||
|
||||
public PathIcon? CloseIcon
|
||||
public Icon? CloseIcon
|
||||
{
|
||||
get => GetValue(CloseIconProperty);
|
||||
set => SetValue(CloseIconProperty, value);
|
||||
@ -382,23 +384,20 @@ public class Tag : TemplatedControl
|
||||
{
|
||||
if (CloseIcon is null)
|
||||
{
|
||||
CloseIcon = new PathIcon
|
||||
{
|
||||
Kind = "CloseOutlined"
|
||||
};
|
||||
CloseIcon = AntDesignIconPackage.CloseOutlined();
|
||||
|
||||
TokenResourceBinder.CreateTokenBinding(CloseIcon, WidthProperty, TagTokenResourceKey.TagCloseIconSize);
|
||||
TokenResourceBinder.CreateTokenBinding(CloseIcon, HeightProperty, TagTokenResourceKey.TagCloseIconSize);
|
||||
if (_hasColorSet && !_isPresetColorTag)
|
||||
{
|
||||
TokenResourceBinder.CreateTokenBinding(CloseIcon, PathIcon.NormalFilledBrushProperty,
|
||||
TokenResourceBinder.CreateTokenBinding(CloseIcon, Icon.NormalFilledBrushProperty,
|
||||
GlobalTokenResourceKey.ColorTextLightSolid);
|
||||
}
|
||||
else
|
||||
{
|
||||
TokenResourceBinder.CreateTokenBinding(CloseIcon, PathIcon.NormalFilledBrushProperty,
|
||||
TokenResourceBinder.CreateTokenBinding(CloseIcon, Icon.NormalFilledBrushProperty,
|
||||
GlobalTokenResourceKey.ColorIcon);
|
||||
TokenResourceBinder.CreateTokenBinding(CloseIcon, PathIcon.ActiveFilledBrushProperty,
|
||||
TokenResourceBinder.CreateTokenBinding(CloseIcon, Icon.ActiveFilledBrushProperty,
|
||||
GlobalTokenResourceKey.ColorIconHover);
|
||||
}
|
||||
}
|
||||
@ -409,7 +408,7 @@ public class Tag : TemplatedControl
|
||||
{
|
||||
if (Icon is not null)
|
||||
{
|
||||
if (_layoutPanel?.Children[0] is PathIcon oldIcon)
|
||||
if (_layoutPanel?.Children[0] is Icon oldIcon)
|
||||
{
|
||||
_layoutPanel.Children.Remove(oldIcon);
|
||||
}
|
||||
@ -419,7 +418,7 @@ public class Tag : TemplatedControl
|
||||
_layoutPanel?.Children.Insert(0, Icon);
|
||||
if (_hasColorSet)
|
||||
{
|
||||
TokenResourceBinder.CreateTokenBinding(Icon, PathIcon.NormalFilledBrushProperty,
|
||||
TokenResourceBinder.CreateTokenBinding(Icon, Icon.NormalFilledBrushProperty,
|
||||
GlobalTokenResourceKey.ColorTextLightSolid);
|
||||
}
|
||||
else if (_isPresetColorTag)
|
||||
|
@ -57,10 +57,10 @@ internal class TagTheme : BaseControlTheme
|
||||
};
|
||||
closeBtn.RegisterInNameScope(scope);
|
||||
|
||||
TokenResourceBinder.CreateTokenBinding(closeBtn, Layoutable.WidthProperty,
|
||||
GlobalTokenResourceKey.IconSizeSM);
|
||||
TokenResourceBinder.CreateTokenBinding(closeBtn, Layoutable.HeightProperty,
|
||||
GlobalTokenResourceKey.IconSizeSM);
|
||||
TokenResourceBinder.CreateTokenBinding(closeBtn, IconButton.IconWidthProperty,
|
||||
GlobalTokenResourceKey.IconSizeXS);
|
||||
TokenResourceBinder.CreateTokenBinding(closeBtn, IconButton.IconHeightProperty,
|
||||
GlobalTokenResourceKey.IconSizeXS);
|
||||
TokenResourceBinder.CreateTokenBinding(textBlock, Layoutable.HeightProperty,
|
||||
TagTokenResourceKey.TagLineHeight);
|
||||
TokenResourceBinder.CreateTokenBinding(textBlock, TextBlock.LineHeightProperty,
|
||||
|
@ -1,4 +1,6 @@
|
||||
using AtomUI.Controls.Internal;
|
||||
using AtomUI.IconPkg;
|
||||
using AtomUI.IconPkg.AntDesign;
|
||||
using AtomUI.Theme.Styling;
|
||||
using Avalonia.Controls;
|
||||
|
||||
@ -11,11 +13,8 @@ internal class RangeTimePickerTheme : RangeInfoPickerInputTheme
|
||||
{
|
||||
}
|
||||
|
||||
protected override PathIcon BuildInfoIcon(InfoPickerInput infoPickerInput, INameScope scope)
|
||||
protected override Icon BuildInfoIcon(InfoPickerInput infoPickerInput, INameScope scope)
|
||||
{
|
||||
return new PathIcon()
|
||||
{
|
||||
Kind = "ClockCircleOutlined"
|
||||
};
|
||||
return AntDesignIconPackage.ClockCircleOutlined();
|
||||
}
|
||||
}
|
||||
|
@ -1,4 +1,6 @@
|
||||
using AtomUI.Controls.Internal;
|
||||
using AtomUI.IconPkg;
|
||||
using AtomUI.IconPkg.AntDesign;
|
||||
using AtomUI.Theme.Styling;
|
||||
using Avalonia.Controls;
|
||||
using Avalonia.Styling;
|
||||
@ -12,12 +14,9 @@ internal class TimePickerTheme : InfoPickerInputTheme
|
||||
{
|
||||
}
|
||||
|
||||
protected override PathIcon BuildInfoIcon(InfoPickerInput infoPickerInput, INameScope scope)
|
||||
protected override Icon BuildInfoIcon(InfoPickerInput infoPickerInput, INameScope scope)
|
||||
{
|
||||
return new PathIcon()
|
||||
{
|
||||
Kind = "ClockCircleOutlined"
|
||||
};
|
||||
return AntDesignIconPackage.ClockCircleOutlined();
|
||||
}
|
||||
|
||||
protected override void BuildStyles()
|
||||
|
@ -1,6 +1,7 @@
|
||||
using AtomUI.Controls.Utils;
|
||||
using AtomUI.Data;
|
||||
using AtomUI.Icon;
|
||||
using AtomUI.IconPkg;
|
||||
using AtomUI.IconPkg.AntDesign;
|
||||
using AtomUI.Media;
|
||||
using AtomUI.Theme.Data;
|
||||
using AtomUI.Theme.Styling;
|
||||
@ -20,22 +21,22 @@ internal class NodeSwitcherButton : ToggleIconButton
|
||||
{
|
||||
#region 公共属性
|
||||
|
||||
public static readonly StyledProperty<PathIcon?> LoadingIconProperty
|
||||
= AvaloniaProperty.Register<NodeSwitcherButton, PathIcon?>(nameof(LoadingIcon));
|
||||
public static readonly StyledProperty<Icon?> LoadingIconProperty
|
||||
= AvaloniaProperty.Register<NodeSwitcherButton, Icon?>(nameof(LoadingIcon));
|
||||
|
||||
public static readonly StyledProperty<PathIcon?> LeafIconProperty
|
||||
= AvaloniaProperty.Register<NodeSwitcherButton, PathIcon?>(nameof(LeafIcon));
|
||||
public static readonly StyledProperty<Icon?> LeafIconProperty
|
||||
= AvaloniaProperty.Register<NodeSwitcherButton, Icon?>(nameof(LeafIcon));
|
||||
|
||||
public static readonly StyledProperty<bool> IsLeafProperty
|
||||
= AvaloniaProperty.Register<NodeSwitcherButton, bool>(nameof(IsLeaf));
|
||||
|
||||
public PathIcon? LoadingIcon
|
||||
public Icon? LoadingIcon
|
||||
{
|
||||
get => GetValue(LoadingIconProperty);
|
||||
set => SetValue(LoadingIconProperty, value);
|
||||
}
|
||||
|
||||
public PathIcon? LeafIcon
|
||||
public Icon? LeafIcon
|
||||
{
|
||||
get => GetValue(LeafIconProperty);
|
||||
set => SetValue(LeafIconProperty, value);
|
||||
@ -77,39 +78,22 @@ internal class NodeSwitcherButton : ToggleIconButton
|
||||
|
||||
protected override void OnApplyTemplate(TemplateAppliedEventArgs e)
|
||||
{
|
||||
if (LoadingIcon is null)
|
||||
{
|
||||
LoadingIcon = new PathIcon
|
||||
{
|
||||
Kind = "LoadingOutlined"
|
||||
};
|
||||
}
|
||||
|
||||
LoadingIcon ??= AntDesignIconPackage.LoadingOutlined();
|
||||
ConfigureFixedSizeIcon(LoadingIcon);
|
||||
|
||||
LoadingIcon.LoadingAnimation = IconAnimation.Spin;
|
||||
|
||||
if (LeafIcon is null)
|
||||
{
|
||||
LeafIcon = new PathIcon
|
||||
{
|
||||
Kind = "FileOutlined"
|
||||
};
|
||||
}
|
||||
LeafIcon ??= AntDesignIconPackage.FileOutlined();
|
||||
|
||||
ConfigureFixedSizeIcon(LeafIcon);
|
||||
base.OnApplyTemplate(e);
|
||||
ApplyIconToContent();
|
||||
if (Transitions is null)
|
||||
Transitions ??= new Transitions
|
||||
{
|
||||
Transitions = new Transitions
|
||||
{
|
||||
AnimationUtils.CreateTransition<SolidColorBrushTransition>(BackgroundProperty)
|
||||
};
|
||||
}
|
||||
AnimationUtils.CreateTransition<SolidColorBrushTransition>(BackgroundProperty)
|
||||
};
|
||||
}
|
||||
|
||||
private void ConfigureFixedSizeIcon(PathIcon icon)
|
||||
private void ConfigureFixedSizeIcon(Icon icon)
|
||||
{
|
||||
icon.SetCurrentValue(HorizontalAlignmentProperty, HorizontalAlignment.Center);
|
||||
icon.SetCurrentValue(VerticalAlignmentProperty, VerticalAlignment.Center);
|
||||
@ -133,7 +117,7 @@ internal class NodeSwitcherButton : ToggleIconButton
|
||||
if (change.Property == LoadingIconProperty ||
|
||||
change.Property == LeafIconProperty)
|
||||
{
|
||||
if (change.NewValue is PathIcon newIcon)
|
||||
if (change.NewValue is Icon newIcon)
|
||||
{
|
||||
ConfigureFixedSizeIcon(newIcon);
|
||||
ApplyIconToContent();
|
||||
|
@ -1,4 +1,6 @@
|
||||
using AtomUI.Controls.Utils;
|
||||
using AtomUI.IconPkg;
|
||||
using AtomUI.IconPkg.AntDesign;
|
||||
using AtomUI.Media;
|
||||
using AtomUI.Theme.Data;
|
||||
using AtomUI.Theme.Styling;
|
||||
@ -26,17 +28,17 @@ public class TreeViewItem : AvaloniaTreeItem
|
||||
public static readonly StyledProperty<bool> IsCheckableProperty =
|
||||
AvaloniaProperty.Register<TreeViewItem, bool>(nameof(IsCheckable), true);
|
||||
|
||||
public static readonly StyledProperty<PathIcon?> IconProperty
|
||||
= AvaloniaProperty.Register<TreeViewItem, PathIcon?>(nameof(Icon));
|
||||
public static readonly StyledProperty<Icon?> IconProperty
|
||||
= AvaloniaProperty.Register<TreeViewItem, Icon?>(nameof(Icon));
|
||||
|
||||
public static readonly StyledProperty<bool?> IsCheckedProperty
|
||||
= AvaloniaProperty.Register<TreeViewItem, bool?>(nameof(IsChecked), false);
|
||||
|
||||
public static readonly StyledProperty<PathIcon?> SwitcherExpandIconProperty
|
||||
= AvaloniaProperty.Register<TreeViewItem, PathIcon?>(nameof(SwitcherExpandIcon));
|
||||
public static readonly StyledProperty<Icon?> SwitcherExpandIconProperty
|
||||
= AvaloniaProperty.Register<TreeViewItem, Icon?>(nameof(SwitcherExpandIcon));
|
||||
|
||||
public static readonly StyledProperty<PathIcon?> SwitcherCollapseIconProperty
|
||||
= AvaloniaProperty.Register<TreeViewItem, PathIcon?>(nameof(SwitcherCollapseIcon));
|
||||
public static readonly StyledProperty<Icon?> SwitcherCollapseIconProperty
|
||||
= AvaloniaProperty.Register<TreeViewItem, Icon?>(nameof(SwitcherCollapseIcon));
|
||||
|
||||
public static readonly DirectProperty<TreeViewItem, bool> IsLeafProperty
|
||||
= AvaloniaProperty.RegisterDirect<TreeViewItem, bool>(nameof(IsLeaf),
|
||||
@ -49,19 +51,19 @@ public class TreeViewItem : AvaloniaTreeItem
|
||||
set => SetValue(IsCheckableProperty, value);
|
||||
}
|
||||
|
||||
public PathIcon? Icon
|
||||
public Icon? Icon
|
||||
{
|
||||
get => GetValue(IconProperty);
|
||||
set => SetValue(IconProperty, value);
|
||||
}
|
||||
|
||||
public PathIcon? SwitcherExpandIcon
|
||||
public Icon? SwitcherExpandIcon
|
||||
{
|
||||
get => GetValue(SwitcherExpandIconProperty);
|
||||
set => SetValue(SwitcherExpandIconProperty, value);
|
||||
}
|
||||
|
||||
public PathIcon? SwitcherCollapseIcon
|
||||
public Icon? SwitcherCollapseIcon
|
||||
{
|
||||
get => GetValue(SwitcherCollapseIconProperty);
|
||||
set => SetValue(SwitcherCollapseIconProperty, value);
|
||||
@ -340,12 +342,12 @@ public class TreeViewItem : AvaloniaTreeItem
|
||||
}
|
||||
else if (change.Property == IconProperty)
|
||||
{
|
||||
if (change.OldValue is PathIcon oldIcon)
|
||||
if (change.OldValue is Icon oldIcon)
|
||||
{
|
||||
UIStructureUtils.SetTemplateParent(oldIcon, null);
|
||||
}
|
||||
|
||||
if (change.NewValue is PathIcon newIcon)
|
||||
if (change.NewValue is Icon newIcon)
|
||||
{
|
||||
UIStructureUtils.SetTemplateParent(newIcon, this);
|
||||
}
|
||||
@ -544,14 +546,8 @@ public class TreeViewItem : AvaloniaTreeItem
|
||||
|
||||
if (IsShowLine)
|
||||
{
|
||||
_switcherButton.UnCheckedIcon = new PathIcon
|
||||
{
|
||||
Kind = "PlusSquareOutlined"
|
||||
};
|
||||
_switcherButton.CheckedIcon = new PathIcon
|
||||
{
|
||||
Kind = "MinusSquareOutlined"
|
||||
};
|
||||
_switcherButton.UnCheckedIcon = AntDesignIconPackage.PlusSquareOutlined();
|
||||
_switcherButton.CheckedIcon = AntDesignIconPackage.MinusSquareOutlined();
|
||||
TokenResourceBinder.CreateTokenBinding(_switcherButton, ToggleIconButton.IconWidthProperty,
|
||||
GlobalTokenResourceKey.IconSize);
|
||||
TokenResourceBinder.CreateTokenBinding(_switcherButton, ToggleIconButton.IconHeightProperty,
|
||||
@ -559,11 +555,8 @@ public class TreeViewItem : AvaloniaTreeItem
|
||||
}
|
||||
else
|
||||
{
|
||||
_switcherButton.CheckedIcon = null;
|
||||
_switcherButton.UnCheckedIcon = new PathIcon
|
||||
{
|
||||
Kind = "CaretRightOutlined"
|
||||
};
|
||||
_switcherButton.CheckedIcon = null;
|
||||
_switcherButton.UnCheckedIcon = AntDesignIconPackage.CaretRightOutlined();
|
||||
TokenResourceBinder.CreateTokenBinding(_switcherButton, ToggleIconButton.IconWidthProperty,
|
||||
GlobalTokenResourceKey.IconSizeXS);
|
||||
TokenResourceBinder.CreateTokenBinding(_switcherButton, ToggleIconButton.IconHeightProperty,
|
||||
|
@ -1,4 +1,5 @@
|
||||
using AtomUI.Theme;
|
||||
using AtomUI.IconPkg;
|
||||
using AtomUI.Theme;
|
||||
using AtomUI.Theme.Styling;
|
||||
using Avalonia;
|
||||
using Avalonia.Controls;
|
||||
@ -174,7 +175,7 @@ internal class TreeViewItemTheme : BaseControlTheme
|
||||
|
||||
// 节点 Icon 的大小
|
||||
var treeItemIconStyle = new Style(selector =>
|
||||
selector.Nesting().Template().Name(IconPresenterPart).Descendant().OfType<PathIcon>());
|
||||
selector.Nesting().Template().Name(IconPresenterPart).Descendant().OfType<Icon>());
|
||||
treeItemIconStyle.Add(Layoutable.WidthProperty, GlobalTokenResourceKey.IconSize);
|
||||
treeItemIconStyle.Add(Layoutable.HeightProperty, GlobalTokenResourceKey.IconSize);
|
||||
treeItemIconStyle.Add(Layoutable.MarginProperty, TreeViewTokenResourceKey.TreeNodeIconMargin);
|
||||
|
25
src/AtomUI.Controls/Utils/IconInfoProviderMarkupExtension.cs
Normal file
25
src/AtomUI.Controls/Utils/IconInfoProviderMarkupExtension.cs
Normal file
@ -0,0 +1,25 @@
|
||||
using AtomUI.IconPkg;
|
||||
using AtomUI.IconPkg.AntDesign;
|
||||
using Avalonia.Markup.Xaml;
|
||||
|
||||
namespace AtomUI.Controls.Utils;
|
||||
|
||||
public class IconInfoProvider : MarkupExtension
|
||||
{
|
||||
public string Kind { get; set; }
|
||||
|
||||
public IconInfoProvider()
|
||||
{
|
||||
Kind = string.Empty;
|
||||
}
|
||||
|
||||
public IconInfoProvider(string kind)
|
||||
{
|
||||
Kind = kind;
|
||||
}
|
||||
|
||||
public override object ProvideValue(IServiceProvider serviceProvider)
|
||||
{
|
||||
return AntDesignIconPackage.Current.GetIconInfo(Kind) ?? new IconInfo();
|
||||
}
|
||||
}
|
@ -1,16 +1,15 @@
|
||||
using AtomUI.Icon;
|
||||
using AtomUI.IconPkg;
|
||||
using AtomUI.IconPkg.AntDesign;
|
||||
using Avalonia.Layout;
|
||||
using Avalonia.Markup.Xaml;
|
||||
using Avalonia.Media;
|
||||
|
||||
namespace AtomUI.Controls;
|
||||
namespace AtomUI.Controls.Utils;
|
||||
|
||||
public class IconProvider : MarkupExtension
|
||||
{
|
||||
public string Kind { get; set; }
|
||||
|
||||
public string? PackageProvider { get; set; }
|
||||
|
||||
// Filled 和 Outlined
|
||||
public IBrush? NormalFilledColor { get; set; }
|
||||
public IBrush? ActiveFilledColor { get; set; }
|
||||
@ -37,19 +36,15 @@ public class IconProvider : MarkupExtension
|
||||
|
||||
public override object ProvideValue(IServiceProvider serviceProvider)
|
||||
{
|
||||
var icon = new PathIcon
|
||||
{
|
||||
Kind = Kind,
|
||||
PackageProvider = PackageProvider
|
||||
};
|
||||
icon.SetCurrentValue(PathIcon.LoadingAnimationProperty, Animation);
|
||||
icon.SetCurrentValue(PathIcon.NormalFilledBrushProperty, NormalFilledColor);
|
||||
icon.SetCurrentValue(PathIcon.ActiveFilledBrushProperty, ActiveFilledColor);
|
||||
icon.SetCurrentValue(PathIcon.SelectedFilledBrushProperty, SelectedFilledColor);
|
||||
icon.SetCurrentValue(PathIcon.DisabledFilledBrushProperty, DisabledFilledColor);
|
||||
icon.SetCurrentValue(PathIcon.PrimaryFilledBrushProperty, SelectedFilledColor);
|
||||
icon.SetCurrentValue(PathIcon.DisabledFilledBrushProperty, PrimaryFilledColor);
|
||||
icon.SetCurrentValue(PathIcon.SecondaryFilledBrushProperty, SecondaryFilledColor);
|
||||
var icon = AntDesignIconPackage.Current.BuildIcon(Kind) ?? new Icon();
|
||||
icon.SetCurrentValue(Icon.LoadingAnimationProperty, Animation);
|
||||
icon.SetCurrentValue(Icon.NormalFilledBrushProperty, NormalFilledColor);
|
||||
icon.SetCurrentValue(Icon.ActiveFilledBrushProperty, ActiveFilledColor);
|
||||
icon.SetCurrentValue(Icon.SelectedFilledBrushProperty, SelectedFilledColor);
|
||||
icon.SetCurrentValue(Icon.DisabledFilledBrushProperty, DisabledFilledColor);
|
||||
icon.SetCurrentValue(Icon.PrimaryFilledBrushProperty, SelectedFilledColor);
|
||||
icon.SetCurrentValue(Icon.DisabledFilledBrushProperty, PrimaryFilledColor);
|
||||
icon.SetCurrentValue(Icon.SecondaryFilledBrushProperty, SecondaryFilledColor);
|
||||
|
||||
if (!double.IsNaN(Width))
|
||||
{
|
@ -1,60 +0,0 @@
|
||||
namespace AtomUI.Icon.AntDesign;
|
||||
|
||||
public partial class AntDesignIconPackage : IconPackage
|
||||
{
|
||||
public AntDesignIconPackage()
|
||||
: base("AntDesign")
|
||||
{
|
||||
SetupIconPool();
|
||||
}
|
||||
|
||||
private partial void SetupIconPool();
|
||||
|
||||
public IconInfo? GetIcon(AntDesignIconKind iconKind)
|
||||
{
|
||||
return GetIconRaw((int)iconKind)!;
|
||||
}
|
||||
|
||||
public IconInfo GetIcon(AntDesignIconKind iconKind, ColorInfo colorInfo)
|
||||
{
|
||||
return GetIconRaw((int)iconKind, colorInfo)!;
|
||||
}
|
||||
|
||||
public IconInfo GetIcon(AntDesignIconKind iconKind, TwoToneColorInfo twoToneColorInfo)
|
||||
{
|
||||
return GetIconRaw((int)iconKind, twoToneColorInfo)!;
|
||||
}
|
||||
|
||||
public override IconInfo? GetIcon(string iconKind, ColorInfo colorInfo)
|
||||
{
|
||||
AntDesignIconKind kind;
|
||||
if (Enum.TryParse(iconKind, out kind))
|
||||
{
|
||||
return GetIcon(kind, colorInfo);
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public override IconInfo? GetIcon(string iconKind, TwoToneColorInfo twoToneColorInfo)
|
||||
{
|
||||
AntDesignIconKind kind;
|
||||
if (Enum.TryParse(iconKind, out kind))
|
||||
{
|
||||
return GetIcon(kind, twoToneColorInfo);
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public override IconInfo? GetIcon(string iconKind)
|
||||
{
|
||||
AntDesignIconKind kind;
|
||||
if (Enum.TryParse(iconKind, out kind))
|
||||
{
|
||||
return GetIcon(kind);
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
@ -1,838 +0,0 @@
|
||||
///
|
||||
/// This code is auto generated. Do not amend.
|
||||
///
|
||||
namespace AtomUI.Icon.AntDesign;
|
||||
public enum AntDesignIconKind
|
||||
{
|
||||
AccountBookFilled = 1,
|
||||
AlertFilled = 2,
|
||||
AlipayCircleFilled = 3,
|
||||
AlipaySquareFilled = 4,
|
||||
AliwangwangFilled = 5,
|
||||
AmazonCircleFilled = 6,
|
||||
AmazonSquareFilled = 7,
|
||||
AndroidFilled = 8,
|
||||
ApiFilled = 9,
|
||||
AppleFilled = 10,
|
||||
AppstoreFilled = 11,
|
||||
AudioFilled = 12,
|
||||
BackwardFilled = 13,
|
||||
BankFilled = 14,
|
||||
BehanceCircleFilled = 15,
|
||||
BehanceSquareFilled = 16,
|
||||
BellFilled = 17,
|
||||
BilibiliFilled = 18,
|
||||
BookFilled = 19,
|
||||
BoxPlotFilled = 20,
|
||||
BugFilled = 21,
|
||||
BuildFilled = 22,
|
||||
BulbFilled = 23,
|
||||
CalculatorFilled = 24,
|
||||
CalendarFilled = 25,
|
||||
CameraFilled = 26,
|
||||
CarFilled = 27,
|
||||
CaretDownFilled = 28,
|
||||
CaretLeftFilled = 29,
|
||||
CaretRightFilled = 30,
|
||||
CaretUpFilled = 31,
|
||||
CarryOutFilled = 32,
|
||||
CheckCircleFilled = 33,
|
||||
CheckSquareFilled = 34,
|
||||
ChromeFilled = 35,
|
||||
CiCircleFilled = 36,
|
||||
ClockCircleFilled = 37,
|
||||
CloseCircleFilled = 38,
|
||||
CloseSquareFilled = 39,
|
||||
CloudFilled = 40,
|
||||
CodeSandboxCircleFilled = 41,
|
||||
CodeSandboxSquareFilled = 42,
|
||||
CodeFilled = 43,
|
||||
CodepenCircleFilled = 44,
|
||||
CodepenSquareFilled = 45,
|
||||
CompassFilled = 46,
|
||||
ContactsFilled = 47,
|
||||
ContainerFilled = 48,
|
||||
ControlFilled = 49,
|
||||
CopyFilled = 50,
|
||||
CopyrightCircleFilled = 51,
|
||||
CreditCardFilled = 52,
|
||||
CrownFilled = 53,
|
||||
CustomerServiceFilled = 54,
|
||||
DashboardFilled = 55,
|
||||
DatabaseFilled = 56,
|
||||
DeleteFilled = 57,
|
||||
DiffFilled = 58,
|
||||
DingtalkCircleFilled = 59,
|
||||
DingtalkSquareFilled = 60,
|
||||
DiscordFilled = 61,
|
||||
DislikeFilled = 62,
|
||||
DollarCircleFilled = 63,
|
||||
DownCircleFilled = 64,
|
||||
DownSquareFilled = 65,
|
||||
DribbbleCircleFilled = 66,
|
||||
DribbbleSquareFilled = 67,
|
||||
DropboxCircleFilled = 68,
|
||||
DropboxSquareFilled = 69,
|
||||
EditFilled = 70,
|
||||
EnvironmentFilled = 71,
|
||||
EuroCircleFilled = 72,
|
||||
ExclamationCircleFilled = 73,
|
||||
ExperimentFilled = 74,
|
||||
EyeInvisibleFilled = 75,
|
||||
EyeFilled = 76,
|
||||
FacebookFilled = 77,
|
||||
FastBackwardFilled = 78,
|
||||
FastForwardFilled = 79,
|
||||
FileAddFilled = 80,
|
||||
FileExcelFilled = 81,
|
||||
FileExclamationFilled = 82,
|
||||
FileImageFilled = 83,
|
||||
FileMarkdownFilled = 84,
|
||||
FilePdfFilled = 85,
|
||||
FilePptFilled = 86,
|
||||
FileTextFilled = 87,
|
||||
FileUnknownFilled = 88,
|
||||
FileWordFilled = 89,
|
||||
FileZipFilled = 90,
|
||||
FileFilled = 91,
|
||||
FilterFilled = 92,
|
||||
FireFilled = 93,
|
||||
FlagFilled = 94,
|
||||
FolderAddFilled = 95,
|
||||
FolderOpenFilled = 96,
|
||||
FolderFilled = 97,
|
||||
FormatPainterFilled = 98,
|
||||
ForwardFilled = 99,
|
||||
FrownFilled = 100,
|
||||
FundFilled = 101,
|
||||
FunnelPlotFilled = 102,
|
||||
GiftFilled = 103,
|
||||
GithubFilled = 104,
|
||||
GitlabFilled = 105,
|
||||
GoldFilled = 106,
|
||||
GoldenFilled = 107,
|
||||
GoogleCircleFilled = 108,
|
||||
GooglePlusCircleFilled = 109,
|
||||
GooglePlusSquareFilled = 110,
|
||||
GoogleSquareFilled = 111,
|
||||
HddFilled = 112,
|
||||
HeartFilled = 113,
|
||||
HighlightFilled = 114,
|
||||
HomeFilled = 115,
|
||||
HourglassFilled = 116,
|
||||
Html5Filled = 117,
|
||||
IdcardFilled = 118,
|
||||
IeCircleFilled = 119,
|
||||
IeSquareFilled = 120,
|
||||
InfoCircleFilled = 121,
|
||||
InstagramFilled = 122,
|
||||
InsuranceFilled = 123,
|
||||
InteractionFilled = 124,
|
||||
LayoutFilled = 125,
|
||||
LeftCircleFilled = 126,
|
||||
LeftSquareFilled = 127,
|
||||
LikeFilled = 128,
|
||||
LinkedinFilled = 129,
|
||||
LockFilled = 130,
|
||||
MacCommandFilled = 131,
|
||||
MailFilled = 132,
|
||||
MedicineBoxFilled = 133,
|
||||
MediumCircleFilled = 134,
|
||||
MediumSquareFilled = 135,
|
||||
MehFilled = 136,
|
||||
MergeFilled = 137,
|
||||
MessageFilled = 138,
|
||||
MinusCircleFilled = 139,
|
||||
MinusSquareFilled = 140,
|
||||
MobileFilled = 141,
|
||||
MoneyCollectFilled = 142,
|
||||
MoonFilled = 143,
|
||||
MutedFilled = 144,
|
||||
NotificationFilled = 145,
|
||||
OpenAIFilled = 146,
|
||||
PauseCircleFilled = 147,
|
||||
PayCircleFilled = 148,
|
||||
PhoneFilled = 149,
|
||||
PictureFilled = 150,
|
||||
PieChartFilled = 151,
|
||||
PinterestFilled = 152,
|
||||
PlayCircleFilled = 153,
|
||||
PlaySquareFilled = 154,
|
||||
PlusCircleFilled = 155,
|
||||
PlusSquareFilled = 156,
|
||||
PoundCircleFilled = 157,
|
||||
PrinterFilled = 158,
|
||||
ProductFilled = 159,
|
||||
ProfileFilled = 160,
|
||||
ProjectFilled = 161,
|
||||
PropertySafetyFilled = 162,
|
||||
PushpinFilled = 163,
|
||||
QqCircleFilled = 164,
|
||||
QqSquareFilled = 165,
|
||||
QuestionCircleFilled = 166,
|
||||
ReadFilled = 167,
|
||||
ReconciliationFilled = 168,
|
||||
RedEnvelopeFilled = 169,
|
||||
RedditCircleFilled = 170,
|
||||
RedditSquareFilled = 171,
|
||||
RestFilled = 172,
|
||||
RightCircleFilled = 173,
|
||||
RightSquareFilled = 174,
|
||||
RobotFilled = 175,
|
||||
RocketFilled = 176,
|
||||
SafetyCertificateFilled = 177,
|
||||
SaveFilled = 178,
|
||||
ScheduleFilled = 179,
|
||||
SecurityScanFilled = 180,
|
||||
SettingFilled = 181,
|
||||
ShopFilled = 182,
|
||||
ShoppingFilled = 183,
|
||||
SignalFilled = 184,
|
||||
SignatureFilled = 185,
|
||||
SketchCircleFilled = 186,
|
||||
SketchSquareFilled = 187,
|
||||
SkinFilled = 188,
|
||||
SkypeFilled = 189,
|
||||
SlackCircleFilled = 190,
|
||||
SlackSquareFilled = 191,
|
||||
SlidersFilled = 192,
|
||||
SmileFilled = 193,
|
||||
SnippetsFilled = 194,
|
||||
SoundFilled = 195,
|
||||
SpotifyFilled = 196,
|
||||
StarFilled = 197,
|
||||
StepBackwardFilled = 198,
|
||||
StepForwardFilled = 199,
|
||||
StopFilled = 200,
|
||||
SunFilled = 201,
|
||||
SwitcherFilled = 202,
|
||||
TabletFilled = 203,
|
||||
TagFilled = 204,
|
||||
TagsFilled = 205,
|
||||
TaobaoCircleFilled = 206,
|
||||
TaobaoSquareFilled = 207,
|
||||
ThunderboltFilled = 208,
|
||||
TikTokFilled = 209,
|
||||
ToolFilled = 210,
|
||||
TrademarkCircleFilled = 211,
|
||||
TrophyFilled = 212,
|
||||
TruckFilled = 213,
|
||||
TwitchFilled = 214,
|
||||
TwitterCircleFilled = 215,
|
||||
TwitterSquareFilled = 216,
|
||||
UnlockFilled = 217,
|
||||
UpCircleFilled = 218,
|
||||
UpSquareFilled = 219,
|
||||
UsbFilled = 220,
|
||||
VideoCameraFilled = 221,
|
||||
WalletFilled = 222,
|
||||
WarningFilled = 223,
|
||||
WechatWorkFilled = 224,
|
||||
WechatFilled = 225,
|
||||
WeiboCircleFilled = 226,
|
||||
WeiboSquareFilled = 227,
|
||||
WindowsFilled = 228,
|
||||
XFilled = 229,
|
||||
YahooFilled = 230,
|
||||
YoutubeFilled = 231,
|
||||
YuqueFilled = 232,
|
||||
ZhihuCircleFilled = 233,
|
||||
ZhihuSquareFilled = 234,
|
||||
AccountBookOutlined = 235,
|
||||
AimOutlined = 236,
|
||||
AlertOutlined = 237,
|
||||
AlibabaOutlined = 238,
|
||||
AlignCenterOutlined = 239,
|
||||
AlignLeftOutlined = 240,
|
||||
AlignRightOutlined = 241,
|
||||
AlipayCircleOutlined = 242,
|
||||
AlipayOutlined = 243,
|
||||
AliwangwangOutlined = 244,
|
||||
AliyunOutlined = 245,
|
||||
AmazonOutlined = 246,
|
||||
AndroidOutlined = 247,
|
||||
AntCloudOutlined = 248,
|
||||
AntDesignOutlined = 249,
|
||||
ApartmentOutlined = 250,
|
||||
ApiOutlined = 251,
|
||||
AppleOutlined = 252,
|
||||
AppstoreAddOutlined = 253,
|
||||
AppstoreOutlined = 254,
|
||||
AreaChartOutlined = 255,
|
||||
ArrowDownOutlined = 256,
|
||||
ArrowLeftOutlined = 257,
|
||||
ArrowRightOutlined = 258,
|
||||
ArrowUpOutlined = 259,
|
||||
ArrowsAltOutlined = 260,
|
||||
AudioMutedOutlined = 261,
|
||||
AudioOutlined = 262,
|
||||
AuditOutlined = 263,
|
||||
BackwardOutlined = 264,
|
||||
BaiduOutlined = 265,
|
||||
BankOutlined = 266,
|
||||
BarChartOutlined = 267,
|
||||
BarcodeOutlined = 268,
|
||||
BarsOutlined = 269,
|
||||
BehanceSquareOutlined = 270,
|
||||
BehanceOutlined = 271,
|
||||
BellOutlined = 272,
|
||||
BgColorsOutlined = 273,
|
||||
BilibiliOutlined = 274,
|
||||
BlockOutlined = 275,
|
||||
BoldOutlined = 276,
|
||||
BookOutlined = 277,
|
||||
BorderBottomOutlined = 278,
|
||||
BorderHorizontalOutlined = 279,
|
||||
BorderInnerOutlined = 280,
|
||||
BorderLeftOutlined = 281,
|
||||
BorderOuterOutlined = 282,
|
||||
BorderRightOutlined = 283,
|
||||
BorderTopOutlined = 284,
|
||||
BorderVerticleOutlined = 285,
|
||||
BorderOutlined = 286,
|
||||
BorderlessTableOutlined = 287,
|
||||
BoxPlotOutlined = 288,
|
||||
BranchesOutlined = 289,
|
||||
BugOutlined = 290,
|
||||
BuildOutlined = 291,
|
||||
BulbOutlined = 292,
|
||||
CalculatorOutlined = 293,
|
||||
CalendarOutlined = 294,
|
||||
CameraOutlined = 295,
|
||||
CarOutlined = 296,
|
||||
CaretDownOutlined = 297,
|
||||
CaretLeftOutlined = 298,
|
||||
CaretRightOutlined = 299,
|
||||
CaretUpOutlined = 300,
|
||||
CarryOutOutlined = 301,
|
||||
CheckCircleOutlined = 302,
|
||||
CheckSquareOutlined = 303,
|
||||
CheckOutlined = 304,
|
||||
ChromeOutlined = 305,
|
||||
CiCircleOutlined = 306,
|
||||
CiOutlined = 307,
|
||||
ClearOutlined = 308,
|
||||
ClockCircleOutlined = 309,
|
||||
CloseCircleOutlined = 310,
|
||||
CloseSquareOutlined = 311,
|
||||
CloseOutlined = 312,
|
||||
CloudDownloadOutlined = 313,
|
||||
CloudServerOutlined = 314,
|
||||
CloudSyncOutlined = 315,
|
||||
CloudUploadOutlined = 316,
|
||||
CloudOutlined = 317,
|
||||
ClusterOutlined = 318,
|
||||
CodeSandboxOutlined = 319,
|
||||
CodeOutlined = 320,
|
||||
CodepenCircleOutlined = 321,
|
||||
CodepenOutlined = 322,
|
||||
CoffeeOutlined = 323,
|
||||
ColumnHeightOutlined = 324,
|
||||
ColumnWidthOutlined = 325,
|
||||
CommentOutlined = 326,
|
||||
CompassOutlined = 327,
|
||||
CompressOutlined = 328,
|
||||
ConsoleSqlOutlined = 329,
|
||||
ContactsOutlined = 330,
|
||||
ContainerOutlined = 331,
|
||||
ControlOutlined = 332,
|
||||
CopyOutlined = 333,
|
||||
CopyrightCircleOutlined = 334,
|
||||
CopyrightOutlined = 335,
|
||||
CreditCardOutlined = 336,
|
||||
CrownOutlined = 337,
|
||||
CustomerServiceOutlined = 338,
|
||||
DashOutlined = 339,
|
||||
DashboardOutlined = 340,
|
||||
DatabaseOutlined = 341,
|
||||
DeleteColumnOutlined = 342,
|
||||
DeleteRowOutlined = 343,
|
||||
DeleteOutlined = 344,
|
||||
DeliveredProcedureOutlined = 345,
|
||||
DeploymentUnitOutlined = 346,
|
||||
DesktopOutlined = 347,
|
||||
DiffOutlined = 348,
|
||||
DingdingOutlined = 349,
|
||||
DingtalkOutlined = 350,
|
||||
DisconnectOutlined = 351,
|
||||
DiscordOutlined = 352,
|
||||
DislikeOutlined = 353,
|
||||
DockerOutlined = 354,
|
||||
DollarCircleOutlined = 355,
|
||||
DollarOutlined = 356,
|
||||
DotChartOutlined = 357,
|
||||
DotNetOutlined = 358,
|
||||
DoubleLeftOutlined = 359,
|
||||
DoubleRightOutlined = 360,
|
||||
DownCircleOutlined = 361,
|
||||
DownSquareOutlined = 362,
|
||||
DownOutlined = 363,
|
||||
DownloadOutlined = 364,
|
||||
DragOutlined = 365,
|
||||
DribbbleSquareOutlined = 366,
|
||||
DribbbleOutlined = 367,
|
||||
DropboxOutlined = 368,
|
||||
EditOutlined = 369,
|
||||
EllipsisOutlined = 370,
|
||||
EnterOutlined = 371,
|
||||
EnvironmentOutlined = 372,
|
||||
EuroCircleOutlined = 373,
|
||||
EuroOutlined = 374,
|
||||
ExceptionOutlined = 375,
|
||||
ExclamationCircleOutlined = 376,
|
||||
ExclamationOutlined = 377,
|
||||
ExpandAltOutlined = 378,
|
||||
ExpandOutlined = 379,
|
||||
ExperimentOutlined = 380,
|
||||
ExportOutlined = 381,
|
||||
EyeInvisibleOutlined = 382,
|
||||
EyeOutlined = 383,
|
||||
FacebookOutlined = 384,
|
||||
FallOutlined = 385,
|
||||
FastBackwardOutlined = 386,
|
||||
FastForwardOutlined = 387,
|
||||
FieldBinaryOutlined = 388,
|
||||
FieldNumberOutlined = 389,
|
||||
FieldStringOutlined = 390,
|
||||
FieldTimeOutlined = 391,
|
||||
FileAddOutlined = 392,
|
||||
FileDoneOutlined = 393,
|
||||
FileExcelOutlined = 394,
|
||||
FileExclamationOutlined = 395,
|
||||
FileGifOutlined = 396,
|
||||
FileImageOutlined = 397,
|
||||
FileJpgOutlined = 398,
|
||||
FileMarkdownOutlined = 399,
|
||||
FilePdfOutlined = 400,
|
||||
FilePptOutlined = 401,
|
||||
FileProtectOutlined = 402,
|
||||
FileSearchOutlined = 403,
|
||||
FileSyncOutlined = 404,
|
||||
FileTextOutlined = 405,
|
||||
FileUnknownOutlined = 406,
|
||||
FileWordOutlined = 407,
|
||||
FileZipOutlined = 408,
|
||||
FileOutlined = 409,
|
||||
FilterOutlined = 410,
|
||||
FireOutlined = 411,
|
||||
FlagOutlined = 412,
|
||||
FolderAddOutlined = 413,
|
||||
FolderOpenOutlined = 414,
|
||||
FolderViewOutlined = 415,
|
||||
FolderOutlined = 416,
|
||||
FontColorsOutlined = 417,
|
||||
FontSizeOutlined = 418,
|
||||
ForkOutlined = 419,
|
||||
FormOutlined = 420,
|
||||
FormatPainterOutlined = 421,
|
||||
ForwardOutlined = 422,
|
||||
FrownOutlined = 423,
|
||||
FullscreenExitOutlined = 424,
|
||||
FullscreenOutlined = 425,
|
||||
FunctionOutlined = 426,
|
||||
FundProjectionScreenOutlined = 427,
|
||||
FundViewOutlined = 428,
|
||||
FundOutlined = 429,
|
||||
FunnelPlotOutlined = 430,
|
||||
GatewayOutlined = 431,
|
||||
GifOutlined = 432,
|
||||
GiftOutlined = 433,
|
||||
GithubOutlined = 434,
|
||||
GitlabOutlined = 435,
|
||||
GlobalOutlined = 436,
|
||||
GoldOutlined = 437,
|
||||
GooglePlusOutlined = 438,
|
||||
GoogleOutlined = 439,
|
||||
GroupOutlined = 440,
|
||||
HarmonyOSOutlined = 441,
|
||||
HddOutlined = 442,
|
||||
HeartOutlined = 443,
|
||||
HeatMapOutlined = 444,
|
||||
HighlightOutlined = 445,
|
||||
HistoryOutlined = 446,
|
||||
HolderOutlined = 447,
|
||||
HomeOutlined = 448,
|
||||
HourglassOutlined = 449,
|
||||
Html5Outlined = 450,
|
||||
IdcardOutlined = 451,
|
||||
IeOutlined = 452,
|
||||
ImportOutlined = 453,
|
||||
InboxOutlined = 454,
|
||||
InfoCircleOutlined = 455,
|
||||
InfoOutlined = 456,
|
||||
InsertRowAboveOutlined = 457,
|
||||
InsertRowBelowOutlined = 458,
|
||||
InsertRowLeftOutlined = 459,
|
||||
InsertRowRightOutlined = 460,
|
||||
InstagramOutlined = 461,
|
||||
InsuranceOutlined = 462,
|
||||
InteractionOutlined = 463,
|
||||
IssuesCloseOutlined = 464,
|
||||
ItalicOutlined = 465,
|
||||
JavaScriptOutlined = 466,
|
||||
JavaOutlined = 467,
|
||||
KeyOutlined = 468,
|
||||
KubernetesOutlined = 469,
|
||||
LaptopOutlined = 470,
|
||||
LayoutOutlined = 471,
|
||||
LeftCircleOutlined = 472,
|
||||
LeftSquareOutlined = 473,
|
||||
LeftOutlined = 474,
|
||||
LikeOutlined = 475,
|
||||
LineChartOutlined = 476,
|
||||
LineHeightOutlined = 477,
|
||||
LineOutlined = 478,
|
||||
LinkOutlined = 479,
|
||||
LinkedinOutlined = 480,
|
||||
LinuxOutlined = 481,
|
||||
Loading3QuartersOutlined = 482,
|
||||
LoadingOutlined = 483,
|
||||
LockOutlined = 484,
|
||||
LoginOutlined = 485,
|
||||
LogoutOutlined = 486,
|
||||
MacCommandOutlined = 487,
|
||||
MailOutlined = 488,
|
||||
ManOutlined = 489,
|
||||
MedicineBoxOutlined = 490,
|
||||
MediumWorkmarkOutlined = 491,
|
||||
MediumOutlined = 492,
|
||||
MehOutlined = 493,
|
||||
MenuFoldOutlined = 494,
|
||||
MenuUnfoldOutlined = 495,
|
||||
MenuOutlined = 496,
|
||||
MergeCellsOutlined = 497,
|
||||
MergeOutlined = 498,
|
||||
MessageOutlined = 499,
|
||||
MinusCircleOutlined = 500,
|
||||
MinusSquareOutlined = 501,
|
||||
MinusOutlined = 502,
|
||||
MobileOutlined = 503,
|
||||
MoneyCollectOutlined = 504,
|
||||
MonitorOutlined = 505,
|
||||
MoonOutlined = 506,
|
||||
MoreOutlined = 507,
|
||||
MutedOutlined = 508,
|
||||
NodeCollapseOutlined = 509,
|
||||
NodeExpandOutlined = 510,
|
||||
NodeIndexOutlined = 511,
|
||||
NotificationOutlined = 512,
|
||||
NumberOutlined = 513,
|
||||
OneToOneOutlined = 514,
|
||||
OpenAIOutlined = 515,
|
||||
OrderedListOutlined = 516,
|
||||
PaperClipOutlined = 517,
|
||||
PartitionOutlined = 518,
|
||||
PauseCircleOutlined = 519,
|
||||
PauseOutlined = 520,
|
||||
PayCircleOutlined = 521,
|
||||
PercentageOutlined = 522,
|
||||
PhoneOutlined = 523,
|
||||
PicCenterOutlined = 524,
|
||||
PicLeftOutlined = 525,
|
||||
PicRightOutlined = 526,
|
||||
PictureOutlined = 527,
|
||||
PieChartOutlined = 528,
|
||||
PinterestOutlined = 529,
|
||||
PlayCircleOutlined = 530,
|
||||
PlaySquareOutlined = 531,
|
||||
PlusCircleOutlined = 532,
|
||||
PlusSquareOutlined = 533,
|
||||
PlusOutlined = 534,
|
||||
PoundCircleOutlined = 535,
|
||||
PoundOutlined = 536,
|
||||
PoweroffOutlined = 537,
|
||||
PrinterOutlined = 538,
|
||||
ProductOutlined = 539,
|
||||
ProfileOutlined = 540,
|
||||
ProjectOutlined = 541,
|
||||
PropertySafetyOutlined = 542,
|
||||
PullRequestOutlined = 543,
|
||||
PushpinOutlined = 544,
|
||||
PythonOutlined = 545,
|
||||
QqOutlined = 546,
|
||||
QrcodeOutlined = 547,
|
||||
QuestionCircleOutlined = 548,
|
||||
QuestionOutlined = 549,
|
||||
RadarChartOutlined = 550,
|
||||
RadiusBottomleftOutlined = 551,
|
||||
RadiusBottomrightOutlined = 552,
|
||||
RadiusSettingOutlined = 553,
|
||||
RadiusUpleftOutlined = 554,
|
||||
RadiusUprightOutlined = 555,
|
||||
ReadOutlined = 556,
|
||||
ReconciliationOutlined = 557,
|
||||
RedEnvelopeOutlined = 558,
|
||||
RedditOutlined = 559,
|
||||
RedoOutlined = 560,
|
||||
ReloadOutlined = 561,
|
||||
RestOutlined = 562,
|
||||
RetweetOutlined = 563,
|
||||
RightCircleOutlined = 564,
|
||||
RightSquareOutlined = 565,
|
||||
RightOutlined = 566,
|
||||
RiseOutlined = 567,
|
||||
RobotOutlined = 568,
|
||||
RocketOutlined = 569,
|
||||
RollbackOutlined = 570,
|
||||
RotateLeftOutlined = 571,
|
||||
RotateRightOutlined = 572,
|
||||
RubyOutlined = 573,
|
||||
SafetyCertificateOutlined = 574,
|
||||
SafetyOutlined = 575,
|
||||
SaveOutlined = 576,
|
||||
ScanOutlined = 577,
|
||||
ScheduleOutlined = 578,
|
||||
ScissorOutlined = 579,
|
||||
SearchOutlined = 580,
|
||||
SecurityScanOutlined = 581,
|
||||
SelectOutlined = 582,
|
||||
SendOutlined = 583,
|
||||
SettingOutlined = 584,
|
||||
ShakeOutlined = 585,
|
||||
ShareAltOutlined = 586,
|
||||
ShopOutlined = 587,
|
||||
ShoppingCartOutlined = 588,
|
||||
ShoppingOutlined = 589,
|
||||
ShrinkOutlined = 590,
|
||||
SignatureOutlined = 591,
|
||||
SisternodeOutlined = 592,
|
||||
SketchOutlined = 593,
|
||||
SkinOutlined = 594,
|
||||
SkypeOutlined = 595,
|
||||
SlackSquareOutlined = 596,
|
||||
SlackOutlined = 597,
|
||||
SlidersOutlined = 598,
|
||||
SmallDashOutlined = 599,
|
||||
SmileOutlined = 600,
|
||||
SnippetsOutlined = 601,
|
||||
SolutionOutlined = 602,
|
||||
SortAscendingOutlined = 603,
|
||||
SortDescendingOutlined = 604,
|
||||
SoundOutlined = 605,
|
||||
SplitCellsOutlined = 606,
|
||||
SpotifyOutlined = 607,
|
||||
StarOutlined = 608,
|
||||
StepBackwardOutlined = 609,
|
||||
StepForwardOutlined = 610,
|
||||
StockOutlined = 611,
|
||||
StopOutlined = 612,
|
||||
StrikethroughOutlined = 613,
|
||||
SubnodeOutlined = 614,
|
||||
SunOutlined = 615,
|
||||
SwapLeftOutlined = 616,
|
||||
SwapRightOutlined = 617,
|
||||
SwapOutlined = 618,
|
||||
SwitcherOutlined = 619,
|
||||
SyncOutlined = 620,
|
||||
TableOutlined = 621,
|
||||
TabletOutlined = 622,
|
||||
TagOutlined = 623,
|
||||
TagsOutlined = 624,
|
||||
TaobaoCircleOutlined = 625,
|
||||
TaobaoOutlined = 626,
|
||||
TeamOutlined = 627,
|
||||
ThunderboltOutlined = 628,
|
||||
TikTokOutlined = 629,
|
||||
ToTopOutlined = 630,
|
||||
ToolOutlined = 631,
|
||||
TrademarkCircleOutlined = 632,
|
||||
TrademarkOutlined = 633,
|
||||
TransactionOutlined = 634,
|
||||
TranslationOutlined = 635,
|
||||
TrophyOutlined = 636,
|
||||
TruckOutlined = 637,
|
||||
TwitchOutlined = 638,
|
||||
TwitterOutlined = 639,
|
||||
UnderlineOutlined = 640,
|
||||
UndoOutlined = 641,
|
||||
UngroupOutlined = 642,
|
||||
UnlockOutlined = 643,
|
||||
UnorderedListOutlined = 644,
|
||||
UpCircleOutlined = 645,
|
||||
UpSquareOutlined = 646,
|
||||
UpOutlined = 647,
|
||||
UploadOutlined = 648,
|
||||
UsbOutlined = 649,
|
||||
UserAddOutlined = 650,
|
||||
UserDeleteOutlined = 651,
|
||||
UserSwitchOutlined = 652,
|
||||
UserOutlined = 653,
|
||||
UsergroupAddOutlined = 654,
|
||||
UsergroupDeleteOutlined = 655,
|
||||
VerifiedOutlined = 656,
|
||||
VerticalAlignBottomOutlined = 657,
|
||||
VerticalAlignMiddleOutlined = 658,
|
||||
VerticalAlignTopOutlined = 659,
|
||||
VerticalLeftOutlined = 660,
|
||||
VerticalRightOutlined = 661,
|
||||
VideoCameraAddOutlined = 662,
|
||||
VideoCameraOutlined = 663,
|
||||
WalletOutlined = 664,
|
||||
WarningOutlined = 665,
|
||||
WechatWorkOutlined = 666,
|
||||
WechatOutlined = 667,
|
||||
WeiboCircleOutlined = 668,
|
||||
WeiboSquareOutlined = 669,
|
||||
WeiboOutlined = 670,
|
||||
WhatsAppOutlined = 671,
|
||||
WifiOutlined = 672,
|
||||
WindowsOutlined = 673,
|
||||
WomanOutlined = 674,
|
||||
XOutlined = 675,
|
||||
YahooOutlined = 676,
|
||||
YoutubeOutlined = 677,
|
||||
YuqueOutlined = 678,
|
||||
ZhihuOutlined = 679,
|
||||
ZoomInOutlined = 680,
|
||||
ZoomOutOutlined = 681,
|
||||
AccountBookTwoTone = 682,
|
||||
AlertTwoTone = 683,
|
||||
ApiTwoTone = 684,
|
||||
AppstoreTwoTone = 685,
|
||||
AudioTwoTone = 686,
|
||||
BankTwoTone = 687,
|
||||
BellTwoTone = 688,
|
||||
BookTwoTone = 689,
|
||||
BoxPlotTwoTone = 690,
|
||||
BugTwoTone = 691,
|
||||
BuildTwoTone = 692,
|
||||
BulbTwoTone = 693,
|
||||
CalculatorTwoTone = 694,
|
||||
CalendarTwoTone = 695,
|
||||
CameraTwoTone = 696,
|
||||
CarTwoTone = 697,
|
||||
CarryOutTwoTone = 698,
|
||||
CheckCircleTwoTone = 699,
|
||||
CheckSquareTwoTone = 700,
|
||||
CiCircleTwoTone = 701,
|
||||
CiTwoTone = 702,
|
||||
ClockCircleTwoTone = 703,
|
||||
CloseCircleTwoTone = 704,
|
||||
CloseSquareTwoTone = 705,
|
||||
CloudTwoTone = 706,
|
||||
CodeTwoTone = 707,
|
||||
CompassTwoTone = 708,
|
||||
ContactsTwoTone = 709,
|
||||
ContainerTwoTone = 710,
|
||||
ControlTwoTone = 711,
|
||||
CopyTwoTone = 712,
|
||||
CopyrightCircleTwoTone = 713,
|
||||
CopyrightTwoTone = 714,
|
||||
CreditCardTwoTone = 715,
|
||||
CrownTwoTone = 716,
|
||||
CustomerServiceTwoTone = 717,
|
||||
DashboardTwoTone = 718,
|
||||
DatabaseTwoTone = 719,
|
||||
DeleteTwoTone = 720,
|
||||
DiffTwoTone = 721,
|
||||
DislikeTwoTone = 722,
|
||||
DollarCircleTwoTone = 723,
|
||||
DollarTwoTone = 724,
|
||||
DownCircleTwoTone = 725,
|
||||
DownSquareTwoTone = 726,
|
||||
EditTwoTone = 727,
|
||||
EnvironmentTwoTone = 728,
|
||||
EuroCircleTwoTone = 729,
|
||||
EuroTwoTone = 730,
|
||||
ExclamationCircleTwoTone = 731,
|
||||
ExperimentTwoTone = 732,
|
||||
EyeInvisibleTwoTone = 733,
|
||||
EyeTwoTone = 734,
|
||||
FileAddTwoTone = 735,
|
||||
FileExcelTwoTone = 736,
|
||||
FileExclamationTwoTone = 737,
|
||||
FileImageTwoTone = 738,
|
||||
FileMarkdownTwoTone = 739,
|
||||
FilePdfTwoTone = 740,
|
||||
FilePptTwoTone = 741,
|
||||
FileTextTwoTone = 742,
|
||||
FileUnknownTwoTone = 743,
|
||||
FileWordTwoTone = 744,
|
||||
FileZipTwoTone = 745,
|
||||
FileTwoTone = 746,
|
||||
FilterTwoTone = 747,
|
||||
FireTwoTone = 748,
|
||||
FlagTwoTone = 749,
|
||||
FolderAddTwoTone = 750,
|
||||
FolderOpenTwoTone = 751,
|
||||
FolderTwoTone = 752,
|
||||
FrownTwoTone = 753,
|
||||
FundTwoTone = 754,
|
||||
FunnelPlotTwoTone = 755,
|
||||
GiftTwoTone = 756,
|
||||
GoldTwoTone = 757,
|
||||
HddTwoTone = 758,
|
||||
HeartTwoTone = 759,
|
||||
HighlightTwoTone = 760,
|
||||
HomeTwoTone = 761,
|
||||
HourglassTwoTone = 762,
|
||||
Html5TwoTone = 763,
|
||||
IdcardTwoTone = 764,
|
||||
InfoCircleTwoTone = 765,
|
||||
InsuranceTwoTone = 766,
|
||||
InteractionTwoTone = 767,
|
||||
LayoutTwoTone = 768,
|
||||
LeftCircleTwoTone = 769,
|
||||
LeftSquareTwoTone = 770,
|
||||
LikeTwoTone = 771,
|
||||
LockTwoTone = 772,
|
||||
MailTwoTone = 773,
|
||||
MedicineBoxTwoTone = 774,
|
||||
MehTwoTone = 775,
|
||||
MessageTwoTone = 776,
|
||||
MinusCircleTwoTone = 777,
|
||||
MinusSquareTwoTone = 778,
|
||||
MobileTwoTone = 779,
|
||||
MoneyCollectTwoTone = 780,
|
||||
NotificationTwoTone = 781,
|
||||
PauseCircleTwoTone = 782,
|
||||
PhoneTwoTone = 783,
|
||||
PictureTwoTone = 784,
|
||||
PieChartTwoTone = 785,
|
||||
PlayCircleTwoTone = 786,
|
||||
PlaySquareTwoTone = 787,
|
||||
PlusCircleTwoTone = 788,
|
||||
PlusSquareTwoTone = 789,
|
||||
PoundCircleTwoTone = 790,
|
||||
PrinterTwoTone = 791,
|
||||
ProfileTwoTone = 792,
|
||||
ProjectTwoTone = 793,
|
||||
PropertySafetyTwoTone = 794,
|
||||
PushpinTwoTone = 795,
|
||||
QuestionCircleTwoTone = 796,
|
||||
ReconciliationTwoTone = 797,
|
||||
RedEnvelopeTwoTone = 798,
|
||||
RestTwoTone = 799,
|
||||
RightCircleTwoTone = 800,
|
||||
RightSquareTwoTone = 801,
|
||||
RocketTwoTone = 802,
|
||||
SafetyCertificateTwoTone = 803,
|
||||
SaveTwoTone = 804,
|
||||
ScheduleTwoTone = 805,
|
||||
SecurityScanTwoTone = 806,
|
||||
SettingTwoTone = 807,
|
||||
ShopTwoTone = 808,
|
||||
ShoppingTwoTone = 809,
|
||||
SkinTwoTone = 810,
|
||||
SlidersTwoTone = 811,
|
||||
SmileTwoTone = 812,
|
||||
SnippetsTwoTone = 813,
|
||||
SoundTwoTone = 814,
|
||||
StarTwoTone = 815,
|
||||
StopTwoTone = 816,
|
||||
SwitcherTwoTone = 817,
|
||||
TabletTwoTone = 818,
|
||||
TagTwoTone = 819,
|
||||
TagsTwoTone = 820,
|
||||
ThunderboltTwoTone = 821,
|
||||
ToolTwoTone = 822,
|
||||
TrademarkCircleTwoTone = 823,
|
||||
TrophyTwoTone = 824,
|
||||
UnlockTwoTone = 825,
|
||||
UpCircleTwoTone = 826,
|
||||
UpSquareTwoTone = 827,
|
||||
UsbTwoTone = 828,
|
||||
VideoCameraTwoTone = 829,
|
||||
WalletTwoTone = 830,
|
||||
WarningTwoTone = 831,
|
||||
}
|
File diff suppressed because one or more lines are too long
@ -1,12 +0,0 @@
|
||||
namespace AtomUI.Icon;
|
||||
|
||||
public interface IIconPackageContainer
|
||||
{
|
||||
public IIconPackageContainer Register(IIconPackageProvider iconPackageProvider);
|
||||
public IIconPackageContainer Register<TIconProvider>() where TIconProvider : IIconPackageProvider, new();
|
||||
|
||||
public TIconPackageProvider? GetIconProvider<TIconPackageProvider>(string? id)
|
||||
where TIconPackageProvider : IIconPackageProvider, new();
|
||||
|
||||
public IIconPackageProvider? GetIconProvider(string? id);
|
||||
}
|
@ -1,9 +0,0 @@
|
||||
namespace AtomUI.Icon;
|
||||
|
||||
public interface IIconPackageProvider : IIconReader
|
||||
{
|
||||
public string Id { get; }
|
||||
public int Priority { get; set; }
|
||||
|
||||
public IEnumerable<IconInfo> GetIconInfos(IconThemeType? iconThemeType);
|
||||
}
|
@ -1,8 +0,0 @@
|
||||
namespace AtomUI.Icon;
|
||||
|
||||
public interface IIconReader
|
||||
{
|
||||
public IconInfo? GetIcon(string iconKind);
|
||||
public IconInfo? GetIcon(string iconKind, ColorInfo colorInfo);
|
||||
public IconInfo? GetIcon(string iconKind, TwoToneColorInfo twoToneColorInfo);
|
||||
}
|
@ -1,8 +0,0 @@
|
||||
namespace AtomUI.Icon;
|
||||
|
||||
public interface IPackageAwareIconReader : IIconReader
|
||||
{
|
||||
public IconInfo? GetIcon(string package, string iconKind);
|
||||
public IconInfo? GetIcon(string package, string iconKind, ColorInfo colorInfo);
|
||||
public IconInfo? GetIcon(string package, string iconKind, TwoToneColorInfo twoToneColorInfo);
|
||||
}
|
@ -1,143 +0,0 @@
|
||||
using Avalonia;
|
||||
using Avalonia.Media;
|
||||
|
||||
namespace AtomUI.Icon;
|
||||
|
||||
internal class IconImage : DrawingImage, IImage
|
||||
{
|
||||
public static readonly StyledProperty<IconInfo> DataProperty = AvaloniaProperty.Register<
|
||||
IconImage,
|
||||
IconInfo
|
||||
>(nameof(Data), new IconInfo());
|
||||
|
||||
public static readonly StyledProperty<IconMode> IconModeProperty = AvaloniaProperty.Register<
|
||||
IconImage,
|
||||
IconMode>(nameof(IconMode));
|
||||
|
||||
public static readonly StyledProperty<Size> SizeProperty = AvaloniaProperty.Register<IconImage, Size>(
|
||||
nameof(Size), new Size(16, 16));
|
||||
|
||||
public IconInfo Data
|
||||
{
|
||||
get => GetValue(DataProperty);
|
||||
set => SetValue(DataProperty, value);
|
||||
}
|
||||
|
||||
public IconMode IconMode
|
||||
{
|
||||
get => GetValue(IconModeProperty);
|
||||
set => SetValue(IconModeProperty, value);
|
||||
}
|
||||
|
||||
public new Size Size
|
||||
{
|
||||
get => GetValue(SizeProperty);
|
||||
set => SetValue(SizeProperty, value);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
Size IImage.Size => GetValue(SizeProperty);
|
||||
|
||||
public IconImage(IconInfo? data = null)
|
||||
{
|
||||
Data = data ?? new IconInfo();
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
void IImage.Draw(DrawingContext context, Rect sourceRect, Rect destRect)
|
||||
{
|
||||
var drawing = Drawing;
|
||||
if (drawing is null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
var scale = Matrix.CreateScale(
|
||||
destRect.Width / sourceRect.Width,
|
||||
destRect.Height / sourceRect.Height
|
||||
);
|
||||
var translate = Matrix.CreateTranslation(
|
||||
-sourceRect.X + destRect.X,
|
||||
-sourceRect.Y + destRect.Y
|
||||
);
|
||||
using (context.PushClip(destRect))
|
||||
using (context.PushTransform(translate * scale))
|
||||
{
|
||||
var geometriesData = Data.Data;
|
||||
var themeType = Data.ThemeType;
|
||||
var geometryDrawing = (Drawing as GeometryDrawing)!;
|
||||
if (themeType != IconThemeType.TwoTone)
|
||||
{
|
||||
var brush = new SolidColorBrush();
|
||||
var colorInfo = Data.ColorInfo;
|
||||
if (colorInfo is not null)
|
||||
{
|
||||
if (IconMode == IconMode.Normal)
|
||||
{
|
||||
brush.Color = colorInfo.Value.NormalColor;
|
||||
}
|
||||
else if (IconMode == IconMode.Active)
|
||||
{
|
||||
brush.Color = colorInfo.Value.ActiveColor;
|
||||
}
|
||||
else if (IconMode == IconMode.Selected)
|
||||
{
|
||||
brush.Color = colorInfo.Value.SelectedColor;
|
||||
}
|
||||
else if (IconMode == IconMode.Disabled)
|
||||
{
|
||||
brush.Color = colorInfo.Value.DisabledColor;
|
||||
}
|
||||
}
|
||||
|
||||
brush.Color = Colors.Black;
|
||||
|
||||
geometryDrawing.Brush = brush;
|
||||
// foreach (var geometryData in geometriesData) {
|
||||
// geometryDrawing.Geometry = StreamGeometry.Parse(geometryData.PathData);
|
||||
// geometryDrawing.Draw(context);
|
||||
// }
|
||||
geometryDrawing.Geometry = StreamGeometry.Parse(
|
||||
"M880 184H712v-64c0-4.4-3.6-8-8-8h-56c-4.4 0-8 3.6-8 8v64H384v-64c0-4.4-3.6-8-8-8h-56c-4.4 0-8 3.6-8 8v64H144c-17.7 0-32 14.3-32 32v664c0 17.7 14.3 32 32 32h736c17.7 0 32-14.3 32-32V216c0-17.7-14.3-32-32-32zM648.3 426.8l-87.7 161.1h45.7c5.5 0 10 4.5 10 10v21.3c0 5.5-4.5 10-10 10h-63.4v29.7h63.4c5.5 0 10 4.5 10 10v21.3c0 5.5-4.5 10-10 10h-63.4V752c0 5.5-4.5 10-10 10h-41.3c-5.5 0-10-4.5-10-10v-51.8h-63.1c-5.5 0-10-4.5-10-10v-21.3c0-5.5 4.5-10 10-10h63.1v-29.7h-63.1c-5.5 0-10-4.5-10-10v-21.3c0-5.5 4.5-10 10-10h45.2l-88-161.1c-2.6-4.8-.9-10.9 4-13.6 1.5-.8 3.1-1.2 4.8-1.2h46c3.8 0 7.2 2.1 8.9 5.5l72.9 144.3 73.2-144.3a10 10 0 0 1 8.9-5.5h45c5.5 0 10 4.5 10 10 .1 1.7-.3 3.3-1.1 4.8z");
|
||||
geometryDrawing.Draw(context);
|
||||
}
|
||||
else
|
||||
{
|
||||
var twoToneColor = Data.TwoToneColorInfo;
|
||||
foreach (var geometryData in geometriesData)
|
||||
{
|
||||
var brush = new SolidColorBrush();
|
||||
if (twoToneColor is not null)
|
||||
{
|
||||
if (geometryData.IsPrimary)
|
||||
{
|
||||
brush.Color = twoToneColor.Value.PrimaryColor;
|
||||
}
|
||||
else
|
||||
{
|
||||
brush.Color = twoToneColor.Value.SecondaryColor;
|
||||
}
|
||||
}
|
||||
|
||||
geometryDrawing.Brush = brush;
|
||||
|
||||
geometryDrawing.Geometry = StreamGeometry.Parse(
|
||||
"M880 184H712v-64c0-4.4-3.6-8-8-8h-56c-4.4 0-8 3.6-8 8v64H384v-64c0-4.4-3.6-8-8-8h-56c-4.4 0-8 3.6-8 8v64H144c-17.7 0-32 14.3-32 32v664c0 17.7 14.3 32 32 32h736c17.7 0 32-14.3 32-32V216c0-17.7-14.3-32-32-32zM648.3 426.8l-87.7 161.1h45.7c5.5 0 10 4.5 10 10v21.3c0 5.5-4.5 10-10 10h-63.4v29.7h63.4c5.5 0 10 4.5 10 10v21.3c0 5.5-4.5 10-10 10h-63.4V752c0 5.5-4.5 10-10 10h-41.3c-5.5 0-10-4.5-10-10v-51.8h-63.1c-5.5 0-10-4.5-10-10v-21.3c0-5.5 4.5-10 10-10h63.1v-29.7h-63.1c-5.5 0-10-4.5-10-10v-21.3c0-5.5 4.5-10 10-10h45.2l-88-161.1c-2.6-4.8-.9-10.9 4-13.6 1.5-.8 3.1-1.2 4.8-1.2h46c3.8 0 7.2 2.1 8.9 5.5l72.9 144.3 73.2-144.3a10 10 0 0 1 8.9-5.5h45c5.5 0 10 4.5 10 10 .1 1.7-.3 3.3-1.1 4.8z");
|
||||
geometryDrawing.Draw(context);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected override void OnPropertyChanged(AvaloniaPropertyChangedEventArgs change)
|
||||
{
|
||||
base.OnPropertyChanged(change);
|
||||
if (change.Property == DataProperty ||
|
||||
(change.Property == IconModeProperty && Data.ThemeType != IconThemeType.TwoTone) ||
|
||||
change.Property == SizeProperty)
|
||||
{
|
||||
Drawing ??= new GeometryDrawing();
|
||||
RaiseInvalidated(EventArgs.Empty);
|
||||
}
|
||||
}
|
||||
}
|
@ -1,162 +0,0 @@
|
||||
namespace AtomUI.Icon;
|
||||
|
||||
public class IconManager : IIconPackageContainer, IPackageAwareIconReader
|
||||
{
|
||||
private string? _defaultPackage;
|
||||
private readonly Dictionary<string, IIconPackageProvider> _iconPackageProviders = new();
|
||||
public static IconManager Current { get; } = new();
|
||||
|
||||
public string? DefaultPackage
|
||||
{
|
||||
get => _defaultPackage;
|
||||
|
||||
set
|
||||
{
|
||||
if (value != null)
|
||||
{
|
||||
if (!_iconPackageProviders.ContainsKey(value))
|
||||
{
|
||||
throw new ArgumentException($"PathIcon package {value} is not registered.");
|
||||
}
|
||||
|
||||
_defaultPackage = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected IconManager()
|
||||
{
|
||||
}
|
||||
|
||||
public IIconPackageContainer Register(IIconPackageProvider iconPackageProvider)
|
||||
{
|
||||
var packageId = iconPackageProvider.Id;
|
||||
if (!_iconPackageProviders.TryAdd(packageId, iconPackageProvider))
|
||||
{
|
||||
throw new ArgumentException($"\"{packageId}\" is already registered.");
|
||||
}
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
public IIconPackageContainer Register<TIconProvider>() where TIconProvider : IIconPackageProvider, new()
|
||||
{
|
||||
return Register(new TIconProvider());
|
||||
}
|
||||
|
||||
public IconInfo? GetIcon(string iconKind)
|
||||
{
|
||||
if (_defaultPackage != null)
|
||||
{
|
||||
return GetIcon(_defaultPackage, iconKind);
|
||||
}
|
||||
|
||||
// 顺序搜索,是否增加个优先级?
|
||||
var iconPackageProviders = _iconPackageProviders.Values.OrderByDescending(provider => provider.Priority);
|
||||
foreach (var provider in iconPackageProviders)
|
||||
{
|
||||
var iconInfo = provider.GetIcon(iconKind);
|
||||
if (iconInfo != null)
|
||||
{
|
||||
return iconInfo;
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public IconInfo? GetIcon(string iconKind, ColorInfo colorInfo)
|
||||
{
|
||||
if (_defaultPackage != null)
|
||||
{
|
||||
return GetIcon(_defaultPackage, iconKind, colorInfo);
|
||||
}
|
||||
|
||||
// 顺序搜索,是否增加个优先级?
|
||||
var iconPackageProviders = _iconPackageProviders.Values.OrderByDescending(provider => provider.Priority);
|
||||
foreach (var provider in iconPackageProviders)
|
||||
{
|
||||
var iconInfo = provider.GetIcon(iconKind, colorInfo);
|
||||
if (iconInfo != null)
|
||||
{
|
||||
return iconInfo;
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public IconInfo? GetIcon(string iconKind, TwoToneColorInfo twoToneColorInfo)
|
||||
{
|
||||
if (_defaultPackage != null)
|
||||
{
|
||||
return GetIcon(_defaultPackage, iconKind, twoToneColorInfo);
|
||||
}
|
||||
|
||||
var iconPackageProviders = _iconPackageProviders.Values.OrderByDescending(provider => provider.Priority);
|
||||
foreach (var provider in iconPackageProviders)
|
||||
{
|
||||
var iconInfo = provider.GetIcon(iconKind, twoToneColorInfo);
|
||||
if (iconInfo != null)
|
||||
{
|
||||
return iconInfo;
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public IconInfo? GetIcon(string package, string iconKind)
|
||||
{
|
||||
if (!_iconPackageProviders.ContainsKey(package))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
var packageProvider = _iconPackageProviders[package];
|
||||
return packageProvider.GetIcon(iconKind);
|
||||
}
|
||||
|
||||
public IconInfo? GetIcon(string package, string iconKind, ColorInfo colorInfo)
|
||||
{
|
||||
if (!_iconPackageProviders.ContainsKey(package))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
var packageProvider = _iconPackageProviders[package];
|
||||
return packageProvider.GetIcon(iconKind, colorInfo);
|
||||
}
|
||||
|
||||
public IconInfo? GetIcon(string package, string iconKind, TwoToneColorInfo twoToneColorInfo)
|
||||
{
|
||||
if (!_iconPackageProviders.ContainsKey(package))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
var packageProvider = _iconPackageProviders[package];
|
||||
return packageProvider.GetIcon(iconKind, twoToneColorInfo);
|
||||
}
|
||||
|
||||
public TIconPackageProvider? GetIconProvider<TIconPackageProvider>(string? id = null)
|
||||
where TIconPackageProvider : IIconPackageProvider, new()
|
||||
{
|
||||
return (TIconPackageProvider?)GetIconProvider(id);
|
||||
}
|
||||
|
||||
public IIconPackageProvider? GetIconProvider(string? id = null)
|
||||
{
|
||||
if (id is null)
|
||||
{
|
||||
id = DefaultPackage;
|
||||
}
|
||||
|
||||
if (id is null || !_iconPackageProviders.ContainsKey(id))
|
||||
{
|
||||
return default;
|
||||
}
|
||||
|
||||
return _iconPackageProviders[id];
|
||||
}
|
||||
}
|
@ -1,102 +0,0 @@
|
||||
using Avalonia.Media;
|
||||
|
||||
namespace AtomUI.Icon;
|
||||
|
||||
public abstract class IconPackage : IIconPackageProvider
|
||||
{
|
||||
protected IDictionary<int, IconInfo> _iconPool;
|
||||
public ColorInfo DefaultColorInfo { get; set; }
|
||||
public TwoToneColorInfo DefaultTwoToneColorInfo { get; set; }
|
||||
public string Id { get; }
|
||||
public int Priority { get; set; } = 0;
|
||||
|
||||
public IconPackage(string id)
|
||||
{
|
||||
Id = id;
|
||||
_iconPool = new Dictionary<int, IconInfo>();
|
||||
DefaultColorInfo = new ColorInfo(Color.FromRgb(51, 51, 51)); // #333
|
||||
DefaultTwoToneColorInfo = new TwoToneColorInfo
|
||||
{
|
||||
PrimaryColor = Color.FromRgb(51, 51, 51),
|
||||
SecondaryColor = Color.FromRgb(217, 217, 217)
|
||||
};
|
||||
}
|
||||
|
||||
public abstract IconInfo? GetIcon(string iconKind);
|
||||
public abstract IconInfo? GetIcon(string iconKind, ColorInfo colorInfo);
|
||||
public abstract IconInfo? GetIcon(string iconKind, TwoToneColorInfo twoToneColorInfo);
|
||||
|
||||
protected IconInfo? GetIconRaw(int iconKind)
|
||||
{
|
||||
if (!_iconPool.ContainsKey(iconKind))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
var iconInfo = _iconPool[iconKind];
|
||||
if (!iconInfo.IsTwoTone)
|
||||
{
|
||||
iconInfo = iconInfo with
|
||||
{
|
||||
ColorInfo = DefaultColorInfo
|
||||
};
|
||||
}
|
||||
else
|
||||
{
|
||||
iconInfo = iconInfo with
|
||||
{
|
||||
TwoToneColorInfo = DefaultTwoToneColorInfo
|
||||
};
|
||||
}
|
||||
|
||||
return iconInfo;
|
||||
}
|
||||
|
||||
protected IconInfo? GetIconRaw(int iconKind, ColorInfo colorInfo)
|
||||
{
|
||||
var iconInfo = GetIconRaw(iconKind);
|
||||
if (iconInfo is null)
|
||||
{
|
||||
return iconInfo;
|
||||
}
|
||||
|
||||
if (!iconInfo.IsTwoTone)
|
||||
{
|
||||
iconInfo = iconInfo with
|
||||
{
|
||||
ColorInfo = colorInfo
|
||||
};
|
||||
}
|
||||
|
||||
return iconInfo;
|
||||
}
|
||||
|
||||
protected IconInfo? GetIconRaw(int iconKind, TwoToneColorInfo twoToneColorInfo)
|
||||
{
|
||||
var iconInfo = GetIconRaw(iconKind);
|
||||
if (iconInfo is null)
|
||||
{
|
||||
return iconInfo;
|
||||
}
|
||||
|
||||
if (iconInfo.IsTwoTone)
|
||||
{
|
||||
iconInfo = iconInfo with
|
||||
{
|
||||
TwoToneColorInfo = twoToneColorInfo
|
||||
};
|
||||
}
|
||||
|
||||
return iconInfo;
|
||||
}
|
||||
|
||||
public IEnumerable<IconInfo> GetIconInfos(IconThemeType? iconThemeType = null)
|
||||
{
|
||||
if (!iconThemeType.HasValue)
|
||||
{
|
||||
return _iconPool.Values;
|
||||
}
|
||||
|
||||
return _iconPool.Values.Where(iconInfo => iconInfo.ThemeType == iconThemeType.Value);
|
||||
}
|
||||
}
|
@ -1,38 +0,0 @@
|
||||
using Avalonia;
|
||||
|
||||
namespace AtomUI.Icon;
|
||||
|
||||
public static class IconPackageExtensions
|
||||
{
|
||||
public static AppBuilder UseIconPackage<T>(this AppBuilder builder, bool isDefault = false)
|
||||
where T : IconPackage, new()
|
||||
{
|
||||
return builder.UseIconPackage<T>(isDefault, null, null);
|
||||
}
|
||||
|
||||
public static AppBuilder UseIconPackage<T>(this AppBuilder builder, bool isDefault, ColorInfo? colorInfo,
|
||||
TwoToneColorInfo? twoToneColorInfo)
|
||||
where T : IconPackage, new()
|
||||
{
|
||||
builder.AfterSetup(builder =>
|
||||
{
|
||||
var package = new T();
|
||||
if (colorInfo.HasValue)
|
||||
{
|
||||
package.DefaultColorInfo = colorInfo.Value;
|
||||
}
|
||||
|
||||
if (twoToneColorInfo.HasValue)
|
||||
{
|
||||
package.DefaultTwoToneColorInfo = twoToneColorInfo.Value;
|
||||
}
|
||||
|
||||
IconManager.Current.Register(package);
|
||||
if (isDefault)
|
||||
{
|
||||
IconManager.Current.DefaultPackage = package.Id;
|
||||
}
|
||||
});
|
||||
return builder;
|
||||
}
|
||||
}
|
@ -1,3 +0,0 @@
|
||||
using Avalonia.Metadata;
|
||||
|
||||
[assembly: XmlnsDefinition("https://atomui.net", "AtomUI.Icon")]
|
109
src/AtomUI.IconPkg.AntDesign/AntDesignIconPackage.cs
Normal file
109
src/AtomUI.IconPkg.AntDesign/AntDesignIconPackage.cs
Normal file
@ -0,0 +1,109 @@
|
||||
namespace AtomUI.IconPkg.AntDesign;
|
||||
|
||||
public partial class AntDesignIconPackage : IconPackage
|
||||
{
|
||||
public static AntDesignIconPackage Current { get; }
|
||||
|
||||
static AntDesignIconPackage()
|
||||
{
|
||||
Current = new AntDesignIconPackage();
|
||||
}
|
||||
|
||||
public AntDesignIconPackage()
|
||||
: base("AntDesign")
|
||||
{
|
||||
SetupIconPool();
|
||||
}
|
||||
|
||||
private partial void SetupIconPool();
|
||||
|
||||
public IconInfo GetIconInfo(AntDesignIconKind iconKind)
|
||||
{
|
||||
return GetIconInfo((int)iconKind)!;
|
||||
}
|
||||
|
||||
public IconInfo GetIconInfo(AntDesignIconKind iconKind, ColorInfo colorInfo)
|
||||
{
|
||||
return GetIconInfo((int)iconKind, colorInfo)!;
|
||||
}
|
||||
|
||||
public IconInfo GetIconInfo(AntDesignIconKind iconKind, TwoToneColorInfo twoToneColorInfo)
|
||||
{
|
||||
return GetIconInfo((int)iconKind, twoToneColorInfo)!;
|
||||
}
|
||||
|
||||
public override IconInfo? GetIconInfo(string iconKind)
|
||||
{
|
||||
if (Enum.TryParse(iconKind, out AntDesignIconKind kind))
|
||||
{
|
||||
return GetIconInfo(kind);
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public override IconInfo? GetIconInfo(string iconKind, ColorInfo colorInfo)
|
||||
{
|
||||
if (Enum.TryParse(iconKind, out AntDesignIconKind kind))
|
||||
{
|
||||
return GetIconInfo(kind, colorInfo);
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public override IconInfo? GetIconInfo(string iconKind, TwoToneColorInfo twoToneColorInfo)
|
||||
{
|
||||
if (Enum.TryParse(iconKind, out AntDesignIconKind kind))
|
||||
{
|
||||
return GetIconInfo(kind, twoToneColorInfo);
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public Icon BuildIcon(AntDesignIconKind iconKind)
|
||||
{
|
||||
return BuildIcon((int)iconKind)!;
|
||||
}
|
||||
|
||||
public Icon BuildIcon(AntDesignIconKind iconKind, ColorInfo colorInfo)
|
||||
{
|
||||
return BuildIcon((int)iconKind, colorInfo)!;
|
||||
}
|
||||
|
||||
public Icon BuildIcon(AntDesignIconKind iconKind, TwoToneColorInfo twoToneColorInfo)
|
||||
{
|
||||
return BuildIcon((int)iconKind, twoToneColorInfo)!;
|
||||
}
|
||||
|
||||
public override Icon? BuildIcon(string iconKind)
|
||||
{
|
||||
if (Enum.TryParse(iconKind, out AntDesignIconKind kind))
|
||||
{
|
||||
return BuildIcon(kind);
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public override Icon? BuildIcon(string iconKind, ColorInfo colorInfo)
|
||||
{
|
||||
if (Enum.TryParse(iconKind, out AntDesignIconKind kind))
|
||||
{
|
||||
return BuildIcon(kind, colorInfo);
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public override Icon? BuildIcon(string iconKind, TwoToneColorInfo twoToneColorInfo)
|
||||
{
|
||||
if (Enum.TryParse(iconKind, out AntDesignIconKind kind))
|
||||
{
|
||||
return BuildIcon(kind, twoToneColorInfo);
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
Before Width: | Height: | Size: 825 B After Width: | Height: | Size: 825 B |
Before Width: | Height: | Size: 700 B After Width: | Height: | Size: 700 B |
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user