3 /* This file is part of the KDE project
5 * Copyright (C) 2000 Richard Moore <rich@kde.org>
6 * 2000 Wynn Wilkes <wynnw@caldera.com>
8 * This library is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Library General Public
10 * License as published by the Free Software Foundation; either
11 * version 2 of the License, or (at your option) any later version.
13 * This library is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 * Library General Public License for more details.
18 * You should have received a copy of the GNU Library General Public License
19 * along with this library; see the file COPYING.LIB. If not, write to
20 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
21 * Boston, MA 02110-1301, USA.
24 #ifndef KJAVAAPPLETCONTEXT_H
25 #define KJAVAAPPLETCONTEXT_H
27 #include <QtCore/QObject>
30 * @short Provides a context for KJavaAppletWidgets
32 * Applets run in a context- (see the Java documentation for more information
33 * on contexts). Currently, each document in KHTML creates one context, in
34 * which multiple applets can run.
36 * @author Richard J. Moore, rich@kde.org
37 * @author Wynn Wilkes, wynnw@caldera.com
41 class KJavaAppletServer
;
43 class KJavaAppletContextPrivate
;
45 class KJavaAppletContext
: public QObject
51 ~KJavaAppletContext();
54 * Returns the ID of this context.
59 * Sets the ID of this context.
61 void setContextId( int id
);
66 void registerApplet( KJavaApplet
* );
69 * Sends a message to create the applet.
71 bool create( KJavaApplet
* );
74 * Sends a message to destroy the applet.
76 void destroy( KJavaApplet
* );
79 * Sends a message to initialize the applet.
81 void init( KJavaApplet
* );
84 * Sends a message to start the applet.
86 void start( KJavaApplet
* );
89 * Sends a message to stop the applet.
91 void stop( KJavaApplet
* );
94 * use this for applet call backs, the AppletServer
95 * calls this directly.
97 void processCmd( QString cmd
, QStringList args
);
100 * LiveConnect functions
102 bool getMember(QStringList
& args
, QStringList
& ret_args
);
103 bool putMember(QStringList
& args
);
104 bool callMember(QStringList
& args
, QStringList
& ret_args
);
105 void derefObject(QStringList
& args
);
107 KJavaAppletServer
* getServer() const { return server
; }
110 * Signals the KHMTL Part to show this as the status message.
112 void showStatus ( const QString
& txt
);
115 * Signals the KHTML Part to show a url in a given target
117 void showDocument( const QString
& url
, const QString
& target
);
120 * Signals the KHTML Part an applet is loaded
125 //The counter to generate ID's for the contexts
126 static int contextCount
;
128 // The applet server this context is attached to.
129 KJavaAppletServer
* server
;
132 void received( const QString
& cmd
, const QStringList
& arg
);
133 void javaProcessExited(int);
137 KJavaAppletContextPrivate
* const d
;
141 #endif // KJAVAAPPLETCONTEXT_H