/***************************************************************************
                            QDragObject.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_QDragObject.h>
#include <qtc/qt_QMimeSource.h>
#include <qtobjc/QDragObject.h>
#include <qtobjc/QPixmap.h>
#include <qtobjc/QPoint.h>
#include <qtobjc/QWidget.h>

@implementation  QDragObject


//- initWithWidget: (QWidget *)dragSource name: (NSString *)name
//{
//	if ([self qt] == 0L) {
//		[self setQt: qt_new_QDragObject((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_QDragObject(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_QDragObject((qt_QDragObject *)[self qt]);
//		}
//		[QtSupport removeQtKey: [self qt]];
//		[self setQt: 0L];
//	}
//	[super dealloc];
//}

- (BOOL) drag
{
	return (BOOL) qt_QDragObject_drag((qt_QDragObject *)[self qt]);
}

- (BOOL) dragMove
{
	return (BOOL) qt_QDragObject_dragMove((qt_QDragObject *)[self qt]);
}

- dragCopy
{
	qt_QDragObject_dragCopy((qt_QDragObject *)[self qt]);
	return self;
}

- dragLink
{
	qt_QDragObject_dragLink((qt_QDragObject *)[self qt]);
	return self;
}

- setPixmap: (QPixmap *)arg1
{
	qt_QDragObject_setPixmap((qt_QDragObject *)[self qt], (qt_QPixmap *) [arg1 qt]);
	return self;
}

- setPixmap: (QPixmap *)arg1 hotspot: (QPoint*)hotspot
{
	qt_QDragObject_setPixmap1((qt_QDragObject *)[self qt], (qt_QPixmap *) [arg1 qt], (qt_QPoint*) [hotspot qt]);
	return self;
}

- (QPixmap*) pixmap
{
	return (QPixmap*) [QtSupport objectForQtKey: qt_QDragObject_pixmap((qt_QDragObject *)[self qt]) withClass: [QPixmap class] allocatedInObjcWorld: YES];
}

- (QPoint*) pixmapHotSpot
{
	return (QPoint*) [QtSupport objectForQtKey: qt_QDragObject_pixmapHotSpot((qt_QDragObject *)[self qt]) withClass: [QPoint class] allocatedInObjcWorld: YES];
}

- (QWidget*) source
{
	return (QWidget*) [QtSupport objectForQtKey: qt_QDragObject_source((qt_QDragObject *)[self qt]) withClass: [QWidget class] allocatedInObjcWorld: YES];
}

+ (QWidget*) target
{
	return (QWidget*) [QtSupport objectForQtKey: qt_QDragObject_target() withClass: [QWidget class] allocatedInObjcWorld: YES];
}

+ setTarget: (QWidget *)arg1
{
	qt_QDragObject_setTarget((qt_QWidget *) [arg1 qt]);
	return self;
}

//- (BOOL) drag: (int)arg1
//{
//	return (BOOL) qt_QDragObject_drag1((qt_QDragObject *)[self qt], (int)arg1);
//}

+ (int) DragDefault
{
	return (int) QDRAGOBJECT_DragDefault;
}

+ (int) DragCopy
{
	return (int) QDRAGOBJECT_DragCopy;
}

+ (int) DragMove
{
	return (int) QDRAGOBJECT_DragMove;
}

+ (int) DragLink
{
	return (int) QDRAGOBJECT_DragLink;
}

+ (int) DragCopyOrMove
{
	return (int) QDRAGOBJECT_DragCopyOrMove;
}

@end

@implementation QDragObject (QMimeSourceImplementation)

- (NSString *) format: (int)n
{
	return (NSString *) [NSString stringWithCString: qt_QMimeSource_format(qt_QDragObject_QMimeSource([self qt]), (int)n)];
}

- (BOOL) provides: (NSString *)arg1
{
	return (BOOL) qt_QMimeSource_provides(qt_QDragObject_QMimeSource([self qt]), (char*) [arg1 cString]);
}

- (QByteArray*) encodedData: (NSString *)arg1
{
	return (QByteArray*) [QtSupport objectForQtKey: qt_QMimeSource_encodedData(qt_QDragObject_QMimeSource([self qt]), (char*) [arg1 cString]) withClass: [QByteArray class] allocatedInObjcWorld: YES];
}

- (int) serialNumber
{
	return (int) qt_QMimeSource_serialNumber(qt_QDragObject_QMimeSource([self qt]));
}

@end
