/***************************************************************************
                            MouseEvent.m -  description
                             -------------------
    begin                : Thu Mar 21 01:01:29 2002
    copyright            : (C) 2000-2002 Lost Highway Ltd. All rights reserved.
    email                : Lost_Highway@tipitina.demon.co.uk
    generated by         : duke@tipitina on Thu Mar 21 01:01:29 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_MouseEvent.h>
#include <kdeobjc/KDESupport.h>
#include <kdeobjc/MouseEvent.h>
#include <kdeobjc/DOMNode.h>
#include <qtobjc/QMouseEvent.h>


@implementation  MouseEvent


- initWithText: (NSString *)name qmouseEvent: (QMouseEvent*)qmouseEvent x: (int)x y: (int)y url: (NSString *)url target: (NSString *)target innerNode: (DOMNode*)innerNode
{
static kde_DOMString * _domstring_target = 0L;
static kde_DOMString * _domstring_url = 0L;
	if ([self qt] == 0L) {
		[self setQt: kde_new_MouseEvent((char*) [name cString], (qt_QMouseEvent*) [qmouseEvent qt], (int)x, (int)y, (kde_DOMString*) [url toDOMString: &_domstring_url], (kde_DOMString*) [target toDOMString: &_domstring_target], (kde_DOMNode*) [innerNode qt])];
		[self setAllocatedInObjcWorld: YES];
		[QtSupport setObject: self forQtKey: [self qt]];
	}
	[super init];
	return self;
}

- (void) dealloc
{
	if ([self qt] != 0L) {
		if ([self allocatedInObjcWorld]) {
			kde_del_MouseEvent((kde_MouseEvent *)[self qt]);
		}
		[QtSupport removeQtKey: [self qt]];
		[self setQt: 0L];
	}
	[super dealloc];
}

//- (QMouseEvent*) qmouseEvent
//{
//	return (QMouseEvent*) [QtSupport objectForQtKey: kde_MouseEvent_qmouseEvent((kde_MouseEvent *)[self qt]) withClass: [QMouseEvent class] allocatedInObjcWorld: YES];
//}

- (int) x
{
	return (int) kde_MouseEvent_x((kde_MouseEvent *)[self qt]);
}

- (int) y
{
	return (int) kde_MouseEvent_y((kde_MouseEvent *)[self qt]);
}

- (int) absX
{
	return (int) kde_MouseEvent_absX((kde_MouseEvent *)[self qt]);
}

- (int) absY
{
	return (int) kde_MouseEvent_absY((kde_MouseEvent *)[self qt]);
}

//- (NSString *) url
//{
//static kde_DOMString * _domstring = 0L;
//	_domstring = kde_MouseEvent_url((kde_MouseEvent *)[self qt]);
//	return [NSString fromDOMString: _domstring];
//}

//- (NSString *) target
//{
//static kde_DOMString * _domstring = 0L;
//	_domstring = kde_MouseEvent_target((kde_MouseEvent *)[self qt]);
//	return [NSString fromDOMString: _domstring];
//}

//- (DOMNode*) innerNode
//{
//	return (DOMNode*) kde_MouseEvent_innerNode((kde_MouseEvent *)[self qt]);
//}

- (long) offset
{
	return (long) kde_MouseEvent_offset((kde_MouseEvent *)[self qt]);
}

@end
