mirror of
https://github.com/microsoft/PowerToys
synced 2025-08-22 18:17:19 +00:00
add it back to the toolkit
This commit is contained in:
commit
ae6b7ac68c
@ -229,42 +229,4 @@ internal sealed partial class SampleListPage : ListPage
|
|||||||
{ "hmm?", null },
|
{ "hmm?", null },
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Represents an icon that is a font glyph.
|
|
||||||
/// This is used for icons that are defined by a specific font face,
|
|
||||||
/// such as Wingdings.
|
|
||||||
///
|
|
||||||
/// Note that Command Palette will default to using the Segoe Fluent Icons,
|
|
||||||
/// Segoe MDL2 Assets font for glyphs in the Segoe UI Symbol range, or Segoe
|
|
||||||
/// UI for any other glyphs. This class is only needed if you want a non-Segoe
|
|
||||||
/// font icon.
|
|
||||||
///
|
|
||||||
/// WHY ISN'T THIS IN THE TOOLKIT: I have NO idea why, but if you put this
|
|
||||||
/// in the toolkit, and not in your extension code, we 100% fail to cast
|
|
||||||
/// the `Dictionary` to an IDictionary. The error was in
|
|
||||||
/// `IExtendedAttributesProvider:Do_Abi_GetProperties_0`
|
|
||||||
/// </summary>
|
|
||||||
internal sealed partial class FontIconData : IconData, IExtendedAttributesProvider
|
|
||||||
{
|
|
||||||
private string FontFamily { get; set; }
|
|
||||||
|
|
||||||
// LOAD-BEARING: Use a Windows.Foundation.Collections.ValueSet as the
|
|
||||||
// backing store for Properties. A regular `Dictionary<string, object>`
|
|
||||||
// will not work across the ABI
|
|
||||||
private readonly Windows.Foundation.Collections.ValueSet _properties;
|
|
||||||
|
|
||||||
public IDictionary<string, object> GetProperties() => _properties;
|
|
||||||
|
|
||||||
public FontIconData(string glyph, string fontFamily)
|
|
||||||
: base(glyph)
|
|
||||||
{
|
|
||||||
FontFamily = fontFamily;
|
|
||||||
|
|
||||||
_properties = new Windows.Foundation.Collections.ValueSet()
|
|
||||||
{
|
|
||||||
{ "FontFamily", FontFamily },
|
|
||||||
};
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,32 @@
|
|||||||
|
// Copyright (c) Microsoft Corporation
|
||||||
|
// The Microsoft Corporation licenses this file to you under the MIT license.
|
||||||
|
// See the LICENSE file in the project root for more information.
|
||||||
|
using Windows.Foundation.Collections;
|
||||||
|
|
||||||
|
namespace Microsoft.CommandPalette.Extensions.Toolkit;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Represents an icon that is a font glyph.
|
||||||
|
/// This is used for icons that are defined by a specific font face,
|
||||||
|
/// such as Wingdings.
|
||||||
|
///
|
||||||
|
/// Note that Command Palette will default to using the Segoe Fluent Icons,
|
||||||
|
/// Segoe MDL2 Assets font for glyphs in the Segoe UI Symbol range, or Segoe
|
||||||
|
/// UI for any other glyphs. This class is only needed if you want a non-Segoe
|
||||||
|
/// font icon.
|
||||||
|
/// </summary>
|
||||||
|
public partial class FontIconData : IconData, IExtendedAttributesProvider
|
||||||
|
{
|
||||||
|
public string FontFamily { get; set; }
|
||||||
|
|
||||||
|
public FontIconData(string glyph, string fontFamily)
|
||||||
|
: base(glyph)
|
||||||
|
{
|
||||||
|
FontFamily = fontFamily;
|
||||||
|
}
|
||||||
|
|
||||||
|
public IDictionary<string, object>? GetProperties() => new ValueSet()
|
||||||
|
{
|
||||||
|
{ "FontFamily", FontFamily },
|
||||||
|
};
|
||||||
|
}
|
@ -2,6 +2,7 @@
|
|||||||
// The Microsoft Corporation licenses this file to you under the MIT license.
|
// The Microsoft Corporation licenses this file to you under the MIT license.
|
||||||
// See the LICENSE file in the project root for more information.
|
// See the LICENSE file in the project root for more information.
|
||||||
|
|
||||||
|
using System.Diagnostics.CodeAnalysis;
|
||||||
using Windows.Storage.Streams;
|
using Windows.Storage.Streams;
|
||||||
|
|
||||||
namespace Microsoft.CommandPalette.Extensions.Toolkit;
|
namespace Microsoft.CommandPalette.Extensions.Toolkit;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user