Skip to content

Commit 91e1b10

Browse files
authored
Update BoxIcons v2 and add BoxIcons v3 (#379)
Update BoxIcons v2 and add BoxIcons v3
2 parents 8b02d77 + 4103ec5 commit 91e1b10

29 files changed

+5779
-1637
lines changed

README.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,10 @@ The same icons are also available for [Avalonia](https://avaloniaui.net/ with th
3333

3434
| Icon collection | Version | ∑ | NuGet |
3535
|---|--:|--:|:--|
36-
| Complete IconPacks collection with all Icons in one package | | 65612 | <a href="https://www.nuget.org/packages/MahApps.Metro.IconPacks/" target="_blank" rel="noopener noreferrer"><img src="https://img.shields.io/nuget/dt/MahApps.Metro.IconPacks.svg?style=flat-square&&label=IconPacks"></a> |
36+
| Complete IconPacks collection with all Icons in one package | | 69196 | <a href="https://www.nuget.org/packages/MahApps.Metro.IconPacks/" target="_blank" rel="noopener noreferrer"><img src="https://img.shields.io/nuget/dt/MahApps.Metro.IconPacks.svg?style=flat-square&&label=IconPacks"></a> |
3737
| [Bootstrap Icons](https://icons.getbootstrap.com/) | 1.13.1 | 2078 | <a href="https://www.nuget.org/packages/MahApps.Metro.IconPacks.BootstrapIcons/" target="_blank" rel="noopener noreferrer"><img src="https://img.shields.io/nuget/dt/MahApps.Metro.IconPacks.BootstrapIcons.svg?style=flat-square&&label=BootstrapIcons"></a> |
38-
| [Boxicons](https://boxicons.com/) | 2.1.4 | 1634 | <a href="https://www.nuget.org/packages/MahApps.Metro.IconPacks.BoxIcons/" target="_blank" rel="noopener noreferrer"><img src="https://img.shields.io/nuget/dt/MahApps.Metro.IconPacks.BoxIcons.svg?style=flat-square&&label=BoxIcons"></a> |
38+
| [Boxicons v2](https://v2.boxicons.com/) | 2.1.4 | 1634 | <a href="https://www.nuget.org/packages/MahApps.Metro.IconPacks.BoxIcons2/" target="_blank" rel="noopener noreferrer"><img src="https://img.shields.io/nuget/dt/MahApps.Metro.IconPacks.BoxIcons2.svg?style=flat-square&&label=BoxIcons2"></a> |
39+
| [Boxicons v3](https://boxicons.com/) | 3.0.0 | 3584 | <a href="https://www.nuget.org/packages/MahApps.Metro.IconPacks.BoxIcons/" target="_blank" rel="noopener noreferrer"><img src="https://img.shields.io/nuget/dt/MahApps.Metro.IconPacks.BoxIcons.svg?style=flat-square&&label=BoxIcons"></a> |
3940
| [Circum Icons Free](https://github.com/Klarr-Agency/Circum-Icons) | 2.0.2 | 288 | <a href="https://www.nuget.org/packages/MahApps.Metro.IconPacks.CircumIcons/" target="_blank" rel="noopener noreferrer"><img src="https://img.shields.io/nuget/dt/MahApps.Metro.IconPacks.CircumIcons.svg?style=flat-square&&label=CircumIcons"></a> |
4041
| [Codicons](https://github.com/microsoft/vscode-codicons) | 0.0.39 | 493 | <a href="https://www.nuget.org/packages/MahApps.Metro.IconPacks.Codicons/" target="_blank" rel="noopener noreferrer"><img src="https://img.shields.io/nuget/dt/MahApps.Metro.IconPacks.Codicons.svg?style=flat-square&&label=Codicons"></a> |
4142
| [Coolicons](https://github.com/krystonschwarze/coolicons) | 4.1 | 442 | <a href="https://www.nuget.org/packages/MahApps.Metro.IconPacks.Coolicons/" target="_blank" rel="noopener noreferrer"><img src="https://img.shields.io/nuget/dt/MahApps.Metro.IconPacks.Coolicons.svg?style=flat-square&&label=Coolicons"></a> |

src/MahApps.Metro.IconPacks.BoxIcons/PackIconBoxIcons.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,10 @@
1010
namespace MahApps.Metro.IconPacks
1111
{
1212
/// <summary>
13-
/// BoxIcons licensed under [SIL OFL 1.1](<see><cref>http://scripts.sil.org/OFL</cref></see>)
14-
/// Contributions, corrections and requests can be made on GitHub <see><cref>https://github.com/atisawd/boxicons</cref></see>.
13+
/// BoxIcons v3 licensed under [CC 4.0 License](<see><cref>https://docs.boxicons.com/license/free</cref></see>)
14+
/// Project web site <see><cref>https://boxicons.com/</cref></see>.
1515
/// </summary>
16-
[MetaData("Boxicons", "https://boxicons.com/", "https://boxicons.com/usage/#license")]
16+
[MetaData("Boxicons v3", "https://boxicons.com/", "https://docs.boxicons.com/license/free")]
1717
public class PackIconBoxIcons : PackIconControlBase
1818
{
1919
public static readonly DependencyProperty KindProperty

src/MahApps.Metro.IconPacks.BoxIcons/PackIconBoxIconsKind.cs

Lines changed: 3576 additions & 1626 deletions
Large diffs are not rendered by default.

src/MahApps.Metro.IconPacks.BoxIcons/PathIconBoxIcons.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,10 @@
88
namespace MahApps.Metro.IconPacks
99
{
1010
/// <summary>
11-
/// BoxIcons licensed under [SIL OFL 1.1](<see><cref>http://scripts.sil.org/OFL</cref></see>)
12-
/// Contributions, corrections and requests can be made on GitHub <see><cref>https://github.com/atisawd/boxicons</cref></see>.
11+
/// BoxIcons v3 licensed under [CC 4.0 License](<see><cref>https://docs.boxicons.com/license/free</cref></see>)
12+
/// Project web site <see><cref>https://boxicons.com/</cref></see>.
1313
/// </summary>
14-
[MetaData("Boxicons", "https://boxicons.com/", "https://boxicons.com/usage/#license")]
14+
[MetaData("Boxicons v3", "https://boxicons.com/", "https://docs.boxicons.com/license/free")]
1515
public class PathIconBoxIcons : PathIconControlBase
1616
{
1717
public static readonly DependencyProperty KindProperty

src/MahApps.Metro.IconPacks.BoxIcons/Resources/Icons.json

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<Project Sdk="Microsoft.NET.Sdk">
3+
4+
<PropertyGroup>
5+
<DefineConstants>$(DefineConstants);BOXICONS2</DefineConstants>
6+
<IconsName>BoxIcons2</IconsName>
7+
<AssemblyName>MahApps.Metro.IconPacks.BoxIcons2</AssemblyName>
8+
<Title>MahApps.Metro.IconPacks.BoxIcons2</Title>
9+
<RootNamespace>MahApps.Metro.IconPacks</RootNamespace>
10+
</PropertyGroup>
11+
12+
<ItemGroup>
13+
<ProjectReference Include="..\MahApps.Metro.IconPacks.Core\MahApps.Metro.IconPacks.Core.csproj" />
14+
</ItemGroup>
15+
16+
<ItemGroup>
17+
<Compile Remove="Resources\*.*" />
18+
<EmbeddedResource Include="Resources\*.*" />
19+
</ItemGroup>
20+
21+
<!-- WPF Items include -->
22+
<ItemGroup Condition="'$(IsWpf)' == 'true'">
23+
<None Remove="**\*.rd.xml" />
24+
<Compile Remove="Path*.*" />
25+
<Page Generator="MSBuild:Compile" Include="Themes\WPF\*.xaml" Link="Themes\%(RecursiveDir)%(Filename)%(Extension)" SubType="Designer" Exclude="**\bin\**\*.xaml;**\obj\**\*.xaml" />
26+
</ItemGroup>
27+
28+
<!-- UWP Items include -->
29+
<ItemGroup Condition="'$(IsUwp)' == 'true'">
30+
<Compile Remove="*Image*.cs;*Cursor*.cs" />
31+
<Compile Remove="Themes\**\*.*" />
32+
<EmbeddedResource Include="Properties\$(AssemblyName).rd.xml" />
33+
<Page Generator="MSBuild:Compile" Include="Themes\UAP\*.xaml" Link="Themes\%(RecursiveDir)%(Filename)%(Extension)" SubType="Designer" Exclude="**\bin\**\*.xaml;**\obj\**\*.xaml" />
34+
<Compile DependentUpon="%(Filename)" Update="**\*.xaml.cs" />
35+
</ItemGroup>
36+
37+
</Project>
Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
using System;
2+
using System.Collections.Generic;
3+
#if (NETFX_CORE || WINDOWS_UWP)
4+
using Windows.UI.Xaml;
5+
using Windows.UI.Xaml.Data;
6+
#else
7+
using System.Windows;
8+
#endif
9+
10+
namespace MahApps.Metro.IconPacks
11+
{
12+
/// <summary>
13+
/// BoxIcons licensed under [MIT](<see><cref>https://v2.boxicons.com/usage#license</cref></see>)
14+
/// Contributions, corrections and requests can be made on GitHub <see><cref>https://github.com/atisawd/boxicons</cref></see>.
15+
/// </summary>
16+
[MetaData("Boxicons v2", "https://v2.boxicons.com/", "https://v2.boxicons.com/usage#license")]
17+
public class PackIconBoxIcons2 : PackIconControlBase
18+
{
19+
public static readonly DependencyProperty KindProperty
20+
= DependencyProperty.Register(nameof(Kind), typeof(PackIconBoxIcons2Kind), typeof(PackIconBoxIcons2), new PropertyMetadata(default(PackIconBoxIcons2Kind), KindPropertyChangedCallback));
21+
22+
private static void KindPropertyChangedCallback(DependencyObject dependencyObject, DependencyPropertyChangedEventArgs e)
23+
{
24+
if (e.NewValue != e.OldValue)
25+
{
26+
((PackIconBoxIcons2)dependencyObject).UpdateData();
27+
}
28+
}
29+
30+
/// <summary>
31+
/// Gets or sets the icon to display.
32+
/// </summary>
33+
public PackIconBoxIcons2Kind Kind
34+
{
35+
get { return (PackIconBoxIcons2Kind)GetValue(KindProperty); }
36+
set { SetValue(KindProperty, value); }
37+
}
38+
39+
#if !(NETFX_CORE || WINDOWS_UWP)
40+
static PackIconBoxIcons2()
41+
{
42+
DefaultStyleKeyProperty.OverrideMetadata(typeof(PackIconBoxIcons2), new FrameworkPropertyMetadata(typeof(PackIconBoxIcons2)));
43+
}
44+
#endif
45+
46+
public PackIconBoxIcons2()
47+
{
48+
#if NETFX_CORE || WINDOWS_UWP
49+
this.DefaultStyleKey = typeof(PackIconBoxIcons2);
50+
#endif
51+
}
52+
53+
protected override void SetKind<TKind>(TKind iconKind)
54+
{
55+
#if NETFX_CORE || WINDOWS_UWP
56+
BindingOperations.SetBinding(this, PackIconBoxIcons2.KindProperty, new Binding() { Source = iconKind, Mode = BindingMode.OneTime });
57+
#else
58+
this.SetCurrentValue(KindProperty, iconKind);
59+
#endif
60+
}
61+
62+
protected override void UpdateData()
63+
{
64+
if (Kind != default(PackIconBoxIcons2Kind))
65+
{
66+
string data = null;
67+
PackIconDataFactory<PackIconBoxIcons2Kind>.DataIndex.Value?.TryGetValue(Kind, out data);
68+
this.Data = data;
69+
}
70+
else
71+
{
72+
this.Data = null;
73+
}
74+
}
75+
}
76+
}
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
using System;
2+
using System.Windows;
3+
using System.Windows.Input;
4+
using System.Windows.Markup;
5+
using System.Windows.Media;
6+
7+
namespace MahApps.Metro.IconPacks
8+
{
9+
[MarkupExtensionReturnType(typeof(Cursor))]
10+
public class BoxIcons2CursorExtension : BoxIcons2ImageExtension, IPackIconCursorExtension
11+
{
12+
public BoxIcons2CursorExtension() : base() => base.Brush = PackIconCursorHelper.DefaultBrush;
13+
public BoxIcons2CursorExtension(PackIconBoxIcons2Kind kind) : base(kind) => base.Brush = PackIconCursorHelper.DefaultBrush;
14+
15+
/// <inheritdoc/>
16+
public Point HotSpot { get; set; }
17+
/// <inheritdoc/>
18+
public double Width { get; set; } = PackIconCursorHelper.DefaultWidth;
19+
/// <inheritdoc/>
20+
public double Height { get; set; } = PackIconCursorHelper.DefaultHeight;
21+
/// <inheritdoc/>
22+
public Brush StrokeBrush { get; set; }
23+
/// <inheritdoc/>
24+
public double StrokeThickness { get; set; } = PackIconCursorHelper.DefaultStrokeThickness;
25+
26+
public override object ProvideValue(IServiceProvider serviceProvider)
27+
{
28+
TransformGroup transformGroup = (TransformGroup)GetTransformGroup(this.Kind);
29+
Geometry geometry = PackIconCursorHelper.GetCursorGeometry(GetPathData(this.Kind), transformGroup, Width, Height);
30+
return PackIconCursorHelper.GeometryToCursor(geometry, Brush, StrokeBrush, StrokeThickness, HotSpot);
31+
}
32+
}
33+
}
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
#if (NETFX_CORE || WINDOWS_UWP)
2+
using Windows.UI.Xaml.Markup;
3+
#else
4+
using System;
5+
using System.Windows.Markup;
6+
#endif
7+
8+
namespace MahApps.Metro.IconPacks
9+
{
10+
#if (NETFX_CORE || WINDOWS_UWP)
11+
[MarkupExtensionReturnType(ReturnType = typeof(PackIconBoxIcons2))]
12+
#else
13+
[MarkupExtensionReturnType(typeof(PackIconBoxIcons2))]
14+
#endif
15+
public class BoxIcons2Extension : BasePackIconExtension
16+
{
17+
public BoxIcons2Extension()
18+
{
19+
}
20+
21+
#if !(NETFX_CORE || WINDOWS_UWP)
22+
public BoxIcons2Extension(PackIconBoxIcons2Kind kind)
23+
{
24+
this.Kind = kind;
25+
}
26+
27+
[ConstructorArgument("kind")]
28+
#endif
29+
public PackIconBoxIcons2Kind Kind { get; set; }
30+
31+
#if (NETFX_CORE || WINDOWS_UWP)
32+
protected override object ProvideValue()
33+
#else
34+
public override object ProvideValue(IServiceProvider serviceProvider)
35+
#endif
36+
{
37+
return this.GetPackIcon<PackIconBoxIcons2, PackIconBoxIcons2Kind>(this.Kind);
38+
}
39+
}
40+
}
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
using System;
2+
using System.Windows.Markup;
3+
using System.Windows.Media;
4+
5+
namespace MahApps.Metro.IconPacks
6+
{
7+
[MarkupExtensionReturnType(typeof(ImageSource))]
8+
public class BoxIcons2ImageExtension : BasePackIconImageExtension
9+
{
10+
public BoxIcons2ImageExtension()
11+
{
12+
}
13+
14+
public BoxIcons2ImageExtension(PackIconBoxIcons2Kind kind)
15+
{
16+
this.Kind = kind;
17+
}
18+
19+
[ConstructorArgument("kind")]
20+
public PackIconBoxIcons2Kind Kind { get; set; }
21+
22+
public override object ProvideValue(IServiceProvider serviceProvider)
23+
{
24+
return CreateImageSource(this.Kind, this.Brush ?? Brushes.Black);
25+
}
26+
27+
/// <inheritdoc />
28+
protected override string GetPathData(object iconKind)
29+
{
30+
string data = null;
31+
if (iconKind is PackIconBoxIcons2Kind kind)
32+
{
33+
PackIconDataFactory<PackIconBoxIcons2Kind>.DataIndex.Value?.TryGetValue(kind, out data);
34+
}
35+
return data;
36+
}
37+
38+
/// <inheritdoc />
39+
protected override ScaleTransform GetScaleTransform(object iconKind)
40+
{
41+
return new ScaleTransform(1, -1);
42+
}
43+
}
44+
}

0 commit comments

Comments
 (0)