summaryrefslogtreecommitdiffstats
path: root/doc/man/man3/tqnpinstance.3qt
blob: db207e487d54592d09fe218a2663df591725e6b1 (plain)
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
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
'\" t
.TH QNPInstance 3qt "2 February 2007" "Trolltech AS" \" -*- nroff -*-
.\" Copyright 1992-2007 Trolltech ASA.  All rights reserved.  See the
.\" license file included in the distribution for a complete license
.\" statement.
.\"
.ad l
.nh
.SH NAME
QNPInstance \- QObject that is a web browser plugin
.SH SYNOPSIS
This class is part of the \fBQt Netscape Extension\fR.
.PP
\fC#include <ntqnp.h>\fR
.PP
Inherits 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 DESCRIPTION
This class is defined in the \fBQt Netscape Extension\fR, which can be found in the \fCqt/extensions\fR directory. It is not included in the main TQt API.
.PP
The QNPInstance class provides a QObject that is a web browser plugin.
.PP
Deriving from QNPInstance creates an object that represents a single \fC<EMBED>\fR tag in an HTML document.
.PP
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.
.PP
Note 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 (i.e. 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.
.PP
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.
.SS "Member Type Documentation"
.SH "QNPInstance::InstanceMode"
This enum type provides Qt-style names for three #defines in \fCnpapi.h\fR:
.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.
.PP
Can only be called from within a derived class created within QNPlugin::newInstance().
.SH "QNPInstance::~QNPInstance ()"
Called when the plugin instance is about to be deleted.
.SH "const char * QNPInstance::arg ( const char * name ) const"
Returns the value of the named arguments, or 0 if no argument 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:
.PP
<center>.nf
.TS
l
-
l.
Tag	Result
	arg("FOO") == 0
	arg("FOO") == ""

.TE
.fi
</center>
.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 note that the SGML specification does not permit multiple arguments with the same name.
.PP
See also arg() and argn().
.SH "const char * QNPInstance::argn ( int i ) const"
Returns the name of the \fIi\fR-th argument.
.PP
See also argc() and argv().
.SH "const char * QNPInstance::argv ( int i ) const"
Returns the value of the \fIi\fR-th argument.
.PP
\\as argc(), arg()
.SH "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.
.PP
The return value is actually a \fCjref\fR we use \fCvoid*\fR so as to avoid burdening plugins which do not require Java.
.PP
See 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 )"
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.
.PP
Netscape: 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
.PP
This function is \fInot tested\fR.
.PP
Requests the creation of a new data stream \fIfrom\fR the plugin. 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 returned by the most recent call to writeReady().
.PP
Note that the AsFileOnly method is not supported by Netscape 2.0 and MSIE 3.0.
.PP
The default implementation accepts any stream.
.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.
.PP
Example: 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
.PP
This function is \fInot tested\fR.
.PP
Called whenever a \fIurl\fR is notified after a call to NPN_GetURLNotify with \fInotifyData\fR. The reason is given in \fIr\fR.
.PP
It is an encapsulation of the NPP_URLNotify function of the Netscape Plugin API.
.PP
See 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
.PP
This function is \fInot tested\fR.
.PP
It is an interface to the NPN_PostURL function of the Netscape Plugin API.
.PP
Passes \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
.PP
This function is \fInot tested\fR.
.PP
Print the instance embedded in a page.
.PP
It 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
.PP
This function is \fInot tested\fR.
.PP
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.
.PP
Note that the AsFileOnly method is not supported by Netscape 2.0 and MSIE 3.0.
.PP
See 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.
.PP
This function should return the amount of data actually consumed.
.PP
Example: 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.
.PP
The 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 COPYRIGHT
Copyright 1992-2007 Trolltech ASA, http://www.trolltech.com.  See the
license file included in the distribution for a complete license
statement.
.SH AUTHOR
Generated automatically from the source code.
.SH BUGS
If 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.
.P
The definitive TQt documentation is provided in HTML format; it is
located at $QTDIR/doc/html and can be read using TQt 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. 
.P
If you find errors in this manual page, please report them to
.BR qt-bugs@trolltech.com .
Please include the name of the manual page (tqnpinstance.3qt) and the Qt
version (3.3.8).