NSView based NSStatusItem
| Originator: | keithbsmiley | ||
| Number: | rdar://17581980 | Date Originated: | 07-Jul-2014 03:48 PM |
| Status: | Duplicate of 17297336 (closed) | Resolved: | |
| Product: | OS X | Product Version: | 14A283o |
| Classification: | Enhancement | Reproducible: | Always |
Since many NSStatusItem methods were deprecated in this beta version of Yosemite I started this thread https://devforums.apple.com/message/999697#999697 about how we are suppose to deal with the different themes in regards to the icons we show. I understand that for NSImage based status items we can use setTemplate on the image to allow AppKit to deal with the theme changes. For NSView backed status items there doesn't seem to be a way to manually deal with this. The uses that I see or have used for NSStatusItems that seemed to required the use of a NSView are: 1. Progress indicators, showing a spinner or something similar to show that your application is doing something the user requested. You see this in applications like Plex when the media library is being scanned. 2. Responding to clicks with modifiers, allowing custom actions when the user option clicks, shift clicks or any combination of modifiers on your status item 3. Showing a custom NSWindow from the status item, finding your global screen frame in order to show a custom window from your status bar. You see this in dropbox and many other applications that want to point out the newly added status item on first launch. It would be great to have this functionality directly in the new NSStatusBarButton class, or allow us to determine the current theme so that we can create our views with this information in mind.
Comments
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!
#2 is also possible since it is backed by a button:
Because of these I closed this radar.
#3 is possible since status items are now backed by buttons:
NSStatusBarButton *statusBarButton = [myStatusItem button]; NSRect rectInWindow = [statusBarButton convertRect:[statusBarButton bounds] toView:nil]; NSRect screenRect = [[statusBarButton window] convertRectToScreen:rectInWindow]; NSLog(@"%@", NSStringFromRect(screenRect));