QNPInstance(3qt)
π QNPInstance(3qt) β the manual page, bestie π
okay so you found the QNPInstance(3qt) page and honestly? iconic of you. this is the Qt Netscape Extension vibe, it's giving "plugin era," it's giving "before your time but still slays." let's get into it. π¦
β¨ NAME β¨
QNPInstance β a QObject that is a web browser plugin. periodt. π
β¨ SYNOPSIS β¨
This class is part of the Qt Netscape Extension.
#include <qnp.h>
Inherits QObject.
πΈ Public Members πΈ
~QNPInstance ()int argc () constconst char * argn ( int i ) constconst char * argv ( int i ) constenum Reason { ReasonDone = 0, ReasonBreak = 1, ReasonError = 2, ReasonUnknown = -1 }const char * arg ( const char * name ) constenum InstanceMode { Embed = 1, Full = 2, Background = 3 }InstanceMode mode () constconst char * userAgent () constvirtual 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 () constvirtual void notifyURL ( const char * url, Reason r, void * notifyData )virtual bool printFullPage ()virtual void print ( QPainter * )
π Protected Members π
QNPInstance ()
β¨ DESCRIPTION β¨
lowkey important: this class is defined in the Qt Netscape Extension, which lives in the qt/extensions directory. it is not included in the main Qt API. so don't come for it, it's off doing its own thing. π
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. yes. one tag, one object. that's the whole vibe. π«Ά
the QNPInstance is responsible for creating an appropriate QNPWidget window if required (and bestie, not all plugins have windows, okay, we don't judge), and for interacting with the input/output facilities intrinsic to plugins.
β οΈ REAL TALK WARNING: there is absolutely no guarantee regarding the order in which functions are called. sometimes the browser will callnewWindow()first, at other times,newStreamCreated()will be called first (assuming the<EMBED>tag has aSRCparameter). so don't build your whole personality on an assumed call order. π
β οΈ ANOTHER ONE: none of Qt's GUI functionality may be used until after the first call tonewWindow(). that includes any use ofQPaintDevice(i.e.QPixmap,QWidget, and all subclasses),QApplication, anything related toQPainter(QBrush, etc.), fonts,QMovie,QToolTip, etc. the classes that specifically can be used areQImage,QFile, andQBuffer. π
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. slay, separation of concerns, we love to see it. β¨
π§ Member Type Documentation π§
QNPInstance::InstanceMode
this enum type provides Qt-style names for three #defines in npapi.h:
QNPInstance::Embedβ corresponds toNP_EMBEDQNPInstance::Fullβ corresponds toNP_FULLQNPInstance::Backgroundβ corresponds toNP_BACKGROUND
QNPInstance::Reason
QNPInstance::ReasonDoneQNPInstance::ReasonBreakQNPInstance::ReasonErrorQNPInstance::ReasonUnknown
QNPInstance::StreamMode
QNPInstance::NormalQNPInstance::SeekQNPInstance::AsFileQNPInstance::AsFileOnly
β¨ MEMBER FUNCTION DOCUMENTATION β¨
QNPInstance::QNPInstance () [protected]
creates a QNPInstance. π
can only be called from within a derived class created within QNPlugin::newInstance(). that's the rule, no cap.
QNPInstance::~QNPInstance ()
called when the plugin instance is about to be deleted. it's the goodbye moment. π
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. and if the argument does appear but has no value assigned? you get the empty string back. empty string β zero, bestie, they are different girls.
in summary:
<center>.nf
Tag
ββββ
</center>
int QNPInstance::argc () const
returns the number of arguments to the instance.
heads up: 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. so like, don't try it. π«
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. (three whole reasons for a zero, we respect the transparency. π)
the return value is actually a jref; they use void* so as to avoid burdening plugins which do not require Java. thoughtful king behavior. π
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. that's it, that's the function. π
QNPStream * QNPInstance::newStream ( const char * mimetype, const char * window, bool as_file = FALSE )
π§ under development: this function is under development and is subject to change. π§ not tested: this function is not tested. fr fr, proceed with the vibes of caution.
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(). no slacking on the consumption, bestie. π
note: the AsFileOnly method is not supported by Netscape 2.0 and MSIE 3.0.
the default implementation accepts any stream. generous of it honestly. π«Ά
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]
π§ under development: this function is under development and is subject to change. π§ not tested: 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 )
π§ under development: this function is under development and is subject to change. π§ not tested: 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. all five, no skips. β
void QNPInstance::print ( QPainter * ) [virtual]
π§ under development: this function is under development and is subject to change. π§ not tested: 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]
π§ under development: this function is under development and is subject to change. π§ not tested: 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. little message, big impact. β¨
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. simpler but less flexible, the eternal tradeoff, iykyk.
note: 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 notcomplete(), then the user has cancelled the transmission β do not give an error message in this case. the user just changed their mind, that's valid, don't be dramatic about it. π
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. generous default energy, we stan. π
β¨ SEE ALSO β¨
β¨ 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. (not even a human, just vibes and a script. π)
okay bestie that's part one!! more is coming, don't go anywhere πβ¨π
π BUGS π
Okay bestie, real talk β found a bug in Qt? π Don't suffer in silence, report it exactly the way they describe over at http://doc.trolltech.com/bughowto.html. Fr fr, good bug reports are the whole entire point β they help them help you. Thank youuu π«Άβ¨
The definitive Qt documentation lives in HTML format, no cap. It's sitting pretty at $QTDIR/doc/html and you can read it with Qt Assistant or just, like, any web browser π This man page? It's a lil convenience for the girlies who prefer man pages β adorable, iconic β but heads up, this format is not officially supported by Trolltech. So it's giving β¨bonus contentβ¨, not the main character ππ
And if you spot errors in this manual page specifically? Spill π β report them to qt-bugs@trolltech.com. But pls pls pls include:
- the name of the manual page β
qnpinstance.3qt - the Qt version β
3.3.8
Without those two lil deets they're out here guessing, and nobody wants that π
That's the whole page, bestie β QNPInstance(3qt), straight from Trolltech AS, dated 2 February 2007, version 3.3.8 energy all the way through. Go forth and embed your plugins, you absolute legend ππ
π¦ where this page comes from
- fedora 43: qt3-devel-docs 3.3.8b-102.fc43 Β· QPL-1.0 OR GPL-2.0-only OR GPL-3.0-only
- fedora 44: qt3-devel-docs 3.3.8b-103.fc44 Β· QPL-1.0 OR GPL-2.0-only OR GPL-3.0-only
- Copyright 1992-2007 Trolltech ASA. All rights reserved. See the
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms