File: qnpinstance.html

package info (click to toggle)
qt-embedded 2.3.2-3
  • links: PTS
  • area: main
  • in suites: woody
  • size: 68,608 kB
  • ctags: 45,998
  • sloc: cpp: 276,654; ansic: 71,987; makefile: 29,074; sh: 12,305; yacc: 2,465; python: 1,863; perl: 481; lex: 480; xml: 68; lisp: 15
file content (232 lines) | stat: -rw-r--r-- 15,253 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"><html><head><meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Qt Toolkit - QNPInstance Class</title><style type="text/css"><!--
h3.fn,span.fn { margin-left: 1cm; text-indent: -1cm; }
a:link { color: #004faf; text-decoration: none }
a:visited { color: #672967; text-decoration: none }body { background: white; color: black; }
--></style>
</head><body bgcolor="#ffffff">

<table width="100%">
<tr><td><a href="index.html">
<img width="100" height="100" src="qtlogo.png"
alt="Home" border="0"><img width="100"
height="100" src="face.png" alt="Home" border="0">
</a><td valign=top><div align=right><img src="dochead.png" width="472" height="27"><br>
<a href="classes.html"><b>Classes</b></a>
-<a href="annotated.html">Annotated</a>
- <a href="hierarchy.html">Tree</a>
-<a href="functions.html">Functions</a>
-<a href="index.html">Home</a>
-<a href="topicals.html"><b>Structure</b></a>
</div>
</table>

<h1 align=center>QNPInstance Class Reference</h1><br clear="all">
<p>
a <a href="qobject.html">QObject</a> that is a Web-browser plugin
<p>This class is part of the <b>Qt NSPlugin Extension.</b>
<a href="#details">More...</a>
<p>
<code>#include &lt;<a href="qnp-h.html">qnp.h</a>&gt;</code>
<p>
Inherits <a href="qobject.html">QObject</a>.
<p><a href="qnpinstance-members.html">List of all member functions.</a>
<h2>Public Members</h2>
<ul>
<li><div class="fn"><a href="#762bdb"><b>~QNPInstance</b></a>()</div>
<li><div class="fn">int<a href="#6ddbff"><b>argc</b></a>()const</div>
<li><div class="fn">constchar*<a href="#2a4eff"><b>argn</b></a>(int)const</div>
<li><div class="fn">constchar*<a href="#1097cd"><b>argv</b></a>(int)const</div>
<li><div class="fn">enum<b>Reason</b>{ReasonDone=0, ReasonBreak=1, ReasonError=2, ReasonUnknown=-1}</div>
<li><div class="fn">constchar*<a href="#a8ecbe"><b>arg</b></a>(constchar*name)const</div>
<li><div class="fn">enum<b>InstanceMode</b>{Embed=1, Full=2, Background=3}</div>
<li><div class="fn">InstanceMode<b>mode</b>()const</div>
<li><div class="fn">constchar*<a href="#4e80e6"><b>userAgent</b></a>()const</div>
<li><div class="fn">virtualQNPWidget*<a href="#9bff06"><b>newWindow</b></a>()</div>
<li><div class="fn">QNPWidget*<a href="#9ac952"><b>widget</b></a>()</div>
<li><div class="fn">enum<b>StreamMode</b>{Normal=1, Seek=2, AsFile=3, AsFileOnly=4}</div>
<li><div class="fn">virtualbool<a href="#46599f"><b>newStreamCreated</b></a>(QNPStream*, StreamMode&amp;smode)</div>
<li><div class="fn">virtualint<a href="#68906c"><b>writeReady</b></a>(QNPStream*)</div>
<li><div class="fn">virtualint<a href="#248e16"><b>write</b></a>(QNPStream*, intoffset, intlen, void*buffer)</div>
<li><div class="fn">virtualvoid<a href="#70d208"><b>streamDestroyed</b></a>(QNPStream*)</div>
<li><div class="fn">void<a href="#ade9f9"><b>status</b></a>(constchar*msg)</div>
<li><div class="fn">void<a href="#aa64a4"><b>getURLNotify</b></a>(constchar*url, constchar*window=0, void*data=0)</div>
<li><div class="fn">void<a href="#d57f95"><b>getURL</b></a>(constchar*url, constchar*window=0)</div>
<li><div class="fn">void<a href="#4468a4"><b>postURL</b></a>(constchar*url, constchar*window, uintlen, constchar*buf, boolfile)</div>
<li><div class="fn">QNPStream*<a href="#d8bf4f"><b>newStream</b></a>(constchar*mimetype, constchar*window, boolas_file=FALSE)</div>
<li><div class="fn">virtualvoid<a href="#99921c"><b>streamAsFile</b></a>(QNPStream*, constchar*fname)</div>
<li><div class="fn">void*<a href="#d20a99"><b>getJavaPeer</b></a>()const</div>
<li><div class="fn">virtualvoid<a href="#d5c4a3"><b>notifyURL</b></a>(constchar*url, Reasonr, void*notifyData)</div>
<li><div class="fn">virtualbool<a href="#470b7d"><b>printFullPage</b></a>()</div>
<li><div class="fn">virtualvoid<a href="#224436"><b>print</b></a>(QPainter*)</div>
</ul>
<h2>Protected Members</h2>
<ul>
<li><div class="fn"><a href="#a995a9"><b>QNPInstance</b></a>()</div>
</ul>
<hr><h2><a name="details"></a>Detailed Description</h2>
This class is defined in the <b>Qt NSPlugin Extension</b>, which can be found in the <tt>qt/extensions</tt> directory.
It is not included in the main Qt API.
<p>
a <a href="qobject.html">QObject</a> that is a Web-browser plugin
<p>
Deriving from QNPInstance creates an object that represents a single
&lt;EMBED&gt; tag in an HTML document.
<p>The 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.
<p>Note that there is <em>absolutely no garrantee</em> as to the order in
which functions are called.  Sometimes the browser will call setWindow()
first, at other times, <a href="#46599f">newStreamCreated</a>() will be called first (assuming the
&lt;EMBED&gt; tag has a SRC parameter).
<p><em>No GUI functionality</em> of Qt may be used until the first call
to setWindow().  This includes any use of <a href="qpaintdevice.html">QPaintDevice</a> (ie. <a href="qpixmap.html">QPixmap</a>,
<a href="qwidget.html">QWidget</a>, and all subclasses), <a href="qapplication.html">QApplication</a>, anything related 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.  Useful
classes which specifically <em>can</em> be used are <a href="qimage.html">QImage</a>, <a href="qfile.html">QFile</a>,
and <a href="qbuffer.html">QBuffer</a>.
<p>By structuring your plugin so that
the task of the QNPInstance is to gather data, while
the task of the <a href="qnpwidget.html">QNPWidget</a> is to provide a graphical interface to that data,
this restriction can be easily accommodated.
<p>Examples:
 <a href="qtimage-qtimage-cpp.html#QNPInstance">qtimage/qtimage.cpp</a>
 <a href="grapher-grapher-cpp.html#QNPInstance">grapher/grapher.cpp</a>
 <a href="trivial-trivial-cpp.html#QNPInstance">trivial/trivial.cpp</a>

<hr><h2>Member Function Documentation</h2>
<h3 class="fn"><a name="a995a9"></a>QNPInstance::QNPInstance() <code>[protected]</code></h3>
<p>Creates a QNPInstance.
Can only be called from within a derived class created
within <a href="qnplugin.html#41f769">QNPlugin::newInstance</a>().
<h3 class="fn"><a name="762bdb"></a>QNPInstance::~QNPInstance()</h3>
<p>Called when the plugin instance is about to disappear.
<h3 class="fn">constchar*<a name="a8ecbe"></a>QNPInstance::arg(constchar*name)const</h3>
<p>Returns the value of the named arguments, or 0 if no argument
with that name appears in the &lt;EMBED&gt; tag of this instance.
If the argument appears, but has no value assigned, the empty
string is returned.  In summary:
<p><ul>
<li> <b>&lt;EMBED ...&gt;</b> - arg("FOO") == 0
<li> <b>&lt;EMBED FOO ...&gt;</b> - arg("FOO") == ""
<li> <b>&lt;EMBED FOO=BAR ...&gt;</b> - arg("FOO") == "BAR"
</ul>
<h3 class="fn">int<a name="6ddbff"></a>QNPInstance::argc()const</h3>
<p>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.
<p>See also  <a href="#a8ecbe">arg</a>().
<h3 class="fn">constchar*<a name="2a4eff"></a>QNPInstance::argn(inti)const</h3>
<p>Returns the name of the <em>i</em>th argument.  See notes of <a href="#6ddbff">argc</a>().
<h3 class="fn">constchar*<a name="1097cd"></a>QNPInstance::argv(inti)const</h3>
<p>Returns the value of the <em>i</em>th argument.  See notes of <a href="#6ddbff">argc</a>().
<h3 class="fn">void*<a name="d20a99"></a>QNPInstance::getJavaPeer()const</h3>
<p>Returns the Java object associated with the plug-in instance, an
object of the
<a href="qnplugin.html#a36de2">plug-in'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>See also  <a href="qnplugin.html#a36de2">QNPlugin::getJavaClass</a>(), <a href="qnplugin.html#515079">QNPlugin::getJavaEnv</a>() and getJavaPeer().
<h3 class="fn">void<a name="d57f95"></a>QNPInstance::getURL(constchar*url, constchar*window=0)</h3>
<p>Requests that the given URL be retrieved and sent to the named
window.  See Netscape's JavaScript documentation for an explanation
of window names.
<p>Examples:
 <a href="grapher-grapher-cpp.html#getURL">grapher/grapher.cpp</a>
<h3 class="fn">void<a name="aa64a4"></a>QNPInstance::getURLNotify(constchar*url, constchar*window=0, void*data=0)</h3>
<p>Print the instance full-page.  By default, this returns FALSE, causing the
browser to call the (embedded) <a href="#224436">print</a>() function instead.
Requests that the given URL be retrieved and sent to the named
window.  See Netscape's JavaScript documentation for an explanation
of window names.
<p>See also:
<a href=http://developer.netscape.com/docs/manuals/communicator/plugin/refpgur.htm#npngeturlnotify>
Netscape: NPN_GetURLNotify method</a>
<h3 class="fn"><a href="qnpstream.html">QNPStream</a>*<a name="d8bf4f"></a>QNPInstance::newStream(constchar*mimetype, constchar*window, boolas_file=FALSE)</h3>
<p>Requests the creation of a new data stream <em>from</em> the plug-in.
This function is not tested.
It is an interface to the NPN_NewStream
function of the Netscape Plugin API.
<h3 class="fn">bool<a name="46599f"></a>QNPInstance::newStreamCreated(<a href="qnpstream.html">QNPStream</a>*, StreamMode&amp;smode) <code>[virtual]</code></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 AsFileOnly, in which case the data
will be delivered some time later to the <a href="#99921c">streamAsFile</a>() function.
Otherwise, the data will be delivered in chunks to the <a href="#248e16">write</a>()
function which must consume at least as much data as was returned
by the most recent call to <a href="#68906c">writeReady</a>().
<p>Note that the AsFileOnly method is not supported by Netscape 2.0
and MS-Explorer 3.0.
<h3 class="fn"><a href="qnpwidget.html">QNPWidget</a>*<a name="9bff06"></a>QNPInstance::newWindow() <code>[virtual]</code></h3>
<p>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 <a href="qnpwidget.html">QNPWidget</a> that provides the required interface.
<h3 class="fn">void<a name="d5c4a3"></a>QNPInstance::notifyURL(constchar*, Reason, void*) <code>[virtual]</code></h3>
<p>Called whenever an url is notified after call to NPN_GetURLNotify
<p>This function is not tested.
It is an encapsulation of the NPP_URLNotify
function of the Netscape 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="4468a4"></a>QNPInstance::postURL(constchar*url, constchar*window, uintlen, constchar*buf, boolfile)</h3>
<p>This function is not tested.  It is an interface to the NPN_PostURL
function of the Netscape Plugin API.
<h3 class="fn">void<a name="224436"></a>QNPInstance::print(<a href="qpainter.html">QPainter</a>*) <code>[virtual]</code></h3>
<p>Print the instance embedded in a page.
<p>This function is not tested.
It is an encapsulation of the NPP_Print
function of the Netscape Plugin API.
<h3 class="fn">bool<a name="470b7d"></a>QNPInstance::printFullPage() <code>[virtual]</code></h3>
<p>This function is not tested.
It is an encapsulation of the NPP_Print
function of the Netscape Plugin API.
<h3 class="fn">void<a name="ade9f9"></a>QNPInstance::status(constchar*msg)</h3>
<p>Sets the status message in the browser containing this instance.
<h3 class="fn">void<a name="99921c"></a>QNPInstance::streamAsFile(<a href="qnpstream.html">QNPStream</a>*, constchar*) <code>[virtual]</code></h3>
<p>Called when a stream is delivered as a single file rather than
as chunks.  This may be simpler for a plugin to deal with, but
precludes any incremental behavior.
<p>See also  <a href="#46599f">newStreamCreated</a>(), <a href="#d8bf4f">newStream</a>(), Note, that, the, AsFileOnly, method, is, not, supported, by, Netscape, 2.0, MS-Explorer and 3.0.
<h3 class="fn">void<a name="70d208"></a>QNPInstance::streamDestroyed(<a href="qnpstream.html">QNPStream</a>*) <code>[virtual]</code></h3>
<p>Called when a stream is destroyed.  At this this, 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">constchar*<a name="4e80e6"></a>QNPInstance::userAgent()const</h3>
<p>Returns the user agent (browser name) containing this instance.
<h3 class="fn"><a href="qnpwidget.html">QNPWidget</a>*<a name="9ac952"></a>QNPInstance::widget()</h3>
<p>Returns the plugin window created at <a href="#9bff06">newWindow</a>(), if any.
<p>Examples:
 <a href="grapher-grapher-cpp.html#widget">grapher/grapher.cpp</a>
<h3 class="fn">int<a name="248e16"></a>QNPInstance::write(<a href="qnpstream.html">QNPStream</a>*, intoffset, intlen, void*buffer) <code>[virtual]</code></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="#68906c">writeReady</a>(), but it may consume up to the
amount given by <em>len. 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.
<h3 class="fn">int<a name="68906c"></a>QNPInstance::writeReady(<a href="qnpstream.html">QNPStream</a>*) <code>[virtual]</code></h3>
<p>Called to inquire the minimum amount of data the instance is
willing to receive from the given stream.
<p>The default returns a very large value.
<hr><p>
Search the documentation, FAQ, qt-interest archive and more (uses
<a href="http://www.trolltech.com">www.trolltech.com</a>):<br>
<form method=post action="http://www.trolltech.com/search.cgi">
<input type=hidden name="version" value="2.3.2"><nobr>
<input size="50" name="search"><input type=submit value="Search">
</nobr></form><hr><p>
This file is part of the <a href="index.html">Qt toolkit</a>,
copyright &copy; 1995-2001
<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  2001 Trolltech<td><a href="http://www.trolltech.com/trademarks.html">Trademarks</a>
<td align="right"><div align="right">Qt version 2.3.2</div>
</table></div></address></body></html>