/***************************************************************************
                            KJavaApplet.m -  description
                             -------------------
    begin                : Fri Mar  8 13:55:08 2002
    copyright            : (C) 2000-2002 Lost Highway Ltd. All rights reserved.
    email                : Lost_Highway@tipitina.demon.co.uk
    generated by         : duke@tipitina on Fri Mar  8 13:55:08 2002, using kalyptus 0.9.
 ***************************************************************************/

/***************************************************************************
 *                                                                         *
 *   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.                       *
 *                                                                         *
 ***************************************************************************/

#include <qtc/qt_QString.h>
#include <qtc/qt_QCString.h>
#include <kdec/kde_KJavaApplet.h>
#include <kdeobjc/KDESupport.h>
#include <kdeobjc/KJavaApplet.h>
#include <qtobjc/QSize.h>


@implementation  KJavaApplet


//- initWithJavaAppletWidget: (KJavaAppletWidget*)_parent _context: (KJavaAppletContext*)_context
//{
//	if ([self qt] == 0L) {
//		[self setQt: kde_new_KJavaApplet((kde_KJavaAppletWidget*) [_parent qt], (kde_KJavaAppletContext*) [_context qt])];
//		[self setAllocatedInObjcWorld: YES];
//		[QtSupport setObject: self forQtKey: [self qt]];
//	}
//	[super init];
//	return self;
//}

//- initWithJavaAppletWidget: (KJavaAppletWidget*)_parent
//{
//	if ([self qt] == 0L) {
//		[self setQt: kde_new_KJavaApplet((kde_KJavaAppletWidget*) [_parent qt], 0)];
//		[self setAllocatedInObjcWorld: YES];
//		[QtSupport setObject: self forQtKey: [self qt]];
//	}
//	[super init];
//	return self;
//}

- (void) dealloc
{
	if ([self qt] != 0L) {
		if ([self allocatedInObjcWorld] && [self parent] == nil) {
			kde_del_KJavaApplet((kde_KJavaApplet *)[self qt]);
		}
		[QtSupport removeQtKey: [self qt]];
		[self setQt: 0L];
	}
	[super dealloc];
}

- setAppletClass: (NSString *)clazzName
{
static qt_QString * _qstring_clazzName = 0L;
	kde_KJavaApplet_setAppletClass((kde_KJavaApplet *)[self qt], (qt_QString *) [clazzName toQString: &_qstring_clazzName]);
	return self;
}

- (NSString *) appletClass
{
static qt_QString * _qstring = 0L;
	_qstring = kde_KJavaApplet_appletClass((kde_KJavaApplet *)[self qt]);
	return [NSString fromQString: _qstring];
}

- setBaseURL: (NSString *)base
{
static qt_QString * _qstring_base = 0L;
	kde_KJavaApplet_setBaseURL((kde_KJavaApplet *)[self qt], (qt_QString *) [base toQString: &_qstring_base]);
	return self;
}

- (NSString *) baseURL
{
static qt_QString * _qstring = 0L;
	_qstring = kde_KJavaApplet_baseURL((kde_KJavaApplet *)[self qt]);
	return [NSString fromQString: _qstring];
}

- setCodeBase: (NSString *)codeBase
{
static qt_QString * _qstring_codeBase = 0L;
	kde_KJavaApplet_setCodeBase((kde_KJavaApplet *)[self qt], (qt_QString *) [codeBase toQString: &_qstring_codeBase]);
	return self;
}

- (NSString *) codeBase
{
static qt_QString * _qstring = 0L;
	_qstring = kde_KJavaApplet_codeBase((kde_KJavaApplet *)[self qt]);
	return [NSString fromQString: _qstring];
}

- setArchives: (NSString *)_archives
{
static qt_QString * _qstring__archives = 0L;
	kde_KJavaApplet_setArchives((kde_KJavaApplet *)[self qt], (qt_QString *) [_archives toQString: &_qstring__archives]);
	return self;
}

- (NSString *) archives
{
static qt_QString * _qstring = 0L;
	_qstring = kde_KJavaApplet_archives((kde_KJavaApplet *)[self qt]);
	return [NSString fromQString: _qstring];
}

- setAppletName: (NSString *)name
{
static qt_QString * _qstring_name = 0L;
	kde_KJavaApplet_setAppletName((kde_KJavaApplet *)[self qt], (qt_QString *) [name toQString: &_qstring_name]);
	return self;
}

- (NSString *) appletName
{
static qt_QString * _qstring = 0L;
	_qstring = kde_KJavaApplet_appletName((kde_KJavaApplet *)[self qt]);
	return [NSString fromQString: _qstring];
}

- setSize: (QSize *)size
{
	kde_KJavaApplet_setSize((kde_KJavaApplet *)[self qt], (qt_QSize *) [size qt]);
	return self;
}

- (QSize*) size
{
	return (QSize*) [QtSupport objectForQtKey: kde_KJavaApplet_size((kde_KJavaApplet *)[self qt]) withClass: [QSize class] allocatedInObjcWorld: YES];
}

- setParameter: (NSString *)name value: (NSString *)value
{
static qt_QString * _qstring_value = 0L;
static qt_QString * _qstring_name = 0L;
	kde_KJavaApplet_setParameter((kde_KJavaApplet *)[self qt], (qt_QString *) [name toQString: &_qstring_name], (qt_QString *) [value toQString: &_qstring_value]);
	return self;
}

- (NSString *) parameter: (NSString *)name
{
static qt_QString * _qstring = 0L;
static qt_QString * _qstring_name = 0L;
	_qstring = kde_KJavaApplet_parameter((kde_KJavaApplet *)[self qt], (qt_QString *) [name toQString: &_qstring_name]);
	return [NSString fromQString: _qstring];
}

- setWindowName: (NSString *)title
{
static qt_QString * _qstring_title = 0L;
	kde_KJavaApplet_setWindowName((kde_KJavaApplet *)[self qt], (qt_QString *) [title toQString: &_qstring_title]);
	return self;
}

- (NSString *) getWindowName
{
static qt_QString * _qstring = 0L;
	_qstring = kde_KJavaApplet_getWindowName((kde_KJavaApplet *)[self qt]);
	return [NSString fromQString: _qstring];
}

- resizeAppletWidget: (int)width height: (int)height
{
	kde_KJavaApplet_resizeAppletWidget((kde_KJavaApplet *)[self qt], (int)width, (int)height);
	return self;
}

- create
{
	kde_KJavaApplet_create((kde_KJavaApplet *)[self qt]);
	return self;
}

- init
{
	kde_KJavaApplet_init((kde_KJavaApplet *)[self qt]);
	return self;
}

- (BOOL) isCreated
{
	return (BOOL) kde_KJavaApplet_isCreated((kde_KJavaApplet *)[self qt]);
}

- start
{
	kde_KJavaApplet_start((kde_KJavaApplet *)[self qt]);
	return self;
}

- stop
{
	kde_KJavaApplet_stop((kde_KJavaApplet *)[self qt]);
	return self;
}

- (int) appletId
{
	return (int) kde_KJavaApplet_appletId((kde_KJavaApplet *)[self qt]);
}

- setAppletId: (int)identifier
{
	kde_KJavaApplet_setAppletId((kde_KJavaApplet *)[self qt], (int)identifier);
	return self;
}

@end
