AppKit: public apis for highlighting custom menu views + tableview rows

Originator:todd.thomas
Number:rdar://24591851 Date Originated:10-Feb-2016 12:37 PM
Status:Fixed Resolved:10.12
Product:OS X SDK Product Version:
Classification: Reproducible:
 
Summary:
It seems like menu highlighting/tableview (source list style) row selections are drawn with NSVisualEffectViews these days.
Unfortunately if you were to try doing something similar yourself it takes private api like setting effectView.material = 4; (not so bad). But then you also need to use the private setEmphasized:YES method to get the proper selection color. Please either expose the needed methods or create some class methods on NSVisualEffectView so we can create those views and they'll behave as expected and use the right colors.

Why would I want to do this? I am responsible for at least two apps that use custom NSMenuItem views. And since those views are responsible for drawing their own highlighting we have to resort to fakery (drawing our own gradients) or private api to set up a visual effect view properly.

As for the tableview case let's say we wanted to create a sidebar that behaves like the Finder does. It uses a lighter selection color whether my appearance in system preferences is Blue or Graphite. I couldn't even find the exact NSVisualEffectView to use for selection. Plus in order to use my own effect view requires swapping in mine when NSOutlineView sets the selection background view.

Steps to Reproduce:
n/a

Expected Results:
n/a

Actual Results:
n/a

Version:
10.11.3 15D21/Xcode 7.2.1

Notes:


Configuration:
10.11 MacBook Pro Retina 2012

Attachments:

Comments

This was fixed in 10.12.

By todd.thomas at Oct. 19, 2016, 9:03 p.m. (reply...)

Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!