/***************************************************************************
                            QDataView.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_QDataView.h>
#include <qtobjc/QDataView.h>
#include <qtobjc/QSqlForm.h>
#include <qtobjc/QSqlRecord.h>


@implementation  QDataView


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

- init
{
	if ([self qt] == 0L) {
		[self setQt: qt_new_QDataView(0, 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 parentWidget: YES] == nil) {
			qt_del_QDataView((qt_QDataView *)[self qt]);
		}
		[QtSupport removeQtKey: [self qt]];
		[self setQt: 0L];
	}
	[super dealloc];
}

- setForm: (QSqlForm*)form
{
	qt_QDataView_setForm((qt_QDataView *)[self qt], (qt_QSqlForm*) [form qt]);
	return self;
}

- (QSqlForm*) form
{
	return (QSqlForm*) [QtSupport objectForQtKey: qt_QDataView_form((qt_QDataView *)[self qt]) withClass: [QSqlForm class] allocatedInObjcWorld: YES];
}

- setRecord: (QSqlRecord*)record
{
	qt_QDataView_setRecord((qt_QDataView *)[self qt], (qt_QSqlRecord*) [record qt]);
	return self;
}

- (QSqlRecord*) record
{
	return (QSqlRecord*) [QtSupport objectForQtKey: qt_QDataView_record((qt_QDataView *)[self qt]) withClass: [QSqlRecord class] allocatedInObjcWorld: YES];
}

- refresh: (QSqlRecord*)buf
{
	qt_QDataView_refresh((qt_QDataView *)[self qt], (qt_QSqlRecord*) [buf qt]);
	return self;
}

- readFields
{
	qt_QDataView_readFields((qt_QDataView *)[self qt]);
	return self;
}

- writeFields
{
	qt_QDataView_writeFields((qt_QDataView *)[self qt]);
	return self;
}

- clearValues
{
	qt_QDataView_clearValues((qt_QDataView *)[self qt]);
	return self;
}

@end
