Mac OSX覆盖 [英] Mac OSX Overlay

查看:173
本文介绍了Mac OSX覆盖的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我如何去编写一个HUD类型覆盖在OSX。
我想能够有一个应用程序,在不同的应用程序的窗口中显示某一点的文本。

How would I go about programming a HUD type overlay in OSX. I want to be able to have an application that will display text at a certain point over a different application's window.

因此,如果(其他应用程序)窗口移动,HUD部分将保持在另一个窗口的同一坐标。

And thus if the (other applications) window moves the HUD part will stay at the same coordinate of the other window.

推荐答案

对于窗口本身,使用一个无边框,透明的窗口(大量的例子)与您自己的自定义视图绘制重叠的元素。

For the window itself, use a borderless, transparent window (plenty of examples) with your own custom view into which to draw your overlaid elements.

对于其他应用程序的窗口部分,没有公开的API,让你顺利这样做。您使用通用访问及其窗口位置/导航API,但它需要您的用户打开启用辅助设备的访问(我认为仍然无法通过编程)。我不相信它让你知道当窗户移动,但我可能是错的。如果是这样,它可能是一次性的这里是我现在的地方,所以你的覆盖可能不会跟上。我也不认为它给你窗口级别,以确保你在任何给定的窗口/工作表/调色板之上。

For the "other applications' windows" part, there's no public API that's going to let you do this smoothly. You use Universal Access and its window location/navigation API, but it requires your users to turn on "Enable access for assistive devices" (I think it still can't be done programmatically). I don't believe it "lets you know" when a window moves, but I could be wrong. If it does, it'd likely be a one-shot "here's where I am now", so your overlay would likely not keep up. I also don't think it gives you the "window level" to allow you to make sure you're "above" any given window/sheet/palette.

只有其他选项(与其他应用程序的窗口移动)是一个全系统,侵入性的入侵应用程序增强器(这是非常有争议的)。这很容易导致错误,并破坏用户系统的稳定性(因此引起争议)。

The only other option (to move with other apps' windows) is a system-wide, invasive hack a la Application Enhancer (which is quite controversial). It's easy to get this wrong and destabilize a user's system (hence the controversy).

这篇关于Mac OSX覆盖的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆