-
-
Notifications
You must be signed in to change notification settings - Fork 222
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
23 changed files
with
1,118 additions
and
0 deletions.
There are no files selected for viewing
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
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
76 changes: 76 additions & 0 deletions
76
src/MahApps.Metro.IconPacks/Icons/CircumIcons/PackIconCircumIcons.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,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 GitHub Octicons <see><cref>https://github.com/Klarr-Agency/Circum-Icons</cref></see> | ||
/// In accordance of <see><cref>https://github.com/Klarr-Agency/Circum-Icons?tab=MPL-2.0-1-ov-file</cref></see>. | ||
/// </summary> | ||
[MetaData("Circum Icons Free", "https://github.com/Klarr-Agency/Circum-Icons", "https://github.com/Klarr-Agency/Circum-Icons?tab=MPL-2.0-1-ov-file")] | ||
public class PackIconCircumIcons : PackIconControlBase | ||
{ | ||
public static readonly DependencyProperty KindProperty | ||
= DependencyProperty.Register(nameof(Kind), typeof(PackIconCircumIconsKind), typeof(PackIconCircumIcons), new PropertyMetadata(default(PackIconCircumIconsKind), KindPropertyChangedCallback)); | ||
|
||
private static void KindPropertyChangedCallback(DependencyObject dependencyObject, DependencyPropertyChangedEventArgs e) | ||
{ | ||
if (e.NewValue != e.OldValue) | ||
{ | ||
((PackIconCircumIcons)dependencyObject).UpdateData(); | ||
} | ||
} | ||
|
||
/// <summary> | ||
/// Gets or sets the icon to display. | ||
/// </summary> | ||
public PackIconCircumIconsKind Kind | ||
{ | ||
get { return (PackIconCircumIconsKind)GetValue(KindProperty); } | ||
set { SetValue(KindProperty, value); } | ||
} | ||
|
||
#if !(NETFX_CORE || WINDOWS_UWP) | ||
static PackIconCircumIcons() | ||
{ | ||
DefaultStyleKeyProperty.OverrideMetadata(typeof(PackIconCircumIcons), new FrameworkPropertyMetadata(typeof(PackIconCircumIcons))); | ||
} | ||
#endif | ||
|
||
public PackIconCircumIcons() | ||
{ | ||
#if NETFX_CORE || WINDOWS_UWP | ||
this.DefaultStyleKey = typeof(PackIconCircumIcons); | ||
#endif | ||
} | ||
|
||
protected override void SetKind<TKind>(TKind iconKind) | ||
{ | ||
#if NETFX_CORE || WINDOWS_UWP | ||
BindingOperations.SetBinding(this, PackIconCircumIcons.KindProperty, new Binding() { Source = iconKind, Mode = BindingMode.OneTime }); | ||
#else | ||
this.SetCurrentValue(KindProperty, iconKind); | ||
#endif | ||
} | ||
|
||
protected override void UpdateData() | ||
{ | ||
if (Kind != default(PackIconCircumIconsKind)) | ||
{ | ||
string data = null; | ||
PackIconCircumIconsDataFactory.DataIndex.Value?.TryGetValue(Kind, out data); | ||
this.Data = data; | ||
} | ||
else | ||
{ | ||
this.Data = null; | ||
} | ||
} | ||
} | ||
} |
33 changes: 33 additions & 0 deletions
33
src/MahApps.Metro.IconPacks/Icons/CircumIcons/PackIconCircumIconsCursorExtension.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,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 CircumIconsCursorExtension : CircumIconsImageExtension, IPackIconCursorExtension | ||
{ | ||
public CircumIconsCursorExtension() : base() => base.Brush = PackIconCursorHelper.DefaultBrush; | ||
public CircumIconsCursorExtension(PackIconCircumIconsKind 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); | ||
} | ||
} | ||
} |
Oops, something went wrong.