views:

11

answers:

1

I have to develop a GUI for an extensible application. As different extensions will be added or removed to or from the application, The GUI is expected to change a lot (menubar etc..). I would like to ask the following questions: 1) what the GUI needs to provide for the extension 2) What does the extension needs to provide to the GUI

I am beginner and I don't know much about plugins and extensions, so please help me!!!

A: 

Your GUI needs to provide an API. This can be in one of at least a couple of forms. If your extensions are trusted you could choose to make the various "important" widgets public. For example, you can give your extensions a way to get a handle to the actual menubar, the toolbar, etc. The extension writers must then be good citizens and not do something destructive. This gives the extension writers the most control, but makes it that much easier for a rogue plugin to do something really bad.

Another method is to expose a custom API to the extension. For example, you could provide a function "add_to_menubar", so the extension might do something like "add_to_menubar("File->Save As Custom Format...", pointer_to_extension_function)". This lets you more tightly control what an extension can do, but also limits what an extension can do.

Which ever way you go, you also need to provide a mechanism for loading these extensions, and ideally a runtime way to see all the extensions and allow the user to enable or disable them.

Bryan Oakley
one question: what if instead of extensions there would be plugins? Would it make a difference?
Tony
@Tony: they are different names for the same thing. You are extending the functionality by plugging in external code.
Bryan Oakley