source: trunk/doc/html/qnpinstance.html

Last change on this file was 190, checked in by rudi, 14 years ago

reference documentation added

File size: 18.3 KB
Line 
1<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
2<!-- /home/espenr/tmp/qt-3.3.8-espenr-2499/qt-x11-free-3.3.8/extensions/nsplugin/src/qnp.cpp:870 -->
3<html>
4<head>
5<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
6<title>QNPInstance Class</title>
7<style type="text/css"><!--
8fn { margin-left: 1cm; text-indent: -1cm; }
9a:link { color: #004faf; text-decoration: none }
10a:visited { color: #672967; text-decoration: none }
11body { background: #ffffff; color: black; }
12--></style>
13</head>
14<body>
15
16<table border="0" cellpadding="0" cellspacing="0" width="100%">
17<tr bgcolor="#E5E5E5">
18<td valign=center>
19 <a href="index.html">
20<font color="#004faf">Home</font></a>
21 | <a href="classes.html">
22<font color="#004faf">All&nbsp;Classes</font></a>
23 | <a href="mainclasses.html">
24<font color="#004faf">Main&nbsp;Classes</font></a>
25 | <a href="annotated.html">
26<font color="#004faf">Annotated</font></a>
27 | <a href="groups.html">
28<font color="#004faf">Grouped&nbsp;Classes</font></a>
29 | <a href="functions.html">
30<font color="#004faf">Functions</font></a>
31</td>
32<td align="right" valign="center"><img src="logo32.png" align="right" width="64" height="32" border="0"></td></tr></table><h1 align=center>QNPInstance Class Reference</h1>
33
34<p>The QNPInstance class provides a QObject that is a web browser plugin.
35<a href="#details">More...</a>
36<p>This class is part of the <b>Qt Netscape Extension</b>.
37<p><tt>#include &lt;<a href="qnp-h.html">qnp.h</a>&gt;</tt>
38<p>Inherits <a href="qobject.html">QObject</a>.
39<p><a href="qnpinstance-members.html">List of all member functions.</a>
40<h2>Public Members</h2>
41<ul>
42<li class=fn><a href="#~QNPInstance"><b>~QNPInstance</b></a> ()</li>
43<li class=fn>int <a href="#argc"><b>argc</b></a> () const</li>
44<li class=fn>const char * <a href="#argn"><b>argn</b></a> ( int&nbsp;i ) const</li>
45<li class=fn>const char * <a href="#argv"><b>argv</b></a> ( int&nbsp;i ) const</li>
46<li class=fn>enum <a href="#Reason-enum"><b>Reason</b></a> { ReasonDone = 0, ReasonBreak = 1, ReasonError = 2, ReasonUnknown = -1 }</li>
47<li class=fn>const char * <a href="#arg"><b>arg</b></a> ( const&nbsp;char&nbsp;*&nbsp;name ) const</li>
48<li class=fn>enum <a href="#InstanceMode-enum"><b>InstanceMode</b></a> { Embed = 1, Full = 2, Background = 3 }</li>
49<li class=fn>InstanceMode <a href="#mode"><b>mode</b></a> () const</li>
50<li class=fn>const char * <a href="#userAgent"><b>userAgent</b></a> () const</li>
51<li class=fn>virtual QNPWidget * <a href="#newWindow"><b>newWindow</b></a> ()</li>
52<li class=fn>QNPWidget * <a href="#widget"><b>widget</b></a> ()</li>
53<li class=fn>enum <a href="#StreamMode-enum"><b>StreamMode</b></a> { Normal = 1, Seek = 2, AsFile = 3, AsFileOnly = 4 }</li>
54<li class=fn>virtual bool <a href="#newStreamCreated"><b>newStreamCreated</b></a> ( QNPStream *, StreamMode&nbsp;&amp;&nbsp;smode )</li>
55<li class=fn>virtual int <a href="#writeReady"><b>writeReady</b></a> ( QNPStream * )</li>
56<li class=fn>virtual int <a href="#write"><b>write</b></a> ( QNPStream *, int&nbsp;offset, int&nbsp;len, void&nbsp;*&nbsp;buffer )</li>
57<li class=fn>virtual void <a href="#streamDestroyed"><b>streamDestroyed</b></a> ( QNPStream * )</li>
58<li class=fn>void <a href="#status"><b>status</b></a> ( const&nbsp;char&nbsp;*&nbsp;msg )</li>
59<li class=fn>void <a href="#getURLNotify"><b>getURLNotify</b></a> ( const&nbsp;char&nbsp;*&nbsp;url, const&nbsp;char&nbsp;*&nbsp;window = 0, void&nbsp;*&nbsp;data = 0 )</li>
60<li class=fn>void <a href="#getURL"><b>getURL</b></a> ( const&nbsp;char&nbsp;*&nbsp;url, const&nbsp;char&nbsp;*&nbsp;window = 0 )</li>
61<li class=fn>void <a href="#postURL"><b>postURL</b></a> ( const&nbsp;char&nbsp;*&nbsp;url, const&nbsp;char&nbsp;*&nbsp;window, uint&nbsp;len, const&nbsp;char&nbsp;*&nbsp;buf, bool&nbsp;file )</li>
62<li class=fn>QNPStream * <a href="#newStream"><b>newStream</b></a> ( const&nbsp;char&nbsp;*&nbsp;mimetype, const&nbsp;char&nbsp;*&nbsp;window, bool&nbsp;as_file = FALSE )</li>
63<li class=fn>virtual void <a href="#streamAsFile"><b>streamAsFile</b></a> ( QNPStream *, const&nbsp;char&nbsp;*&nbsp;fname )</li>
64<li class=fn>void * <a href="#getJavaPeer"><b>getJavaPeer</b></a> () const</li>
65<li class=fn>virtual void <a href="#notifyURL"><b>notifyURL</b></a> ( const&nbsp;char&nbsp;*&nbsp;url, Reason&nbsp;r, void&nbsp;*&nbsp;notifyData )</li>
66<li class=fn>virtual bool <a href="#printFullPage"><b>printFullPage</b></a> ()</li>
67<li class=fn>virtual void <a href="#print"><b>print</b></a> ( QPainter * )</li>
68</ul>
69<h2>Protected Members</h2>
70<ul>
71<li class=fn><a href="#QNPInstance"><b>QNPInstance</b></a> ()</li>
72</ul>
73<hr><a name="details"></a><h2>Detailed Description</h2>
74<p> This class is defined in the <b>Qt <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 Qt API.
75<p>
76
77The QNPInstance class provides a <a href="qobject.html">QObject</a> that is a web browser plugin.
78<p>
79<p> Deriving from QNPInstance creates an object that represents a
80single <tt>&lt;EMBED&gt;</tt> tag in an HTML document.
81<p> The QNPInstance is responsible for creating an appropriate
82<a href="qnpwidget.html">QNPWidget</a> window if required (not all plugins have windows), and
83for interacting with the input/output facilities intrinsic to
84plugins.
85<p> Note that there is <em>absolutely no guarantee</em> regarding the order
86in which functions are called. Sometimes the browser will call
87<a href="#newWindow">newWindow</a>() first, at other times, <a href="#newStreamCreated">newStreamCreated</a>() will be
88called first (assuming the <tt>&lt;EMBED&gt;</tt> tag has a SRC parameter).
89<p> <em>None of Qt's GUI functionality</em> may be used until after the
90first call to newWindow(). This includes any use of <a href="qpaintdevice.html">QPaintDevice</a>
91(i.e. <a href="qpixmap.html">QPixmap</a>, <a href="qwidget.html">QWidget</a>, and all subclasses), <a href="qapplication.html">QApplication</a>, anything
92related to <a href="qpainter.html">QPainter</a> (<a href="qbrush.html">QBrush</a>, etc.), fonts, <a href="qmovie.html">QMovie</a>, <a href="qtooltip.html">QToolTip</a>, etc.
93Useful classes which specifically <em>can</em> be used are <a href="qimage.html">QImage</a>,
94<a href="qfile.html">QFile</a>, and <a href="qbuffer.html">QBuffer</a>.
95<p> This restriction can easily be accommodated by structuring your
96plugin so that the task of the QNPInstance is to gather data,
97while the task of the <a href="qnpwidget.html">QNPWidget</a> is to provide a graphical
98interface to that data.
99
100<hr><h2>Member Type Documentation</h2>
101<h3 class=fn><a name="InstanceMode-enum"></a>QNPInstance::InstanceMode</h3>
102
103<p> This enum type provides Qt-style names for three #defines in
104<tt>npapi.h</tt>:
105<ul>
106<li><tt>QNPInstance::Embed</tt> - corresponds to NP_EMBED
107<li><tt>QNPInstance::Full</tt> - corresponds to NP_FULL
108<li><tt>QNPInstance::Background</tt> - corresponds to NP_BACKGROUND
109</ul><p>
110<h3 class=fn><a name="Reason-enum"></a>QNPInstance::Reason</h3>
111
112<ul>
113<li><tt>QNPInstance::ReasonDone</tt>
114<li><tt>QNPInstance::ReasonBreak</tt>
115<li><tt>QNPInstance::ReasonError</tt>
116<li><tt>QNPInstance::ReasonUnknown</tt>
117</ul>
118<h3 class=fn><a name="StreamMode-enum"></a>QNPInstance::StreamMode</h3>
119
120<ul>
121<li><tt>QNPInstance::Normal</tt>
122<li><tt>QNPInstance::Seek</tt>
123<li><tt>QNPInstance::AsFile</tt>
124<li><tt>QNPInstance::AsFileOnly</tt>
125</ul>
126<hr><h2>Member Function Documentation</h2>
127<h3 class=fn><a name="QNPInstance"></a>QNPInstance::QNPInstance ()<tt> [protected]</tt>
128</h3>
129Creates a QNPInstance.
130<p> Can only be called from within a derived class created within
131<a href="qnplugin.html#newInstance">QNPlugin::newInstance</a>().
132
133<h3 class=fn><a name="~QNPInstance"></a>QNPInstance::~QNPInstance ()
134</h3>
135Called when the plugin instance is about to be deleted.
136
137<h3 class=fn>const char * <a name="arg"></a>QNPInstance::arg ( const&nbsp;char&nbsp;*&nbsp;name ) const
138</h3>
139Returns the value of the named arguments, or 0 if no argument
140called <em>name</em> appears in the <tt>&lt;EMBED&gt;</tt> tag of this instance.
141If the argument appears, but has no value assigned, the empty
142string is returned. In summary:
143<p> <center><table cellpadding="4" cellspacing="2" border="0">
144<tr bgcolor="#a2c511"> <th valign="top">Tag <th valign="top">Result
145<tr bgcolor="#f0f0f0"> <td valign="top"><tt>&lt;EMBED ...&gt;</tt> <td valign="top">arg("FOO") == 0
146<tr bgcolor="#d0d0d0"> <td valign="top"><tt>&lt;EMBED FOO ...&gt;</tt> <td valign="top">arg("FOO") == ""
147<tr bgcolor="#f0f0f0"> <td valign="top"><tt>&lt;EMBED FOO=BAR ...&gt;</tt> <td valign="top">arg("FOO") == "BAR"
148</table></center>
149
150<h3 class=fn>int <a name="argc"></a>QNPInstance::argc () const
151</h3>
152Returns the number of arguments to the instance. Note that you
153should not normally rely on the ordering of arguments, and
154note that the SGML specification does not permit multiple
155arguments with the same name.
156<p> <p>See also <a href="#arg">arg</a>() and <a href="#argn">argn</a>().
157
158<h3 class=fn>const char * <a name="argn"></a>QNPInstance::argn ( int&nbsp;i ) const
159</h3>
160Returns the name of the <em>i</em>-th argument.
161<p> <p>See also <a href="#argc">argc</a>() and <a href="#argv">argv</a>().
162
163<h3 class=fn>const char * <a name="argv"></a>QNPInstance::argv ( int&nbsp;i ) const
164</h3>
165Returns the value of the <em>i</em>-th argument.
166<p> \as <a href="#argc">argc</a>(), <a href="#arg">arg</a>()
167
168<h3 class=fn>void * <a name="getJavaPeer"></a>QNPInstance::getJavaPeer () const
169</h3>
170Returns the Java object associated with the plugin instance, an
171object of the <a href="qnplugin.html#getJavaClass">plugin's Java
172 class</a>, or 0 if the plug-in does not have a Java class,
173Java is disabled, or an error occurred.
174<p> The return value is actually a <tt>jref</tt> we use <tt>void*</tt> so as to
175avoid burdening plugins which do not require Java.
176<p> <p>See also <a href="qnplugin.html#getJavaClass">QNPlugin::getJavaClass</a>() and <a href="qnplugin.html#getJavaEnv">QNPlugin::getJavaEnv</a>().
177
178<h3 class=fn>void <a name="getURL"></a>QNPInstance::getURL ( const&nbsp;char&nbsp;*&nbsp;url, const&nbsp;char&nbsp;*&nbsp;window = 0 )
179</h3>
180Requests 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
181of window names.
182
183<h3 class=fn>void <a name="getURLNotify"></a>QNPInstance::getURLNotify ( const&nbsp;char&nbsp;*&nbsp;url, const&nbsp;char&nbsp;*&nbsp;window = 0, void&nbsp;*&nbsp;data = 0 )
184</h3>
185Requests that the given <em>url</em> be retrieved and sent to
186the named <em>window</em>. See <a href="netscape-plugin.html#Netscape">Netscape</a>'s JavaScript documentation for
187an explanation of window names. Passes the arguments including <em>data</em> to NPN_GetURLNotify.
188<p>
189<a href="http://developer.netscape.com/docs/manuals/communicator/plugin/refpgur.htm#npngeturlnotify">Netscape: NPN_GetURLNotify method</a>
190
191<h3 class=fn><a href="qnpinstance.html#InstanceMode-enum">InstanceMode</a> <a name="mode"></a>QNPInstance::mode () const
192</h3>
193Returns the mode of the plugin.
194
195<h3 class=fn><a href="qnpstream.html">QNPStream</a>&nbsp;* <a name="newStream"></a>QNPInstance::newStream ( const&nbsp;char&nbsp;*&nbsp;mimetype, const&nbsp;char&nbsp;*&nbsp;window, bool&nbsp;as_file = FALSE )
196</h3>
197<p><b>This function is under development and is subject to change.</b>
198<p> This function is <em>not tested</em>.
199<p> Requests the creation of a new data stream <em>from</em> the plugin.
200The MIME type and window are passed in <em>mimetype</em> and <em>window</em>.
201<em>as_file</em> holds the <a href="#StreamMode-enum">AsFileOnly</a> flag. It is an interface to the
202NPN_NewStream function of the <a href="netscape-plugin.html#Netscape">Netscape</a> Plugin API.
203
204<h3 class=fn>bool <a name="newStreamCreated"></a>QNPInstance::newStreamCreated ( <a href="qnpstream.html">QNPStream</a>&nbsp;*, <a href="qnpinstance.html#StreamMode-enum">StreamMode</a>&nbsp;&amp;&nbsp;smode )<tt> [virtual]</tt>
205</h3>
206
207<p> This function is called when a new stream has been created. The
208instance should return TRUE if it accepts the processing of the
209stream. If the instance requires the stream as a file, it should
210set <em>smode</em> to <a href="#StreamMode-enum">AsFileOnly</a>, in which case the data will be
211delivered some time later to the <a href="#streamAsFile">streamAsFile</a>() function.
212Otherwise, the data will be delivered in chunks to the <a href="#write">write</a>()
213function, which must consume at least as much data as returned
214by the most recent call to <a href="#writeReady">writeReady</a>().
215<p> Note that the <a href="#StreamMode-enum">AsFileOnly</a> method is not supported by <a href="netscape-plugin.html#Netscape">Netscape</a>
2162.0 and MSIE 3.0.
217<p> The default implementation accepts any stream.
218
219<h3 class=fn><a href="qnpwidget.html">QNPWidget</a>&nbsp;* <a name="newWindow"></a>QNPInstance::newWindow ()<tt> [virtual]</tt>
220</h3>
221Called at most once, at some time after the QNPInstance is
222created. If the plugin requires a window, this function should
223return a derived class of <a href="qnpwidget.html">QNPWidget</a> that provides the required
224interface.
225
226<p>Example: <a href="grapher-nsplugin-example.html#x2751">grapher/grapher.cpp</a>.
227<h3 class=fn>void <a name="notifyURL"></a>QNPInstance::notifyURL ( const&nbsp;char&nbsp;*&nbsp;url, <a href="qnpinstance.html#Reason-enum">Reason</a>&nbsp;r, void&nbsp;*&nbsp;notifyData )<tt> [virtual]</tt>
228</h3>
229<p><b>This function is under development and is subject to change.</b>
230<p> This function is <em>not tested</em>.
231<p> Called whenever a <em>url</em> is notified after a call to
232NPN_GetURLNotify with <em>notifyData</em>. The reason is given in <em>r</em>.
233<p> It is an encapsulation of the NPP_URLNotify function of the
234<a href="netscape-plugin.html#Netscape">Netscape</a> Plugin API.
235<p> See also:
236<a href="http://developer.netscape.com/docs/manuals/communicator/plugin/refpgur.htm#nppurlnotify">Netscape: NPP_URLNotify method</a>
237
238<h3 class=fn>void <a name="postURL"></a>QNPInstance::postURL ( const&nbsp;char&nbsp;*&nbsp;url, const&nbsp;char&nbsp;*&nbsp;window, uint&nbsp;len, const&nbsp;char&nbsp;*&nbsp;buf, bool&nbsp;file )
239</h3>
240<p><b>This function is under development and is subject to change.</b>
241<p> This function is <em>not tested</em>.
242<p> It is an interface to the NPN_PostURL function of the <a href="netscape-plugin.html#Netscape">Netscape</a>
243Plugin API.
244<p> Passes <em>url</em>, <em>window</em>, <em>buf</em>, <em>len</em>, and <em>file</em> to
245NPN_PostURL.
246
247<h3 class=fn>void <a name="print"></a>QNPInstance::print ( <a href="qpainter.html">QPainter</a>&nbsp;* )<tt> [virtual]</tt>
248</h3>
249<p><b>This function is under development and is subject to change.</b>
250<p> This function is <em>not tested</em>.
251<p> Print the instance embedded in a page.
252<p> It is an encapsulation of the NPP_Print function of the <a href="netscape-plugin.html#Netscape">Netscape</a>
253Plugin API.
254
255<h3 class=fn>bool <a name="printFullPage"></a>QNPInstance::printFullPage ()<tt> [virtual]</tt>
256</h3>
257<p><b>This function is under development and is subject to change.</b>
258<p> This function is <em>not tested</em>.
259<p> It is an encapsulation of the NPP_Print function of the <a href="netscape-plugin.html#Netscape">Netscape</a>
260Plugin API.
261
262<h3 class=fn>void <a name="status"></a>QNPInstance::status ( const&nbsp;char&nbsp;*&nbsp;msg )
263</h3>
264Sets the status message in the browser containing this instance to
265<em>msg</em>.
266
267<h3 class=fn>void <a name="streamAsFile"></a>QNPInstance::streamAsFile ( <a href="qnpstream.html">QNPStream</a>&nbsp;*, const&nbsp;char&nbsp;*&nbsp;fname )<tt> [virtual]</tt>
268</h3>
269Called when a stream is delivered as a single file called <em>fname</em>
270rather than as chunks. This may be simpler for a plugin to deal
271with, but precludes any incremental behavior.
272<p> Note that the <a href="#StreamMode-enum">AsFileOnly</a> method is not supported by <a href="netscape-plugin.html#Netscape">Netscape</a>
2732.0 and MSIE 3.0.
274<p> <p>See also <a href="#newStreamCreated">newStreamCreated</a>() and <a href="#newStream">newStream</a>().
275
276<h3 class=fn>void <a name="streamDestroyed"></a>QNPInstance::streamDestroyed ( <a href="qnpstream.html">QNPStream</a>&nbsp;* )<tt> [virtual]</tt>
277</h3>
278Called when a stream is destroyed. At this point, the stream may
279be complete() and okay(). If it is not okay(), then an error has
280occurred. If it is okay(), but not complete(), then the user has
281cancelled the transmission; do not give an error message in this
282case.
283
284<h3 class=fn>const char * <a name="userAgent"></a>QNPInstance::userAgent () const
285</h3>
286Returns the user agent (browser name) containing this instance.
287
288<h3 class=fn><a href="qnpwidget.html">QNPWidget</a>&nbsp;* <a name="widget"></a>QNPInstance::widget ()
289</h3>
290Returns the plugin window created by <a href="#newWindow">newWindow</a>(), if any.
291
292<h3 class=fn>int <a name="write"></a>QNPInstance::write ( <a href="qnpstream.html">QNPStream</a>&nbsp;*, int&nbsp;offset, int&nbsp;len, void&nbsp;*&nbsp;buffer )<tt> [virtual]</tt>
293</h3>
294
295<p> Called when incoming data is available for processing by the
296instance. The instance <em>must</em> consume at least the amount that it
297returned in the most recent call to <a href="#writeReady">writeReady</a>(), but it may
298consume up to the amount given by <em>len</em>. <em>buffer</em> is the data
299available for consumption. The <em>offset</em> argument is merely an
300informational value indicating the total amount of data that has
301been consumed in prior calls.
302<p> This function should return the amount of data actually consumed.
303
304<p>Example: <a href="grapher-nsplugin-example.html#x2752">grapher/grapher.cpp</a>.
305<h3 class=fn>int <a name="writeReady"></a>QNPInstance::writeReady ( <a href="qnpstream.html">QNPStream</a>&nbsp;* )<tt> [virtual]</tt>
306</h3>
307Returns the minimum amount of data the instance is willing to
308receive from the given stream.
309<p> The default returns a very large value.
310
311<!-- eof -->
312<hr><p>
313This file is part of the <a href="index.html">Qt toolkit</a>.
314Copyright &copy; 1995-2007
315<a href="http://www.trolltech.com/">Trolltech</a>. All Rights Reserved.<p><address><hr><div align=center>
316<table width=100% cellspacing=0 border=0><tr>
317<td>Copyright &copy; 2007
318<a href="troll.html">Trolltech</a><td align=center><a href="trademarks.html">Trademarks</a>
319<td align=right><div align=right>Qt 3.3.8</div>
320</table></div></address></body>
321</html>
Note: See TracBrowser for help on using the repository browser.