/***************************************************************************
                            KURLDrag.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_KURLDrag.h>
#include <kdeobjc/KDESupport.h>
#include <kdeobjc/KURLDrag.h>
#include <qtobjc/QWidget.h>


@implementation  KURLDrag


- initWithArray: (NSArray *)urls dragSource: (QWidget *)dragSource name: (NSString *)name
{
static kde_KURLList * _qlist_urls = 0L;
	if ([self qt] == 0L) {
		[self setQt: kde_new_KURLDrag((kde_KURLList*) [urls toKURLList: (void *)&_qlist_urls], (qt_QWidget *) [dragSource qt], (char*) [name cString])];
		[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_KURLDrag((kde_KURLDrag *)[self qt]);
		}
		[QtSupport removeQtKey: [self qt]];
		[self setQt: 0L];
	}
	[super dealloc];
}

+ (KURLDrag*) newDrag: (NSArray *)urls dragSource: (QWidget *)dragSource name: (NSString *)name
{
static kde_KURLList * _qlist_urls = 0L;
	return (KURLDrag*) [QtSupport objectForQtKey: kde_KURLDrag_newDrag((kde_KURLList*) [urls toKURLList: (void *)&_qlist_urls], (qt_QWidget *) [dragSource qt], (char*) [name cString]) withClass: [KURLDrag class] allocatedInObjcWorld: YES];
}

+ (KURLDrag*) newDrag: (NSArray *)urls 
{
static kde_KURLList * _qlist_urls = 0L;
	return (KURLDrag*) [QtSupport objectForQtKey: kde_KURLDrag_newDrag((kde_KURLList*) [urls toKURLList: (void *)&_qlist_urls], 0, 0) withClass: [KURLDrag class] allocatedInObjcWorld: YES];
}

//+ (BOOL) decode: (QMimeSource*)e urls: (NSArray *)urls
//{
//static kde_KURLList * _qlist_urls = 0L;
//	return (BOOL) kde_KURLDrag_decode((qt_QMimeSource*) [e qt], (kde_KURLList*) [urls toKURLList: (void *)&_qlist_urls]);
//}

//+ (BOOL) decode: (NSArray *)e uris: (NSArray *)uris
//{
//static kde_KURLList * _qlist_uris = 0L;
//static qt_QStringList * _qlist_e = 0L;
//	return (BOOL) kde_KURLDrag_decode2((qt_QStringList*) [e toQStringList: (void *)&_qlist_e], (kde_KURLList*) [uris toKURLList: (void *)&_qlist_uris]);
//}

//- (NSString *) format: (int)i
//{
//	return (NSString *) [NSString stringWithCString: kde_KURLDrag_format((kde_KURLDrag *)[self qt], (int)i)];
//}

//- (QByteArray*) encodedData: (NSString *)mime
//{
//	return (QByteArray*) [QtSupport objectForQtKey: kde_KURLDrag_encodedData((kde_KURLDrag *)[self qt], (char*) [mime cString]) withClass: [QByteArray class] allocatedInObjcWorld: YES];
//}

@end
