From 5dab468444ff9f790775b205dc217e17cb9a435d Mon Sep 17 00:00:00 2001 From: Teodor Petrov Date: Fri, 24 Apr 2020 22:08:26 +0300 Subject: [PATCH 1/2] Implement wxSYS_COLOUR_HOTLIGHT on macOS * There is linkColor avaiable since 10.10. Just use it. * https://developer.apple.com/documentation/appkit/nscolor/2998828-linkcolor * https://developer.apple.com/design/human-interface-guidelines/macos/visual-design/color/ --- src/osx/cocoa/settings.mm | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/osx/cocoa/settings.mm b/src/osx/cocoa/settings.mm index 74e06a5a03..74cc6243a4 100644 --- a/src/osx/cocoa/settings.mm +++ b/src/osx/cocoa/settings.mm @@ -163,8 +163,15 @@ wxColour wxSystemSettingsNative::GetColour(wxSystemColour index) sysColor = [NSColor windowBackgroundColor]; break; case wxSYS_COLOUR_HOTLIGHT: - // OSX doesn't change color on mouse hover - sysColor = [NSColor controlTextColor]; + if ( WX_IS_MACOS_AVAILABLE(10, 10) ) + { + sysColor = [NSColor linkColor]; + } + else + { + // OSX doesn't change color on mouse hover + sysColor = [NSColor controlTextColor]; + } break; case wxSYS_COLOUR_MENUHILIGHT: sysColor = [NSColor selectedMenuItemColor]; From e60d43c21eebfe465f609ae8b5b09f93d5bb2054 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Wed, 6 May 2020 17:48:28 +0200 Subject: [PATCH 2/2] Add compilation guards for macOS 10.10 to avoid warnings "[NSColor linkColor]" gives a compile-time warning even if we don't use it during the run-time, so check MAC_OS_X_VERSION_MAX_ALLOWED before using it. --- src/osx/cocoa/settings.mm | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/osx/cocoa/settings.mm b/src/osx/cocoa/settings.mm index 74cc6243a4..59400e7e08 100644 --- a/src/osx/cocoa/settings.mm +++ b/src/osx/cocoa/settings.mm @@ -163,11 +163,13 @@ wxColour wxSystemSettingsNative::GetColour(wxSystemColour index) sysColor = [NSColor windowBackgroundColor]; break; case wxSYS_COLOUR_HOTLIGHT: +#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_10 if ( WX_IS_MACOS_AVAILABLE(10, 10) ) { sysColor = [NSColor linkColor]; } else +#endif { // OSX doesn't change color on mouse hover sysColor = [NSColor controlTextColor];