-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
362 changed files
with
62,906 additions
and
593 deletions.
There are no files selected for viewing
12 changes: 12 additions & 0 deletions
12
src/IconPacks.Avalonia.BootstrapIcons/BootstrapIcons.axaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
<Styles xmlns="https://github.com/avaloniaui" | ||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"> | ||
<Styles.Resources> | ||
<ResourceDictionary> | ||
<ResourceDictionary.MergedDictionaries> | ||
<MergeResourceInclude Source="avares://IconPacks.Avalonia.BootstrapIcons/PackIconBootstrapIcons.axaml" /> | ||
</ResourceDictionary.MergedDictionaries> | ||
</ResourceDictionary> | ||
</Styles.Resources> | ||
|
||
<StyleInclude Source="avares://IconPacks.Avalonia.Core/PackIcon.axaml" /> | ||
</Styles> |
27 changes: 27 additions & 0 deletions
27
...IconPacks.Avalonia.BootstrapIcons/Converter/PackIconBootstrapIconsKindToImageConverter.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
using Avalonia.Media; | ||
using IconPacks.Avalonia.Core; | ||
using IconPacks.Avalonia.Core.Converter; | ||
|
||
namespace IconPacks.Avalonia.BootstrapIcons.Converter | ||
{ | ||
public class PackIconBootstrapIconsKindToImageConverter : PackIconKindToImageConverterBase | ||
{ | ||
/// <inheritdoc /> | ||
protected override string GetPathData(object iconKind) | ||
{ | ||
string data = null; | ||
if (iconKind is PackIconBootstrapIconsKind kind) | ||
{ | ||
PackIconDataFactory<PackIconBootstrapIconsKind>.DataIndex.Value?.TryGetValue(kind, out data); | ||
} | ||
|
||
return data; | ||
} | ||
|
||
/// <inheritdoc /> | ||
protected override ScaleTransform GetScaleTransform(object iconKind) | ||
{ | ||
return new ScaleTransform(1, -1); | ||
} | ||
} | ||
} |
22 changes: 22 additions & 0 deletions
22
src/IconPacks.Avalonia.BootstrapIcons/IconPacks.Avalonia.BootstrapIcons.csproj
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
|
||
<PropertyGroup> | ||
<DefineConstants>$(DefineConstants);BOOTSTRAPICONS</DefineConstants> | ||
<IconsName>BootstrapIcons</IconsName> | ||
<AssemblyName>IconPacks.Avalonia.BootstrapIcons</AssemblyName> | ||
<Title>IconPacks.Avalonia.BootstrapIcons</Title> | ||
</PropertyGroup> | ||
|
||
<ItemGroup> | ||
<PackageReference Include="Avalonia" /> | ||
</ItemGroup> | ||
|
||
<ItemGroup> | ||
<ProjectReference Include="..\IconPacks.Avalonia.Core\IconPacks.Avalonia.Core.csproj" /> | ||
</ItemGroup> | ||
|
||
<ItemGroup> | ||
<AvaloniaResource Include="Resources/**" /> | ||
</ItemGroup> | ||
|
||
</Project> |
18 changes: 18 additions & 0 deletions
18
src/IconPacks.Avalonia.BootstrapIcons/PackIconBootstrapIcons.axaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
<ResourceDictionary xmlns="https://github.com/avaloniaui" | ||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" | ||
xmlns:iconPacks="https://github.com/MahApps/IconPacks.Avalonia" | ||
x:ClassModifier="internal"> | ||
|
||
<Design.PreviewWith> | ||
<iconPacks:PackIconBootstrapIcons Kind="_0Circle" /> | ||
</Design.PreviewWith> | ||
|
||
<ControlTheme x:Key="IconPacks.Avalonia.PackIconBootstrapIcons.Theme" | ||
BasedOn="{StaticResource IconPacks.Avalonia.PackIconControlBase.Theme}" | ||
TargetType="iconPacks:PackIconBootstrapIcons" /> | ||
|
||
<ControlTheme x:Key="{x:Type iconPacks:PackIconBootstrapIcons}" | ||
BasedOn="{StaticResource IconPacks.Avalonia.PackIconBootstrapIcons.Theme}" | ||
TargetType="iconPacks:PackIconBootstrapIcons" /> | ||
|
||
</ResourceDictionary> |
63 changes: 63 additions & 0 deletions
63
src/IconPacks.Avalonia.BootstrapIcons/PackIconBootstrapIcons.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
using Avalonia; | ||
using Avalonia.Media; | ||
using IconPacks.Avalonia.Core; | ||
using IconPacks.Avalonia.Core.Attributes; | ||
|
||
namespace IconPacks.Avalonia.BootstrapIcons | ||
{ | ||
/// <summary> | ||
/// Bootstrap Icons are licensed under the [MIT license](<see><cref>https://github.com/twbs/icons?tab=MIT-1-ov-file#readme</cref></see>). | ||
/// Contributions, corrections and requests can be made on GitHub <see><cref>https://github.com/twbs/icons</cref></see>. | ||
/// </summary> | ||
[MetaData("Bootstrap Icons", "https://icons.getbootstrap.com/", "https://github.com/twbs/icons?tab=MIT-1-ov-file#readme")] | ||
public class PackIconBootstrapIcons : PackIconControlBase | ||
{ | ||
public PackIconBootstrapIcons() | ||
{ | ||
UpdateIconPseudoClasses(true, false, true); | ||
} | ||
|
||
public static readonly StyledProperty<PackIconBootstrapIconsKind> KindProperty | ||
= AvaloniaProperty.Register<PackIconBootstrapIcons, PackIconBootstrapIconsKind>(nameof(Kind)); | ||
|
||
/// <summary> | ||
/// Gets or sets the icon to display. | ||
/// </summary> | ||
public PackIconBootstrapIconsKind Kind | ||
{ | ||
get { return GetValue(KindProperty); } | ||
set { SetValue(KindProperty, value); } | ||
} | ||
|
||
// We override OnPropertyChanged of the base class. That way we can react on property changes | ||
protected override void OnPropertyChanged(AvaloniaPropertyChangedEventArgs change) | ||
{ | ||
base.OnPropertyChanged(change); | ||
|
||
// if the changed property is the KindProperty, we need to update the stars | ||
if (change.Property == KindProperty) | ||
{ | ||
UpdateData(); | ||
} | ||
} | ||
|
||
protected override void SetKind<TKind>(TKind iconKind) | ||
{ | ||
this.SetCurrentValue(KindProperty, iconKind); | ||
} | ||
|
||
protected override void UpdateData() | ||
{ | ||
if (Kind != default) | ||
{ | ||
string data = null; | ||
PackIconDataFactory<PackIconBootstrapIconsKind>.DataIndex.Value?.TryGetValue(Kind, out data); | ||
this.Data = data != null ? StreamGeometry.Parse(data) : null; | ||
} | ||
else | ||
{ | ||
this.Data = null; | ||
} | ||
} | ||
} | ||
} |
25 changes: 25 additions & 0 deletions
25
src/IconPacks.Avalonia.BootstrapIcons/PackIconBootstrapIconsExtension.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
using System; | ||
using Avalonia.Markup.Xaml; | ||
using IconPacks.Avalonia.Core; | ||
|
||
namespace IconPacks.Avalonia.BootstrapIcons | ||
{ | ||
public class BootstrapIconsExtension : BasePackIconExtension | ||
{ | ||
public BootstrapIconsExtension() | ||
{ | ||
} | ||
|
||
public BootstrapIconsExtension(PackIconBootstrapIconsKind kind) | ||
{ | ||
this.Kind = kind; | ||
} | ||
|
||
[ConstructorArgument("kind")] public PackIconBootstrapIconsKind Kind { get; set; } | ||
|
||
public override object ProvideValue(IServiceProvider serviceProvider) | ||
{ | ||
return this.GetPackIcon<PackIconBootstrapIcons, PackIconBootstrapIconsKind>(this.Kind); | ||
} | ||
} | ||
} |
44 changes: 44 additions & 0 deletions
44
src/IconPacks.Avalonia.BootstrapIcons/PackIconBootstrapIconsImageExtension.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
using System; | ||
using Avalonia.Markup.Xaml; | ||
using Avalonia.Media; | ||
using IconPacks.Avalonia.Core; | ||
|
||
namespace IconPacks.Avalonia.BootstrapIcons | ||
{ | ||
public class BootstrapIconsImageExtension : BasePackIconImageExtension | ||
{ | ||
public BootstrapIconsImageExtension() | ||
{ | ||
} | ||
|
||
public BootstrapIconsImageExtension(PackIconBootstrapIconsKind kind) | ||
{ | ||
this.Kind = kind; | ||
} | ||
|
||
[ConstructorArgument("kind")] public PackIconBootstrapIconsKind Kind { get; set; } | ||
|
||
public override object ProvideValue(IServiceProvider serviceProvider) | ||
{ | ||
return CreateImageSource(this.Kind, this.Brush ?? Brushes.Black); | ||
} | ||
|
||
/// <inheritdoc /> | ||
protected override string GetPathData(object iconKind) | ||
{ | ||
string data = null; | ||
if (iconKind is PackIconBootstrapIconsKind kind) | ||
{ | ||
PackIconDataFactory<PackIconBootstrapIconsKind>.DataIndex.Value?.TryGetValue(kind, out data); | ||
} | ||
|
||
return data; | ||
} | ||
|
||
/// <inheritdoc /> | ||
protected override ScaleTransform GetScaleTransform(object iconKind) | ||
{ | ||
return new ScaleTransform(1, -1); | ||
} | ||
} | ||
} |
Oops, something went wrong.