qnp_8h-source.html

qnp.h

00001 /****************************************************************************
00002 ** $Id: qnp.h,v 1.1 2004/08/31 15:09:43 frauenberger Exp $
00003 **
00004 ** Definition of Qt extension classes for Netscape Plugin support.
00005 **
00006 ** Created : 970601
00007 **
00008 ** Copyright (C) 1992-2000 Trolltech AS.  All rights reserved.
00009 **
00010 ** This file is part of the Qt GUI Toolkit.
00011 **
00012 ** This file may be distributed under the terms of the Q Public License
00013 ** as defined by Trolltech AS of Norway and appearing in the file
00014 ** LICENSE.QPL included in the packaging of this file.
00015 **
00016 ** This file may be distributed and/or modified under the terms of the
00017 ** GNU General Public License version 2 as published by the Free Software
00018 ** Foundation and appearing in the file LICENSE.GPL included in the
00019 ** packaging of this file.
00020 **
00021 ** Licensees holding valid Qt Enterprise Edition or Qt Professional Edition
00022 ** licenses may use this file in accordance with the Qt Commercial License
00023 ** Agreement provided with the Software.
00024 **
00025 ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
00026 ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
00027 **
00028 ** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for
00029 **   information about Qt Commercial License Agreements.
00030 ** See http://www.trolltech.com/qpl/ for QPL licensing information.
00031 ** See http://www.trolltech.com/gpl/ for GPL licensing information.
00032 **
00033 ** Contact info@trolltech.com if any conditions of this licensing are
00034 ** not clear to you.
00035 **
00036 **********************************************************************/
00037 
00038 #ifndef QNP_H
00039 #define QNP_H
00040 
00041 #ifndef QT_H
00042 #include "qwidget.h"
00043 #endif // QT_H
00044 
00045 
00046 struct _NPInstance;
00047 struct _NPStream;
00048 class QNPInstance;
00049 
00050 class QNPStream {
00051 public:
00052     ~QNPStream();
00053 
00054     const char* url() const;
00055     uint end() const;
00056     uint lastModified() const;
00057 
00058     const char* type() const;
00059     bool seekable() const;
00060     bool okay() const;
00061     bool complete() const;
00062 
00063     void requestRead(int offset, uint length);
00064     int write( int len, void* buffer );
00065 
00066     QNPInstance* instance() { return inst; }
00067     QNPStream(QNPInstance*,const char*,_NPStream*,bool);
00068     void setOkay(bool);
00069     void setComplete(bool);
00070 
00071 private:
00072     QNPInstance* inst;
00073     _NPStream* stream;
00074     QString mtype;
00075     int seek:1;
00076     int isokay:1;
00077     int iscomplete:1;
00078 };
00079 
00080 class QNPWidget : public QWidget {
00081     Q_OBJECT
00082 public:
00083     QNPWidget();
00084     ~QNPWidget();
00085     void enterEvent(QEvent*);
00086     void leaveEvent(QEvent*);
00087 
00088     virtual void enterInstance();
00089     virtual void leaveInstance();
00090 
00091     QNPInstance* instance();
00092 
00093 private:
00094     _NPInstance* pi;
00095 };
00096 
00097 class QNPInstance : public QObject {
00098     Q_OBJECT
00099 public:
00100     ~QNPInstance();
00101 
00102     // Arguments passed to EMBED
00103     int argc() const;
00104     const char* argn(int) const;
00105     const char* argv(int) const;
00106     enum Reason {
00107         ReasonDone = 0,
00108         ReasonBreak = 1,
00109         ReasonError = 2,
00110         ReasonUnknown = -1
00111     };
00112     const char* arg(const char* name) const;
00113     enum InstanceMode { Embed=1, Full=2, Background=3 };
00114     InstanceMode mode() const;
00115 
00116     // The browser's name
00117     const char* userAgent() const;
00118 
00119     // Your window.
00120     virtual QNPWidget* newWindow();
00121     QNPWidget* widget();
00122 
00123     // Incoming streams (SRC=... tag).
00124     // Defaults ignore data.
00125     enum StreamMode { Normal=1, Seek=2, AsFile=3, AsFileOnly=4 };
00126     virtual bool newStreamCreated(QNPStream*, StreamMode& smode);
00127     virtual int writeReady(QNPStream*);
00128     virtual int write(QNPStream*, int offset, int len, void* buffer);
00129     virtual void streamDestroyed(QNPStream*);
00130 
00131     void status(const char* msg);
00132     void getURLNotify(const char* url, const char* window=0, void*data=0);
00133 
00134     void getURL(const char* url, const char* window=0);
00135     void postURL(const char* url, const char* window,
00136              uint len, const char* buf, bool file);
00137 
00138     QNPStream* newStream(const char* mimetype, const char* window,
00139         bool as_file=FALSE);
00140     virtual void streamAsFile(QNPStream*, const char* fname);
00141 
00142     void* getJavaPeer() const;
00143 
00144     virtual void notifyURL(const char* url, Reason r, void* notifyData);
00145     virtual bool printFullPage();
00146     virtual void print(QPainter*);
00147 
00148 protected:
00149     QNPInstance();
00150 
00151 private:
00152     friend class QNPStream;
00153     _NPInstance* pi;
00154 };
00155 
00156 
00157 class QNPlugin {
00158 public:
00159     // Write this to return your QNPlugin derived class.
00160     static QNPlugin* create();
00161 
00162     static QNPlugin* actual();
00163 
00164     virtual ~QNPlugin();
00165 
00166     void getVersionInfo(int& plugin_major, int& plugin_minor,
00167              int& browser_major, int& browser_minor);
00168 
00169     virtual QNPInstance* newInstance()=0;
00170     virtual const char* getMIMEDescription() const=0;
00171     virtual const char* getPluginNameString() const=0;
00172     virtual const char* getPluginDescriptionString() const=0;
00173 
00174     virtual void* getJavaClass();
00175     virtual void unuseJavaClass();
00176     void* getJavaEnv() const;
00177 
00178 protected:
00179     QNPlugin();
00180 };
00181 
00182 
00183 #endif  // QNP_H

Generated on Thu Nov 25 15:42:53 2004 for iARS(internetAudioRenderingSystem) by  doxygen 1.3.9.1