Home | All Classes | Main Classes | Annotated | Grouped Classes | Functions

TQNPlugin Class Reference

The TQNPlugin class provides the main factory for plugin objects. More...

This class is part of the TQt Netscape Extension.

#include <qnp.h>

List of all member functions.

Public Members

Static Public Members

Protected Members


Detailed Description

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

The TQNPlugin class provides the main factory for plugin objects.

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

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


Member Function Documentation

TQNPlugin::TQNPlugin () [protected]

Creates a TQNPlugin. This may only be used by the constructor of the class, derived from TQNPlugin, that is returned by your plugin's implementation of the TQNPlugin::create() function.

TQNPlugin::~TQNPlugin () [virtual]

Destroys the TQNPlugin. 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 TQApplication will still exist at this time, but will be deleted shortly after, just before the plugin is deleted.

TQNPlugin * TQNPlugin::actual () [static]

Returns the plugin most recently returned by TQNPlugin::create().

TQNPlugin * TQNPlugin::create () [static]

This function must be implemented by your plugin code. It should return a derived class of TQNPlugin.

void * TQNPlugin::getJavaClass () [virtual]

Override this function 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 TQNPlugin::unuseJavaClass().

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

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

void * TQNPlugin::getJavaEnv () const

Returns a pointer to the Java execution environment, or 0 if either 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 retquire Java.

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

const char * TQNPlugin::getMIMEDescription () const [pure virtual]

Override this function 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 * TQNPlugin::getPluginDescriptionString () const [pure virtual]

Returns a pointer to the plain-text description of the plugin.

const char * TQNPlugin::getPluginNameString () const [pure virtual]

Returns a pointer to the plain-text name of the plugin.

void TQNPlugin::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 web browser.

TQNPInstance * TQNPlugin::newInstance () [pure virtual]

Override this function to return an appropriate derived class of TQNPInstance.

void TQNPlugin::unuseJavaClass () [virtual]

This function is called when the plugin is shutting down. The function should unuse the Java class returned earlier by getJavaClass().

This file is part of the TQt toolkit. Copyright © 1995-2007 Trolltech. All Rights Reserved.


Copyright © 2007 TrolltechTrademarks
TQt 3.3.8