<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<!-- /home/espenr/tmp/qt - 3.3.8 - espenr - 2499/qt - x11 - free - 3.3.8/extensions/nsplugin/src/qnp.cpp:870 -->
< html >
< head >
< meta http-equiv = "Content-Type" content = "text/html; charset=ISO-8859-1" >
< title > TQNPInstance Class< / title >
< style type = "text/css" > < ! - -
fn { margin-left: 1cm; text-indent: -1cm; }
a:link { color: #004faf; text-decoration: none }
a:visited { color: #672967; text-decoration: none }
body { background: #ffffff; color: black; }
-->< / style >
< / head >
< body >
< table border = "0" cellpadding = "0" cellspacing = "0" width = "100%" >
< tr bgcolor = "#E5E5E5" >
< td valign = center >
< a href = "index.html" >
< font color = "#004faf" > Home< / font > < / a >
| < a href = "classes.html" >
< font color = "#004faf" > All Classes< / font > < / a >
| < a href = "mainclasses.html" >
< font color = "#004faf" > Main Classes< / font > < / a >
| < a href = "annotated.html" >
< font color = "#004faf" > Annotated< / font > < / a >
| < a href = "groups.html" >
< font color = "#004faf" > Grouped Classes< / font > < / a >
| < a href = "functions.html" >
< font color = "#004faf" > Functions< / font > < / a >
< / td >
< td align = "right" valign = "center" > < img src = "logo32.png" align = "right" width = "64" height = "32" border = "0" > < / td > < / tr > < / table > < h1 align = center > TQNPInstance Class Reference< / h1 >
< p > The TQNPInstance class provides a TQObject that is a web browser plugin.
< a href = "#details" > More...< / a >
< p > This class is part of the < b > TQt Netscape Extension< / b > .
< p > < tt > #include < < a href = "qnp-h.html" > ntqnp.h< / a > > < / tt >
< p > Inherits < a href = "tqobject.html" > TQObject< / a > .
< p > < a href = "qnpinstance-members.html" > List of all member functions.< / a >
< h2 > Public Members< / h2 >
< ul >
< li class = fn > < a href = "#~TQNPInstance" > < b > ~TQNPInstance< / b > < / a > ()< / li >
< li class = fn > int < a href = "#argc" > < b > argc< / b > < / a > () const< / li >
< li class = fn > const char * < a href = "#argn" > < b > argn< / b > < / a > ( int i ) const< / li >
< li class = fn > const char * < a href = "#argv" > < b > argv< / b > < / a > ( int i ) const< / li >
< li class = fn > enum < a href = "#Reason-enum" > < b > Reason< / b > < / a > { ReasonDone = 0, ReasonBreak = 1, ReasonError = 2, ReasonUnknown = -1 }< / li >
< li class = fn > const char * < a href = "#arg" > < b > arg< / b > < / a > ( const char * name ) const< / li >
< li class = fn > enum < a href = "#InstanceMode-enum" > < b > InstanceMode< / b > < / a > { Embed = 1, Full = 2, Background = 3 }< / li >
< li class = fn > InstanceMode < a href = "#mode" > < b > mode< / b > < / a > () const< / li >
< li class = fn > const char * < a href = "#userAgent" > < b > userAgent< / b > < / a > () const< / li >
< li class = fn > virtual TQNPWidget * < a href = "#newWindow" > < b > newWindow< / b > < / a > ()< / li >
< li class = fn > TQNPWidget * < a href = "#widget" > < b > widget< / b > < / a > ()< / li >
< li class = fn > enum < a href = "#StreamMode-enum" > < b > StreamMode< / b > < / a > { Normal = 1, Seek = 2, AsFile = 3, AsFileOnly = 4 }< / li >
< li class = fn > virtual bool < a href = "#newStreamCreated" > < b > newStreamCreated< / b > < / a > ( TQNPStream *, StreamMode & smode )< / li >
< li class = fn > virtual int < a href = "#writeReady" > < b > writeReady< / b > < / a > ( TQNPStream * )< / li >
< li class = fn > virtual int < a href = "#write" > < b > write< / b > < / a > ( TQNPStream *, int offset, int len, void * buffer )< / li >
< li class = fn > virtual void < a href = "#streamDestroyed" > < b > streamDestroyed< / b > < / a > ( TQNPStream * )< / li >
< li class = fn > void < a href = "#status" > < b > status< / b > < / a > ( const char * msg )< / li >
< li class = fn > void < a href = "#getURLNotify" > < b > getURLNotify< / b > < / a > ( const char * url, const char * window = 0, void * data = 0 )< / li >
< li class = fn > void < a href = "#getURL" > < b > getURL< / b > < / a > ( const char * url, const char * window = 0 )< / li >
< li class = fn > void < a href = "#postURL" > < b > postURL< / b > < / a > ( const char * url, const char * window, uint len, const char * buf, bool file )< / li >
< li class = fn > TQNPStream * < a href = "#newStream" > < b > newStream< / b > < / a > ( const char * mimetype, const char * window, bool as_file = FALSE )< / li >
< li class = fn > virtual void < a href = "#streamAsFile" > < b > streamAsFile< / b > < / a > ( TQNPStream *, const char * fname )< / li >
< li class = fn > void * < a href = "#getJavaPeer" > < b > getJavaPeer< / b > < / a > () const< / li >
< li class = fn > virtual void < a href = "#notifyURL" > < b > notifyURL< / b > < / a > ( const char * url, Reason r, void * notifyData )< / li >
< li class = fn > virtual bool < a href = "#printFullPage" > < b > printFullPage< / b > < / a > ()< / li >
< li class = fn > virtual void < a href = "#print" > < b > print< / b > < / a > ( TQPainter * )< / li >
< / ul >
< h2 > Protected Members< / h2 >
< ul >
< li class = fn > < a href = "#TQNPInstance" > < b > TQNPInstance< / b > < / a > ()< / li >
< / ul >
< hr > < a name = "details" > < / a > < h2 > Detailed Description< / h2 >
< p > This class is defined in the < b > TQt < a href = "netscape-plugin.html#Netscape" > Netscape< / a > Extension< / b > , which can be found in the < tt > qt/extensions< / tt > directory. It is not included in the main TQt API.
< p >
The TQNPInstance class provides a < a href = "tqobject.html" > TQObject< / a > that is a web browser plugin.
< p >
< p > Deriving from TQNPInstance creates an object that represents a
single < tt > < EMBED> < / tt > tag in an HTML document.
< p > The TQNPInstance is responsible for creating an appropriate
< a href = "qnpwidget.html" > TQNPWidget< / a > window if required (not all plugins have windows), and
for interacting with the input/output facilities intrinsic to
plugins.
< p > Note that there is < em > absolutely no guarantee< / em > regarding the order
in which functions are called. Sometimes the browser will call
< a href = "#newWindow" > newWindow< / a > () first, at other times, < a href = "#newStreamCreated" > newStreamCreated< / a > () will be
called first (assuming the < tt > < EMBED> < / tt > tag has a SRC parameter).
< p > < em > None of TQt's GUI functionality< / em > may be used until after the
first call to newWindow(). This includes any use of < a href = "ntqpaintdevice.html" > TQPaintDevice< / a >
(i.e. < a href = "ntqpixmap.html" > TQPixmap< / a > , < a href = "tqwidget.html" > TQWidget< / a > , and all subclasses), < a href = "ntqapplication.html" > TQApplication< / a > , anything
related to < a href = "ntqpainter.html" > TQPainter< / a > (< a href = "ntqbrush.html" > TQBrush< / a > , etc.), fonts, < a href = "ntqmovie.html" > TQMovie< / a > , < a href = "tqtooltip.html" > TQToolTip< / a > , etc.
Useful classes which specifically < em > can< / em > be used are < a href = "tqimage.html" > TQImage< / a > ,
< a href = "tqfile.html" > TQFile< / a > , and < a href = "tqbuffer.html" > TQBuffer< / a > .
< p > This restriction can easily be accommodated by structuring your
plugin so that the task of the TQNPInstance is to gather data,
while the task of the < a href = "qnpwidget.html" > TQNPWidget< / a > is to provide a graphical
interface to that data.
< hr > < h2 > Member Type Documentation< / h2 >
< h3 class = fn > < a name = "InstanceMode-enum" > < / a > TQNPInstance::InstanceMode< / h3 >
< p > This enum type provides TQt-style names for three #defines in
< tt > npapi.h< / tt > :
< ul >
< li > < tt > TQNPInstance::Embed< / tt > - corresponds to NP_EMBED
< li > < tt > TQNPInstance::Full< / tt > - corresponds to NP_FULL
< li > < tt > TQNPInstance::Background< / tt > - corresponds to NP_BACKGROUND
< / ul > < p >
< h3 class = fn > < a name = "Reason-enum" > < / a > TQNPInstance::Reason< / h3 >
< ul >
< li > < tt > TQNPInstance::ReasonDone< / tt >
< li > < tt > TQNPInstance::ReasonBreak< / tt >
< li > < tt > TQNPInstance::ReasonError< / tt >
< li > < tt > TQNPInstance::ReasonUnknown< / tt >
< / ul >
< h3 class = fn > < a name = "StreamMode-enum" > < / a > TQNPInstance::StreamMode< / h3 >
< ul >
< li > < tt > TQNPInstance::Normal< / tt >
< li > < tt > TQNPInstance::Seek< / tt >
< li > < tt > TQNPInstance::AsFile< / tt >
< li > < tt > TQNPInstance::AsFileOnly< / tt >
< / ul >
< hr > < h2 > Member Function Documentation< / h2 >
< h3 class = fn > < a name = "TQNPInstance" > < / a > TQNPInstance::TQNPInstance ()< tt > [protected]< / tt >
< / h3 >
Creates a TQNPInstance.
< p > Can only be called from within a derived class created within
< a href = "qnplugin.html#newInstance" > TQNPlugin::newInstance< / a > ().
< h3 class = fn > < a name = "~TQNPInstance" > < / a > TQNPInstance::~TQNPInstance ()
< / h3 >
Called when the plugin instance is about to be deleted.
< h3 class = fn > const char * < a name = "arg" > < / a > TQNPInstance::arg ( const char * name ) const
< / h3 >
Returns the value of the named arguments, or 0 if no argument
called < em > name< / em > appears in the < tt > < EMBED> < / tt > tag of this instance.
If the argument appears, but has no value assigned, the empty
string is returned. In summary:
< p > < center > < table cellpadding = "4" cellspacing = "2" border = "0" >
< tr bgcolor = "#a2c511" > < th valign = "top" > Tag < th valign = "top" > Result
< tr bgcolor = "#f0f0f0" > < td valign = "top" > < tt > < EMBED ...> < / tt > < td valign = "top" > arg("FOO") == 0
< tr bgcolor = "#d0d0d0" > < td valign = "top" > < tt > < EMBED FOO ...> < / tt > < td valign = "top" > arg("FOO") == ""
< tr bgcolor = "#f0f0f0" > < td valign = "top" > < tt > < EMBED FOO=BAR ...> < / tt > < td valign = "top" > arg("FOO") == "BAR"
< / table > < / center >
< h3 class = fn > int < a name = "argc" > < / a > TQNPInstance::argc () const
< / h3 >
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.
< p > < p > See also < a href = "#arg" > arg< / a > () and < a href = "#argn" > argn< / a > ().
< h3 class = fn > const char * < a name = "argn" > < / a > TQNPInstance::argn ( int i ) const
< / h3 >
Returns the name of the < em > i< / em > -th argument.
< p > < p > See also < a href = "#argc" > argc< / a > () and < a href = "#argv" > argv< / a > ().
< h3 class = fn > const char * < a name = "argv" > < / a > TQNPInstance::argv ( int i ) const
< / h3 >
Returns the value of the < em > i< / em > -th argument.
< p > \as < a href = "#argc" > argc< / a > (), < a href = "#arg" > arg< / a > ()
< h3 class = fn > void * < a name = "getJavaPeer" > < / a > TQNPInstance::getJavaPeer () const
< / h3 >
Returns the Java object associated with the plugin instance, an
object of the < a href = "qnplugin.html#getJavaClass" > plugin's Java
class< / a > , or 0 if the plug-in does not have a Java class,
Java is disabled, or an error occurred.
< p > The return value is actually a < tt > jref< / tt > we use < tt > void*< / tt > so as to
avoid burdening plugins which do not require Java.
< p > < p > See also < a href = "qnplugin.html#getJavaClass" > TQNPlugin::getJavaClass< / a > () and < a href = "qnplugin.html#getJavaEnv" > TQNPlugin::getJavaEnv< / a > ().
< h3 class = fn > void < a name = "getURL" > < / a > TQNPInstance::getURL ( const char * url, const char * window = 0 )
< / h3 >
Requests that the < em > url< / em > be retrieved and sent to the named < em > window< / em > . See < a href = "netscape-plugin.html#Netscape" > Netscape< / a > 's JavaScript documentation for an explanation
of window names.
< h3 class = fn > void < a name = "getURLNotify" > < / a > TQNPInstance::getURLNotify ( const char * url, const char * window = 0, void * data = 0 )
< / h3 >
Requests that the given < em > url< / em > be retrieved and sent to
the named < em > window< / em > . See < a href = "netscape-plugin.html#Netscape" > Netscape< / a > 's JavaScript documentation for
an explanation of window names. Passes the arguments including < em > data< / em > to NPN_GetURLNotify.
< p >
< a href = "http://developer.netscape.com/docs/manuals/communicator/plugin/refpgur.htm#npngeturlnotify" > Netscape: NPN_GetURLNotify method< / a >
< h3 class = fn > < a href = "qnpinstance.html#InstanceMode-enum" > InstanceMode< / a > < a name = "mode" > < / a > TQNPInstance::mode () const
< / h3 >
Returns the mode of the plugin.
< h3 class = fn > < a href = "qnpstream.html" > TQNPStream< / a > * < a name = "newStream" > < / a > TQNPInstance::newStream ( const char * mimetype, const char * window, bool as_file = FALSE )
< / h3 >
< p > < b > This function is under development and is subject to change.< / b >
< p > This function is < em > not tested< / em > .
< p > Requests the creation of a new data stream < em > from< / em > the plugin.
The MIME type and window are passed in < em > mimetype< / em > and < em > window< / em > .
< em > as_file< / em > holds the < a href = "#StreamMode-enum" > AsFileOnly< / a > flag. It is an interface to the
NPN_NewStream function of the < a href = "netscape-plugin.html#Netscape" > Netscape< / a > Plugin API.
< h3 class = fn > bool < a name = "newStreamCreated" > < / a > TQNPInstance::newStreamCreated ( < a href = "qnpstream.html" > TQNPStream< / a > *, < a href = "qnpinstance.html#StreamMode-enum" > StreamMode< / a > & smode )< tt > [virtual]< / tt >
< / h3 >
< p > 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 < em > smode< / em > to < a href = "#StreamMode-enum" > AsFileOnly< / a > , in which case the data will be
delivered some time later to the < a href = "#streamAsFile" > streamAsFile< / a > () function.
Otherwise, the data will be delivered in chunks to the < a href = "#write" > write< / a > ()
function, which must consume at least as much data as returned
by the most recent call to < a href = "#writeReady" > writeReady< / a > ().
< p > Note that the < a href = "#StreamMode-enum" > AsFileOnly< / a > method is not supported by < a href = "netscape-plugin.html#Netscape" > Netscape< / a >
2.0 and MSIE 3.0.
< p > The default implementation accepts any stream.
< h3 class = fn > < a href = "qnpwidget.html" > TQNPWidget< / a > * < a name = "newWindow" > < / a > TQNPInstance::newWindow ()< tt > [virtual]< / tt >
< / h3 >
Called at most once, at some time after the TQNPInstance is
created. If the plugin requires a window, this function should
return a derived class of < a href = "qnpwidget.html" > TQNPWidget< / a > that provides the required
interface.
< p > Example: < a href = "grapher-nsplugin-example.html#x2751" > grapher/grapher.cpp< / a > .
< h3 class = fn > void < a name = "notifyURL" > < / a > TQNPInstance::notifyURL ( const char * url, < a href = "qnpinstance.html#Reason-enum" > Reason< / a > r, void * notifyData )< tt > [virtual]< / tt >
< / h3 >
< p > < b > This function is under development and is subject to change.< / b >
< p > This function is < em > not tested< / em > .
< p > Called whenever a < em > url< / em > is notified after a call to
NPN_GetURLNotify with < em > notifyData< / em > . The reason is given in < em > r< / em > .
< p > It is an encapsulation of the NPP_URLNotify function of the
< a href = "netscape-plugin.html#Netscape" > Netscape< / a > Plugin API.
< p > See also:
< a href = "http://developer.netscape.com/docs/manuals/communicator/plugin/refpgur.htm#nppurlnotify" > Netscape: NPP_URLNotify method< / a >
< h3 class = fn > void < a name = "postURL" > < / a > TQNPInstance::postURL ( const char * url, const char * window, uint len, const char * buf, bool file )
< / h3 >
< p > < b > This function is under development and is subject to change.< / b >
< p > This function is < em > not tested< / em > .
< p > It is an interface to the NPN_PostURL function of the < a href = "netscape-plugin.html#Netscape" > Netscape< / a >
Plugin API.
< p > Passes < em > url< / em > , < em > window< / em > , < em > buf< / em > , < em > len< / em > , and < em > file< / em > to
NPN_PostURL.
< h3 class = fn > void < a name = "print" > < / a > TQNPInstance::print ( < a href = "ntqpainter.html" > TQPainter< / a > * )< tt > [virtual]< / tt >
< / h3 >
< p > < b > This function is under development and is subject to change.< / b >
< p > This function is < em > not tested< / em > .
< p > Print the instance embedded in a page.
< p > It is an encapsulation of the NPP_Print function of the < a href = "netscape-plugin.html#Netscape" > Netscape< / a >
Plugin API.
< h3 class = fn > bool < a name = "printFullPage" > < / a > TQNPInstance::printFullPage ()< tt > [virtual]< / tt >
< / h3 >
< p > < b > This function is under development and is subject to change.< / b >
< p > This function is < em > not tested< / em > .
< p > It is an encapsulation of the NPP_Print function of the < a href = "netscape-plugin.html#Netscape" > Netscape< / a >
Plugin API.
< h3 class = fn > void < a name = "status" > < / a > TQNPInstance::status ( const char * msg )
< / h3 >
Sets the status message in the browser containing this instance to
< em > msg< / em > .
< h3 class = fn > void < a name = "streamAsFile" > < / a > TQNPInstance::streamAsFile ( < a href = "qnpstream.html" > TQNPStream< / a > *, const char * fname )< tt > [virtual]< / tt >
< / h3 >
Called when a stream is delivered as a single file called < em > fname< / em >
rather than as chunks. This may be simpler for a plugin to deal
with, but precludes any incremental behavior.
< p > Note that the < a href = "#StreamMode-enum" > AsFileOnly< / a > method is not supported by < a href = "netscape-plugin.html#Netscape" > Netscape< / a >
2.0 and MSIE 3.0.
< p > < p > See also < a href = "#newStreamCreated" > newStreamCreated< / a > () and < a href = "#newStream" > newStream< / a > ().
< h3 class = fn > void < a name = "streamDestroyed" > < / a > TQNPInstance::streamDestroyed ( < a href = "qnpstream.html" > TQNPStream< / a > * )< tt > [virtual]< / tt >
< / h3 >
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.
< h3 class = fn > const char * < a name = "userAgent" > < / a > TQNPInstance::userAgent () const
< / h3 >
Returns the user agent (browser name) containing this instance.
< h3 class = fn > < a href = "qnpwidget.html" > TQNPWidget< / a > * < a name = "widget" > < / a > TQNPInstance::widget ()
< / h3 >
Returns the plugin window created by < a href = "#newWindow" > newWindow< / a > (), if any.
< h3 class = fn > int < a name = "write" > < / a > TQNPInstance::write ( < a href = "qnpstream.html" > TQNPStream< / a > *, int offset, int len, void * buffer )< tt > [virtual]< / tt >
< / h3 >
< p > Called when incoming data is available for processing by the
instance. The instance < em > must< / em > consume at least the amount that it
returned in the most recent call to < a href = "#writeReady" > writeReady< / a > (), but it may
consume up to the amount given by < em > len< / em > . < em > buffer< / em > is the data
available for consumption. The < em > offset< / em > argument is merely an
informational value indicating the total amount of data that has
been consumed in prior calls.
< p > This function should return the amount of data actually consumed.
< p > Example: < a href = "grapher-nsplugin-example.html#x2752" > grapher/grapher.cpp< / a > .
< h3 class = fn > int < a name = "writeReady" > < / a > TQNPInstance::writeReady ( < a href = "qnpstream.html" > TQNPStream< / a > * )< tt > [virtual]< / tt >
< / h3 >
Returns the minimum amount of data the instance is willing to
receive from the given stream.
< p > The default returns a very large value.
<!-- eof -->
< hr > < p >
This file is part of the < a href = "index.html" > TQt toolkit< / a > .
Copyright © 1995-2007
< a href = "http://www.trolltech.com/" > Trolltech< / a > . All Rights Reserved.< p > < address > < hr > < div align = center >
< table width = 100% cellspacing = 0 border = 0 > < tr >
< td > Copyright © 2007
< a href = "troll.html" > Trolltech< / a > < td align = center > < a href = "trademarks.html" > Trademarks< / a >
< td align = right > < div align = right > TQt 3.3.8< / div >
< / table > < / div > < / address > < / body >
< / html >