Skip navigation.
 
mlRe: Plugin interface design?
FROM : Development
DATE : Fri Aug 04 17:50:09 2006

I might be able to help you here, if you can give me a little more 
information on the subject.

Basically handing off:
   You can pass ANY cocoa object to the plugin so all you have to do is 
add the support code in the main app and receiver code in the plugin. 
For instance...
   If you want a plugin to take over processing of a graphic image, you 
would add the support code to detect that you have a graphic 
processor plugin, you would then have to have the plugin able to tell 
the main app that it could in fact process this type of graphic. Then 
you need to have a uniform receiver method such as : -(BOOL)
executePlugin:(id)object to receive the data from the main app. And 
in this example since you are passing it as (id) you could pass the 
path to the file, or you could pass the actual image data. You would 
also want to initialize the plugin with a pointer to the calling 
class. -(id)initWithController:(id)controller so that you could do 
things like request a pointer to the window you are working in.
   As for extending the interface there are several ways. One of the 
easiest and it's the way I used with JigSaw, just make a nib file for 
the plugin. You can also add support code to build menus based on 
information in the plugin. So you could have the plugin pass a menu 
title and don't forget to add support code that would allow the 
plugin to pass YES or NO to the validateMenuItem method in the 
controller class. But since you would have a uniform activator for 
every plugin the setMenuAction will always be the same method name. 
And the target will be the plugin you are loading. (It's best to 
build the menus as the plugins are being loaded.)
   For the most part what you want to do is design a general framework 
for the plugin to work within. You have to add all the support code 
to the application and then the responders and receivers in the 
plugin. I found it easiest to design a test plugin with all the basic 
functions of a real plugin and then add all the support code that 
would be needed in the main application.
   If you go to http://www.fornextsoft.com/?page=jsbeta you can 
download the JigSaw development kit and open that to see an example 
plugin. That is my general plugin framework. Read the example plugin 
header to get a basic idea of how to build your plugins. Once you get 
a clear understanding of how you want the plugin to work, it will be 
very easy to add the support code to the main application.


FOR neXtSoft

On Aug 4, 2006, at 8:25 AM, Adam Knight wrote:

> So, a general question...
>
> I've read about how to make plugins, and I've written a demo app 
> that finds and calls a method on the plugin.  That much I have. 
> However, what I can't seem to locate out there is a good document 
> about how to design a plugin interface for various problems.  That 
> is, if I want to hand processing off to a plugin, or have it extend 
> the GUI in one place, etc. as to what concepts could be employed in 
> the protocol to make that easiest.
>
> It's theory, and not proper for a discussion here, but if anyone 
> has some links or resources to follow up with, I'd love to see it.
>
> Thanks!
> --
> Adam Knight
> codepoetry - http://www.codepoetry.net/products/
>
>
> _______________________________________________
> Do not post admin requests to the list. They will be ignored.
> Cocoa-dev mailing list      (<email_removed>)
> Help/Unsubscribe/Update your Subscription:
> http://lists.apple.com/mailman/options/cocoa-dev/development%
> 40fornextsoft.com
>
> This email sent to <email_removed>
>
>

Related mailsAuthorDate
mlPlugin interface design? Adam Knight Aug 4, 17:25
mlRe: Plugin interface design? Development Aug 4, 17:50