Mac Firefox 插件示例?

发布于 2024-08-22 06:19:09 字数 342 浏览 7 评论 0原文

我正在尝试为 Mac 重写一个旧的图像查看插件。旧版本使用 QuickDraw(我说它很旧)和资源(真的很旧),所以它在 Firefox 3.6 中不起作用(这就是我重写它的原因)

我了解一些 Objective C,所以我我打算使用新奇的 Mac 例程和笔尖等来重新编写此内容。但是,我不知道如何开始。我有 mozilla 源代码附带的 BasicPlugin 示例,所以我知道如何创建带有入口点的插件等。但是,我不知道如何创建 nib,以及如何将 Obj-C 与入口点连接, ?

有谁知道比 BasicPlugin.bundle 更高级的 mac 示例吗 (最好足够简单,我只要看一下就可以理解......)

谢谢。

I'm trying to re-write an old image-viewing plugin for the mac. The old version uses QuickDraw (I said it was old) and resources (really really old) and so it doesn't work in Firefox 3.6 (which is why I'm re-writing it)

I know some Objective C, and so I figure I'm going co re-write this in that using new-fangled Mac routines and nibs, etc. However, I don't know how to start. I've got the BasicPlugin example that comes with mozilla source, so I know how to create a plugin with entrypoints, etc. However, I don't know how to create the nib, and how to interface Obj-C with the entrypoints, etc.

Does anyone know of a more advanced sample for mac than BasicPlugin.bundle? (Preferably simple enough that I can just look at it and understand it...)

thanks.

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

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

发布评论

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

评论(1

贪了杯 2024-08-29 06:19:09

遗憾的是,我真的不知道有什么好的“中间”示例。然而,集成 Obj-C 并不那么困难。因此,以下是需要做什么的简短概述。

您可以在同一个项目中使用 Obj-C 和 C/C++ 源,只是建议在某种程度上将它们分开。例如,这可以通过让带有入口点的源文件和其他 NPAPI 接口保留纯 C 或 C++ 文件来完成,例如从那里将调用转发到插件中。
不透明指针有助于保持干净的分离,请参见此处

对插件的主要更改包括切换到不同的绘图和事件模型。这些必须在 NPP_New() 中协商,此处是绘图模型的示例。使用 Cocoa 并支持 64 位环境时,您需要使用 Cocoa 事件模型

要绘制 UI 元素,您应该能够使用 NSGraphicsContext 来自 CGContextRef ,然后绘制一个 NSView 在上下文中。另请参阅这篇文章及其中提供的详细信息后续行动。

Sadly i don't really know of any good "intermediate" example. However, integrating Obj-C isn't that difficult. Thus, following is a short overview of what needs to be done.

You can use Obj-C and C/C++-sources in the same project, its just recommendable to keep them seperated to some extent. This can for example be done by letting the source file with the entry-points and other NPAPI-interfacing stay plain C or C++ files and e.g. forward calls into the plugin from there.
Opaque pointers help to keep a clean seperation, see e.g. here.

The main changes to your plugin include switching to different drawing and event models. These have to be negotiated in NPP_New(), here is an example for the drawing model. When using Cocoa and to support 64bit enviroments, you need to use the Cocoa event model.

To draw UI elements you should be able to use a NSGraphicsContext from the CGContextRef and then draw an NSView in the context. See also the details provided in this post and its follow-ups.

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