/***************************************************************************
                            QMultiLineEdit.m -  description
                             -------------------
    begin                : Wed Nov 21 12:08:37 2001
    copyright            : (C) 2000-2001 Lost Highway Ltd. All rights reserved.
    email                : Lost_Highway@tipitina.demon.co.uk
    generated by         : duke@tipitina on Wed Nov 21 12:08:37 2001, 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 <qtc/qt_QMultiLineEdit.h>
#include <qtobjc/QMultiLineEdit.h>
#include <qtobjc/QPainter.h>

@implementation  QMultiLineEdit


- initWithWidget: (QWidget *)parent name: (NSString *)name
{
	if ([self qt] == 0L) {
		[self setQt: qt_new_QMultiLineEdit((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: qt_new_QMultiLineEdit(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) {
			qt_del_QMultiLineEdit((qt_QMultiLineEdit *)[self qt]);
		}
		[QtSupport removeQtKey: [self qt]];
		[self setQt: 0L];
	}
	[super dealloc];
}

- (NSString *) textLine: (int)line
{
static qt_QString * _qstring = 0L;
	_qstring = qt_QMultiLineEdit_textLine((qt_QMultiLineEdit *)[self qt], (int)line);
	return [NSString fromQString: _qstring];
}

- (int) numLines
{
	return (int) qt_QMultiLineEdit_numLines((qt_QMultiLineEdit *)[self qt]);
}

- insertLine: (NSString *)s line: (int)line
{
static qt_QString * _qstring_s = 0L;
	qt_QMultiLineEdit_insertLine((qt_QMultiLineEdit *)[self qt], (qt_QString *) [s toQString: &_qstring_s], (int)line);
	return self;
}

- insertLine: (NSString *)s 
{
static qt_QString * _qstring_s = 0L;
	qt_QMultiLineEdit_insertLine((qt_QMultiLineEdit *)[self qt], (qt_QString *) [s toQString: &_qstring_s], -1);
	return self;
}

- insertAt: (NSString *)s line: (int)line col: (int)col mark: (BOOL)mark
{
static qt_QString * _qstring_s = 0L;
	qt_QMultiLineEdit_insertAt((qt_QMultiLineEdit *)[self qt], (qt_QString *) [s toQString: &_qstring_s], (int)line, (int)col, (int)mark);
	return self;
}

- insertAt: (NSString *)s line: (int)line col: (int)col 
{
static qt_QString * _qstring_s = 0L;
	qt_QMultiLineEdit_insertAt((qt_QMultiLineEdit *)[self qt], (qt_QString *) [s toQString: &_qstring_s], (int)line, (int)col, 0);
	return self;
}

- removeLine: (int)line
{
	qt_QMultiLineEdit_removeLine((qt_QMultiLineEdit *)[self qt], (int)line);
	return self;
}

- setCursorPosition: (int)line col: (int)col mark: (BOOL)mark
{
	qt_QMultiLineEdit_setCursorPosition((qt_QMultiLineEdit *)[self qt], (int)line, (int)col, (int)mark);
	return self;
}

- setCursorPosition: (int)line col: (int)col 
{
	qt_QMultiLineEdit_setCursorPosition((qt_QMultiLineEdit *)[self qt], (int)line, (int)col, 0);
	return self;
}

- (BOOL) atBeginning
{
	return (BOOL) qt_QMultiLineEdit_atBeginning((qt_QMultiLineEdit *)[self qt]);
}

- (BOOL) atEnd
{
	return (BOOL) qt_QMultiLineEdit_atEnd((qt_QMultiLineEdit *)[self qt]);
}

- setAlignment: (int)flags
{
	qt_QMultiLineEdit_setAlignment((qt_QMultiLineEdit *)[self qt], (int)flags);
	return self;
}

- (int) alignment
{
	return (int) qt_QMultiLineEdit_alignment((qt_QMultiLineEdit *)[self qt]);
}

- setEdited: (BOOL)arg1
{
	qt_QMultiLineEdit_setEdited((qt_QMultiLineEdit *)[self qt], (int)arg1);
	return self;
}

- (BOOL) edited
{
	return (BOOL) qt_QMultiLineEdit_edited((qt_QMultiLineEdit *)[self qt]);
}

- (BOOL) hasMarkedText
{
	return (BOOL) qt_QMultiLineEdit_hasMarkedText((qt_QMultiLineEdit *)[self qt]);
}

- (NSString *) markedText
{
static qt_QString * _qstring = 0L;
	_qstring = qt_QMultiLineEdit_markedText((qt_QMultiLineEdit *)[self qt]);
	return [NSString fromQString: _qstring];
}

- cursorWordForward: (BOOL)mark
{
	qt_QMultiLineEdit_cursorWordForward((qt_QMultiLineEdit *)[self qt], (int)mark);
	return self;
}

- cursorWordBackward: (BOOL)mark
{
	qt_QMultiLineEdit_cursorWordBackward((qt_QMultiLineEdit *)[self qt], (int)mark);
	return self;
}

- (BOOL) autoUpdate
{
	return (BOOL) qt_QMultiLineEdit_autoUpdate((qt_QMultiLineEdit *)[self qt]);
}

- setAutoUpdate: (BOOL)arg1
{
	qt_QMultiLineEdit_setAutoUpdate((qt_QMultiLineEdit *)[self qt], (int)arg1);
	return self;
}

- (int) totalWidth
{
	return (int) qt_QMultiLineEdit_totalWidth((qt_QMultiLineEdit *)[self qt]);
}

- (int) totalHeight
{
	return (int) qt_QMultiLineEdit_totalHeight((qt_QMultiLineEdit *)[self qt]);
}

- (int) maxLines
{
	return (int) qt_QMultiLineEdit_maxLines((qt_QMultiLineEdit *)[self qt]);
}

- setMaxLines: (int)arg1
{
	qt_QMultiLineEdit_setMaxLines((qt_QMultiLineEdit *)[self qt], (int)arg1);
	return self;
}

- deselect
{
	qt_QMultiLineEdit_deselect((qt_QMultiLineEdit *)[self qt]);
	return self;
}

- (QPoint*) cursorPoint
{
	return (QPoint*) [QtSupport objectForQtKey: qt_QMultiLineEdit_cursorPoint((qt_QMultiLineEdit *)[self qt]) withClass: [QPoint class] allocatedInObjcWorld: YES];
}

- insertAndMark: (NSString *)arg1 mark: (BOOL)mark
{
static qt_QString * _qstring_arg1 = 0L;
	qt_QMultiLineEdit_insertAndMark((qt_QMultiLineEdit *)[self qt], (qt_QString *) [arg1 toQString: &_qstring_arg1], (int)mark);
	return self;
}

- newLine
{
	qt_QMultiLineEdit_newLine((qt_QMultiLineEdit *)[self qt]);
	return self;
}

- killLine
{
	qt_QMultiLineEdit_killLine((qt_QMultiLineEdit *)[self qt]);
	return self;
}

- pageUp: (BOOL)mark
{
	qt_QMultiLineEdit_pageUp((qt_QMultiLineEdit *)[self qt], (int)mark);
	return self;
}

- pageUp
{
	qt_QMultiLineEdit_pageUp((qt_QMultiLineEdit *)[self qt], 0);
	return self;
}

- pageDown: (BOOL)mark
{
	qt_QMultiLineEdit_pageDown((qt_QMultiLineEdit *)[self qt], (int)mark);
	return self;
}

- pageDown
{
	qt_QMultiLineEdit_pageDown((qt_QMultiLineEdit *)[self qt], 0);
	return self;
}

- cursorLeft: (BOOL)mark wrap: (BOOL)wrap
{
	qt_QMultiLineEdit_cursorLeft((qt_QMultiLineEdit *)[self qt], (int)mark, (int)wrap);
	return self;
}

- cursorLeft
{
	qt_QMultiLineEdit_cursorLeft((qt_QMultiLineEdit *)[self qt], 0, 1);
	return self;
}

- cursorRight: (BOOL)mark wrap: (BOOL)wrap
{
	qt_QMultiLineEdit_cursorRight((qt_QMultiLineEdit *)[self qt], (int)mark, (int)wrap);
	return self;
}

- cursorRight
{
	qt_QMultiLineEdit_cursorRight((qt_QMultiLineEdit *)[self qt], 0, 1);
	return self;
}

- cursorUp: (BOOL)mark
{
	qt_QMultiLineEdit_cursorUp((qt_QMultiLineEdit *)[self qt], (int)mark);
	return self;
}

- cursorUp
{
	qt_QMultiLineEdit_cursorUp((qt_QMultiLineEdit *)[self qt], 0);
	return self;
}

- cursorDown: (BOOL)mark
{
	qt_QMultiLineEdit_cursorDown((qt_QMultiLineEdit *)[self qt], (int)mark);
	return self;
}

- cursorDown
{
	qt_QMultiLineEdit_cursorDown((qt_QMultiLineEdit *)[self qt], 0);
	return self;
}

- backspace
{
	qt_QMultiLineEdit_backspace((qt_QMultiLineEdit *)[self qt]);
	return self;
}

- home: (BOOL)mark
{
	qt_QMultiLineEdit_home((qt_QMultiLineEdit *)[self qt], (int)mark);
	return self;
}

- home
{
	qt_QMultiLineEdit_home((qt_QMultiLineEdit *)[self qt], 0);
	return self;
}

- end: (BOOL)mark
{
	qt_QMultiLineEdit_end((qt_QMultiLineEdit *)[self qt], (int)mark);
	return self;
}

- end
{
	qt_QMultiLineEdit_end((qt_QMultiLineEdit *)[self qt], 0);
	return self;
}

- (BOOL) getMarkedRegion: (int*)line1 col1: (int*)col1 line2: (int*)line2 col2: (int*)col2
{
	return (BOOL) qt_QMultiLineEdit_getMarkedRegion((qt_QMultiLineEdit *)[self qt], (int*)line1, (int*)col1, (int*)line2, (int*)col2);
}

- (int) lineLength: (int)row
{
	return (int) qt_QMultiLineEdit_lineLength((qt_QMultiLineEdit *)[self qt], (int)row);
}

@end
