/***************************************************************************
                            KEditListBox.m -  description
                             -------------------
    begin                : Thu Mar 21 01:01:29 2002
    copyright            : (C) 2000-2002 Lost Highway Ltd. All rights reserved.
    email                : Lost_Highway@tipitina.demon.co.uk
    generated by         : duke@tipitina on Thu Mar 21 01:01:29 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_KEditListBox.h>
#include <kdeobjc/KDESupport.h>
#include <kdeobjc/KEditListBox.h>

@implementation  KEditListBox


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

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

- initWithText: (NSString *)title parent: (QWidget *)parent name: (NSString *)name checkAtEntering: (BOOL)checkAtEntering buttons: (int)buttons
{
static qt_QString * _qstring_title = 0L;
	if ([self qt] == 0L) {
		[self setQt: kde_new_KEditListBox1((qt_QString *) [title toQString: &_qstring_title], (qt_QWidget *) [parent qt], (char*) [name cString], (int)checkAtEntering, (int)buttons)];
		[self setAllocatedInObjcWorld: YES];
		[QtSupport setObject: self forQtKey: [self qt]];
	}
	[super init];
	return self;
}

- initWithText: (NSString *)title 
{
static qt_QString * _qstring_title = 0L;
	if ([self qt] == 0L) {
		[self setQt: kde_new_KEditListBox1((qt_QString *) [title toQString: &_qstring_title], 0, 0, 0, [KEditListBox All])];
		[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_KEditListBox((kde_KEditListBox *)[self qt]);
		}
		[QtSupport removeQtKey: [self qt]];
		[self setQt: 0L];
	}
	[super dealloc];
}

- (QListBox*) listBox
{
	return (QListBox*) [QtSupport objectForQtKey: kde_KEditListBox_listBox((kde_KEditListBox *)[self qt]) withClass: [QListBox class] allocatedInObjcWorld: YES];
}

- (KLineEdit*) lineEdit
{
	return (KLineEdit*) [QtSupport objectForQtKey: kde_KEditListBox_lineEdit((kde_KEditListBox *)[self qt]) withClass: [KLineEdit class] allocatedInObjcWorld: YES];
}

- (QPushButton*) addButton
{
	return (QPushButton*) [QtSupport objectForQtKey: kde_KEditListBox_addButton((kde_KEditListBox *)[self qt]) withClass: [QPushButton class] allocatedInObjcWorld: YES];
}

- (QPushButton*) removeButton
{
	return (QPushButton*) [QtSupport objectForQtKey: kde_KEditListBox_removeButton((kde_KEditListBox *)[self qt]) withClass: [QPushButton class] allocatedInObjcWorld: YES];
}

- (QPushButton*) upButton
{
	return (QPushButton*) [QtSupport objectForQtKey: kde_KEditListBox_upButton((kde_KEditListBox *)[self qt]) withClass: [QPushButton class] allocatedInObjcWorld: YES];
}

- (QPushButton*) downButton
{
	return (QPushButton*) [QtSupport objectForQtKey: kde_KEditListBox_downButton((kde_KEditListBox *)[self qt]) withClass: [QPushButton class] allocatedInObjcWorld: YES];
}

- (int) count
{
	return (int) kde_KEditListBox_count((kde_KEditListBox *)[self qt]);
}

- insertStringList: (NSArray *)list index: (int)index
{
static qt_QStringList * _qlist_list = 0L;
	kde_KEditListBox_insertStringList((kde_KEditListBox *)[self qt], (qt_QStringList*) [list toQStringList: (void *)&_qlist_list], (int)index);
	return self;
}

- insertStringList: (NSArray *)list 
{
static qt_QStringList * _qlist_list = 0L;
	kde_KEditListBox_insertStringList((kde_KEditListBox *)[self qt], (qt_QStringList*) [list toQStringList: (void *)&_qlist_list], -1);
	return self;
}

- insertStrList: (NSArray *)list index: (int)index
{
static qt_QStrList * _qlist_list = 0L;
	kde_KEditListBox_insertStrList((kde_KEditListBox *)[self qt], (qt_QStrList *) [list toQStrList: (void *)&_qlist_list], (int)index);
	return self;
}

- insertStrList: (NSArray *)list 
{
static qt_QStrList * _qlist_list = 0L;
	kde_KEditListBox_insertStrList((kde_KEditListBox *)[self qt], (qt_QStrList *) [list toQStrList: (void *)&_qlist_list], -1);
	return self;
}

//- insertStrList: (NSArray *)list index: (int)index
//{
//static qt_QStrList * _qlist_list = 0L;
//	kde_KEditListBox_insertStrList1((kde_KEditListBox *)[self qt], (qt_QStrList *) [list toQStrList: (void *)&_qlist_list], (int)index);
//	return self;
//}

//- insertStrList: (NSArray *)list
//{
//static qt_QStrList * _qlist_list = 0L;
//	kde_KEditListBox_insertStrList1((kde_KEditListBox *)[self qt], (qt_QStrList *) [list toQStrList: (void *)&_qlist_list], -1);
//	return self;
//}

- insertStrListFromString: (NSString *)list numStrings: (int)numStrings index: (int)index
{
	kde_KEditListBox_insertStrList2((kde_KEditListBox *)[self qt], (char**) [list cString], (int)numStrings, (int)index);
	return self;
}

- insertStrListFromString: (NSString *)list
{
	kde_KEditListBox_insertStrList2((kde_KEditListBox *)[self qt], (char**) [list cString], -1, -1);
	return self;
}

- insertTextItem: (NSString *)text index: (int)index
{
static qt_QString * _qstring_text = 0L;
	kde_KEditListBox_insertItem((kde_KEditListBox *)[self qt], (qt_QString *) [text toQString: &_qstring_text], (int)index);
	return self;
}

- insertTextItem: (NSString *)text 
{
static qt_QString * _qstring_text = 0L;
	kde_KEditListBox_insertItem((kde_KEditListBox *)[self qt], (qt_QString *) [text toQString: &_qstring_text], -1);
	return self;
}

- clear
{
	kde_KEditListBox_clear((kde_KEditListBox *)[self qt]);
	return self;
}

- (NSString *) text: (int)index
{
static qt_QString * _qstring = 0L;
	_qstring = kde_KEditListBox_text((kde_KEditListBox *)[self qt], (int)index);
	return [NSString fromQString: _qstring];
}

- (int) currentItem
{
	return (int) kde_KEditListBox_currentItem((kde_KEditListBox *)[self qt]);
}

- (NSString *) currentText
{
static qt_QString * _qstring = 0L;
	_qstring = kde_KEditListBox_currentText((kde_KEditListBox *)[self qt]);
	return [NSString fromQString: _qstring];
}

- (NSArray *) items
{
static qt_QStringList * _qlist = 0L;
	_qlist = kde_KEditListBox_items((kde_KEditListBox *)[self qt]);
	return (NSArray *) [NSMutableArray arrayWithQStringList: _qlist];
}

- virtual_hook: (int)identifier data: (void*)data
{
	kde_KEditListBox_virtual_hook((kde_KEditListBox *)[self qt], (int)identifier, (void*)data);
	return self;
}

- moveItemUp
{
	kde_KEditListBox_moveItemUp((kde_KEditListBox *)[self qt]);
	return self;
}

- moveItemDown
{
	kde_KEditListBox_moveItemDown((kde_KEditListBox *)[self qt]);
	return self;
}

- addItem
{
	kde_KEditListBox_addItem((kde_KEditListBox *)[self qt]);
	return self;
}

- removeItem
{
	kde_KEditListBox_removeItem((kde_KEditListBox *)[self qt]);
	return self;
}

- enableMoveButtons: (int)index
{
	kde_KEditListBox_enableMoveButtons((kde_KEditListBox *)[self qt], (int)index);
	return self;
}

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

+ (int) Add
{
	return (int) KEDITLISTBOX_Add;
}

+ (int) Remove
{
	return (int) KEDITLISTBOX_Remove;
}

+ (int) UpDown
{
	return (int) KEDITLISTBOX_UpDown;
}

+ (int) All
{
	return (int) KEDITLISTBOX_All;
}

@end
