khtml Library API Documentation

kjavaapplet.h

00001 // -*- c++ -*-
00002 /* This file is part of the KDE project
00003  *
00004  * Copyright (C) 2000 Richard Moore <rich@kde.org>
00005  *               2000 Wynn Wilkes <wynnw@caldera.com>
00006  *
00007  * This library is free software; you can redistribute it and/or
00008  * modify it under the terms of the GNU Library General Public
00009  * License as published by the Free Software Foundation; either
00010  * version 2 of the License, or (at your option) any later version.
00011  *
00012  * This library is distributed in the hope that it will be useful,
00013  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00014  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00015  * Library General Public License for more details.
00016  *
00017  * You should have received a copy of the GNU Library General Public License
00018  * along with this library; see the file COPYING.LIB.  If not, write to
00019  * the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
00020  * Boston, MA 02111-1307, USA.
00021  */
00022 
00023 
00024 #ifndef KJAVAAPPLET_H
00025 #define KJAVAAPPLET_H
00026 
00027 #include <kurl.h>
00028 #include <kparts/browserextension.h>
00029 
00030 #include <qobject.h>
00031 #include <qmap.h>
00032 
00045 class KJavaApplet;
00046 class KJavaAppletWidget;
00047 class KJavaAppletContext;
00048 class KJavaAppletPrivate;
00049 
00050 class KJavaLiveConnect : public KParts::LiveConnectExtension
00051 {
00052 Q_OBJECT
00053 
00054 public:
00055     KJavaLiveConnect(KJavaAppletContext*, KJavaApplet*);
00056 
00057     bool get( const unsigned long objid, const QString & field, KParts::LiveConnectExtension::Type & type, unsigned long & retobjid, QString & value );
00058     bool put( const unsigned long, const QString & field, const QString & value );
00059     bool call( const unsigned long , const QString & func, const QStringList & args, KParts::LiveConnectExtension::Type & type, unsigned long & retobjid, QString & value );
00060     void unregister( const unsigned long objid );
00061 
00062     void sendEvent(const unsigned long objid, const QString & event, const KParts::LiveConnectExtension::ArgList & args ) {
00063         emit partEvent(objid, event, args);
00064     }
00065 signals:
00066 
00067   virtual void partEvent( const unsigned long objid, const QString & event, const KParts::LiveConnectExtension::ArgList & args );
00068 
00069 private:
00070 
00071   KJavaAppletContext *context;
00072   KJavaApplet *applet;
00073 };
00074 
00075 class KJavaApplet : public QObject
00076 {
00077 Q_OBJECT
00078 
00079 public:
00080     // states describing the life cycle of an applet.
00081     // keep in sync with applet state in KJASAppletStub.java !
00082     typedef enum {
00083          UNKNOWN      = 0,
00084          CLASS_LOADED = 1,
00085          INSTANCIATED = 2,
00086          INITIALIZED  = 3,
00087          STARTED      = 4,
00088          STOPPED      = 5,
00089          DESTROYED    = 6
00090     } AppletState;
00091     KJavaApplet( KJavaAppletWidget* _parent, KJavaAppletContext* _context = 0 );
00092     ~KJavaApplet();
00093 
00097     void setAppletClass( const QString& clazzName );
00098 
00102     QString& appletClass();
00103 
00107     void setBaseURL( const QString& base );
00108 
00112     QString& baseURL();
00113 
00117     void setCodeBase( const QString& codeBase );
00118 
00122     QString& codeBase();
00123 
00128     void setArchives( const QString& _archives );
00129 
00134     QString& archives();
00135 
00139     void setAppletName( const QString& name );
00140 
00144     QString& appletName();
00145 
00149     void setSize( QSize size );
00150 
00154     QSize size();
00155 
00159     void setParameter( const QString& name, const QString& value );
00160 
00165     QString& parameter( const QString& name );
00166 
00170     QMap<QString,QString>& getParams();
00171 
00175     KParts::LiveConnectExtension * getLiveConnectExtension() { 
00176         return liveconnect;
00177     }
00178 
00182     void setWindowName( const QString& title );
00183 
00187     QString& getWindowName();
00188 
00192     void resizeAppletWidget( int width, int height );
00193 
00198     void create();
00199 
00204     void init();
00205 
00209     bool isCreated();
00210  
00214     void start();
00215 
00219     void stop();
00220 
00224     int  appletId();
00225 
00229     void setAppletId( int id );
00230     
00231     KJavaAppletContext* getContext() const { return context; }
00232     
00238     void stateChange ( const int newState );
00239     void setFailed ();
00240     AppletState state() const;
00241     bool failed() const;
00242     bool isAlive() const;
00243 
00244 private:
00245     void showStatus( const QString &msg);
00246     KJavaAppletPrivate*    d;
00247     QMap<QString, QString> params;
00248     KJavaAppletContext*    context;
00249     KJavaLiveConnect*      liveconnect;
00250     int                    id;
00251 };
00252 
00253 #endif // KJAVAAPPLET_H
KDE Logo
This file is part of the documentation for kdelibs Version 3.1.0.
Documentation copyright © 1996-2002 the KDE developers.
Generated on Wed Oct 8 12:22:39 2003 by doxygen 1.2.18 written by Dimitri van Heesch, © 1997-2001