/***************************************************************************
                            KEdit.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_KEdit.h>
#include <kdeobjc/KDESupport.h>
#include <kdeobjc/KEdit.h>
#include <qtobjc/QPopupMenu.h>
#include <qtobjc/QTextStream.h>


@implementation  KEdit


- initWithWidget: (QWidget *)_parent name: (NSString *)name
{
	if ([self qt] == 0L) {
		[self setQt: kde_new_KEdit((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_KEdit(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) {
			kde_del_KEdit((kde_KEdit *)[self qt]);
		}
		[QtSupport removeQtKey: [self qt]];
		[self setQt: 0L];
	}
	[super dealloc];
}

- insertText: (QTextStream*)arg1
{
	kde_KEdit_insertText((kde_KEdit *)[self qt], (qt_QTextStream*) [arg1 qt]);
	return self;
}

- saveText: (QTextStream*)arg1
{
	kde_KEdit_saveText((kde_KEdit *)[self qt], (qt_QTextStream*) [arg1 qt]);
	return self;
}

- selectFont
{
	kde_KEdit_selectFont((kde_KEdit *)[self qt]);
	return self;
}

- search
{
	kde_KEdit_search((kde_KEdit *)[self qt]);
	return self;
}

- (BOOL) repeatSearch
{
	return (BOOL) kde_KEdit_repeatSearch((kde_KEdit *)[self qt]);
}

- replace
{
	kde_KEdit_replace((kde_KEdit *)[self qt]);
	return self;
}

- doGotoLine
{
	kde_KEdit_doGotoLine((kde_KEdit *)[self qt]);
	return self;
}

- cleanWhiteSpace
{
	kde_KEdit_cleanWhiteSpace((kde_KEdit *)[self qt]);
	return self;
}

- installRBPopup: (QPopupMenu*)arg1
{
	kde_KEdit_installRBPopup((kde_KEdit *)[self qt], (qt_QPopupMenu*) [arg1 qt]);
	return self;
}

- (int) currentLine
{
	return (int) kde_KEdit_currentLine((kde_KEdit *)[self qt]);
}

- (int) currentColumn
{
	return (int) kde_KEdit_currentColumn((kde_KEdit *)[self qt]);
}

- spellcheck_start
{
	kde_KEdit_spellcheck_start((kde_KEdit *)[self qt]);
	return self;
}

- spellcheck_stop
{
	kde_KEdit_spellcheck_stop((kde_KEdit *)[self qt]);
	return self;
}

- setOverwriteEnabled: (BOOL)b
{
	kde_KEdit_setOverwriteEnabled((kde_KEdit *)[self qt], (int)b);
	return self;
}

- computePosition
{
	kde_KEdit_computePosition((kde_KEdit *)[self qt]);
	return self;
}

- (int) doSearch: (NSString *)s_pattern case_sensitive: (BOOL)case_sensitive regex: (BOOL)regex forward: (BOOL)forward line: (int)line col: (int)col
{
static qt_QString * _qstring_s_pattern = 0L;
	return (int) kde_KEdit_doSearch((kde_KEdit *)[self qt], (qt_QString *) [s_pattern toQString: &_qstring_s_pattern], (int)case_sensitive, (int)regex, (int)forward, (int)line, (int)col);
}

- (int) doReplace: (NSString *)s_pattern case_sensitive: (BOOL)case_sensitive regex: (BOOL)regex forward: (BOOL)forward line: (int)line col: (int)col replace: (BOOL)replace
{
static qt_QString * _qstring_s_pattern = 0L;
	return (int) kde_KEdit_doReplace((kde_KEdit *)[self qt], (qt_QString *) [s_pattern toQString: &_qstring_s_pattern], (int)case_sensitive, (int)regex, (int)forward, (int)line, (int)col, (int)replace);
}

- posToRowCol: (unsigned int)pos line: (unsigned int)line col: (unsigned int)col
{
	kde_KEdit_posToRowCol((kde_KEdit *)[self qt], (unsigned int)pos, (unsigned int)line, (unsigned int)col);
	return self;
}

- create: (unsigned int)arg1 initializeWindow: (BOOL)initializeWindow destroyOldWindow: (BOOL)destroyOldWindow
{
	kde_KEdit_create((kde_KEdit *)[self qt], (unsigned int)arg1, (int)initializeWindow, (int)destroyOldWindow);
	return self;
}

- create
{
	kde_KEdit_create((kde_KEdit *)[self qt], 0, 1, 1);
	return self;
}

+ (int) NONE
{
	return (int) KEDIT_NONE;
}

+ (int) FORWARD
{
	return (int) KEDIT_FORWARD;
}

+ (int) BACKWARD
{
	return (int) KEDIT_BACKWARD;
}

@end
