QNPlugin(3qt)

NAME
QNPlugin - The plugin central factory

SYNOPSIS
This class is part of the Qt Netscape Extension.

#include <qnp.h>

  Public Members
virtual ~QNPlugin ()
void getVersionInfo ( int & plugin_major, int & plugin_minor, int & browser_major, int & browser_minor )
virtual QNPInstance * newInstance () = 0
virtual const char * getMIMEDescription () const = 0
virtual const char * getPluginNameString () const = 0
virtual const char * getPluginDescriptionString () const = 0
virtual void * getJavaClass ()
virtual void unuseJavaClass ()
void * getJavaEnv () const

  Static Public Members
QNPlugin * create ()
QNPlugin * actual ()

  Protected Members
QNPlugin ()

DESCRIPTION
This class is defined in the Qt Netscape Extension, which can be found in the qt/extensions directory. It is not included in the main Qt API.

The QNPlugin class provides the plugin central factory.

This class is the heart of the plugin. One instance of this object is created when the plugin is first needed, by calling QNPlugin::create(), which must be implemented in your plugin code to return some derived class of QNPlugin. The one QNPlugin object creates all QNPInstance instances for a single running Web-browser process.

Additionally, if Qt is linked to the plugin as a dynamic library, only one instance of QApplication will exist across all plugins that have been made with Qt. So, your plugin should tread lightly on global settings - do not, for example, use QApplication::setFont() - that will change the font in every widget of every Qt-based plugin currently loaded!

MEMBER FUNCTION DOCUMENTATION

QNPlugin::QNPlugin () [protected]
Creates a QNPlugin. This may only be used by the constructor derived class returned by the plugin's implementation of the QNPlugin::create() function.

QNPlugin::~QNPlugin () [virtual]
Destroys the QNPlugin. This is called by the plugin binding code just before the plugin is about to be unloaded from memory. If newWindow() has been called, a QApplication will still exist at this time, but will be deleted shortly after before the plugin is deleted.

QNPlugin * QNPlugin::actual () [static]
Returns the plugin most recently returned by QNPlugin::create().

QNPlugin * QNPlugin::create () [static]
This must be implemented by your plugin code. It should return a derived class of QNPlugin.

void * QNPlugin::getJavaClass () [virtual]
Override to return a reference to the Java class that represents the plugin. The default returns 0, indicating no class.

If you override this class, you must also override QNPlugin::unuseJavaClass().

The return value is actually a jref; we use void* so as to avoid burdening plugins which do not require Java.

See also getJavaEnv() and QNPInstance::getJavaPeer().

void * QNPlugin::getJavaEnv () const
Returns a pointer to the Java execution environment, or 0 if Java is disabled or an error occurred.

The return value is actually a JRIEnv*; we use void* so as to avoid burdening plugins which do not require Java.

See also getJavaClass() and QNPInstance::getJavaPeer().

const char * QNPlugin::getMIMEDescription () const [pure virtual]
Override this to return the MIME description of the data formats supported by your plugin. The format of this string is shown by the following example:

    const char* getMIMEDescription() const
    {
        return "image/x-png:png:PNG Image;"
               "image/png:png:PNG Image;"
               "image/x-portable-bitmap:pbm:PBM Image;"
               "image/x-portable-graymap:pgm:PGM Image;"
               "image/x-portable-pixmap:ppm:PPM Image;"
               "image/bmp:bmp:BMP Image;"
               "image/x-ms-bmp:bmp:BMP Image;"
               "image/x-xpixmap:xpm:XPM Image;"
               "image/xpm:xpm:XPM Image";
    }

const char * QNPlugin::getPluginDescriptionString () const [pure virtual]
Returns the plain-text description of the plugin.

const char * QNPlugin::getPluginNameString () const [pure virtual]
Returns the plain-text name of the plugin.

void QNPlugin::getVersionInfo ( int & plugin_major, int & plugin_minor, int & browser_major, int & browser_minor )
Populates *plugin_major and *plugin_minor with the version of the plugin API and populates *browser_major and *browser_minor with the version of the browser.

QNPInstance * QNPlugin::newInstance () [pure virtual]
Override this to return an appropriate derived class of QNPInstance.

void QNPlugin::unuseJavaClass () [virtual]
This function is called when the plugin is shutting down, with jc set to the value returned earlier by getJavaClass(). The function should unuse the Java class.

SEE ALSO
http://doc.trolltech.com/qnplugin.html http://www.trolltech.com/faq/tech.html

COPYRIGHT
Copyright 1992-2001 Trolltech AS, http://www.trolltech.com. See the license file included in the distribution for a complete license statement.

AUTHOR
Generated automatically from the source code.

BUGS
If you find a bug in Qt, please report it as described in http://doc.trolltech.com/bughowto.html. Good bug reports help us to help you. Thank you.

The definitive Qt documentation is provided in HTML format; it is located at $QTDIR/doc/html and can be read using Qt Assistant or with a web browser. This man page is provided as a convenience for those users who prefer man pages, although this format is not officially supported by Trolltech.

If you find errors in this manual page, please report them to qt-bugs@trolltech.com. Please include the name of the manual page (qnplugin.3qt) and the Qt version (3.2.1).