You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
251 lines
6.2 KiB
251 lines
6.2 KiB
15 years ago
|
/* This file is part of the KDE project
|
||
|
*
|
||
|
* Copyright (C) 2000 Richard Moore <rich@kde.org>
|
||
|
* 2000 Wynn Wilkes <wynnw@caldera.com>
|
||
|
*
|
||
|
* This library is free software; you can redistribute it and/or
|
||
|
* modify it under the terms of the GNU Library General Public
|
||
|
* License as published by the Free Software Foundation; either
|
||
|
* version 2 of the License, or (at your option) any later version.
|
||
|
*
|
||
|
* This library is distributed in the hope that it will be useful,
|
||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||
|
* Library General Public License for more details.
|
||
|
*
|
||
|
* You should have received a copy of the GNU Library General Public License
|
||
|
* along with this library; see the file COPYING.LIB. If not, write to
|
||
|
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||
|
* Boston, MA 02110-1301, USA.
|
||
|
*/
|
||
|
|
||
|
|
||
|
#ifndef KJAVAAPPLET_H
|
||
|
#define KJAVAAPPLET_H
|
||
|
|
||
|
#include <kurl.h>
|
||
|
|
||
15 years ago
|
#include <tqobject.h>
|
||
|
#include <tqstringlist.h>
|
||
|
#include <tqmap.h>
|
||
15 years ago
|
|
||
|
/**
|
||
|
* @short A Java applet
|
||
|
*
|
||
|
* This class encapsulates the data the Applet Server needs to load
|
||
|
* the Applet class files, and set the proper size of the Applet. It also
|
||
|
* has an interface for applets to resize themselves.
|
||
|
*
|
||
|
* @author Richard J. Moore, rich@kde.org
|
||
|
* @author Wynn Wilkes, wynnw@kde.org
|
||
|
*/
|
||
|
|
||
|
class KJavaApplet;
|
||
|
class KJavaAppletWidget;
|
||
|
class KJavaAppletContext;
|
||
|
class KJavaAppletPrivate;
|
||
|
|
||
|
|
||
14 years ago
|
class KJavaApplet : public TQObject
|
||
15 years ago
|
{
|
||
|
Q_OBJECT
|
||
|
|
||
|
public:
|
||
|
// states describing the life cycle of an applet.
|
||
|
// keep in sync with applet state in KJASAppletStub.java !
|
||
|
typedef enum {
|
||
|
UNKNOWN = 0,
|
||
|
CLASS_LOADED = 1,
|
||
|
INSTANCIATED = 2,
|
||
|
INITIALIZED = 3,
|
||
|
STARTED = 4,
|
||
|
STOPPED = 5,
|
||
|
DESTROYED = 6
|
||
|
} AppletState;
|
||
|
KJavaApplet( KJavaAppletWidget* _parent, KJavaAppletContext* _context = 0 );
|
||
|
~KJavaApplet();
|
||
|
|
||
|
/**
|
||
|
* Set the applet context'.
|
||
|
*/
|
||
|
void setAppletContext( KJavaAppletContext* _context );
|
||
|
|
||
|
/**
|
||
|
* Specify the name of the class file to run. For example 'Lake.class'.
|
||
|
*/
|
||
15 years ago
|
void setAppletClass( const TQString& clazzName );
|
||
15 years ago
|
|
||
|
/**
|
||
|
* Get the name of the Class file the applet should run
|
||
|
*/
|
||
15 years ago
|
TQString& appletClass();
|
||
15 years ago
|
|
||
|
/**
|
||
|
* Set the URL of the document embedding the applet.
|
||
|
*/
|
||
15 years ago
|
void setBaseURL( const TQString& base );
|
||
15 years ago
|
|
||
|
/**
|
||
|
* get the Base URL of the document embedding the applet
|
||
|
*/
|
||
15 years ago
|
TQString& baseURL();
|
||
15 years ago
|
|
||
|
/**
|
||
|
* Set the codebase of the applet classes.
|
||
|
*/
|
||
15 years ago
|
void setCodeBase( const TQString& codeBase );
|
||
15 years ago
|
|
||
|
/**
|
||
|
* Get the codebase of the applet classes
|
||
|
*/
|
||
15 years ago
|
TQString& codeBase();
|
||
15 years ago
|
|
||
|
/**
|
||
|
* Set the list of archives at the Applet's codebase to search in for
|
||
|
* class files and other resources
|
||
|
*/
|
||
15 years ago
|
void setArchives( const TQString& _archives );
|
||
15 years ago
|
|
||
|
/**
|
||
|
* Get the list of Archives that should be searched for class files
|
||
|
* and other resources
|
||
|
*/
|
||
15 years ago
|
TQString& archives();
|
||
15 years ago
|
|
||
|
/**
|
||
|
* Set the name the applet should be called in its context
|
||
|
*/
|
||
15 years ago
|
void setAppletName( const TQString& name );
|
||
15 years ago
|
|
||
|
/**
|
||
|
* Get the name the applet should be called in its context
|
||
|
*/
|
||
15 years ago
|
TQString& appletName();
|
||
15 years ago
|
|
||
|
/**
|
||
|
* Set the size of the applet
|
||
|
*/
|
||
15 years ago
|
void setSize( TQSize size );
|
||
15 years ago
|
|
||
|
/**
|
||
|
* Get the size of the applet
|
||
|
*/
|
||
15 years ago
|
TQSize size();
|
||
15 years ago
|
|
||
|
/**
|
||
|
* Specify a parameter to be passed to the applet.
|
||
|
*/
|
||
15 years ago
|
void setParameter( const TQString& name, const TQString& value );
|
||
15 years ago
|
|
||
|
/**
|
||
|
* Look up the parameter value for the given Parameter. Returns
|
||
15 years ago
|
* TQString::null if the name has not been set.
|
||
15 years ago
|
*/
|
||
15 years ago
|
TQString& parameter( const TQString& name );
|
||
15 years ago
|
|
||
|
/**
|
||
|
* Get a reference to the Paramaters and their values
|
||
|
*/
|
||
15 years ago
|
TQMap<TQString,TQString>& getParams();
|
||
15 years ago
|
|
||
|
/**
|
||
|
* Set the window title for swallowing
|
||
|
*/
|
||
15 years ago
|
void setWindowName( const TQString& title );
|
||
15 years ago
|
|
||
|
/**
|
||
|
* Get the window title this applet should use
|
||
|
*/
|
||
15 years ago
|
TQString& getWindowName();
|
||
15 years ago
|
|
||
|
/**
|
||
|
* Interface for applets to resize themselves
|
||
|
*/
|
||
|
void resizeAppletWidget( int width, int height );
|
||
|
|
||
|
/**
|
||
|
* Send message to AppletServer to create this applet's
|
||
|
* frame to be swallowed and download the applet classes
|
||
|
*/
|
||
|
void create();
|
||
|
|
||
|
/**
|
||
|
* Send message to AppletServer to Initialize and show
|
||
|
* this applet
|
||
|
*/
|
||
|
void init();
|
||
|
|
||
|
/**
|
||
|
* Returns status of applet- whether it's been created or not
|
||
|
*/
|
||
|
bool isCreated();
|
||
|
|
||
|
/**
|
||
|
* Run the applet.
|
||
|
*/
|
||
|
void start();
|
||
|
|
||
|
/**
|
||
|
* Pause the applet.
|
||
|
*/
|
||
|
void stop();
|
||
|
|
||
|
/**
|
||
|
* Returns the unique ID this applet is given
|
||
|
*/
|
||
|
int appletId();
|
||
|
|
||
|
/**
|
||
|
* Set the applet ID.
|
||
|
*/
|
||
|
void setAppletId( int id );
|
||
|
|
||
|
KJavaAppletContext* getContext() const { return context; }
|
||
|
|
||
|
/**
|
||
|
* Get/Set the user name
|
||
|
*/
|
||
15 years ago
|
void setUser(const TQString & _user) { username = _user; }
|
||
|
const TQString & user () const { return username; }
|
||
15 years ago
|
|
||
|
/**
|
||
|
* Get/Set the user password
|
||
|
*/
|
||
15 years ago
|
void setPassword(const TQString & _password) { userpassword = _password; }
|
||
|
const TQString & password () const { return userpassword; }
|
||
15 years ago
|
|
||
|
/**
|
||
|
* Get/Set the auth name
|
||
|
*/
|
||
15 years ago
|
void setAuthName(const TQString & _auth) { authname = _auth; }
|
||
|
const TQString & authName () const { return authname; }
|
||
15 years ago
|
|
||
|
/**
|
||
|
* called from the protocol engine
|
||
|
* changes the status according to the one on the java side.
|
||
|
* Do not call this yourself!
|
||
|
*/
|
||
|
void stateChange ( const int newState );
|
||
|
void setFailed ();
|
||
|
AppletState state() const;
|
||
|
bool failed() const;
|
||
|
bool isAlive() const;
|
||
|
/**
|
||
|
* JavaScript coming from Java
|
||
|
**/
|
||
15 years ago
|
void jsData (const TQStringList & args) { emit jsEvent (args); }
|
||
15 years ago
|
signals:
|
||
15 years ago
|
void jsEvent (const TQStringList & args);
|
||
15 years ago
|
private:
|
||
14 years ago
|
void showStatus( const TQString &msg);
|
||
15 years ago
|
KJavaAppletPrivate* d;
|
||
15 years ago
|
TQMap<TQString, TQString> params;
|
||
15 years ago
|
KJavaAppletContext* context;
|
||
|
int id;
|
||
15 years ago
|
TQString username;
|
||
|
TQString userpassword;
|
||
|
TQString authname;
|
||
15 years ago
|
};
|
||
|
|
||
|
#endif // KJAVAAPPLET_H
|