You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
291 lines
12 KiB
291 lines
12 KiB
'\" t
|
|
.TH QNPInstance 3qt "2 February 2007" "Trolltech AS" \" -*- nroff -*-
|
|
.\" Copyright 1992-2007 Trolltech ASA. All rights reserved. See the
|
|
.\" license file included in the distribution for a complete license
|
|
.\" statement.
|
|
.\"
|
|
.ad l
|
|
.nh
|
|
.SH NAME
|
|
QNPInstance \- QObject that is a web browser plugin
|
|
.SH SYNOPSIS
|
|
This class is part of the \fBQt Netscape Extension\fR.
|
|
.PP
|
|
\fC#include <ntqnp.h>\fR
|
|
.PP
|
|
Inherits QObject.
|
|
.PP
|
|
.SS "Public Members"
|
|
.in +1c
|
|
.ti -1c
|
|
.BI "\fB~QNPInstance\fR ()"
|
|
.br
|
|
.ti -1c
|
|
.BI "int \fBargc\fR () const"
|
|
.br
|
|
.ti -1c
|
|
.BI "const char * \fBargn\fR ( int i ) const"
|
|
.br
|
|
.ti -1c
|
|
.BI "const char * \fBargv\fR ( int i ) const"
|
|
.br
|
|
.ti -1c
|
|
.BI "enum \fBReason\fR { ReasonDone = 0, ReasonBreak = 1, ReasonError = 2, ReasonUnknown = -1 }"
|
|
.br
|
|
.ti -1c
|
|
.BI "const char * \fBarg\fR ( const char * name ) const"
|
|
.br
|
|
.ti -1c
|
|
.BI "enum \fBInstanceMode\fR { Embed = 1, Full = 2, Background = 3 }"
|
|
.br
|
|
.ti -1c
|
|
.BI "InstanceMode \fBmode\fR () const"
|
|
.br
|
|
.ti -1c
|
|
.BI "const char * \fBuserAgent\fR () const"
|
|
.br
|
|
.ti -1c
|
|
.BI "virtual QNPWidget * \fBnewWindow\fR ()"
|
|
.br
|
|
.ti -1c
|
|
.BI "QNPWidget * \fBwidget\fR ()"
|
|
.br
|
|
.ti -1c
|
|
.BI "enum \fBStreamMode\fR { Normal = 1, Seek = 2, AsFile = 3, AsFileOnly = 4 }"
|
|
.br
|
|
.ti -1c
|
|
.BI "virtual bool \fBnewStreamCreated\fR ( QNPStream *, StreamMode & smode )"
|
|
.br
|
|
.ti -1c
|
|
.BI "virtual int \fBwriteReady\fR ( QNPStream * )"
|
|
.br
|
|
.ti -1c
|
|
.BI "virtual int \fBwrite\fR ( QNPStream *, int offset, int len, void * buffer )"
|
|
.br
|
|
.ti -1c
|
|
.BI "virtual void \fBstreamDestroyed\fR ( QNPStream * )"
|
|
.br
|
|
.ti -1c
|
|
.BI "void \fBstatus\fR ( const char * msg )"
|
|
.br
|
|
.ti -1c
|
|
.BI "void \fBgetURLNotify\fR ( const char * url, const char * window = 0, void * data = 0 )"
|
|
.br
|
|
.ti -1c
|
|
.BI "void \fBgetURL\fR ( const char * url, const char * window = 0 )"
|
|
.br
|
|
.ti -1c
|
|
.BI "void \fBpostURL\fR ( const char * url, const char * window, uint len, const char * buf, bool file )"
|
|
.br
|
|
.ti -1c
|
|
.BI "QNPStream * \fBnewStream\fR ( const char * mimetype, const char * window, bool as_file = FALSE )"
|
|
.br
|
|
.ti -1c
|
|
.BI "virtual void \fBstreamAsFile\fR ( QNPStream *, const char * fname )"
|
|
.br
|
|
.ti -1c
|
|
.BI "void * \fBgetJavaPeer\fR () const"
|
|
.br
|
|
.ti -1c
|
|
.BI "virtual void \fBnotifyURL\fR ( const char * url, Reason r, void * notifyData )"
|
|
.br
|
|
.ti -1c
|
|
.BI "virtual bool \fBprintFullPage\fR ()"
|
|
.br
|
|
.ti -1c
|
|
.BI "virtual void \fBprint\fR ( QPainter * )"
|
|
.br
|
|
.in -1c
|
|
.SS "Protected Members"
|
|
.in +1c
|
|
.ti -1c
|
|
.BI "\fBQNPInstance\fR ()"
|
|
.br
|
|
.in -1c
|
|
.SH DESCRIPTION
|
|
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.
|
|
.PP
|
|
The QNPInstance class provides a QObject that is a web browser plugin.
|
|
.PP
|
|
Deriving from QNPInstance creates an object that represents a single \fC<EMBED>\fR tag in an HTML document.
|
|
.PP
|
|
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.
|
|
.PP
|
|
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).
|
|
.PP
|
|
\fINone of Qt's GUI functionality\fR may be used until after the first call to newWindow(). This includes any use of QPaintDevice (i.e. QPixmap, QWidget, and all subclasses), QApplication, anything related to QPainter (QBrush, etc.), fonts, QMovie, QToolTip, etc. Useful classes which specifically \fIcan\fR be used are QImage, QFile, and QBuffer.
|
|
.PP
|
|
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
|
|
.SH "QNPInstance::Reason"
|
|
.TP
|
|
\fCQNPInstance::ReasonDone\fR
|
|
.TP
|
|
\fCQNPInstance::ReasonBreak\fR
|
|
.TP
|
|
\fCQNPInstance::ReasonError\fR
|
|
.TP
|
|
\fCQNPInstance::ReasonUnknown\fR
|
|
.SH "QNPInstance::StreamMode"
|
|
.TP
|
|
\fCQNPInstance::Normal\fR
|
|
.TP
|
|
\fCQNPInstance::Seek\fR
|
|
.TP
|
|
\fCQNPInstance::AsFile\fR
|
|
.TP
|
|
\fCQNPInstance::AsFileOnly\fR
|
|
.SH MEMBER FUNCTION DOCUMENTATION
|
|
.SH "QNPInstance::QNPInstance ()\fC [protected]\fR"
|
|
Creates a QNPInstance.
|
|
.PP
|
|
Can only be called from within a derived class created within QNPlugin::newInstance().
|
|
.SH "QNPInstance::~QNPInstance ()"
|
|
Called when the plugin instance is about to be deleted.
|
|
.SH "const char * QNPInstance::arg ( const char * name ) const"
|
|
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.
|
|
.PP
|
|
The return value is actually a \fCjref\fR we use \fCvoid*\fR so as to avoid burdening plugins which do not require Java.
|
|
.PP
|
|
See also QNPlugin::getJavaClass() and QNPlugin::getJavaEnv().
|
|
.SH "void QNPInstance::getURL ( const char * url, const char * window = 0 )"
|
|
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.
|
|
.SH "void QNPInstance::getURLNotify ( const char * url, const char * window = 0, void * data = 0 )"
|
|
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.
|
|
.PP
|
|
Netscape: NPN_GetURLNotify method
|
|
.SH "InstanceMode QNPInstance::mode () const"
|
|
Returns the mode of the plugin.
|
|
.SH "QNPStream * QNPInstance::newStream ( const char * mimetype, const char * window, bool as_file = FALSE )"
|
|
\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.
|
|
.SH "bool QNPInstance::newStreamCreated ( QNPStream *, StreamMode & smode )\fC [virtual]\fR"
|
|
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().
|
|
.PP
|
|
Note that the AsFileOnly method is not supported by Netscape 2.0 and MSIE 3.0.
|
|
.PP
|
|
The default implementation accepts any stream.
|
|
.SH "QNPWidget * QNPInstance::newWindow ()\fC [virtual]\fR"
|
|
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.
|
|
.PP
|
|
Example: grapher/grapher.cpp.
|
|
.SH "void QNPInstance::notifyURL ( const char * url, Reason r, void * notifyData )\fC [virtual]\fR"
|
|
\fBThis function is under development and is subject to change.\fR
|
|
.PP
|
|
This function is \fInot tested\fR.
|
|
.PP
|
|
Called whenever a \fIurl\fR is notified after a call to NPN_GetURLNotify with \fInotifyData\fR. The reason is given in \fIr\fR.
|
|
.PP
|
|
It is an encapsulation of the NPP_URLNotify function of the Netscape Plugin API.
|
|
.PP
|
|
See also: Netscape: NPP_URLNotify method
|
|
.SH "void QNPInstance::postURL ( const char * url, const char * window, uint len, const char * buf, bool file )"
|
|
\fBThis function is under development and is subject to change.\fR
|
|
.PP
|
|
This function is \fInot tested\fR.
|
|
.PP
|
|
It is an interface to the NPN_PostURL function of the Netscape Plugin API.
|
|
.PP
|
|
Passes \fIurl\fR, \fIwindow\fR, \fIbuf\fR, \fIlen\fR, and \fIfile\fR to NPN_PostURL.
|
|
.SH "void QNPInstance::print ( QPainter * )\fC [virtual]\fR"
|
|
\fBThis function is under development and is subject to change.\fR
|
|
.PP
|
|
This function is \fInot tested\fR.
|
|
.PP
|
|
Print the instance embedded in a page.
|
|
.PP
|
|
It is an encapsulation of the NPP_Print function of the Netscape Plugin API.
|
|
.SH "bool QNPInstance::printFullPage ()\fC [virtual]\fR"
|
|
\fBThis function is under development and is subject to change.\fR
|
|
.PP
|
|
This function is \fInot tested\fR.
|
|
.PP
|
|
It is an encapsulation of the NPP_Print function of the Netscape Plugin API.
|
|
.SH "void QNPInstance::status ( const char * msg )"
|
|
Sets the status message in the browser containing this instance to \fImsg\fR.
|
|
.SH "void QNPInstance::streamAsFile ( QNPStream *, const char * fname )\fC [virtual]\fR"
|
|
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.
|
|
.PP
|
|
See also newStreamCreated() and newStream().
|
|
.SH "void QNPInstance::streamDestroyed ( QNPStream * )\fC [virtual]\fR"
|
|
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.
|
|
.SH "const char * QNPInstance::userAgent () const"
|
|
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.
|
|
.PP
|
|
Example: grapher/grapher.cpp.
|
|
.SH "int QNPInstance::writeReady ( QNPStream * )\fC [virtual]\fR"
|
|
Returns the minimum amount of data the instance is willing to receive from the given stream.
|
|
.PP
|
|
The default returns a very large value.
|
|
|
|
.SH "SEE ALSO"
|
|
.BR http://doc.trolltech.com/qnpinstance.html
|
|
.BR http://www.trolltech.com/faq/tech.html
|
|
.SH COPYRIGHT
|
|
Copyright 1992-2007 Trolltech ASA, http://www.trolltech.com. See the
|
|
license file included in the distribution for a complete license
|
|
statement.
|
|
.SH AUTHOR
|
|
Generated automatically from the source code.
|
|
.SH BUGS
|
|
If you find a bug in Qt, please report it as described in
|
|
.BR http://doc.trolltech.com/bughowto.html .
|
|
Good bug reports help us to help you. Thank you.
|
|
.P
|
|
The definitive TQt documentation is provided in HTML format; it is
|
|
located at $QTDIR/doc/html and can be read using TQt 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.
|
|
.P
|
|
If you find errors in this manual page, please report them to
|
|
.BR qt-bugs@trolltech.com .
|
|
Please include the name of the manual page (tqnpinstance.3qt) and the Qt
|
|
version (3.3.8).
|