/***************************************************************************
                            KHistoryCombo.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_KHistoryCombo.h>
#include <kdeobjc/KDESupport.h>
#include <kdeobjc/KHistoryCombo.h>
#include <kdeobjc/KPixmapProvider.h>


@implementation  KHistoryCombo


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

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

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

- initWithBOOL: (BOOL)useCompletion 
{
	if ([self qt] == 0L) {
		[self setQt: kde_new_KHistoryCombo1((int)useCompletion, 0L, 0L)];
		[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_KHistoryCombo((kde_KHistoryCombo *)[self qt]);
		}
		[QtSupport removeQtKey: [self qt]];
		[self setQt: 0L];
	}
	[super dealloc];
}

- setHistoryItems: (NSArray *)items
{
static qt_QStringList * _qlist_items = 0L;
	kde_KHistoryCombo_setHistoryItems((kde_KHistoryCombo *)[self qt], (qt_QStringList*) [items toQStringList: (void *)&_qlist_items]);
	return self;
}

- setHistoryItems: (NSArray *)items setCompletionList: (BOOL)setCompletionList
{
static qt_QStringList * _qlist_items = 0L;
	kde_KHistoryCombo_setHistoryItems1((kde_KHistoryCombo *)[self qt], (qt_QStringList*) [items toQStringList: (void *)&_qlist_items], (int)setCompletionList);
	return self;
}

- (NSArray *) historyItems
{
static qt_QStringList * _qlist = 0L;
	_qlist = kde_KHistoryCombo_historyItems((kde_KHistoryCombo *)[self qt]);
	return (NSArray *) [NSMutableArray arrayWithQStringList: _qlist];
}

- (BOOL) removeFromHistory: (NSString *)item
{
static qt_QString * _qstring_item = 0L;
	return (BOOL) kde_KHistoryCombo_removeFromHistory((kde_KHistoryCombo *)[self qt], (qt_QString *) [item toQString: &_qstring_item]);
}

- setPixmapProvider: (KPixmapProvider*)prov
{
	kde_KHistoryCombo_setPixmapProvider((kde_KHistoryCombo *)[self qt], (kde_KPixmapProvider*) [prov qt]);
	return self;
}

- (KPixmapProvider*) pixmapProvider
{
	return (KPixmapProvider*) [QtSupport objectForQtKey: kde_KHistoryCombo_pixmapProvider((kde_KHistoryCombo *)[self qt]) withClass: [KPixmapProvider class] allocatedInObjcWorld: YES];
}

- reset
{
	kde_KHistoryCombo_reset((kde_KHistoryCombo *)[self qt]);
	return self;
}

- addToHistory: (NSString *)item
{
static qt_QString * _qstring_item = 0L;
	kde_KHistoryCombo_addToHistory((kde_KHistoryCombo *)[self qt], (qt_QString *) [item toQString: &_qstring_item]);
	return self;
}

- clearHistory
{
	kde_KHistoryCombo_clearHistory((kde_KHistoryCombo *)[self qt]);
	return self;
}

- insertItems: (NSArray *)items
{
static qt_QStringList * _qlist_items = 0L;
	kde_KHistoryCombo_insertItems((kde_KHistoryCombo *)[self qt], (qt_QStringList*) [items toQStringList: (void *)&_qlist_items]);
	return self;
}

- (BOOL) useCompletion
{
	return (BOOL) kde_KHistoryCombo_useCompletion((kde_KHistoryCombo *)[self qt]);
}

@end
