/***************************************************************************
                            BrowserExtension.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_BrowserExtension.h>
#include <kdeobjc/KDESupport.h>
#include <kdeobjc/BrowserExtension.h>
#include <qtobjc/QDataStream.h>
#include <kdeobjc/ReadOnlyPart.h>
#include <kdeobjc/URLArgs.h>


@implementation  BrowserExtension


- initWithReadOnlyPart: (ReadOnlyPart*)parent name: (NSString *)name
{
	if ([self qt] == 0L) {
		[self setQt: kde_new_BrowserExtension((kde_ReadOnlyPart*) [parent qt], (char*) [name cString])];
		[self setAllocatedInObjcWorld: YES];
		[QtSupport setObject: self forQtKey: [self qt]];
	}
	[super init];
	return self;
}

- initWithReadOnlyPart: (ReadOnlyPart*)parent 
{
	if ([self qt] == 0L) {
		[self setQt: kde_new_BrowserExtension((kde_ReadOnlyPart*) [parent qt], 0L)];
		[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) {
			kde_del_BrowserExtension((kde_BrowserExtension *)[self qt]);
		}
		[QtSupport removeQtKey: [self qt]];
		[self setQt: 0L];
	}
	[super dealloc];
}

- setURLArgs: (URLArgs*)args
{
	kde_BrowserExtension_setURLArgs((kde_BrowserExtension *)[self qt], (kde_URLArgs*) [args qt]);
	return self;
}

- (URLArgs*) urlArgs
{
	return (URLArgs*) [QtSupport objectForQtKey: kde_BrowserExtension_urlArgs((kde_BrowserExtension *)[self qt]) withClass: [URLArgs class] allocatedInObjcWorld: YES];
}

- (int) xOffset
{
	return (int) kde_BrowserExtension_xOffset((kde_BrowserExtension *)[self qt]);
}

- (int) yOffset
{
	return (int) kde_BrowserExtension_yOffset((kde_BrowserExtension *)[self qt]);
}

- saveState: (QDataStream *)stream
{
	kde_BrowserExtension_saveState((kde_BrowserExtension *)[self qt], (qt_QDataStream *) [stream qt]);
	return self;
}

- restoreState: (QDataStream *)stream
{
	kde_BrowserExtension_restoreState((kde_BrowserExtension *)[self qt], (qt_QDataStream *) [stream qt]);
	return self;
}

- (BOOL) isURLDropHandlingEnabled
{
	return (BOOL) kde_BrowserExtension_isURLDropHandlingEnabled((kde_BrowserExtension *)[self qt]);
}

- setURLDropHandlingEnabled: (BOOL)enable
{
	kde_BrowserExtension_setURLDropHandlingEnabled((kde_BrowserExtension *)[self qt], (int)enable);
	return self;
}

//- setBrowserInterface: (BrowserInterface*)impl
//{
//	kde_BrowserExtension_setBrowserInterface((kde_BrowserExtension *)[self qt], (kde_BrowserInterface*) [impl qt]);
//	return self;
//}

//- (BrowserInterface*) browserInterface
//{
//	return (BrowserInterface*) [QtSupport objectForQtKey: kde_BrowserExtension_browserInterface((kde_BrowserExtension *)[self qt]) withClass: [BrowserInterface class] allocatedInObjcWorld: YES];
//}

- (BOOL) isActionEnabled: (NSString *)name
{
	return (BOOL) kde_BrowserExtension_isActionEnabled((kde_BrowserExtension *)[self qt], (char*) [name cString]);
}

//+ (ActionSlotMap) actionSlotMap
//{
//	return (ActionSlotMap) kde_BrowserExtension_actionSlotMap();
//}

//+ (ActionSlotMap*) actionSlotMapPtr
//{
//	return (ActionSlotMap*) kde_BrowserExtension_actionSlotMapPtr();
//}

+ (BrowserExtension*) childObject: (QObject *)obj
{
	return (BrowserExtension*) [QtSupport objectForQtKey: kde_BrowserExtension_childObject((qt_QObject *) [obj qt]) withClass: [BrowserExtension class] allocatedInObjcWorld: YES];
}

@end
