/***************************************************************************
                            QCheckListItem.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_QCheckListItem.h>
#include <qtobjc/QCheckListItem.h>
#include <qtobjc/QListView.h>
#include <qtobjc/QPixmap.h>
#include <qtobjc/QPainter.h>
#include <qtobjc/QColorGroup.h>
#include <qtobjc/QRect.h>
#include <qtobjc/QFontMetrics.h>

@implementation  QCheckListItem


- initWithCheckListItem: (QCheckListItem *)parent text: (NSString *)text int: (int)arg1
{
static qt_QString * _qstring_text = 0L;
	if ([self qt] == 0L) {
		[self setQt: qt_new_QCheckListItem((qt_QCheckListItem *) [parent qt], (qt_QString *) [text toQString: &_qstring_text], (int)arg1)];
		[self setAllocatedInObjcWorld: YES];
		[QtSupport setObject: self forQtKey: [self qt]];
	}
	[super init];
	return self;
}

- initWithCheckListItem: (QCheckListItem *)parent text: (NSString *)text 
{
static qt_QString * _qstring_text = 0L;
	if ([self qt] == 0L) {
		[self setQt: qt_new_QCheckListItem((qt_QCheckListItem *) [parent qt], (qt_QString *) [text toQString: &_qstring_text], [QCheckListItem Controller])];
		[self setAllocatedInObjcWorld: YES];
		[QtSupport setObject: self forQtKey: [self qt]];
	}
	[super init];
	return self;
}

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

- initWithListViewItem: (QListViewItem *)parent text: (NSString *)text 
{
static qt_QString * _qstring_text = 0L;
	if ([self qt] == 0L) {
		[self setQt: qt_new_QCheckListItem1((qt_QListViewItem *) [parent qt], (qt_QString *) [text toQString: &_qstring_text], [QCheckListItem Controller])];
		[self setAllocatedInObjcWorld: YES];
		[QtSupport setObject: self forQtKey: [self qt]];
	}
	[super init];
	return self;
}

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

- initWithListView: (QListView *)parent text: (NSString *)text 
{
static qt_QString * _qstring_text = 0L;
	if ([self qt] == 0L) {
		[self setQt: qt_new_QCheckListItem2((qt_QListView *) [parent qt], (qt_QString *) [text toQString: &_qstring_text], [QCheckListItem Controller])];
		[self setAllocatedInObjcWorld: YES];
		[QtSupport setObject: self forQtKey: [self qt]];
	}
	[super init];
	return self;
}

- initWithListViewItem: (QListViewItem *)parent text: (NSString *)text pixmap: (QPixmap *)arg1
{
static qt_QString * _qstring_text = 0L;
	if ([self qt] == 0L) {
		[self setQt: qt_new_QCheckListItem3((qt_QListViewItem *) [parent qt], (qt_QString *) [text toQString: &_qstring_text], (qt_QPixmap *) [arg1 qt])];
		[self setAllocatedInObjcWorld: YES];
		[QtSupport setObject: self forQtKey: [self qt]];
	}
	[super init];
	return self;
}

- initWithListView: (QListView *)parent text: (NSString *)text pixmap: (QPixmap *)arg1
{
static qt_QString * _qstring_text = 0L;
	if ([self qt] == 0L) {
		[self setQt: qt_new_QCheckListItem4((qt_QListView *) [parent qt], (qt_QString *) [text toQString: &_qstring_text], (qt_QPixmap *) [arg1 qt])];
		[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) {
			qt_del_QCheckListItem((qt_QCheckListItem *)[self qt]);
		}
		[QtSupport removeQtKey: [self qt]];
		[self setQt: 0L];
	}
	[super dealloc];
}

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

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

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

- setup
{
	qt_QCheckListItem_setup((qt_QCheckListItem *)[self qt]);
	return self;
}

- setOn: (BOOL)arg1
{
	qt_QCheckListItem_setOn((qt_QCheckListItem *)[self qt], (int)arg1);
	return self;
}

- (BOOL) isOn
{
	return (BOOL) qt_QCheckListItem_isOn((qt_QCheckListItem *)[self qt]);
}

- (int) type
{
	return (int) qt_QCheckListItem_type((qt_QCheckListItem *)[self qt]);
}

- (NSString *) text
{
static qt_QString * _qstring = 0L;
	_qstring = qt_QCheckListItem_text((qt_QCheckListItem *)[self qt]);
	return [NSString fromQString: _qstring];
}

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

- (int) rtti
{
	return (int) qt_QCheckListItem_rtti((qt_QCheckListItem *)[self qt]);
}

- activate
{
	qt_QCheckListItem_activate((qt_QCheckListItem *)[self qt]);
	return self;
}

- turnOffChild
{
	qt_QCheckListItem_turnOffChild((qt_QCheckListItem *)[self qt]);
	return self;
}

- stateChange: (BOOL)arg1
{
	qt_QCheckListItem_stateChange((qt_QCheckListItem *)[self qt], (int)arg1);
	return self;
}

+ (int) RadioButton
{
	return (int) QCHECKLISTITEM_RadioButton;
}

+ (int) CheckBox
{
	return (int) QCHECKLISTITEM_CheckBox;
}

+ (int) Controller
{
	return (int) QCHECKLISTITEM_Controller;
}

@end
