/***************************************************************************
                            QIconView.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_QIconView.h>
#include <qtobjc/QIconView.h>
#include <qtobjc/QFont.h>
#include <qtobjc/QPoint.h>
#include <qtobjc/QRect.h>
#include <qtobjc/QSize.h>

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

@implementation  QIconView


- initWithWidget: (QWidget *)parent name: (NSString *)name f: (int)f
{
	if ([self qt] == 0L) {
		[self setQt: qt_new_QIconView((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_QIconView(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_QIconView((qt_QIconView *)[self qt]);
		}
		[QtSupport removeQtKey: [self qt]];
		[self setQt: 0L];
	}
	[super dealloc];
}

- insertIconViewItem: (QIconViewItem*)item after: (QIconViewItem*)after
{
	qt_QIconView_insertItem((qt_QIconView *)[self qt], (qt_QIconViewItem*) [item qt], (qt_QIconViewItem*) [after qt]);
	return self;
}

- insertIconViewItem: (QIconViewItem*)item 
{
	qt_QIconView_insertItem((qt_QIconView *)[self qt], (qt_QIconViewItem*) [item qt], 0L);
	return self;
}

- takeItem: (QIconViewItem*)item
{
	qt_QIconView_takeItem((qt_QIconView *)[self qt], (qt_QIconViewItem*) [item qt]);
	return self;
}

- (int) index: (QIconViewItem*)item
{
	return (int) qt_QIconView_index((qt_QIconView *)[self qt], (qt_QIconViewItem*) [item qt]);
}

- (QIconViewItem*) firstItem
{
	return (QIconViewItem*) [QtSupport objectForQtKey: qt_QIconView_firstItem((qt_QIconView *)[self qt]) withClass: [QIconViewItem class] allocatedInObjcWorld: YES];
}

- (QIconViewItem*) lastItem
{
	return (QIconViewItem*) [QtSupport objectForQtKey: qt_QIconView_lastItem((qt_QIconView *)[self qt]) withClass: [QIconViewItem class] allocatedInObjcWorld: YES];
}

- (QIconViewItem*) currentItem
{
	return (QIconViewItem*) [QtSupport objectForQtKey: qt_QIconView_currentItem((qt_QIconView *)[self qt]) withClass: [QIconViewItem class] allocatedInObjcWorld: YES];
}

- setCurrentItem: (QIconViewItem*)item
{
	qt_QIconView_setCurrentItem((qt_QIconView *)[self qt], (qt_QIconViewItem*) [item qt]);
	return self;
}

- setSelected: (QIconViewItem*)item s: (BOOL)s cb: (BOOL)cb
{
	qt_QIconView_setSelected((qt_QIconView *)[self qt], (qt_QIconViewItem*) [item qt], (int)s, (int)cb);
	return self;
}

- setSelected: (QIconViewItem*)item s: (BOOL)s 
{
	qt_QIconView_setSelected((qt_QIconView *)[self qt], (qt_QIconViewItem*) [item qt], (int)s, 0);
	return self;
}

- (unsigned int) count
{
	return (unsigned int) qt_QIconView_count((qt_QIconView *)[self qt]);
}

//- showEvent: (QShowEvent*)arg1
//{
//	qt_QIconView_showEvent((qt_QIconView *)[self qt], (qt_QShowEvent*) [arg1 qt]);
//	return self;
//}

- setSelectionMode: (int)m
{
	qt_QIconView_setSelectionMode((qt_QIconView *)[self qt], (int)m);
	return self;
}

- (int) selectionMode
{
	return (int) qt_QIconView_selectionMode((qt_QIconView *)[self qt]);
}

- (QIconViewItem*) findItemAtPoint: (QPoint*)pos
{
	return (QIconViewItem*) [QtSupport objectForQtKey: qt_QIconView_findItem((qt_QIconView *)[self qt], (qt_QPoint*) [pos qt]) withClass: [QIconViewItem class] allocatedInObjcWorld: YES];
}

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

- (QIconViewItem*) findItem: (NSString *)text 
{
static qt_QString * _qstring_text = 0L;
	return (QIconViewItem*) [QtSupport objectForQtKey: qt_QIconView_findItem1((qt_QIconView *)[self qt], (qt_QString *) [text toQString: &_qstring_text], [QIconView BeginsWith]) withClass: [QIconViewItem class] allocatedInObjcWorld: YES];
}

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

- clearSelection
{
	qt_QIconView_clearSelection((qt_QIconView *)[self qt]);
	return self;
}

- invertSelection
{
	qt_QIconView_invertSelection((qt_QIconView *)[self qt]);
	return self;
}

- repaintItem: (QIconViewItem*)item
{
	qt_QIconView_repaintItem((qt_QIconView *)[self qt], (qt_QIconViewItem*) [item qt]);
	return self;
}

- ensureItemVisible: (QIconViewItem*)item
{
	qt_QIconView_ensureItemVisible((qt_QIconView *)[self qt], (qt_QIconViewItem*) [item qt]);
	return self;
}

- (QIconViewItem*) findFirstVisibleItem: (QRect*)r
{
	return (QIconViewItem*) [QtSupport objectForQtKey: qt_QIconView_findFirstVisibleItem((qt_QIconView *)[self qt], (qt_QRect*) [r qt]) withClass: [QIconViewItem class] allocatedInObjcWorld: YES];
}

- (QIconViewItem*) findLastVisibleItem: (QRect*)r
{
	return (QIconViewItem*) [QtSupport objectForQtKey: qt_QIconView_findLastVisibleItem((qt_QIconView *)[self qt], (qt_QRect*) [r qt]) withClass: [QIconViewItem class] allocatedInObjcWorld: YES];
}

- clear
{
	qt_QIconView_clear((qt_QIconView *)[self qt]);
	return self;
}

- setGridX: (int)rx
{
	qt_QIconView_setGridX((qt_QIconView *)[self qt], (int)rx);
	return self;
}

- setGridY: (int)ry
{
	qt_QIconView_setGridY((qt_QIconView *)[self qt], (int)ry);
	return self;
}

- (int) gridX
{
	return (int) qt_QIconView_gridX((qt_QIconView *)[self qt]);
}

- (int) gridY
{
	return (int) qt_QIconView_gridY((qt_QIconView *)[self qt]);
}

- setSpacing: (int)sp
{
	qt_QIconView_setSpacing((qt_QIconView *)[self qt], (int)sp);
	return self;
}

- (int) spacing
{
	return (int) qt_QIconView_spacing((qt_QIconView *)[self qt]);
}

- setItemTextPos: (int)pos
{
	qt_QIconView_setItemTextPos((qt_QIconView *)[self qt], (int)pos);
	return self;
}

- (int) itemTextPos
{
	return (int) qt_QIconView_itemTextPos((qt_QIconView *)[self qt]);
}

- setItemTextBackground: (QBrush *)b
{
	qt_QIconView_setItemTextBackground((qt_QIconView *)[self qt], (qt_QBrush *) [b qt]);
	return self;
}

- (QBrush*) itemTextBackground
{
	return (QBrush*) [QtSupport objectForQtKey: qt_QIconView_itemTextBackground((qt_QIconView *)[self qt]) withClass: [QBrush class] allocatedInObjcWorld: YES];
}

- setArrangement: (int)am
{
	qt_QIconView_setArrangement((qt_QIconView *)[self qt], (int)am);
	return self;
}

- (int) arrangement
{
	return (int) qt_QIconView_arrangement((qt_QIconView *)[self qt]);
}

- setResizeMode: (int)am
{
	qt_QIconView_setResizeMode((qt_QIconView *)[self qt], (int)am);
	return self;
}

- (int) resizeMode
{
	return (int) qt_QIconView_resizeMode((qt_QIconView *)[self qt]);
}

- setMaxItemWidth: (int)w
{
	qt_QIconView_setMaxItemWidth((qt_QIconView *)[self qt], (int)w);
	return self;
}

- (int) maxItemWidth
{
	return (int) qt_QIconView_maxItemWidth((qt_QIconView *)[self qt]);
}

- setMaxItemTextLength: (int)w
{
	qt_QIconView_setMaxItemTextLength((qt_QIconView *)[self qt], (int)w);
	return self;
}

- (int) maxItemTextLength
{
	return (int) qt_QIconView_maxItemTextLength((qt_QIconView *)[self qt]);
}

- setAutoArrange: (BOOL)b
{
	qt_QIconView_setAutoArrange((qt_QIconView *)[self qt], (int)b);
	return self;
}

- (BOOL) autoArrange
{
	return (BOOL) qt_QIconView_autoArrange((qt_QIconView *)[self qt]);
}

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

- (BOOL) showToolTips
{
	return (BOOL) qt_QIconView_showToolTips((qt_QIconView *)[self qt]);
}

- setSorting: (BOOL)sort ascending: (BOOL)ascending
{
	qt_QIconView_setSorting((qt_QIconView *)[self qt], (int)sort, (int)ascending);
	return self;
}

- setSorting: (BOOL)sort 
{
	qt_QIconView_setSorting((qt_QIconView *)[self qt], (int)sort, 1);
	return self;
}

- (BOOL) sorting
{
	return (BOOL) qt_QIconView_sorting((qt_QIconView *)[self qt]);
}

- (BOOL) sortDirection
{
	return (BOOL) qt_QIconView_sortDirection((qt_QIconView *)[self qt]);
}

- setItemsMovable: (BOOL)b
{
	qt_QIconView_setItemsMovable((qt_QIconView *)[self qt], (int)b);
	return self;
}

- (BOOL) itemsMovable
{
	return (BOOL) qt_QIconView_itemsMovable((qt_QIconView *)[self qt]);
}

- setWordWrapIconText: (BOOL)b
{
	qt_QIconView_setWordWrapIconText((qt_QIconView *)[self qt], (int)b);
	return self;
}

- (BOOL) wordWrapIconText
{
	return (BOOL) qt_QIconView_wordWrapIconText((qt_QIconView *)[self qt]);
}

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

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

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

- sort: (BOOL)ascending
{
	qt_QIconView_sort((qt_QIconView *)[self qt], (int)ascending);
	return self;
}

- sort
{
	qt_QIconView_sort((qt_QIconView *)[self qt], 1);
	return self;
}

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

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

- (BOOL) isRenaming
{
	return (BOOL) qt_QIconView_isRenaming((qt_QIconView *)[self qt]);
}

- arrangeItemsInGrid: (QSize *)grid update: (BOOL)update
{
	qt_QIconView_arrangeItemsInGrid((qt_QIconView *)[self qt], (qt_QSize *) [grid qt], (int)update);
	return self;
}

- arrangeItemsInGridWithSize: (QSize *)grid
{
	qt_QIconView_arrangeItemsInGrid((qt_QIconView *)[self qt], (qt_QSize *) [grid qt], 1);
	return self;
}

- arrangeItemsInGrid: (BOOL)update
{
	qt_QIconView_arrangeItemsInGrid1((qt_QIconView *)[self qt], (int)update);
	return self;
}

- arrangeItemsInGrid
{
	qt_QIconView_arrangeItemsInGrid1((qt_QIconView *)[self qt], 1);
	return self;
}

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

- updateContents
{
	qt_QIconView_updateContents((qt_QIconView *)[self qt]);
	return self;
}

- drawContents: (QPainter *)p cx: (int)cx cy: (int)cy cw: (int)cw ch: (int)ch
{
	qt_QIconView_drawContents((qt_QIconView *)[self qt], (qt_QPainter *) [p qt], (int)cx, (int)cy, (int)cw, (int)ch);
	return self;
}

- drawRubber: (QPainter *)p
{
	qt_QIconView_drawRubber((qt_QIconView *)[self qt], (qt_QPainter *) [p qt]);
	return self;
}

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

- startDrag
{
	qt_QIconView_startDrag((qt_QIconView *)[self qt]);
	return self;
}

- insertInGrid: (QIconViewItem*)item
{
	qt_QIconView_insertInGrid((qt_QIconView *)[self qt], (qt_QIconViewItem*) [item qt]);
	return self;
}

- drawBackground: (QPainter *)p r: (QRect*)r
{
	qt_QIconView_drawBackground((qt_QIconView *)[self qt], (qt_QPainter *) [p qt], (qt_QRect*) [r qt]);
	return self;
}

- emitSelectionChanged: (QIconViewItem*)i
{
	qt_QIconView_emitSelectionChanged((qt_QIconView *)[self qt], (qt_QIconViewItem*) [i qt]);
	return self;
}

- emitSelectionChanged
{
	qt_QIconView_emitSelectionChanged((qt_QIconView *)[self qt], 0);
	return self;
}

- emitRenamed: (QIconViewItem*)item
{
	qt_QIconView_emitRenamed((qt_QIconView *)[self qt], (qt_QIconViewItem*) [item qt]);
	return self;
}

- (QIconViewItem*) makeRowLayout: (QIconViewItem*)begin y: (int)y changed: (BOOL)changed
{
	return (QIconViewItem*) [QtSupport objectForQtKey: qt_QIconView_makeRowLayout((qt_QIconView *)[self qt], (qt_QIconViewItem*) [begin qt], (int)y, (int)changed) withClass: [QIconViewItem class] allocatedInObjcWorld: YES];
}

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

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

- doAutoScroll
{
	qt_QIconView_doAutoScroll((qt_QIconView *)[self qt]);
	return self;
}

- adjustItems
{
	qt_QIconView_adjustItems((qt_QIconView *)[self qt]);
	return self;
}

- slotUpdate
{
	qt_QIconView_slotUpdate((qt_QIconView *)[self qt]);
	return self;
}

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

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

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

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

+ (int) LeftToRight
{
	return (int) QICONVIEW_LeftToRight;
}

+ (int) TopToBottom
{
	return (int) QICONVIEW_TopToBottom;
}

+ (int) Fixed
{
	return (int) QICONVIEW_Fixed;
}

+ (int) Adjust
{
	return (int) QICONVIEW_Adjust;
}

+ (int) Bottom
{
	return (int) QICONVIEW_Bottom;
}

+ (int) Right
{
	return (int) QICONVIEW_Right;
}

@end
