📄 qnpinstance.3qt
字号:
'\" t.TH QNPInstance 3qt "11 October 2001" "Trolltech AS" \" -*- nroff -*-.\" Copyright 1992-2001 Trolltech AS. All rights reserved. See the.\" license file included in the distribution for a complete license.\" statement..\".ad l.nh.SH NAMEQNPInstance \- QObject that is a Web-browser plugin.PP\fC#include <qnp.h>\fR.PPInherits 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 DESCRIPTIONThis class is defined in the \fBQt NSPlugin Extension\fR, which can be found in the \fCqt/extensions\fR directory. It is not included in the main Qt API..PPThe QNPInstance class provides a QObject that is a Web-browser plugin..PPDeriving from QNPInstance creates an object that represents a single \fC<EMBED>\fR tag in an HTML document..PPThe QNPInstance is responsible for creating an appropriate window if required (not all plugins have windows), and for interacting with the input/output facilities intrinsic to plugins..PPNote 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 (ie. 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..PPBy 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, this restriction can easily be accommodated..SS "Member Type Documentation".SH "QNPInstance::InstanceMode"This enum type provides Qt-style names for three #defines in npapi.h:.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. Can only be called from within a derived class created within QNPlugin::newInstance()..SH "QNPInstance::~QNPInstance ()"Called when the plugin instance is about to disappear..SH "const char * QNPInstance::arg ( const char * name ) const"Returns the value of the named arguments, or 0 if no argument with 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:.TP\fC<EMBED ...>\fR -- arg("FOO") == 0.TP\fC<EMBED FOO ...>\fR -- arg("FOO") == "".TP\fC<EMBED FOO=BAR ...>\fR -- arg("FOO") == "BAR".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 also note that the SGML specification does not permit multiple arguments with the same name..PPSee also arg()..SH "const char * QNPInstance::argn ( int i ) const"Returns the name of the \fIi\fR-th argument. See argc()..SH "const char * QNPInstance::argv ( int i ) const"Returns the value of the \fIi\fR-th argument. See argc()..SH "void * QNPInstance::getJavaPeer () const"Returns the Java object associated with the plug-in instance, an object of the plug-in's Java class, or 0 if the plug-in does not have a Java class, Java is disabled, or an error occurred..PPThe return value is actually a \fCjref\fR we use \fCvoid*\fR so as to avoid burdening plugins which do not require Java..PPSee 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 )"Print the instance full-page. By default, this returns FALSE, causing the browser to call the (embedded) print() function instead. 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..PPNetscape: 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.PPThis function is \fInot tested\fR..PPRequests the creation of a new data stream \fIfrom\fR the plug-in. 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 was returned by the most recent call to writeReady()..PPNote that the AsFileOnly method is not supported by Netscape 2.0 and MSIE 3.0..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..PPExample: 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.PPThis function is \fInot tested\fR..PPCalled whenever a \fIurl\fR is notified after call to NPN_GetURLNotify with \fInotifyData\fR. The reason is given in \fIr\fR..PPIt is an encapsulation of the NPP_URLNotify function of the Netscape Plugin API..PPSee 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.PPThis function is \fInot tested\fR..PPIt is an interface to the NPN_PostURL function of the Netscape Plugin API..PPPasses \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.PPThis function is \fInot tested\fR..PPPrint the instance embedded in a page..PPIt 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.PPThis function is \fInot tested\fR. 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..PPNote that the AsFileOnly method is not supported by Netscape 2.0 and MSIE 3.0..PPSee 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..PPThis function should return the amount of data actually consumed..PPExample: 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..PPThe 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 COPYRIGHTCopyright 1992-2001 Trolltech AS, http://www.trolltech.com. See thelicense file included in the distribution for a complete licensestatement..SH AUTHORGenerated automatically from the source code..SH BUGSIf 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..PThe definitive Qt documentation is provided in HTML format; it islocated at $QTDIR/doc/html and can be read using Qt Assistant or witha web browser. This man page is provided as a convenience for thoseusers who prefer man pages, although this format is not officiallysupported by Trolltech. .PIf you find errors in this manual page, please report them to.BR qt-bugs@trolltech.com .Please include the name of the manual page (qnpinstance.3qt) and the Qtversion (3.0.0).
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -