Skip to content

Commit

Permalink
Merge pull request #326 from MahApps/icons/MemoryIconsv1.5.0
Browse files Browse the repository at this point in the history
Add Memory Icons v1.5.0
  • Loading branch information
punker76 authored Apr 29, 2024
2 parents f18e597 + a0b1e49 commit 93a8e7e
Show file tree
Hide file tree
Showing 24 changed files with 1,846 additions and 1 deletion.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ This `IconPacks` library contains controls, markup extensions and converters to
| [Material Design Icons](https://pictogrammers.com/library/mdi/) | 7.4.47 | 7447 | <a href="https://www.nuget.org/packages/MahApps.Metro.IconPacks.Material/" target="_blank" rel="noopener noreferrer"><img src="https://img.shields.io/nuget/dt/MahApps.Metro.IconPacks.Material.svg?style=flat-square&&label=Material"></a> |
| [Material Design Icons Light](https://github.com/Templarian/MaterialDesignLight) | 0.2.63 | 257 | <a href="https://www.nuget.org/packages/MahApps.Metro.IconPacks.MaterialLight/" target="_blank" rel="noopener noreferrer"><img src="https://img.shields.io/nuget/dt/MahApps.Metro.IconPacks.MaterialLight.svg?style=flat-square&&label=MaterialLight"></a> |
| [Material design icons (Google)](https://github.com/google/material-design-icons) | 3.0.1 | 932 | <a href="https://www.nuget.org/packages/MahApps.Metro.IconPacks.MaterialDesign/" target="_blank" rel="noopener noreferrer"><img src="https://img.shields.io/nuget/dt/MahApps.Metro.IconPacks.MaterialDesign.svg?style=flat-square&&label=MaterialDesign"></a> |
| [Memory Icons](https://pictogrammers.com/library/memory/) | 1.5.0 | 651 | <a href="https://www.nuget.org/packages/MahApps.Metro.IconPacks.MemoryIcons/" target="_blank" rel="noopener noreferrer"><img src="https://img.shields.io/nuget/dt/MahApps.Metro.IconPacks.MemoryIcons.svg?style=flat-square&&label=MemoryIcons"></a> |
| [Microns](https://github.com/stephenhutchings/microns) | 1.0.10 | 108 | <a href="https://www.nuget.org/packages/MahApps.Metro.IconPacks.Microns/" target="_blank" rel="noopener noreferrer"><img src="https://img.shields.io/nuget/dt/MahApps.Metro.IconPacks.Microns.svg?style=flat-square&&label=Microns"></a> |
| [Modern UI Icons](https://github.com/Templarian/WindowsIcons) | | 1260 | <a href="https://www.nuget.org/packages/MahApps.Metro.IconPacks.Modern/" target="_blank" rel="noopener noreferrer"><img src="https://img.shields.io/nuget/dt/MahApps.Metro.IconPacks.Modern.svg?style=flat-square&&label=Modern"></a> |
| [GitHub Octicons](https://octicons.github.com/) | 9.6.0 | 204 | <a href="https://www.nuget.org/packages/MahApps.Metro.IconPacks.Octicons/" target="_blank" rel="noopener noreferrer"><img src="https://img.shields.io/nuget/dt/MahApps.Metro.IconPacks.Octicons.svg?style=flat-square&&label=Octicons"></a> |
Expand Down
3 changes: 2 additions & 1 deletion build.cake
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,8 @@ Setup(ctx =>
throw new NotImplementedException($"{repoName} will only build on Windows because it's not possible to target WPF and Windows Forms from UNIX.");
}

Information(Figlet(repoName));
Information(Figlet("MahApps.Metro"));
Information(Figlet("IconPacks"));

Information("Informational Version: {0}", gitVersion.InformationalVersion);
Information("SemVer Version: {0}", gitVersion.SemVer);
Expand Down
14 changes: 14 additions & 0 deletions src/MahApps.Metro.IconPacks.sln
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,8 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution
global.json = global.json
EndProjectSection
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "MahApps.Metro.IconPacks.MemoryIcons", "MahApps.Metro.IconPacks\MahApps.Metro.IconPacks.MemoryIcons.csproj", "{A4425946-87FA-4F7A-A9BF-A97D73608BBE}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand Down Expand Up @@ -482,6 +484,18 @@ Global
{EAEEF1E8-A3F0-4A5B-BB18-6F737858EC73}.Release|x64.Build.0 = Release|Any CPU
{EAEEF1E8-A3F0-4A5B-BB18-6F737858EC73}.Release|x86.ActiveCfg = Release|Any CPU
{EAEEF1E8-A3F0-4A5B-BB18-6F737858EC73}.Release|x86.Build.0 = Release|Any CPU
{A4425946-87FA-4F7A-A9BF-A97D73608BBE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{A4425946-87FA-4F7A-A9BF-A97D73608BBE}.Debug|Any CPU.Build.0 = Debug|Any CPU
{A4425946-87FA-4F7A-A9BF-A97D73608BBE}.Debug|x64.ActiveCfg = Debug|Any CPU
{A4425946-87FA-4F7A-A9BF-A97D73608BBE}.Debug|x64.Build.0 = Debug|Any CPU
{A4425946-87FA-4F7A-A9BF-A97D73608BBE}.Debug|x86.ActiveCfg = Debug|Any CPU
{A4425946-87FA-4F7A-A9BF-A97D73608BBE}.Debug|x86.Build.0 = Debug|Any CPU
{A4425946-87FA-4F7A-A9BF-A97D73608BBE}.Release|Any CPU.ActiveCfg = Release|Any CPU
{A4425946-87FA-4F7A-A9BF-A97D73608BBE}.Release|Any CPU.Build.0 = Release|Any CPU
{A4425946-87FA-4F7A-A9BF-A97D73608BBE}.Release|x64.ActiveCfg = Release|Any CPU
{A4425946-87FA-4F7A-A9BF-A97D73608BBE}.Release|x64.Build.0 = Release|Any CPU
{A4425946-87FA-4F7A-A9BF-A97D73608BBE}.Release|x86.ActiveCfg = Release|Any CPU
{A4425946-87FA-4F7A-A9BF-A97D73608BBE}.Release|x86.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
using System;
using System.Collections.Generic;
#if (NETFX_CORE || WINDOWS_UWP)
using Windows.UI.Xaml;
using Windows.UI.Xaml.Data;
#else
using System.Windows;
#endif

namespace MahApps.Metro.IconPacks
{
/// <summary>
/// All icons sourced from Memory Icons <see><cref>https://pictogrammers.com/library/memory/</cref></see>
/// In accordance of <see><cref>https://github.com/Pictogrammers/Memory?tab=License-1-ov-file#readme</cref></see>.
/// </summary>
[MetaData("Memory Icons", "https://pictogrammers.com/library/memory/", "https://github.com/Pictogrammers/Memory?tab=License-1-ov-file#readme")]
public class PackIconMemoryIcons : PackIconControlBase
{
public static readonly DependencyProperty KindProperty
= DependencyProperty.Register(nameof(Kind), typeof(PackIconMemoryIconsKind), typeof(PackIconMemoryIcons), new PropertyMetadata(default(PackIconMemoryIconsKind), KindPropertyChangedCallback));

private static void KindPropertyChangedCallback(DependencyObject dependencyObject, DependencyPropertyChangedEventArgs e)
{
if (e.NewValue != e.OldValue)
{
((PackIconMemoryIcons)dependencyObject).UpdateData();
}
}

/// <summary>
/// Gets or sets the icon to display.
/// </summary>
public PackIconMemoryIconsKind Kind
{
get { return (PackIconMemoryIconsKind)GetValue(KindProperty); }
set { SetValue(KindProperty, value); }
}

#if !(NETFX_CORE || WINDOWS_UWP)
static PackIconMemoryIcons()
{
DefaultStyleKeyProperty.OverrideMetadata(typeof(PackIconMemoryIcons), new FrameworkPropertyMetadata(typeof(PackIconMemoryIcons)));
}
#endif

public PackIconMemoryIcons()
{
#if NETFX_CORE || WINDOWS_UWP
this.DefaultStyleKey = typeof(PackIconMemoryIcons);
#endif
}

protected override void SetKind<TKind>(TKind iconKind)
{
#if NETFX_CORE || WINDOWS_UWP
BindingOperations.SetBinding(this, PackIconMemoryIcons.KindProperty, new Binding() { Source = iconKind, Mode = BindingMode.OneTime });
#else
this.SetCurrentValue(KindProperty, iconKind);
#endif
}

protected override void UpdateData()
{
if (Kind != default(PackIconMemoryIconsKind))
{
string data = null;
PackIconMemoryIconsDataFactory.DataIndex.Value?.TryGetValue(Kind, out data);
this.Data = data;
}
else
{
this.Data = null;
}
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
using System;
using System.Windows;
using System.Windows.Input;
using System.Windows.Markup;
using System.Windows.Media;

namespace MahApps.Metro.IconPacks
{
[MarkupExtensionReturnType(typeof(Cursor))]
public class MemoryIconsCursorExtension : MemoryIconsImageExtension, IPackIconCursorExtension
{
public MemoryIconsCursorExtension() : base() => base.Brush = PackIconCursorHelper.DefaultBrush;
public MemoryIconsCursorExtension(PackIconMemoryIconsKind kind) : base(kind) => base.Brush = PackIconCursorHelper.DefaultBrush;

/// <inheritdoc/>
public Point HotSpot { get; set; }
/// <inheritdoc/>
public double Width { get; set; } = PackIconCursorHelper.DefaultWidth;
/// <inheritdoc/>
public double Height { get; set; } = PackIconCursorHelper.DefaultHeight;
/// <inheritdoc/>
public Brush StrokeBrush { get; set; }
/// <inheritdoc/>
public double StrokeThickness { get; set; } = PackIconCursorHelper.DefaultStrokeThickness;

public override object ProvideValue(IServiceProvider serviceProvider)
{
TransformGroup transformGroup = (TransformGroup)GetTransformGroup(this.Kind);
Geometry geometry = PackIconCursorHelper.GetCursorGeometry(GetPathData(this.Kind), transformGroup, Width, Height);
return PackIconCursorHelper.GeometryToCursor(geometry, Brush, StrokeBrush, StrokeThickness, HotSpot);
}
}
}
Loading

0 comments on commit 93a8e7e

Please sign in to comment.