Mac OS X,使窗口越过菜单栏
是否可以创建一个窗口来越过菜单栏,而不进入全屏?
提前致谢!
Is it possible to make a window to go over the menu bar, without going in fullscreen?
Thanks in Advance!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
是的,简单地说:(
参考:绘图到全屏,Mac OS X 的 OpenGL 编程指南。)
sebastianmarkow 是正确的,因为这是可怕的行为对于普通文档窗口,但有几种窗口类型是正常的:光标、工具提示和特殊实用程序(如 Xscope)。
Yes, trivially:
(Reference: Drawing to the Full Screen, OpenGL Programming Guide for Mac OS X.)
sebastianmarkow is correct in that this is terrible behaviour for a normal document window, but there are several window types for which this is normal: cursors, tool tips, and special utilities like Xscope.
我喜欢 Jens Ayton 的答案,但我认为最好使用定义的常量之一,而不是选择这样的任意数字。
就我个人而言,我使用了
NSPopUpMenuWindowLevel
,如下所示:截至我发布此答案时,您可能更喜欢的其他常量包括:
NSNormalWindowLevel
NSFloatingWindowLevel
NSSubmenuWindowLevel
NSNormalWindowLevel
NSMainMenuWindowLevel
NSStatusWindowLevel
NSModalPaneWindowLevel
NSPopUpMenuWindowLevel
NSScreenSaverWindowLevel
这是参考(Apple 多年来倾向于改变他们组织文档的方式并打破这些链接,但是 API不会发生太大变化,这就是为什么我在上面列出了这个列表,我怀疑这个链接在 3 年内是否有效,但这些常量在未来 20 年内可能不会发生太大变化。)
https://developer.apple.com/library/mac/documentation/cocoa/reference/applicationkit/classes/NSWindow_Class/Reference/Reference.html#//apple_ref/doc/constant_group/Window_Levels
I liked Jens Ayton's answer, but rather than pick an arbitrary number like that, I think it would be preferred that you use one of the defined constants.
Personally, I used
NSPopUpMenuWindowLevel
as in:Other constants that you might prefer, as of my posting this answer, include:
NSNormalWindowLevel
NSFloatingWindowLevel
NSSubmenuWindowLevel
NSNormalWindowLevel
NSMainMenuWindowLevel
NSStatusWindowLevel
NSModalPaneWindowLevel
NSPopUpMenuWindowLevel
NSScreenSaverWindowLevel
Here's the reference (Apple has a tendency to change how they organize their docs and break these links over the years, but the APIs don't change much, which is why I included that list above. I doubt this link will work in 3 years or so, but these constants probably won't change much in the next 20 years.)
https://developer.apple.com/library/mac/documentation/cocoa/reference/applicationkit/classes/NSWindow_Class/Reference/Reference.html#//apple_ref/doc/constant_group/Window_Levels
我不相信您可以转到菜单栏的顶部,但是当您的应用程序是最前面的应用程序时,您可以通过调用
Which 来将菜单栏设置为自动隐藏,这应该让您可以使用通常用于菜单栏的空间应用。
I do not believe that you can go on top of the menu bar, but you can set the menu bar to auto-hide when your application is the frontmost application by calling
Which should let you use the space normally used for the menu bar in your application.