/***************************************************************************
                            KCompletionBase.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_KCompletionBase.h>
#include <kdeobjc/KDESupport.h>
#include <kdeobjc/KCompletionBase.h>
#include <kdeobjc/KShortcut.h>

#include <kdeobjc/KCompletion.h>


@implementation  KCompletionBase


- (void) dealloc
{
	if ([self qt] != 0L) {
		if ([self allocatedInObjcWorld]) {
			kde_del_KCompletionBase((kde_KCompletionBase *)[self qt]);
		}
		[QtSupport removeQtKey: [self qt]];
		[self setQt: 0L];
	}
	[super dealloc];
}

- (KCompletion*) completionObject: (BOOL)hsig
{
	return (KCompletion*) [QtSupport objectForQtKey: kde_KCompletionBase_completionObject((kde_KCompletionBase *)[self qt], (int)hsig) withClass: [KCompletion class] allocatedInObjcWorld: YES];
}

- (KCompletion*) completionObject
{
	return (KCompletion*) [QtSupport objectForQtKey: kde_KCompletionBase_completionObject((kde_KCompletionBase *)[self qt], 1) withClass: [KCompletion class] allocatedInObjcWorld: YES];
}

- setCompletionObject: (KCompletion*)arg1 hsig: (BOOL)hsig
{
	kde_KCompletionBase_setCompletionObject((kde_KCompletionBase *)[self qt], (kde_KCompletion*) [arg1 qt], (int)hsig);
	return self;
}

- setCompletionObject: (KCompletion*)arg1 
{
	kde_KCompletionBase_setCompletionObject((kde_KCompletionBase *)[self qt], (kde_KCompletion*) [arg1 qt], 1);
	return self;
}

- setHandleSignals: (BOOL)arg1
{
	kde_KCompletionBase_setHandleSignals((kde_KCompletionBase *)[self qt], (int)arg1);
	return self;
}

- (BOOL) isCompletionObjectAutoDeleted
{
	return (BOOL) kde_KCompletionBase_isCompletionObjectAutoDeleted((kde_KCompletionBase *)[self qt]);
}

- setAutoDeleteCompletionObject: (BOOL)autoDelete
{
	kde_KCompletionBase_setAutoDeleteCompletionObject((kde_KCompletionBase *)[self qt], (int)autoDelete);
	return self;
}

- setEnableSignals: (BOOL)enable
{
	kde_KCompletionBase_setEnableSignals((kde_KCompletionBase *)[self qt], (int)enable);
	return self;
}

- (BOOL) handleSignals
{
	return (BOOL) kde_KCompletionBase_handleSignals((kde_KCompletionBase *)[self qt]);
}

- (BOOL) emitSignals
{
	return (BOOL) kde_KCompletionBase_emitSignals((kde_KCompletionBase *)[self qt]);
}

- setCompletionMode: (int)mode
{
	kde_KCompletionBase_setCompletionMode((kde_KCompletionBase *)[self qt], (int)mode);
	return self;
}

- (int) completionMode
{
	return (int) kde_KCompletionBase_completionMode((kde_KCompletionBase *)[self qt]);
}

- (BOOL) setKeyBinding: (int)arg1 cut: (KShortcut*)cut
{
	return (BOOL) kde_KCompletionBase_setKeyBinding((kde_KCompletionBase *)[self qt], (int)arg1, (kde_KShortcut*) [cut qt]);
}

- (KShortcut*) getKeyBinding: (int)item
{
	return (KShortcut*) [QtSupport objectForQtKey: kde_KCompletionBase_getKeyBinding((kde_KCompletionBase *)[self qt], (int)item) withClass: [KShortcut class] allocatedInObjcWorld: YES];
}

- useGlobalKeyBindings
{
	kde_KCompletionBase_useGlobalKeyBindings((kde_KCompletionBase *)[self qt]);
	return self;
}

- setCompletedText: (NSString *)text
{
static qt_QString * _qstring_text = 0L;
	kde_KCompletionBase_setCompletedText((kde_KCompletionBase *)[self qt], (qt_QString *) [text toQString: &_qstring_text]);
	return self;
}

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

- (KCompletion*) compObj
{
	return (KCompletion*) [QtSupport objectForQtKey: kde_KCompletionBase_compObj((kde_KCompletionBase *)[self qt]) withClass: [KCompletion class] allocatedInObjcWorld: YES];
}
- (void *) qt
{
	return _qt;
}

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

- (BOOL) allocatedInObjcWorld
{
	return _allocatedInObjcWorld;
}

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


+ (int) TextCompletion
{
	return (int) KCOMPLETIONBASE_TextCompletion;
}

+ (int) PrevCompletionMatch
{
	return (int) KCOMPLETIONBASE_PrevCompletionMatch;
}

+ (int) NextCompletionMatch
{
	return (int) KCOMPLETIONBASE_NextCompletionMatch;
}

+ (int) SubstringCompletion
{
	return (int) KCOMPLETIONBASE_SubstringCompletion;
}

@end
