From acf02be8088d63bb43898fbfc4746b9fcab7adb8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Va=CC=81clav=20Slavi=CC=81k?= Date: Thu, 27 Aug 2020 18:56:12 +0200 Subject: [PATCH] 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"). --- src/osx/carbon/utilscocoa.mm | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/osx/carbon/utilscocoa.mm b/src/osx/carbon/utilscocoa.mm index a3062ba261..4d3a182515 100644 --- a/src/osx/carbon/utilscocoa.mm +++ b/src/osx/carbon/utilscocoa.mm @@ -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; }