/***************************************************************************
                            QPoint.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_QPoint.h>
#include <qtobjc/QPoint.h>

@implementation  QPoint

- (void *) qt
{
	return _qt;
}

- setQt: (void *) qt
{
	_qt = qt;
	return self;
}

- (BOOL) allocatedInObjcWorld
{
	return _allocatedInObjcWorld;
}

- setAllocatedInObjcWorld: (BOOL) yn
{
	_allocatedInObjcWorld = yn;
	return self;
}


- init
{
	if ([self qt] == 0L) {
		[self setQt: qt_new_QPoint()];
		[self setAllocatedInObjcWorld: YES];
		[QtSupport setObject: self forQtKey: [self qt]];
	}
	[super init];
	return self;
}

- initWithInt: (int)xpos ypos: (int)ypos
{
	if ([self qt] == 0L) {
		[self setQt: qt_new_QPoint1((int)xpos, (int)ypos)];
		[self setAllocatedInObjcWorld: YES];
		[QtSupport setObject: self forQtKey: [self qt]];
	}
	[super init];
	return self;
}

- (BOOL) isNull
{
	return (BOOL) qt_QPoint_isNull((qt_QPoint *)[self qt]);
}

- (int) x
{
	return (int) qt_QPoint_x((qt_QPoint *)[self qt]);
}

- (int) y
{
	return (int) qt_QPoint_y((qt_QPoint *)[self qt]);
}

- setX: (int)x
{
	qt_QPoint_setX((qt_QPoint *)[self qt], (int)x);
	return self;
}

- setY: (int)y
{
	qt_QPoint_setY((qt_QPoint *)[self qt], (int)y);
	return self;
}

- (int) manhattanLength
{
	return (int) qt_QPoint_manhattanLength((qt_QPoint *)[self qt]);
}

- (short) rx
{
	return (short) qt_QPoint_rx((qt_QPoint *)[self qt]);
}

- (short) ry
{
	return (short) qt_QPoint_ry((qt_QPoint *)[self qt]);
}

@end
