/***************************************************************************
                            KURLComboBox.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_KURLComboBox.h>
#include <kdeobjc/KDESupport.h>
#include <kdeobjc/KURLComboBox.h>
#include <kdeobjc/KURL.h>
#include <qtobjc/QPixmap.h>


@implementation  KURLComboBox


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

- initWithInt: (int)mode 
{
	if ([self qt] == 0L) {
		[self setQt: kde_new_KURLComboBox((int)mode, 0, 0)];
		[self setAllocatedInObjcWorld: YES];
		[QtSupport setObject: self forQtKey: [self qt]];
	}
	[super init];
	return self;
}

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

- initWithInt: (int)mode rw: (BOOL)rw 
{
	if ([self qt] == 0L) {
		[self setQt: kde_new_KURLComboBox1((int)mode, (int)rw, 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_KURLComboBox((kde_KURLComboBox *)[self qt]);
		}
		[QtSupport removeQtKey: [self qt]];
		[self setQt: 0L];
	}
	[super dealloc];
}

- setURL: (KURL*)url
{
	kde_KURLComboBox_setURL((kde_KURLComboBox *)[self qt], (kde_KURL*) [url qt]);
	return self;
}

- setURLs: (NSArray *)urls
{
static qt_QStringList * _qlist_urls = 0L;
	kde_KURLComboBox_setURLs((kde_KURLComboBox *)[self qt], (qt_QStringList*) [urls toQStringList: (void *)&_qlist_urls]);
	return self;
}

- setURLs: (NSArray *)urls remove: (int)remove
{
static qt_QStringList * _qlist_urls = 0L;
	kde_KURLComboBox_setURLs1((kde_KURLComboBox *)[self qt], (qt_QStringList*) [urls toQStringList: (void *)&_qlist_urls], (int)remove);
	return self;
}

- (NSArray *) urls
{
static qt_QStringList * _qlist = 0L;
	_qlist = kde_KURLComboBox_urls((kde_KURLComboBox *)[self qt]);
	return (NSArray *) [NSMutableArray arrayWithQStringList: _qlist];
}

- setMaxItems: (int)arg1
{
	kde_KURLComboBox_setMaxItems((kde_KURLComboBox *)[self qt], (int)arg1);
	return self;
}

- (int) maxItems
{
	return (int) kde_KURLComboBox_maxItems((kde_KURLComboBox *)[self qt]);
}

- addDefaultURL: (KURL*)url text: (NSString *)text
{
static qt_QString * _qstring_text = 0L;
	kde_KURLComboBox_addDefaultURL((kde_KURLComboBox *)[self qt], (kde_KURL*) [url qt], (qt_QString *) [text toQString: &_qstring_text]);
	return self;
}

- addDefaultURL: (KURL*)url 
{
	kde_KURLComboBox_addDefaultURL((kde_KURLComboBox *)[self qt], (kde_KURL*) [url qt], qt_QString_null());
	return self;
}

- addDefaultURL: (KURL*)url pixmap: (QPixmap *)pix text: (NSString *)text
{
static qt_QString * _qstring_text = 0L;
	kde_KURLComboBox_addDefaultURL1((kde_KURLComboBox *)[self qt], (kde_KURL*) [url qt], (qt_QPixmap *) [pix qt], (qt_QString *) [text toQString: &_qstring_text]);
	return self;
}

- addDefaultURL: (KURL*)url pixmap: (QPixmap *)pix 
{
	kde_KURLComboBox_addDefaultURL1((kde_KURLComboBox *)[self qt], (kde_KURL*) [url qt], (qt_QPixmap *) [pix qt], qt_QString_null());
	return self;
}

- setDefaults
{
	kde_KURLComboBox_setDefaults((kde_KURLComboBox *)[self qt]);
	return self;
}

- removeURL: (KURL*)url checkDefaultURLs: (BOOL)checkDefaultURLs
{
	kde_KURLComboBox_removeURL((kde_KURLComboBox *)[self qt], (kde_KURL*) [url qt], (int)checkDefaultURLs);
	return self;
}

- removeURL: (KURL*)url 
{
	kde_KURLComboBox_removeURL((kde_KURLComboBox *)[self qt], (kde_KURL*) [url qt], 1);
	return self;
}

- init: (int)mode
{
	kde_KURLComboBox_init((kde_KURLComboBox *)[self qt], (int)mode);
	return self;
}

//- insertURLItem: (KURLComboItem*)arg1
//{
//	kde_KURLComboBox_insertURLItem((kde_KURLComboBox *)[self qt], (kde_KURLComboItem*) [arg1 qt]);
//	return self;
//}

- (QPixmap*) getPixmap: (KURL*)url
{
	return (QPixmap*) [QtSupport objectForQtKey: kde_KURLComboBox_getPixmap((kde_KURLComboBox *)[self qt], (kde_KURL*) [url qt]) withClass: [QPixmap class] allocatedInObjcWorld: YES];
}

//- updateURLComboItem: (KURLComboItem*)item index: (int)index pixmap: (QPixmap *)pix
//{
//	kde_KURLComboBox_updateItem((kde_KURLComboBox *)[self qt], (kde_KURLComboItem*) [item qt], (int)index, (qt_QPixmap *) [pix qt]);
//	return self;
//}

- slotActivated: (int)arg1
{
	kde_KURLComboBox_slotActivated((kde_KURLComboBox *)[self qt], (int)arg1);
	return self;
}

+ (int) Files
{
	return (int) KURLCOMBOBOX_Files;
}

+ (int) Directories
{
	return (int) KURLCOMBOBOX_Directories;
}

+ (int) Both
{
	return (int) KURLCOMBOBOX_Both;
}

+ (int) RemoveTop
{
	return (int) KURLCOMBOBOX_RemoveTop;
}

+ (int) RemoveBottom
{
	return (int) KURLCOMBOBOX_RemoveBottom;
}

@end
