/***************************************************************************
                            QUriDrag.m -  description
                             -------------------
    begin                : Wed Nov 21 12:08:37 2001
    copyright            : (C) 2000-2001 Lost Highway Ltd. All rights reserved.
    email                : Lost_Highway@tipitina.demon.co.uk
    generated by         : duke@tipitina on Wed Nov 21 12:08:37 2001, 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 <qtc/qt_QStrList.h>
#include <qtc/qt_QStringList.h>
#include <qtc/qt_QUriDrag.h>
#include <qtobjc/QUriDrag.h>
#include <qtobjc/QWidget.h>

@implementation  QUriDrag


- initWithArray: (NSArray *)uris dragSource: (QWidget *)dragSource name: (NSString *)name
{
static qt_QStrList * _qlist_uris = 0L;
	if ([self qt] == 0L) {
		[self setQt: qt_new_QUriDrag((qt_QStrList *) [uris toQStrList: (void *)&_qlist_uris], (qt_QWidget *) [dragSource qt], (char*) [name cString])];
		[self setAllocatedInObjcWorld: YES];
		[QtSupport setObject: self forQtKey: [self qt]];
	}
	[super init];
	return self;
}

- initWithArray: (NSArray *)uris 
{
static qt_QStrList * _qlist_uris = 0L;
	if ([self qt] == 0L) {
		[self setQt: qt_new_QUriDrag((qt_QStrList *) [uris toQStrList: (void *)&_qlist_uris], 0, 0)];
		[self setAllocatedInObjcWorld: YES];
		[QtSupport setObject: self forQtKey: [self qt]];
	}
	[super init];
	return self;
}

- initWithWidget: (QWidget *)dragSource name: (NSString *)name
{
	if ([self qt] == 0L) {
		[self setQt: qt_new_QUriDrag1((qt_QWidget *) [dragSource qt], (char*) [name cString])];
		[self setAllocatedInObjcWorld: YES];
		[QtSupport setObject: self forQtKey: [self qt]];
	}
	[super init];
	return self;
}

- init
{
	if ([self qt] == 0L) {
		[self setQt: qt_new_QUriDrag1(0, 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) {
			qt_del_QUriDrag((qt_QUriDrag *)[self qt]);
		}
		[QtSupport removeQtKey: [self qt]];
		[self setQt: 0L];
	}
	[super dealloc];
}

- setFilenames: (NSArray *)fnames
{
static qt_QStringList * _qlist_fnames = 0L;
	qt_QUriDrag_setFilenames((qt_QUriDrag *)[self qt], (qt_QStringList*) [fnames toQStringList: (void *)&_qlist_fnames]);
	return self;
}

- setFileNames: (NSArray *)fnames
{
static qt_QStringList * _qlist_fnames = 0L;
	qt_QUriDrag_setFileNames((qt_QUriDrag *)[self qt], (qt_QStringList*) [fnames toQStringList: (void *)&_qlist_fnames]);
	return self;
}

- setUnicodeUris: (NSArray *)uuris
{
static qt_QStringList * _qlist_uuris = 0L;
	qt_QUriDrag_setUnicodeUris((qt_QUriDrag *)[self qt], (qt_QStringList*) [uuris toQStringList: (void *)&_qlist_uuris]);
	return self;
}

- setUris: (NSArray *)uris
{
static qt_QStrList * _qlist_uris = 0L;
	qt_QUriDrag_setUris((qt_QUriDrag *)[self qt], (qt_QStrList *) [uris toQStrList: (void *)&_qlist_uris]);
	return self;
}

+ (NSString *) uriToLocalFile: (NSString *)arg1
{
static qt_QString * _qstring = 0L;
	_qstring = qt_QUriDrag_uriToLocalFile((char*) [arg1 cString]);
	return [NSString fromQString: _qstring];
}

+ (NSString *) localFileToUri: (NSString *)arg1
{
static qt_QCString * _qcstring = 0L;
static qt_QString * _qstring_arg1 = 0L;
	_qcstring = qt_QUriDrag_localFileToUri((qt_QString *) [arg1 toQString: &_qstring_arg1]);
	return [NSString fromQCString: _qcstring];
}

+ (NSString *) uriToUnicodeUri: (NSString *)arg1
{
static qt_QString * _qstring = 0L;
	_qstring = qt_QUriDrag_uriToUnicodeUri((char*) [arg1 cString]);
	return [NSString fromQString: _qstring];
}

+ (NSString *) unicodeUriToUri: (NSString *)arg1
{
static qt_QCString * _qcstring = 0L;
static qt_QString * _qstring_arg1 = 0L;
	_qcstring = qt_QUriDrag_unicodeUriToUri((qt_QString *) [arg1 toQString: &_qstring_arg1]);
	return [NSString fromQCString: _qcstring];
}

+ (BOOL) canDecode: (QMimeSource*)e
{
	return (BOOL) qt_QUriDrag_canDecode((qt_QMimeSource*) [e qt]);
}

+ (BOOL) decode: (QMimeSource*)e i: (NSArray *)i
{
static qt_QStrList * _qlist_i = 0L;
	return (BOOL) qt_QUriDrag_decode((qt_QMimeSource*) [e qt], (qt_QStrList *) [i toQStrList: (void *)&_qlist_i]);
}

+ (BOOL) decodeToUnicodeUris: (QMimeSource*)e i: (NSArray *)i
{
static qt_QStringList * _qlist_i = 0L;
	return (BOOL) qt_QUriDrag_decodeToUnicodeUris((qt_QMimeSource*) [e qt], (qt_QStringList*) [i toQStringList: (void *)&_qlist_i]);
}

+ (BOOL) decodeLocalFiles: (QMimeSource*)e i: (NSArray *)i
{
static qt_QStringList * _qlist_i = 0L;
	return (BOOL) qt_QUriDrag_decodeLocalFiles((qt_QMimeSource*) [e qt], (qt_QStringList*) [i toQStringList: (void *)&_qlist_i]);
}

@end
