This class is defined in the \fBQt Netscape Extension\fR, which can be found in the \fCqt/extensions\fR directory. It is not included in the main TQt API.
The QNPInstance is responsible for creating an appropriate QNPWidget window if required (not all plugins have windows), and for interacting with the input/output facilities intrinsic to plugins.
Note that there is \fIabsolutely no guarantee\fR regarding the order in which functions are called. Sometimes the browser will call newWindow() first, at other times, newStreamCreated() will be called first (assuming the \fC<EMBED>\fR tag has a SRC parameter).
\fINone of Qt's GUI functionality\fR may be used until after the first call to newWindow(). This includes any use of TQPaintDevice (i.e. TQPixmap, TQWidget, and all subclasses), QApplication, anything related to TQPainter (TQBrush, etc.), fonts, TQMovie, TQToolTip, etc. Useful classes which specifically \fIcan\fR be used are TQImage, TQFile, and TQBuffer.
This restriction can easily be accommodated by structuring your plugin so that the task of the QNPInstance is to gather data, while the task of the QNPWidget is to provide a graphical interface to that data.
.SS "Member Type Documentation"
.SH "QNPInstance::InstanceMode"
This enum type provides Qt-style names for three #defines in \fCnpapi.h\fR:
.TP
\fCQNPInstance::Embed\fR - corresponds to NP_EMBED
.TP
\fCQNPInstance::Full\fR - corresponds to NP_FULL
.TP
\fCQNPInstance::Background\fR - corresponds to NP_BACKGROUND
Returns the value of the named arguments, or 0 if no argument called \fIname\fR appears in the \fC<EMBED>\fR tag of this instance. If the argument appears, but has no value assigned, the empty string is returned. In summary:
.PP
<center>.nf
.TS
l
-
l.
Tag Result
arg("FOO") == 0
arg("FOO") == ""
.TE
.fi
</center>
.SH "int QNPInstance::argc () const"
Returns the number of arguments to the instance. Note that you should not normally rely on the ordering of arguments, and note that the SGML specification does not permit multiple arguments with the same name.
.PP
See also arg() and argn().
.SH "const char * QNPInstance::argn ( int i ) const"
Returns the name of the \fIi\fR-th argument.
.PP
See also argc() and argv().
.SH "const char * QNPInstance::argv ( int i ) const"
Returns the value of the \fIi\fR-th argument.
.PP
\\as argc(), arg()
.SH "void * QNPInstance::getJavaPeer () const"
Returns the Java object associated with the plugin instance, an object of the plugin's Java class, or 0 if the plug-in does not have a Java class, Java is disabled, or an error occurred.
Requests that the \fIurl\fR be retrieved and sent to the named \fIwindow\fR. See Netscape's JavaScript documentation for an explanation of window names.
Requests that the given \fIurl\fR be retrieved and sent to the named \fIwindow\fR. See Netscape's JavaScript documentation for an explanation of window names. Passes the arguments including \fIdata\fR to NPN_GetURLNotify.
\fBThis function is under development and is subject to change.\fR
.PP
This function is \fInot tested\fR.
.PP
Requests the creation of a new data stream \fIfrom\fR the plugin. The MIME type and window are passed in \fImimetype\fR and \fIwindow\fR. \fIas_file\fR holds the AsFileOnly flag. It is an interface to the NPN_NewStream function of the Netscape Plugin API.
This function is called when a new stream has been created. The instance should return TRUE if it accepts the processing of the stream. If the instance requires the stream as a file, it should set \fIsmode\fR to AsFileOnly, in which case the data will be delivered some time later to the streamAsFile() function. Otherwise, the data will be delivered in chunks to the write() function, which must consume at least as much data as returned by the most recent call to writeReady().
Called at most once, at some time after the QNPInstance is created. If the plugin requires a window, this function should return a derived class of QNPWidget that provides the required interface.
Called when a stream is delivered as a single file called \fIfname\fR rather than as chunks. This may be simpler for a plugin to deal with, but precludes any incremental behavior.
.PP
Note that the AsFileOnly method is not supported by Netscape 2.0 and MSIE 3.0.
Called when a stream is destroyed. At this point, the stream may be complete() and okay(). If it is not okay(), then an error has occurred. If it is okay(), but not complete(), then the user has cancelled the transmission; do not give an error message in this case.
Returns the user agent (browser name) containing this instance.
.SH "QNPWidget * QNPInstance::widget ()"
Returns the plugin window created by newWindow(), if any.
.SH "int QNPInstance::write ( QNPStream *, int offset, int len, void * buffer )\fC [virtual]\fR"
Called when incoming data is available for processing by the instance. The instance \fImust\fR consume at least the amount that it returned in the most recent call to writeReady(), but it may consume up to the amount given by \fIlen\fR. \fIbuffer\fR is the data available for consumption. The \fIoffset\fR argument is merely an informational value indicating the total amount of data that has been consumed in prior calls.
.PP
This function should return the amount of data actually consumed.