table of contents
- NAME
- SYNOPSIS
- DESCRIPTION
- QNPInstance::InstanceMode
- QNPInstance::Reason
- QNPInstance::StreamMode
- MEMBER FUNCTION DOCUMENTATION
- QNPInstance::QNPInstance () [protected]
- QNPInstance::~QNPInstance ()
- const char * QNPInstance::arg ( const char * name ) const
- int QNPInstance::argc () const
- const char * QNPInstance::argn ( int i ) const
- const char * QNPInstance::argv ( int i ) const
- void * QNPInstance::getJavaPeer () const
- void QNPInstance::getURL ( const char * url, const char * window = 0 )
- void QNPInstance::getURLNotify ( const char * url, const char * window = 0, void * data = 0 )
- InstanceMode QNPInstance::mode () const
- QNPStream * QNPInstance::newStream ( const char * mimetype, const char * window, bool as_file = FALSE )
- bool QNPInstance::newStreamCreated ( QNPStream *, StreamMode & smode ) [virtual]
- QNPWidget * QNPInstance::newWindow () [virtual]
- void QNPInstance::notifyURL ( const char * url, Reason r, void * notifyData ) [virtual]
- void QNPInstance::postURL ( const char * url, const char * window, uint len, const char * buf, bool file )
- void QNPInstance::print ( QPainter * ) [virtual]
- bool QNPInstance::printFullPage () [virtual]
- void QNPInstance::status ( const char * msg )
- void QNPInstance::streamAsFile ( QNPStream *, const char * fname ) [virtual]
- void QNPInstance::streamDestroyed ( QNPStream * ) [virtual]
- const char * QNPInstance::userAgent () const
- QNPWidget * QNPInstance::widget ()
- int QNPInstance::write ( QNPStream *, int offset, int len, void * buffer ) [virtual]
- int QNPInstance::writeReady ( QNPStream * ) [virtual]
- SEE ALSO
- COPYRIGHT
- AUTHOR
- BUGS
QNPInstance(3qt) | QNPInstance(3qt) |
NAME¶
QNPInstance - QObject that is a web browser plugin
SYNOPSIS¶
This class is part of the Qt Netscape Extension.
#include <qnp.h>
Inherits QObject.
Public Members¶
~QNPInstance ()
int argc () const
const char * argn ( int i ) const
const char * argv ( int i ) const
enum Reason { ReasonDone = 0, ReasonBreak = 1, ReasonError = 2,
ReasonUnknown = -1 }
const char * arg ( const char * name ) const
enum InstanceMode { Embed = 1, Full = 2, Background = 3 }
InstanceMode mode () const
const char * userAgent () const
virtual QNPWidget * newWindow ()
QNPWidget * widget ()
enum StreamMode { Normal = 1, Seek = 2, AsFile = 3, AsFileOnly = 4
}
virtual bool newStreamCreated ( QNPStream *, StreamMode & smode
)
virtual int writeReady ( QNPStream * )
virtual int write ( QNPStream *, int offset, int len, void * buffer
)
virtual void streamDestroyed ( QNPStream * )
void status ( const char * msg )
void getURLNotify ( const char * url, const char * window = 0, void
* data = 0 )
void getURL ( const char * url, const char * window = 0 )
void postURL ( const char * url, const char * window, uint len,
const char * buf, bool file )
QNPStream * newStream ( const char * mimetype, const char * window,
bool as_file = FALSE )
virtual void streamAsFile ( QNPStream *, const char * fname )
void * getJavaPeer () const
virtual void notifyURL ( const char * url, Reason r, void *
notifyData )
virtual bool printFullPage ()
virtual void print ( QPainter * )
Protected Members¶
QNPInstance ()
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 QNPInstance class provides a QObject that is a web browser plugin.
Deriving from QNPInstance creates an object that represents a single <EMBED> tag in an HTML document.
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 absolutely no guarantee 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 <EMBED> tag has a SRC parameter).
None of Qt's GUI functionality 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 can be used are QImage, QFile, and QBuffer.
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.
Member Type Documentation¶
QNPInstance::InstanceMode¶
This enum type provides Qt-style names for three #defines in npapi.h:
- QNPInstance::Embed - corresponds to NP_EMBED
- QNPInstance::Full - corresponds to NP_FULL
- QNPInstance::Background - corresponds to NP_BACKGROUND
QNPInstance::Reason¶
- QNPInstance::ReasonDone
- QNPInstance::ReasonBreak
- QNPInstance::ReasonError
- QNPInstance::ReasonUnknown
QNPInstance::StreamMode¶
- QNPInstance::Normal
- QNPInstance::Seek
- QNPInstance::AsFile
- QNPInstance::AsFileOnly
MEMBER FUNCTION DOCUMENTATION¶
QNPInstance::QNPInstance () [protected]¶
Creates a QNPInstance.
Can only be called from within a derived class created within QNPlugin::newInstance().
QNPInstance::~QNPInstance ()¶
Called when the plugin instance is about to be deleted.
const char * QNPInstance::arg ( const char * name ) const¶
Returns the value of the named arguments, or 0 if no argument called name appears in the <EMBED> tag of this instance. If the argument appears, but has no value assigned, the empty string is returned. In summary:
<center>.nf
Tag |
</center>
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.
See also arg() and argn().
const char * QNPInstance::argn ( int i ) const¶
Returns the name of the i-th argument.
See also argc() and argv().
const char * QNPInstance::argv ( int i ) const¶
Returns the value of the i-th argument.
\as argc(), arg()
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.
The return value is actually a jref we use void* so as to avoid burdening plugins which do not require Java.
See also QNPlugin::getJavaClass() and QNPlugin::getJavaEnv().
void QNPInstance::getURL ( const char * url, const char * window = 0 )¶
Requests that the url be retrieved and sent to the named window. See Netscape's JavaScript documentation for an explanation of window names.
void QNPInstance::getURLNotify ( const char * url, const char * window = 0, void * data = 0 )¶
Requests that the given url be retrieved and sent to the named window. See Netscape's JavaScript documentation for an explanation of window names. Passes the arguments including data to NPN_GetURLNotify.
Netscape: NPN_GetURLNotify method
InstanceMode QNPInstance::mode () const¶
Returns the mode of the plugin.
QNPStream * QNPInstance::newStream ( const char * mimetype, const char * window, bool as_file = FALSE )¶
This function is under development and is subject to change.
This function is not tested.
Requests the creation of a new data stream from the plugin. The MIME type and window are passed in mimetype and window. as_file holds the AsFileOnly flag. It is an interface to the NPN_NewStream function of the Netscape Plugin API.
bool QNPInstance::newStreamCreated ( QNPStream *, StreamMode & smode ) [virtual]¶
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 smode 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().
Note that the AsFileOnly method is not supported by Netscape 2.0 and MSIE 3.0.
The default implementation accepts any stream.
QNPWidget * QNPInstance::newWindow () [virtual]¶
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.
Example: grapher/grapher.cpp.
void QNPInstance::notifyURL ( const char * url, Reason r, void * notifyData ) [virtual]¶
This function is under development and is subject to change.
This function is not tested.
Called whenever a url is notified after a call to NPN_GetURLNotify with notifyData. The reason is given in r.
It is an encapsulation of the NPP_URLNotify function of the Netscape Plugin API.
See also: Netscape: NPP_URLNotify method
void QNPInstance::postURL ( const char * url, const char * window, uint len, const char * buf, bool file )¶
This function is under development and is subject to change.
This function is not tested.
It is an interface to the NPN_PostURL function of the Netscape Plugin API.
Passes url, window, buf, len, and file to NPN_PostURL.
void QNPInstance::print ( QPainter * ) [virtual]¶
This function is under development and is subject to change.
This function is not tested.
Print the instance embedded in a page.
It is an encapsulation of the NPP_Print function of the Netscape Plugin API.
bool QNPInstance::printFullPage () [virtual]¶
This function is under development and is subject to change.
This function is not tested.
It is an encapsulation of the NPP_Print function of the Netscape Plugin API.
void QNPInstance::status ( const char * msg )¶
Sets the status message in the browser containing this instance to msg.
void QNPInstance::streamAsFile ( QNPStream *, const char * fname ) [virtual]¶
Called when a stream is delivered as a single file called fname rather than as chunks. This may be simpler for a plugin to deal with, but precludes any incremental behavior.
Note that the AsFileOnly method is not supported by Netscape 2.0 and MSIE 3.0.
See also newStreamCreated() and newStream().
void QNPInstance::streamDestroyed ( QNPStream * ) [virtual]¶
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.
const char * QNPInstance::userAgent () const¶
Returns the user agent (browser name) containing this instance.
QNPWidget * QNPInstance::widget ()¶
Returns the plugin window created by newWindow(), if any.
int QNPInstance::write ( QNPStream *, int offset, int len, void * buffer ) [virtual]¶
Called when incoming data is available for processing by the instance. The instance must 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 len. buffer is the data available for consumption. The offset argument is merely an informational value indicating the total amount of data that has been consumed in prior calls.
This function should return the amount of data actually consumed.
Example: grapher/grapher.cpp.
int QNPInstance::writeReady ( QNPStream * ) [virtual]¶
Returns the minimum amount of data the instance is willing to receive from the given stream.
The default returns a very large value.
SEE ALSO¶
http://doc.trolltech.com/qnpinstance.html http://www.trolltech.com/faq/tech.html
COPYRIGHT¶
Copyright 1992-2007 Trolltech ASA, 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 (qnpinstance.3qt) and the Qt version (3.3.8).
2 February 2007 | Trolltech AS |