/***************************************************************************
                            KHTMLView.m -  description
                             -------------------
    begin                : Fri Mar  8 13:55:08 2002
    copyright            : (C) 2000-2002 Lost Highway Ltd. All rights reserved.
    email                : Lost_Highway@tipitina.demon.co.uk
    generated by         : duke@tipitina on Fri Mar  8 13:55:08 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_KHTMLView.h>
#include <kdeobjc/KDESupport.h>
#include <kdeobjc/KHTMLView.h>
#include <kdeobjc/KHTMLPart.h>
#include <qtobjc/QPainter.h>
#include <qtobjc/QRect.h>


@implementation  KHTMLView


- initWithHTMLPart: (KHTMLPart*)part parent: (QWidget *)parent name: (NSString *)name
{
	if ([self qt] == 0L) {
		[self setQt: kde_new_KHTMLView((kde_KHTMLPart*) [part qt], (qt_QWidget *) [parent qt], (char*) [name cString])];
		[self setAllocatedInObjcWorld: YES];
		[QtSupport setObject: self forQtKey: [self qt]];
	}
	[super init];
	return self;
}

- initWithHTMLPart: (KHTMLPart*)part parent: (QWidget *)parent 
{
	if ([self qt] == 0L) {
		[self setQt: kde_new_KHTMLView((kde_KHTMLPart*) [part qt], (qt_QWidget *) [parent qt], 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) {
			kde_del_KHTMLView((kde_KHTMLView *)[self qt]);
		}
		[QtSupport removeQtKey: [self qt]];
		[self setQt: 0L];
	}
	[super dealloc];
}

- (KHTMLPart*) part
{
	return (KHTMLPart*) [QtSupport objectForQtKey: kde_KHTMLView_part((kde_KHTMLView *)[self qt]) withClass: [KHTMLPart class] allocatedInObjcWorld: YES];
}

- (int) frameWidth
{
	return (int) kde_KHTMLView_frameWidth((kde_KHTMLView *)[self qt]);
}

- setMarginWidth: (int)x
{
	kde_KHTMLView_setMarginWidth((kde_KHTMLView *)[self qt], (int)x);
	return self;
}

- (int) marginWidth
{
	return (int) kde_KHTMLView_marginWidth((kde_KHTMLView *)[self qt]);
}

- setMarginHeight: (int)y
{
	kde_KHTMLView_setMarginHeight((kde_KHTMLView *)[self qt], (int)y);
	return self;
}

- (int) marginHeight
{
	return (int) kde_KHTMLView_marginHeight((kde_KHTMLView *)[self qt]);
}

- setVScrollBarMode: (int)mode
{
	kde_KHTMLView_setVScrollBarMode((kde_KHTMLView *)[self qt], (int)mode);
	return self;
}

- setHScrollBarMode: (int)mode
{
	kde_KHTMLView_setHScrollBarMode((kde_KHTMLView *)[self qt], (int)mode);
	return self;
}

//- forceHScrollBarMode: (int)mode
//{
//	kde_KHTMLView_forceHScrollBarMode((kde_KHTMLView *)[self qt], (int)mode);
//	return self;
//}

//- forceVScrollBarMode: (int)mode
//{
//	kde_KHTMLView_forceVScrollBarMode((kde_KHTMLView *)[self qt], (int)mode);
//	return self;
//}

- print
{
	kde_KHTMLView_print((kde_KHTMLView *)[self qt]);
	return self;
}

- layout
{
	kde_KHTMLView_layout((kde_KHTMLView *)[self qt]);
	return self;
}

- clear
{
	kde_KHTMLView_clear((kde_KHTMLView *)[self qt]);
	return self;
}

- (BOOL) focusNextPrevChild: (BOOL)next
{
	return (BOOL) kde_KHTMLView_focusNextPrevChild((kde_KHTMLView *)[self qt], (int)next);
}

- drawContents: (QPainter *)p clipx: (int)clipx clipy: (int)clipy clipw: (int)clipw cliph: (int)cliph
{
	kde_KHTMLView_drawContents((kde_KHTMLView *)[self qt], (qt_QPainter *) [p qt], (int)clipx, (int)clipy, (int)clipw, (int)cliph);
	return self;
}

- drawContents: (QPainter *)arg1
{
	kde_KHTMLView_drawContents1((kde_KHTMLView *)[self qt], (qt_QPainter *) [arg1 qt]);
	return self;
}

- doAutoScroll
{
	kde_KHTMLView_doAutoScroll((kde_KHTMLView *)[self qt]);
	return self;
}

- slotPaletteChanged
{
	kde_KHTMLView_slotPaletteChanged((kde_KHTMLView *)[self qt]);
	return self;
}

- slotScrollBarMoved
{
	kde_KHTMLView_slotScrollBarMoved((kde_KHTMLView *)[self qt]);
	return self;
}

@end
