/***************************************************************************
                            QListViewItem.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_QListViewItem.h>
#include <qtobjc/QListViewItem.h>
#include <qtobjc/QPoint.h>

#include <qtobjc/QListView.h>
#include <qtobjc/QPainter.h>
#include <qtobjc/QColorGroup.h>
#include <qtobjc/QFontMetrics.h>
#include <qtobjc/QPixmap.h>

@implementation  QListViewItem


- initWithListView: (QListView *)parent
{
	if ([self qt] == 0L) {
		[self setQt: qt_new_QListViewItem((qt_QListView *) [parent qt])];
		[self setAllocatedInObjcWorld: YES];
		[QtSupport setObject: self forQtKey: [self qt]];
	}
	[super init];
	return self;
}

- copyWithZone: (NSZone *) zone
{
	QListViewItem * aCopy;
	aCopy = [[(QListViewItem *)[[self class] allocWithZone: zone] setQt: qt_new_QListViewItem1([self qt])] init];
	[aCopy setAllocatedInObjcWorld: YES];
	[QtSupport setObject: aCopy forQtKey: [aCopy qt]];
	return aCopy;
}

- initWithListView: (QListView *)parent after: (QListViewItem *)after
{
	if ([self qt] == 0L) {
		[self setQt: qt_new_QListViewItem2((qt_QListView *) [parent qt], (qt_QListViewItem *) [after qt])];
		[self setAllocatedInObjcWorld: YES];
		[QtSupport setObject: self forQtKey: [self qt]];
	}
	[super init];
	return self;
}

- initWithListViewItem: (QListViewItem *)parent after: (QListViewItem *)after
{
	if ([self qt] == 0L) {
		[self setQt: qt_new_QListViewItem3((qt_QListViewItem *) [parent qt], (qt_QListViewItem *) [after qt])];
		[self setAllocatedInObjcWorld: YES];
		[QtSupport setObject: self forQtKey: [self qt]];
	}
	[super init];
	return self;
}

- initWithListView: (QListView *)parent string: (NSString *)arg1 string: (NSString *)arg2 string: (NSString *)arg3 string: (NSString *)arg4 string: (NSString *)arg5 string: (NSString *)arg6 string: (NSString *)arg7 string: (NSString *)arg8
{
static qt_QString * _qstring_arg8 = 0L;
static qt_QString * _qstring_arg7 = 0L;
static qt_QString * _qstring_arg6 = 0L;
static qt_QString * _qstring_arg5 = 0L;
static qt_QString * _qstring_arg4 = 0L;
static qt_QString * _qstring_arg3 = 0L;
static qt_QString * _qstring_arg2 = 0L;
static qt_QString * _qstring_arg1 = 0L;
	if ([self qt] == 0L) {
		[self setQt: qt_new_QListViewItem4((qt_QListView *) [parent qt], (qt_QString *) [arg1 toQString: &_qstring_arg1], (qt_QString *) [arg2 toQString: &_qstring_arg2], (qt_QString *) [arg3 toQString: &_qstring_arg3], (qt_QString *) [arg4 toQString: &_qstring_arg4], (qt_QString *) [arg5 toQString: &_qstring_arg5], (qt_QString *) [arg6 toQString: &_qstring_arg6], (qt_QString *) [arg7 toQString: &_qstring_arg7], (qt_QString *) [arg8 toQString: &_qstring_arg8])];
		[self setAllocatedInObjcWorld: YES];
		[QtSupport setObject: self forQtKey: [self qt]];
	}
	[super init];
	return self;
}

- initWithListView: (QListView *)parent string: (NSString *)arg1 
{
static qt_QString * _qstring_arg1 = 0L;
	if ([self qt] == 0L) {
		[self setQt: qt_new_QListViewItem4((qt_QListView *) [parent qt], (qt_QString *) [arg1 toQString: &_qstring_arg1], qt_QString_null(), qt_QString_null(), qt_QString_null(), qt_QString_null(), qt_QString_null(), qt_QString_null(), qt_QString_null())];
		[self setAllocatedInObjcWorld: YES];
		[QtSupport setObject: self forQtKey: [self qt]];
	}
	[super init];
	return self;
}

- initWithListViewItem: (QListViewItem *)parent string: (NSString *)arg1 string: (NSString *)arg2 string: (NSString *)arg3 string: (NSString *)arg4 string: (NSString *)arg5 string: (NSString *)arg6 string: (NSString *)arg7 string: (NSString *)arg8
{
static qt_QString * _qstring_arg8 = 0L;
static qt_QString * _qstring_arg7 = 0L;
static qt_QString * _qstring_arg6 = 0L;
static qt_QString * _qstring_arg5 = 0L;
static qt_QString * _qstring_arg4 = 0L;
static qt_QString * _qstring_arg3 = 0L;
static qt_QString * _qstring_arg2 = 0L;
static qt_QString * _qstring_arg1 = 0L;
	if ([self qt] == 0L) {
		[self setQt: qt_new_QListViewItem5((qt_QListViewItem *) [parent qt], (qt_QString *) [arg1 toQString: &_qstring_arg1], (qt_QString *) [arg2 toQString: &_qstring_arg2], (qt_QString *) [arg3 toQString: &_qstring_arg3], (qt_QString *) [arg4 toQString: &_qstring_arg4], (qt_QString *) [arg5 toQString: &_qstring_arg5], (qt_QString *) [arg6 toQString: &_qstring_arg6], (qt_QString *) [arg7 toQString: &_qstring_arg7], (qt_QString *) [arg8 toQString: &_qstring_arg8])];
		[self setAllocatedInObjcWorld: YES];
		[QtSupport setObject: self forQtKey: [self qt]];
	}
	[super init];
	return self;
}

- initWithListViewItem: (QListViewItem *)parent string: (NSString *)arg1 
{
static qt_QString * _qstring_arg1 = 0L;
	if ([self qt] == 0L) {
		[self setQt: qt_new_QListViewItem5((qt_QListViewItem *) [parent qt], (qt_QString *) [arg1 toQString: &_qstring_arg1], qt_QString_null(), qt_QString_null(), qt_QString_null(), qt_QString_null(), qt_QString_null(), qt_QString_null(), qt_QString_null())];
		[self setAllocatedInObjcWorld: YES];
		[QtSupport setObject: self forQtKey: [self qt]];
	}
	[super init];
	return self;
}

- initWithListView: (QListView *)parent after: (QListViewItem *)after string: (NSString *)arg1 string: (NSString *)arg2 string: (NSString *)arg3 string: (NSString *)arg4 string: (NSString *)arg5 string: (NSString *)arg6 string: (NSString *)arg7 string: (NSString *)arg8
{
static qt_QString * _qstring_arg8 = 0L;
static qt_QString * _qstring_arg7 = 0L;
static qt_QString * _qstring_arg6 = 0L;
static qt_QString * _qstring_arg5 = 0L;
static qt_QString * _qstring_arg4 = 0L;
static qt_QString * _qstring_arg3 = 0L;
static qt_QString * _qstring_arg2 = 0L;
static qt_QString * _qstring_arg1 = 0L;
	if ([self qt] == 0L) {
		[self setQt: qt_new_QListViewItem6((qt_QListView *) [parent qt], (qt_QListViewItem *) [after qt], (qt_QString *) [arg1 toQString: &_qstring_arg1], (qt_QString *) [arg2 toQString: &_qstring_arg2], (qt_QString *) [arg3 toQString: &_qstring_arg3], (qt_QString *) [arg4 toQString: &_qstring_arg4], (qt_QString *) [arg5 toQString: &_qstring_arg5], (qt_QString *) [arg6 toQString: &_qstring_arg6], (qt_QString *) [arg7 toQString: &_qstring_arg7], (qt_QString *) [arg8 toQString: &_qstring_arg8])];
		[self setAllocatedInObjcWorld: YES];
		[QtSupport setObject: self forQtKey: [self qt]];
	}
	[super init];
	return self;
}

- initWithListView: (QListView *)parent after: (QListViewItem *)after string: (NSString *)arg1 
{
static qt_QString * _qstring_arg1 = 0L;
	if ([self qt] == 0L) {
		[self setQt: qt_new_QListViewItem6((qt_QListView *) [parent qt], (qt_QListViewItem *) [after qt], (qt_QString *) [arg1 toQString: &_qstring_arg1], qt_QString_null(), qt_QString_null(), qt_QString_null(), qt_QString_null(), qt_QString_null(), qt_QString_null(), qt_QString_null())];
		[self setAllocatedInObjcWorld: YES];
		[QtSupport setObject: self forQtKey: [self qt]];
	}
	[super init];
	return self;
}

- initWithListViewItem: (QListViewItem *)parent after: (QListViewItem *)after string: (NSString *)arg1 string: (NSString *)arg2 string: (NSString *)arg3 string: (NSString *)arg4 string: (NSString *)arg5 string: (NSString *)arg6 string: (NSString *)arg7 string: (NSString *)arg8
{
static qt_QString * _qstring_arg8 = 0L;
static qt_QString * _qstring_arg7 = 0L;
static qt_QString * _qstring_arg6 = 0L;
static qt_QString * _qstring_arg5 = 0L;
static qt_QString * _qstring_arg4 = 0L;
static qt_QString * _qstring_arg3 = 0L;
static qt_QString * _qstring_arg2 = 0L;
static qt_QString * _qstring_arg1 = 0L;
	if ([self qt] == 0L) {
		[self setQt: qt_new_QListViewItem7((qt_QListViewItem *) [parent qt], (qt_QListViewItem *) [after qt], (qt_QString *) [arg1 toQString: &_qstring_arg1], (qt_QString *) [arg2 toQString: &_qstring_arg2], (qt_QString *) [arg3 toQString: &_qstring_arg3], (qt_QString *) [arg4 toQString: &_qstring_arg4], (qt_QString *) [arg5 toQString: &_qstring_arg5], (qt_QString *) [arg6 toQString: &_qstring_arg6], (qt_QString *) [arg7 toQString: &_qstring_arg7], (qt_QString *) [arg8 toQString: &_qstring_arg8])];
		[self setAllocatedInObjcWorld: YES];
		[QtSupport setObject: self forQtKey: [self qt]];
	}
	[super init];
	return self;
}

- initWithListViewItem: (QListViewItem *)parent after: (QListViewItem *)after string: (NSString *)arg1 
{
static qt_QString * _qstring_arg1 = 0L;
	if ([self qt] == 0L) {
		[self setQt: qt_new_QListViewItem7((qt_QListViewItem *) [parent qt], (qt_QListViewItem *) [after qt], (qt_QString *) [arg1 toQString: &_qstring_arg1], qt_QString_null(), qt_QString_null(), qt_QString_null(), qt_QString_null(), qt_QString_null(), qt_QString_null(), qt_QString_null())];
		[self setAllocatedInObjcWorld: YES];
		[QtSupport setObject: self forQtKey: [self qt]];
	}
	[super init];
	return self;
}

- (void) dealloc
{
	if ([self qt] != 0L) {
		if ([self allocatedInObjcWorld] && [self parent] == nil && [self listView] == nil) {
			qt_del_QListViewItem((qt_QListViewItem *)[self qt]);
		}
		[QtSupport removeQtKey: [self qt]];
		[self setQt: 0L];
	}
	[super dealloc];
}

- insertListViewItem: (QListViewItem *)arg1
{
	qt_QListViewItem_insertItem((qt_QListViewItem *)[self qt], (qt_QListViewItem *) [arg1 qt]);
	return self;
}

- takeItem: (QListViewItem *)arg1
{
	qt_QListViewItem_takeItem((qt_QListViewItem *)[self qt], (qt_QListViewItem *) [arg1 qt]);
	return self;
}

- removeListViewItem: (QListViewItem *)item
{
	qt_QListViewItem_removeItem((qt_QListViewItem *)[self qt], (qt_QListViewItem *) [item qt]);
	return self;
}

- (int) height
{
	return (int) qt_QListViewItem_height((qt_QListViewItem *)[self qt]);
}

- invalidateHeight
{
	qt_QListViewItem_invalidateHeight((qt_QListViewItem *)[self qt]);
	return self;
}

- (int) totalHeight
{
	return (int) qt_QListViewItem_totalHeight((qt_QListViewItem *)[self qt]);
}

- (int) width: (QFontMetrics *)arg1 listview: (QListView *)arg2 column: (int)column
{
	return (int) qt_QListViewItem_width((qt_QListViewItem *)[self qt], (qt_QFontMetrics *) [arg1 qt], (qt_QListView *) [arg2 qt], (int)column);
}

- widthChanged: (int)column
{
	qt_QListViewItem_widthChanged((qt_QListViewItem *)[self qt], (int)column);
	return self;
}

- widthChanged
{
	qt_QListViewItem_widthChanged((qt_QListViewItem *)[self qt], -1);
	return self;
}

- (int) depth
{
	return (int) qt_QListViewItem_depth((qt_QListViewItem *)[self qt]);
}

- setText: (int)arg1 string: (NSString *)arg2
{
static qt_QString * _qstring_arg2 = 0L;
	qt_QListViewItem_setText((qt_QListViewItem *)[self qt], (int)arg1, (qt_QString *) [arg2 toQString: &_qstring_arg2]);
	return self;
}

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

- setPixmap: (int)arg1 pixmap: (QPixmap *)arg2
{
	qt_QListViewItem_setPixmap((qt_QListViewItem *)[self qt], (int)arg1, (qt_QPixmap *) [arg2 qt]);
	return self;
}

- (QPixmap*) pixmap: (int)arg1
{
	return (QPixmap*) [QtSupport objectForQtKey: qt_QListViewItem_pixmap((qt_QListViewItem *)[self qt], (int)arg1) withClass: [QPixmap class] allocatedInObjcWorld: YES];
}

- (NSString *) key: (int)arg1 bool: (BOOL)arg2
{
static qt_QString * _qstring = 0L;
	_qstring = qt_QListViewItem_key((qt_QListViewItem *)[self qt], (int)arg1, (int)arg2);
	return [NSString fromQString: _qstring];
}

- (int) compare: (QListViewItem *)i col: (int)col bool: (BOOL)arg1
{
	return (int) qt_QListViewItem_compare((qt_QListViewItem *)[self qt], (qt_QListViewItem *) [i qt], (int)col, (int)arg1);
}

- sortChildItems: (int)arg1 bool: (BOOL)arg2
{
	qt_QListViewItem_sortChildItems((qt_QListViewItem *)[self qt], (int)arg1, (int)arg2);
	return self;
}

- (int) childCount
{
	return (int) qt_QListViewItem_childCount((qt_QListViewItem *)[self qt]);
}

- (BOOL) isOpen
{
	return (BOOL) qt_QListViewItem_isOpen((qt_QListViewItem *)[self qt]);
}

- setOpen: (BOOL)arg1
{
	qt_QListViewItem_setOpen((qt_QListViewItem *)[self qt], (int)arg1);
	return self;
}

- setup
{
	qt_QListViewItem_setup((qt_QListViewItem *)[self qt]);
	return self;
}

- setSelected: (BOOL)arg1
{
	qt_QListViewItem_setSelected((qt_QListViewItem *)[self qt], (int)arg1);
	return self;
}

- (BOOL) isSelected
{
	return (BOOL) qt_QListViewItem_isSelected((qt_QListViewItem *)[self qt]);
}

- paintCell: (QPainter *)arg1 cg: (QColorGroup *)cg column: (int)column width: (int)width alignment: (int)alignment
{
	qt_QListViewItem_paintCell((qt_QListViewItem *)[self qt], (qt_QPainter *) [arg1 qt], (qt_QColorGroup *) [cg qt], (int)column, (int)width, (int)alignment);
	return self;
}

- paintBranches: (QPainter *)p cg: (QColorGroup *)cg w: (int)w y: (int)y h: (int)h
{
	qt_QListViewItem_paintBranches((qt_QListViewItem *)[self qt], (qt_QPainter *) [p qt], (qt_QColorGroup *) [cg qt], (int)w, (int)y, (int)h);
	return self;
}

- paintFocus: (QPainter *)arg1 cg: (QColorGroup *)cg r: (QRect*)r
{
	qt_QListViewItem_paintFocus((qt_QListViewItem *)[self qt], (qt_QPainter *) [arg1 qt], (qt_QColorGroup *) [cg qt], (qt_QRect*) [r qt]);
	return self;
}

- (QListViewItem*) firstChild
{
	return (QListViewItem*) [QtSupport objectForQtKey: qt_QListViewItem_firstChild((qt_QListViewItem *)[self qt]) withClass: [QListViewItem class] allocatedInObjcWorld: YES];
}

- (QListViewItem*) nextSibling
{
	return (QListViewItem*) [QtSupport objectForQtKey: qt_QListViewItem_nextSibling((qt_QListViewItem *)[self qt]) withClass: [QListViewItem class] allocatedInObjcWorld: YES];
}

- (QListViewItem*) parent
{
	return (QListViewItem*) [QtSupport objectForQtKey: qt_QListViewItem_parent((qt_QListViewItem *)[self qt]) withClass: [QListViewItem class] allocatedInObjcWorld: YES];
}

- (QListViewItem*) itemAbove
{
	return (QListViewItem*) [QtSupport objectForQtKey: qt_QListViewItem_itemAbove((qt_QListViewItem *)[self qt]) withClass: [QListViewItem class] allocatedInObjcWorld: YES];
}

- (QListViewItem*) itemBelow
{
	return (QListViewItem*) [QtSupport objectForQtKey: qt_QListViewItem_itemBelow((qt_QListViewItem *)[self qt]) withClass: [QListViewItem class] allocatedInObjcWorld: YES];
}

- (int) itemPos
{
	return (int) qt_QListViewItem_itemPos((qt_QListViewItem *)[self qt]);
}

- (QListView*) listView
{
	return (QListView*) [QtSupport objectForQtKey: qt_QListViewItem_listView((qt_QListViewItem *)[self qt]) withClass: [QListView class] allocatedInObjcWorld: YES];
}

- setSelectable: (BOOL)enable
{
	qt_QListViewItem_setSelectable((qt_QListViewItem *)[self qt], (int)enable);
	return self;
}

- (BOOL) isSelectable
{
	return (BOOL) qt_QListViewItem_isSelectable((qt_QListViewItem *)[self qt]);
}

- setExpandable: (BOOL)arg1
{
	qt_QListViewItem_setExpandable((qt_QListViewItem *)[self qt], (int)arg1);
	return self;
}

- (BOOL) isExpandable
{
	return (BOOL) qt_QListViewItem_isExpandable((qt_QListViewItem *)[self qt]);
}

- repaint
{
	qt_QListViewItem_repaint((qt_QListViewItem *)[self qt]);
	return self;
}

- sort
{
	qt_QListViewItem_sort((qt_QListViewItem *)[self qt]);
	return self;
}

- moveItem: (QListViewItem *)after
{
	qt_QListViewItem_moveItem((qt_QListViewItem *)[self qt], (qt_QListViewItem *) [after qt]);
	return self;
}

- setDragEnabled: (BOOL)allow
{
	qt_QListViewItem_setDragEnabled((qt_QListViewItem *)[self qt], (int)allow);
	return self;
}

- setDropEnabled: (BOOL)allow
{
	qt_QListViewItem_setDropEnabled((qt_QListViewItem *)[self qt], (int)allow);
	return self;
}

- (BOOL) dragEnabled
{
	return (BOOL) qt_QListViewItem_dragEnabled((qt_QListViewItem *)[self qt]);
}

- (BOOL) dropEnabled
{
	return (BOOL) qt_QListViewItem_dropEnabled((qt_QListViewItem *)[self qt]);
}

- (BOOL) acceptDrop: (QMimeSource*)mime
{
	return (BOOL) qt_QListViewItem_acceptDrop((qt_QListViewItem *)[self qt], (qt_QMimeSource*) [mime qt]);
}

- setVisible: (BOOL)b
{
	qt_QListViewItem_setVisible((qt_QListViewItem *)[self qt], (int)b);
	return self;
}

- (BOOL) isVisible
{
	return (BOOL) qt_QListViewItem_isVisible((qt_QListViewItem *)[self qt]);
}

- setRenameEnabled: (int)col b: (BOOL)b
{
	qt_QListViewItem_setRenameEnabled((qt_QListViewItem *)[self qt], (int)col, (int)b);
	return self;
}

- (BOOL) renameEnabled: (int)col
{
	return (BOOL) qt_QListViewItem_renameEnabled((qt_QListViewItem *)[self qt], (int)col);
}

- startRename: (int)col
{
	qt_QListViewItem_startRename((qt_QListViewItem *)[self qt], (int)col);
	return self;
}

- setEnabled: (BOOL)b
{
	qt_QListViewItem_setEnabled((qt_QListViewItem *)[self qt], (int)b);
	return self;
}

- (BOOL) isEnabled
{
	return (BOOL) qt_QListViewItem_isEnabled((qt_QListViewItem *)[self qt]);
}

- (int) rtti
{
	return (int) qt_QListViewItem_rtti((qt_QListViewItem *)[self qt]);
}

- setMultiLinesEnabled: (BOOL)b
{
	qt_QListViewItem_setMultiLinesEnabled((qt_QListViewItem *)[self qt], (int)b);
	return self;
}

- (BOOL) multiLinesEnabled
{
	return (BOOL) qt_QListViewItem_multiLinesEnabled((qt_QListViewItem *)[self qt]);
}

- enforceSortOrder
{
	qt_QListViewItem_enforceSortOrder((qt_QListViewItem *)[self qt]);
	return self;
}

- setHeight: (int)arg1
{
	qt_QListViewItem_setHeight((qt_QListViewItem *)[self qt], (int)arg1);
	return self;
}

- activate
{
	qt_QListViewItem_activate((qt_QListViewItem *)[self qt]);
	return self;
}

- (BOOL) activatedPos: (QPoint*)arg1
{
	return (BOOL) qt_QListViewItem_activatedPos((qt_QListViewItem *)[self qt], (qt_QPoint*) [arg1 qt]);
}

- dropped: (QDropEvent*)e
{
	qt_QListViewItem_dropped((qt_QListViewItem *)[self qt], (qt_QDropEvent*) [e qt]);
	return self;
}

- dragEntered
{
	qt_QListViewItem_dragEntered((qt_QListViewItem *)[self qt]);
	return self;
}

- dragLeft
{
	qt_QListViewItem_dragLeft((qt_QListViewItem *)[self qt]);
	return self;
}

- okRename: (int)col
{
	qt_QListViewItem_okRename((qt_QListViewItem *)[self qt], (int)col);
	return self;
}

- cancelRename: (int)col
{
	qt_QListViewItem_cancelRename((qt_QListViewItem *)[self qt], (int)col);
	return self;
}

- ignoreDoubleClick
{
	qt_QListViewItem_ignoreDoubleClick((qt_QListViewItem *)[self qt]);
	return self;
}

@end
