开发者

Fake NSWindow with a NSView inside a NSMenuItem

Before I start I should say I know this seems like a long shot, however I figured it was worth a try.

One app I am working on right now is a Mac Statusbar App. It has a NSStatusItem in the menubar and when clicked it will display a custom window with a popover appearance (like on iPad or like Fantastical has on the mac.) Anyway I started testing this by inserting a single nsmenu item in the status items menu. The view has set clear color for the background color on its window. However this still doesn't quite work as you can see in the pic below

Fake NSWindow with a NSView inside a NSMenuItem

  1. There is still a small white thin line above and below the item
  2. The clear area isn't clear, its like it has a blur filter 开发者_如何学运维on it

Other than that, it works fantastically great. I just didn't know if anybody else has ever attempted anything like this before and figured out how to overcome these 2 issues which seem to be the only thing preventing this from working.

If there is no way to do this I may have to resort to using a custom view for the NSStatusItem so I can get the coordinates on screen to position my own window below the NSStatusItem.


A fake window seems like a rather weird approach to this. Why not just pop up a regular window? I suggest MAAttachedWindow: http://mattgemmell.com/2007/10/03/maattachedwindow-nswindow-subclass

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜