From 388d322b68dcd28e9084515c4917ec67e783e096 Mon Sep 17 00:00:00 2001 From: Stefan Csomor Date: Tue, 28 Sep 2021 10:17:09 +0200 Subject: [PATCH] carry changes to toolbar over to prefs on osx --- include/wx/preferences.h | 1 + src/osx/cocoa/preferences.mm | 14 ++++++++------ 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/include/wx/preferences.h b/include/wx/preferences.h index 40dac7a0bd..88c8138d50 100644 --- a/include/wx/preferences.h +++ b/include/wx/preferences.h @@ -15,6 +15,7 @@ #if wxUSE_PREFERENCES_EDITOR #include "wx/bitmap.h" +#include "wx/bmpbndl.h" #include "wx/vector.h" class WXDLLIMPEXP_FWD_CORE wxWindow; diff --git a/src/osx/cocoa/preferences.mm b/src/osx/cocoa/preferences.mm index 4d26a958ab..e58274a18c 100644 --- a/src/osx/cocoa/preferences.mm +++ b/src/osx/cocoa/preferences.mm @@ -32,6 +32,7 @@ #include "wx/weakref.h" #include "wx/windowid.h" #include "wx/osx/private.h" +#include "wx/private/bmpbndl.h" #include "wx/osx/private/available.h" #import @@ -39,15 +40,16 @@ wxBitmap wxStockPreferencesPage::GetLargeIcon() const { + wxBitmapBundle bundle; #if __MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_16 if ( WX_IS_MACOS_AVAILABLE(11, 0) ) { switch ( m_kind ) { case Kind_General: - return wxBitmap([NSImage imageWithSystemSymbolName:@"gearshape" accessibilityDescription:nil]); + bundle = wxOSXMakeBundleFromImage([NSImage imageWithSystemSymbolName:@"gearshape" accessibilityDescription:nil]); case Kind_Advanced: - return wxBitmap([NSImage imageWithSystemSymbolName:@"gearshape.2" accessibilityDescription:nil]); + bundle = wxOSXMakeBundleFromImage([NSImage imageWithSystemSymbolName:@"gearshape.2" accessibilityDescription:nil]); } } #endif @@ -55,12 +57,12 @@ wxBitmap wxStockPreferencesPage::GetLargeIcon() const switch ( m_kind ) { case Kind_General: - return wxBitmap([NSImage imageNamed:NSImageNamePreferencesGeneral]); + bundle = wxOSXMakeBundleFromImage([NSImage imageNamed:NSImageNamePreferencesGeneral]); case Kind_Advanced: - return wxBitmap([NSImage imageNamed:NSImageNameAdvanced]); + bundle = wxOSXMakeBundleFromImage([NSImage imageNamed:NSImageNameAdvanced]); } - return wxBitmap(); // silence compiler warning + return bundle.IsOk() ? bundle.GetBitmap(bundle.GetDefaultSize()) : wxNullBitmap; } @@ -98,7 +100,7 @@ public: "can't add more preferences pages after showing the window" ); const wxString title = page->GetName(); - wxBitmap bmp(page->GetLargeIcon()); + wxBitmapBundle bmp(page->GetLargeIcon()); wxASSERT_MSG( bmp.IsOk(), "OS X requires valid bitmap for preference page" ); int toolId = wxIdManager::ReserveId();