/***************************************************************************
                            QListView.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_QListView.h>
#include <qtobjc/QListView.h>
#include <qtobjc/QFont.h>
#include <qtobjc/QPoint.h>
#include <qtobjc/QRect.h>

#include <qtobjc/QListViewItem.h>
#include <qtobjc/QFont.h>
#include <qtobjc/QPoint.h>
#include <qtobjc/QRect.h>

#include <qtobjc/QPainter.h>
#include <qtobjc/QStyle.h>
#include <qtobjc/QIconSet.h>
#include <qtobjc/QPalette.h>

@implementation  QListView


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

- init
{
	if ([self qt] == 0L) {
		[self setQt: qt_new_QListView(0, 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_QListView((qt_QListView *)[self qt]);
		}
		[QtSupport removeQtKey: [self qt]];
		[self setQt: 0L];
	}
	[super dealloc];
}

- (int) treeStepSize
{
	return (int) qt_QListView_treeStepSize((qt_QListView *)[self qt]);
}

- setTreeStepSize: (int)arg1
{
	qt_QListView_setTreeStepSize((qt_QListView *)[self qt], (int)arg1);
	return self;
}

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

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

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

- (QHeader*) header
{
	return (QHeader*) [QtSupport objectForQtKey: qt_QListView_header((qt_QListView *)[self qt]) withClass: [QHeader class] allocatedInObjcWorld: YES];
}

- (int) addColumn: (NSString *)label size: (int)size
{
static qt_QString * _qstring_label = 0L;
	return (int) qt_QListView_addColumn((qt_QListView *)[self qt], (qt_QString *) [label toQString: &_qstring_label], (int)size);
}

- (int) addColumn: (NSString *)label 
{
static qt_QString * _qstring_label = 0L;
	return (int) qt_QListView_addColumn((qt_QListView *)[self qt], (qt_QString *) [label toQString: &_qstring_label], -1);
}

- (int) addColumn: (QIconSet*)iconset label: (NSString *)label size: (int)size
{
static qt_QString * _qstring_label = 0L;
	return (int) qt_QListView_addColumn1((qt_QListView *)[self qt], (qt_QIconSet*) [iconset qt], (qt_QString *) [label toQString: &_qstring_label], (int)size);
}

- (int) addColumn: (QIconSet*)iconset label: (NSString *)label 
{
static qt_QString * _qstring_label = 0L;
	return (int) qt_QListView_addColumn1((qt_QListView *)[self qt], (qt_QIconSet*) [iconset qt], (qt_QString *) [label toQString: &_qstring_label], -1);
}

- removeColumn: (int)index
{
	qt_QListView_removeColumn((qt_QListView *)[self qt], (int)index);
	return self;
}

- setColumnText: (int)column label: (NSString *)label
{
static qt_QString * _qstring_label = 0L;
	qt_QListView_setColumnText((qt_QListView *)[self qt], (int)column, (qt_QString *) [label toQString: &_qstring_label]);
	return self;
}

- setColumnText: (int)column iconset: (QIconSet*)iconset label: (NSString *)label
{
static qt_QString * _qstring_label = 0L;
	qt_QListView_setColumnText1((qt_QListView *)[self qt], (int)column, (qt_QIconSet*) [iconset qt], (qt_QString *) [label toQString: &_qstring_label]);
	return self;
}

- (NSString *) columnText: (int)column
{
static qt_QString * _qstring = 0L;
	_qstring = qt_QListView_columnText((qt_QListView *)[self qt], (int)column);
	return [NSString fromQString: _qstring];
}

- setColumnWidth: (int)column width: (int)width
{
	qt_QListView_setColumnWidth((qt_QListView *)[self qt], (int)column, (int)width);
	return self;
}

- (int) columnWidth: (int)column
{
	return (int) qt_QListView_columnWidth((qt_QListView *)[self qt], (int)column);
}

- setColumnWidthMode: (int)column int: (int)arg1
{
	qt_QListView_setColumnWidthMode((qt_QListView *)[self qt], (int)column, (int)arg1);
	return self;
}

- (int) columnWidthMode: (int)column
{
	return (int) qt_QListView_columnWidthMode((qt_QListView *)[self qt], (int)column);
}

- (int) columns
{
	return (int) qt_QListView_columns((qt_QListView *)[self qt]);
}

- setColumnAlignment: (int)arg1 int: (int)arg2
{
	qt_QListView_setColumnAlignment((qt_QListView *)[self qt], (int)arg1, (int)arg2);
	return self;
}

- (int) columnAlignment: (int)arg1
{
	return (int) qt_QListView_columnAlignment((qt_QListView *)[self qt], (int)arg1);
}

- show
{
	qt_QListView_show((qt_QListView *)[self qt]);
	return self;
}

- (QListViewItem*) itemAt: (QPoint*)screenPos
{
	return (QListViewItem*) [QtSupport objectForQtKey: qt_QListView_itemAt((qt_QListView *)[self qt], (qt_QPoint*) [screenPos qt]) withClass: [QListViewItem class] allocatedInObjcWorld: YES];
}

- (QRect*) itemRect: (QListViewItem *)arg1
{
	return (QRect*) [QtSupport objectForQtKey: qt_QListView_itemRect((qt_QListView *)[self qt], (qt_QListViewItem *) [arg1 qt]) withClass: [QRect class] allocatedInObjcWorld: YES];
}

- (int) itemPos: (QListViewItem *)arg1
{
	return (int) qt_QListView_itemPos((qt_QListView *)[self qt], (qt_QListViewItem *) [arg1 qt]);
}

- ensureItemVisible: (QListViewItem *)arg1
{
	qt_QListView_ensureItemVisible((qt_QListView *)[self qt], (qt_QListViewItem *) [arg1 qt]);
	return self;
}

- repaintItem: (QListViewItem *)arg1
{
	qt_QListView_repaintItem((qt_QListView *)[self qt], (qt_QListViewItem *) [arg1 qt]);
	return self;
}

- setMultiSelection: (BOOL)enable
{
	qt_QListView_setMultiSelection((qt_QListView *)[self qt], (int)enable);
	return self;
}

- (BOOL) isMultiSelection
{
	return (BOOL) qt_QListView_isMultiSelection((qt_QListView *)[self qt]);
}

- setSelectionMode: (int)mode
{
	qt_QListView_setSelectionMode((qt_QListView *)[self qt], (int)mode);
	return self;
}

- (int) selectionMode
{
	return (int) qt_QListView_selectionMode((qt_QListView *)[self qt]);
}

- clearSelection
{
	qt_QListView_clearSelection((qt_QListView *)[self qt]);
	return self;
}

- setSelected: (QListViewItem *)arg1 bool: (BOOL)arg2
{
	qt_QListView_setSelected((qt_QListView *)[self qt], (qt_QListViewItem *) [arg1 qt], (int)arg2);
	return self;
}

- (BOOL) isSelected: (QListViewItem *)arg1
{
	return (BOOL) qt_QListView_isSelected((qt_QListView *)[self qt], (qt_QListViewItem *) [arg1 qt]);
}

- (QListViewItem*) selectedItem
{
	return (QListViewItem*) [QtSupport objectForQtKey: qt_QListView_selectedItem((qt_QListView *)[self qt]) withClass: [QListViewItem class] allocatedInObjcWorld: YES];
}

- setOpen: (QListViewItem *)arg1 bool: (BOOL)arg2
{
	qt_QListView_setOpen((qt_QListView *)[self qt], (qt_QListViewItem *) [arg1 qt], (int)arg2);
	return self;
}

- (BOOL) isOpen: (QListViewItem *)arg1
{
	return (BOOL) qt_QListView_isOpen((qt_QListView *)[self qt], (qt_QListViewItem *) [arg1 qt]);
}

- setCurrentItem: (QListViewItem *)arg1
{
	qt_QListView_setCurrentItem((qt_QListView *)[self qt], (qt_QListViewItem *) [arg1 qt]);
	return self;
}

- (QListViewItem*) currentItem
{
	return (QListViewItem*) [QtSupport objectForQtKey: qt_QListView_currentItem((qt_QListView *)[self qt]) withClass: [QListViewItem class] allocatedInObjcWorld: YES];
}

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

- (QListViewItem*) lastItem
{
	return (QListViewItem*) [QtSupport objectForQtKey: qt_QListView_lastItem((qt_QListView *)[self qt]) withClass: [QListViewItem class] allocatedInObjcWorld: YES];
}

- (int) childCount
{
	return (int) qt_QListView_childCount((qt_QListView *)[self qt]);
}

- setAllColumnsShowFocus: (BOOL)arg1
{
	qt_QListView_setAllColumnsShowFocus((qt_QListView *)[self qt], (int)arg1);
	return self;
}

- (BOOL) allColumnsShowFocus
{
	return (BOOL) qt_QListView_allColumnsShowFocus((qt_QListView *)[self qt]);
}

- setItemMargin: (int)arg1
{
	qt_QListView_setItemMargin((qt_QListView *)[self qt], (int)arg1);
	return self;
}

- (int) itemMargin
{
	return (int) qt_QListView_itemMargin((qt_QListView *)[self qt]);
}

- setRootIsDecorated: (BOOL)arg1
{
	qt_QListView_setRootIsDecorated((qt_QListView *)[self qt], (int)arg1);
	return self;
}

- (BOOL) rootIsDecorated
{
	return (BOOL) qt_QListView_rootIsDecorated((qt_QListView *)[self qt]);
}

- setSorting: (int)column increasing: (BOOL)increasing
{
	qt_QListView_setSorting((qt_QListView *)[self qt], (int)column, (int)increasing);
	return self;
}

- setSorting: (int)column 
{
	qt_QListView_setSorting((qt_QListView *)[self qt], (int)column, 1);
	return self;
}

- sort
{
	qt_QListView_sort((qt_QListView *)[self qt]);
	return self;
}

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

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

- (BOOL) eventFilter: (QObject *)o event: (QEvent *)arg1
{
	return (BOOL) qt_QListView_eventFilter((qt_QListView *)[self qt], (qt_QObject *) [o qt], (qt_QEvent *) [arg1 qt]);
}

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

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

- setShowSortIndicator: (BOOL)show
{
	qt_QListView_setShowSortIndicator((qt_QListView *)[self qt], (int)show);
	return self;
}

- (BOOL) showSortIndicator
{
	return (BOOL) qt_QListView_showSortIndicator((qt_QListView *)[self qt]);
}

- setShowToolTips: (BOOL)b
{
	qt_QListView_setShowToolTips((qt_QListView *)[self qt], (int)b);
	return self;
}

- (BOOL) showToolTips
{
	return (BOOL) qt_QListView_showToolTips((qt_QListView *)[self qt]);
}

- setResizeMode: (int)m
{
	qt_QListView_setResizeMode((qt_QListView *)[self qt], (int)m);
	return self;
}

- (int) resizeMode
{
	return (int) qt_QListView_resizeMode((qt_QListView *)[self qt]);
}

- (QListViewItem*) findItem: (NSString *)text column: (int)column compare: (int)compare
{
static qt_QString * _qstring_text = 0L;
	return (QListViewItem*) [QtSupport objectForQtKey: qt_QListView_findItem((qt_QListView *)[self qt], (qt_QString *) [text toQString: &_qstring_text], (int)column, (int)compare) withClass: [QListViewItem class] allocatedInObjcWorld: YES];
}

- (QListViewItem*) findItem: (NSString *)text column: (int)column 
{
static qt_QString * _qstring_text = 0L;
	return (QListViewItem*) [QtSupport objectForQtKey: qt_QListView_findItem((qt_QListView *)[self qt], (qt_QString *) [text toQString: &_qstring_text], (int)column, [QListView ExactMatch] | [QListView CaseSensitive]) withClass: [QListViewItem class] allocatedInObjcWorld: YES];
}

- setDefaultRenameAction: (int)a
{
	qt_QListView_setDefaultRenameAction((qt_QListView *)[self qt], (int)a);
	return self;
}

- (int) defaultRenameAction
{
	return (int) qt_QListView_defaultRenameAction((qt_QListView *)[self qt]);
}

- (BOOL) isRenaming
{
	return (BOOL) qt_QListView_isRenaming((qt_QListView *)[self qt]);
}

- clear
{
	qt_QListView_clear((qt_QListView *)[self qt]);
	return self;
}

- invertSelection
{
	qt_QListView_invertSelection((qt_QListView *)[self qt]);
	return self;
}

- selectAll: (BOOL)select
{
	qt_QListView_selectAll((qt_QListView *)[self qt], (int)select);
	return self;
}

- triggerUpdate
{
	qt_QListView_triggerUpdate((qt_QListView *)[self qt]);
	return self;
}

- setContentsPos: (int)x y: (int)y
{
	qt_QListView_setContentsPos((qt_QListView *)[self qt], (int)x, (int)y);
	return self;
}

- (QDragObject*) dragObject
{
	return (QDragObject*) [QtSupport objectForQtKey: qt_QListView_dragObject((qt_QListView *)[self qt]) withClass: [QDragObject class] allocatedInObjcWorld: YES];
}

- startDrag
{
	qt_QListView_startDrag((qt_QListView *)[self qt]);
	return self;
}

- drawContentsOffset: (QPainter *)arg1 ox: (int)ox oy: (int)oy cx: (int)cx cy: (int)cy cw: (int)cw ch: (int)ch
{
	qt_QListView_drawContentsOffset((qt_QListView *)[self qt], (qt_QPainter *) [arg1 qt], (int)ox, (int)oy, (int)cx, (int)cy, (int)cw, (int)ch);
	return self;
}

- paintEmptyArea: (QPainter *)arg1 rect: (QRect*)arg2
{
	qt_QListView_paintEmptyArea((qt_QListView *)[self qt], (qt_QPainter *) [arg1 qt], (qt_QRect*) [arg2 qt]);
	return self;
}

- styleChange: (QStyle*)arg1
{
	qt_QListView_styleChange((qt_QListView *)[self qt], (qt_QStyle*) [arg1 qt]);
	return self;
}

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

- updateContents
{
	qt_QListView_updateContents((qt_QListView *)[self qt]);
	return self;
}

- doAutoScroll
{
	qt_QListView_doAutoScroll((qt_QListView *)[self qt]);
	return self;
}

+ (int) Manual
{
	return (int) QLISTVIEW_Manual;
}

+ (int) Maximum
{
	return (int) QLISTVIEW_Maximum;
}

+ (int) Single
{
	return (int) QLISTVIEW_Single;
}

+ (int) Multi
{
	return (int) QLISTVIEW_Multi;
}

+ (int) Extended
{
	return (int) QLISTVIEW_Extended;
}

+ (int) NoSelection
{
	return (int) QLISTVIEW_NoSelection;
}

+ (int) NoColumn
{
	return (int) QLISTVIEW_NoColumn;
}

+ (int) AllColumns
{
	return (int) QLISTVIEW_AllColumns;
}

+ (int) LastColumn
{
	return (int) QLISTVIEW_LastColumn;
}

+ (int) Accept
{
	return (int) QLISTVIEW_Accept;
}

+ (int) Reject
{
	return (int) QLISTVIEW_Reject;
}

@end
