是否可以在菜单栏(而不是状态栏区域)上绘图?

发布于 2024-09-29 19:05:55 字数 96 浏览 0 评论 0原文

是否可以将自定义 NSView 放置在菜单栏顶部? 我需要有一个永久可见的视图,就像在状态栏中一样,但需要更多的空间。顺便说一句, NSStatusbarItem 的空间有限吗?

Is it possible to place a custom NSView on top of the menubar?
I need to have a view permanently visible, as like in the statusbar, but need more real estate. BTW is the real estate of an NSStatusbarItem limited?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

猫性小仙女 2024-10-06 19:05:55

状态项可以根据需要有多大,但菜单始终优先 - 如果菜单和状态栏重叠,菜单将暂时从状态栏中隐藏所需数量的状态项,以便自动重新显示一旦再次有空间。这是设计使然;你没有办法打败它。

您应该只显示值得显示的内容,或者让用户决定哪些内容值得显示并仅显示用户选择的内容。

如果用户切换到具有足够菜单的应用程序来抑制您的状态项,他们只需自行处理(通过调整启动状态项应用程序的顺序,以便您的应用程序更早启动,从而位于状态栏的更右侧,或者切换到另一个菜单较少的应用程序以使用您的状态项)。

A status item can be as big as it needs to be, but menus always take precedence—if the menus and the status bar overlap, the menus will temporarily hide as many status items as necessary from the status bar, to be automatically re-shown once there's space again. This is by design; there is no way for you to defeat that.

You should either only show things that are worth showing, or enable the user to decide what things are worth showing and only show the ones the user chose.

If the user switches to an application with enough menus to suppress your status item, they'll just have to deal with that on their own (either by adjusting the order in which they launch status-item applications, so that yours launches earlier and thus is farther right in the status bar, or by switching to another app with fewer menus in order to use your status item).

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文