/***************************************************************************
                            QLineEdit.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_QLineEdit.h>
#include <qtobjc/QLineEdit.h>
#include <qtobjc/QFont.h>
#include <qtobjc/QPainter.h>

#include <qtobjc/QValidator.h>
#include <qtobjc/QPalette.h>

@implementation  QLineEdit


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

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

- initWithText: (NSString *)arg1 parent: (QWidget *)parent name: (NSString *)name
{
static qt_QString * _qstring_arg1 = 0L;
	if ([self qt] == 0L) {
		[self setQt: qt_new_QLineEdit1((qt_QString *) [arg1 toQString: &_qstring_arg1], (qt_QWidget *) [parent qt], (char*) [name cString])];
		[self setAllocatedInObjcWorld: YES];
		[QtSupport setObject: self forQtKey: [self qt]];
	}
	[super init];
	return self;
}

- initWithText: (NSString *)arg1 parent: (QWidget *)parent 
{
static qt_QString * _qstring_arg1 = 0L;
	if ([self qt] == 0L) {
		[self setQt: qt_new_QLineEdit1((qt_QString *) [arg1 toQString: &_qstring_arg1], (qt_QWidget *) [parent qt], 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_QLineEdit((qt_QLineEdit *)[self qt]);
		}
		[QtSupport removeQtKey: [self qt]];
		[self setQt: 0L];
	}
	[super dealloc];
}

- (NSString *) text
{
static qt_QString * _qstring = 0L;
	_qstring = qt_QLineEdit_text((qt_QLineEdit *)[self qt]);
	return [NSString fromQString: _qstring];
}

- (NSString *) displayText
{
static qt_QString * _qstring = 0L;
	_qstring = qt_QLineEdit_displayText((qt_QLineEdit *)[self qt]);
	return [NSString fromQString: _qstring];
}

- (int) maxLength
{
	return (int) qt_QLineEdit_maxLength((qt_QLineEdit *)[self qt]);
}

- (BOOL) frame
{
	return (BOOL) qt_QLineEdit_frame((qt_QLineEdit *)[self qt]);
}

- (int) echoMode
{
	return (int) qt_QLineEdit_echoMode((qt_QLineEdit *)[self qt]);
}

- (BOOL) isReadOnly
{
	return (BOOL) qt_QLineEdit_isReadOnly((qt_QLineEdit *)[self qt]);
}

- (QValidator*) validator
{
	return (QValidator*) [QtSupport objectForQtKey: qt_QLineEdit_validator((qt_QLineEdit *)[self qt]) withClass: [QValidator class] allocatedInObjcWorld: YES];
}

- (QSize*) sizeHint
{
	return (QSize*) [QtSupport objectForQtKey: qt_QLineEdit_sizeHint((qt_QLineEdit *)[self qt]) withClass: [QSize class] allocatedInObjcWorld: YES];
}

- (QSize*) minimumSizeHint
{
	return (QSize*) [QtSupport objectForQtKey: qt_QLineEdit_minimumSizeHint((qt_QLineEdit *)[self qt]) withClass: [QSize class] allocatedInObjcWorld: YES];
}

- (int) cursorPosition
{
	return (int) qt_QLineEdit_cursorPosition((qt_QLineEdit *)[self qt]);
}

- (BOOL) validateAndSet: (NSString *)arg1 int: (int)arg2 int: (int)arg3 int: (int)arg4
{
static qt_QString * _qstring_arg1 = 0L;
	return (BOOL) qt_QLineEdit_validateAndSet((qt_QLineEdit *)[self qt], (qt_QString *) [arg1 toQString: &_qstring_arg1], (int)arg2, (int)arg3, (int)arg4);
}

- (int) alignment
{
	return (int) qt_QLineEdit_alignment((qt_QLineEdit *)[self qt]);
}

- cursorLeft: (BOOL)mark steps: (int)steps
{
	qt_QLineEdit_cursorLeft((qt_QLineEdit *)[self qt], (int)mark, (int)steps);
	return self;
}

- cursorLeft: (BOOL)mark 
{
	qt_QLineEdit_cursorLeft((qt_QLineEdit *)[self qt], (int)mark, 1);
	return self;
}

- cursorRight: (BOOL)mark steps: (int)steps
{
	qt_QLineEdit_cursorRight((qt_QLineEdit *)[self qt], (int)mark, (int)steps);
	return self;
}

- cursorRight: (BOOL)mark 
{
	qt_QLineEdit_cursorRight((qt_QLineEdit *)[self qt], (int)mark, 1);
	return self;
}

- cursorForward: (BOOL)mark steps: (int)steps
{
	qt_QLineEdit_cursorForward((qt_QLineEdit *)[self qt], (int)mark, (int)steps);
	return self;
}

- cursorForward: (BOOL)mark 
{
	qt_QLineEdit_cursorForward((qt_QLineEdit *)[self qt], (int)mark, 1);
	return self;
}

- cursorBackward: (BOOL)mark steps: (int)steps
{
	qt_QLineEdit_cursorBackward((qt_QLineEdit *)[self qt], (int)mark, (int)steps);
	return self;
}

- cursorBackward: (BOOL)mark 
{
	qt_QLineEdit_cursorBackward((qt_QLineEdit *)[self qt], (int)mark, 1);
	return self;
}

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

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

- backspace
{
	qt_QLineEdit_backspace((qt_QLineEdit *)[self qt]);
	return self;
}

- del
{
	qt_QLineEdit_del((qt_QLineEdit *)[self qt]);
	return self;
}

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

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

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

- (BOOL) edited
{
	return (BOOL) qt_QLineEdit_edited((qt_QLineEdit *)[self qt]);
}

- (BOOL) hasSelectedText
{
	return (BOOL) qt_QLineEdit_hasSelectedText((qt_QLineEdit *)[self qt]);
}

- (NSString *) selectedText
{
static qt_QString * _qstring = 0L;
	_qstring = qt_QLineEdit_selectedText((qt_QLineEdit *)[self qt]);
	return [NSString fromQString: _qstring];
}

- (BOOL) getSelection: (int*)start end: (int*)end
{
	return (BOOL) qt_QLineEdit_getSelection((qt_QLineEdit *)[self qt], (int*)start, (int*)end);
}

- (BOOL) isUndoAvailable
{
	return (BOOL) qt_QLineEdit_isUndoAvailable((qt_QLineEdit *)[self qt]);
}

- (BOOL) isRedoAvailable
{
	return (BOOL) qt_QLineEdit_isRedoAvailable((qt_QLineEdit *)[self qt]);
}

- (BOOL) hasMarkedText
{
	return (BOOL) qt_QLineEdit_hasMarkedText((qt_QLineEdit *)[self qt]);
}

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

- (BOOL) dragEnabled
{
	return (BOOL) qt_QLineEdit_dragEnabled((qt_QLineEdit *)[self qt]);
}

- (int) characterAt: (int)xpos chr: (unichar *)chr
{
	return (int) qt_QLineEdit_characterAt((qt_QLineEdit *)[self qt], (int)xpos, (qt_QChar*)chr);
}

- setText: (NSString *)arg1
{
static qt_QString * _qstring_arg1 = 0L;
	qt_QLineEdit_setText((qt_QLineEdit *)[self qt], (qt_QString *) [arg1 toQString: &_qstring_arg1]);
	return self;
}

- selectAll
{
	qt_QLineEdit_selectAll((qt_QLineEdit *)[self qt]);
	return self;
}

- deselect
{
	qt_QLineEdit_deselect((qt_QLineEdit *)[self qt]);
	return self;
}

- clearValidator
{
	qt_QLineEdit_clearValidator((qt_QLineEdit *)[self qt]);
	return self;
}

- insert: (NSString *)arg1
{
static qt_QString * _qstring_arg1 = 0L;
	qt_QLineEdit_insert((qt_QLineEdit *)[self qt], (qt_QString *) [arg1 toQString: &_qstring_arg1]);
	return self;
}

- clear
{
	qt_QLineEdit_clear((qt_QLineEdit *)[self qt]);
	return self;
}

- undo
{
	qt_QLineEdit_undo((qt_QLineEdit *)[self qt]);
	return self;
}

- redo
{
	qt_QLineEdit_redo((qt_QLineEdit *)[self qt]);
	return self;
}

- setMaxLength: (int)arg1
{
	qt_QLineEdit_setMaxLength((qt_QLineEdit *)[self qt], (int)arg1);
	return self;
}

- setFrame: (BOOL)arg1
{
	qt_QLineEdit_setFrame((qt_QLineEdit *)[self qt], (int)arg1);
	return self;
}

- setEchoMode: (int)arg1
{
	qt_QLineEdit_setEchoMode((qt_QLineEdit *)[self qt], (int)arg1);
	return self;
}

- setReadOnly: (BOOL)arg1
{
	qt_QLineEdit_setReadOnly((qt_QLineEdit *)[self qt], (int)arg1);
	return self;
}

- setValidator: (QValidator *)arg1
{
	qt_QLineEdit_setValidator((qt_QLineEdit *)[self qt], (qt_QValidator *) [arg1 qt]);
	return self;
}

- setFont: (QFont *)arg1
{
	qt_QLineEdit_setFont((qt_QLineEdit *)[self qt], (qt_QFont *) [arg1 qt]);
	return self;
}

- setPalette: (QPalette *)arg1
{
	qt_QLineEdit_setPalette((qt_QLineEdit *)[self qt], (qt_QPalette *) [arg1 qt]);
	return self;
}

- setSelection: (int)arg1 int: (int)arg2
{
	qt_QLineEdit_setSelection((qt_QLineEdit *)[self qt], (int)arg1, (int)arg2);
	return self;
}

- setCursorPosition: (int)arg1
{
	qt_QLineEdit_setCursorPosition((qt_QLineEdit *)[self qt], (int)arg1);
	return self;
}

- setAlignment: (int)flag
{
	qt_QLineEdit_setAlignment((qt_QLineEdit *)[self qt], (int)flag);
	return self;
}

- cut
{
	qt_QLineEdit_cut((qt_QLineEdit *)[self qt]);
	return self;
}

- copy
{
	qt_QLineEdit_copy((qt_QLineEdit *)[self qt]);
	return self;
}

- paste
{
	qt_QLineEdit_paste((qt_QLineEdit *)[self qt]);
	return self;
}

- setDragEnabled: (BOOL)b
{
	qt_QLineEdit_setDragEnabled((qt_QLineEdit *)[self qt], (int)b);
	return self;
}

- (BOOL) event: (QEvent *)arg1
{
	return (BOOL) qt_QLineEdit_event((qt_QLineEdit *)[self qt], (qt_QEvent *) [arg1 qt]);
}

- drawContents: (QPainter *)painter
{
	qt_QLineEdit_drawContents((qt_QLineEdit *)[self qt], (qt_QPainter *) [painter qt]);
	return self;
}

- repaintArea: (int)arg1 int: (int)arg2
{
	qt_QLineEdit_repaintArea((qt_QLineEdit *)[self qt], (int)arg1, (int)arg2);
	return self;
}

- (QPopupMenu*) createPopupMenu
{
	return (QPopupMenu*) [QtSupport objectForQtKey: qt_QLineEdit_createPopupMenu((qt_QLineEdit *)[self qt]) withClass: [QPopupMenu class] allocatedInObjcWorld: YES];
}

- windowActivationChange: (BOOL)arg1
{
	qt_QLineEdit_windowActivationChange((qt_QLineEdit *)[self qt], (int)arg1);
	return self;
}

+ (int) Normal
{
	return (int) QLINEEDIT_Normal;
}

+ (int) NoEcho
{
	return (int) QLINEEDIT_NoEcho;
}

+ (int) Password
{
	return (int) QLINEEDIT_Password;
}

@end
