Support SF Symbols images on macOS 11

Extend wxOSXGetSystemImage() and thus wxArtProvider with support for directly
loading the new symbolic images in addition to existing support for named
bundle resources.

This enables usage such as wxArtProvider::GetBitmap("gearshape").
This commit is contained in:
Václav Slavík
2020-08-27 18:56:12 +02:00
parent ab29743097
commit acf02be808

View File

@@ -183,6 +183,16 @@ wxBitmap wxOSXCreateSystemBitmap(const wxString& name, const wxString &client, c
WXImage wxOSXGetSystemImage(const wxString& name)
{
wxCFStringRef cfname(name);
#if __MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_16
if ( WX_IS_MACOS_AVAILABLE(11, 0) )
{
NSImage *symbol = [NSImage imageWithSystemSymbolName:cfname.AsNSString() accessibilityDescription:nil];
if ( symbol )
return symbol;
}
#endif
NSImage* nsimage = [NSImage imageNamed:cfname.AsNSString()];
return nsimage;
}