/***************************************************************************
                            QHeader.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_QHeader.h>
#include <qtobjc/QHeader.h>
#include <qtobjc/QRect.h>

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

@implementation  QHeader


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

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

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

- initWithInt: (int)arg1 
{
	if ([self qt] == 0L) {
		[self setQt: qt_new_QHeader1((int)arg1, 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_QHeader((qt_QHeader *)[self qt]);
		}
		[QtSupport removeQtKey: [self qt]];
		[self setQt: 0L];
	}
	[super dealloc];
}

- (int) addLabel: (NSString *)arg1 size: (int)size
{
static qt_QString * _qstring_arg1 = 0L;
	return (int) qt_QHeader_addLabel((qt_QHeader *)[self qt], (qt_QString *) [arg1 toQString: &_qstring_arg1], (int)size);
}

- (int) addLabel: (NSString *)arg1 
{
static qt_QString * _qstring_arg1 = 0L;
	return (int) qt_QHeader_addLabel((qt_QHeader *)[self qt], (qt_QString *) [arg1 toQString: &_qstring_arg1], -1);
}

- (int) addLabel: (QIconSet*)arg1 string: (NSString *)arg2 size: (int)size
{
static qt_QString * _qstring_arg2 = 0L;
	return (int) qt_QHeader_addLabel1((qt_QHeader *)[self qt], (qt_QIconSet*) [arg1 qt], (qt_QString *) [arg2 toQString: &_qstring_arg2], (int)size);
}

- (int) addLabel: (QIconSet*)arg1 string: (NSString *)arg2 
{
static qt_QString * _qstring_arg2 = 0L;
	return (int) qt_QHeader_addLabel1((qt_QHeader *)[self qt], (qt_QIconSet*) [arg1 qt], (qt_QString *) [arg2 toQString: &_qstring_arg2], -1);
}

- removeLabel: (int)section
{
	qt_QHeader_removeLabel((qt_QHeader *)[self qt], (int)section);
	return self;
}

- setLabel: (int)arg1 string: (NSString *)arg2 size: (int)size
{
static qt_QString * _qstring_arg2 = 0L;
	qt_QHeader_setLabel((qt_QHeader *)[self qt], (int)arg1, (qt_QString *) [arg2 toQString: &_qstring_arg2], (int)size);
	return self;
}

- setLabel: (int)arg1 string: (NSString *)arg2 
{
static qt_QString * _qstring_arg2 = 0L;
	qt_QHeader_setLabel((qt_QHeader *)[self qt], (int)arg1, (qt_QString *) [arg2 toQString: &_qstring_arg2], -1);
	return self;
}

- setLabel: (int)arg1 iconset: (QIconSet*)arg2 string: (NSString *)arg3 size: (int)size
{
static qt_QString * _qstring_arg3 = 0L;
	qt_QHeader_setLabel1((qt_QHeader *)[self qt], (int)arg1, (qt_QIconSet*) [arg2 qt], (qt_QString *) [arg3 toQString: &_qstring_arg3], (int)size);
	return self;
}

- setLabel: (int)arg1 iconset: (QIconSet*)arg2 string: (NSString *)arg3 
{
static qt_QString * _qstring_arg3 = 0L;
	qt_QHeader_setLabel1((qt_QHeader *)[self qt], (int)arg1, (qt_QIconSet*) [arg2 qt], (qt_QString *) [arg3 toQString: &_qstring_arg3], -1);
	return self;
}

- (NSString *) label: (int)section
{
static qt_QString * _qstring = 0L;
	_qstring = qt_QHeader_label((qt_QHeader *)[self qt], (int)section);
	return [NSString fromQString: _qstring];
}

- (QIconSet*) iconSet: (int)section
{
	return (QIconSet*) [QtSupport objectForQtKey: qt_QHeader_iconSet((qt_QHeader *)[self qt], (int)section) withClass: [QIconSet class] allocatedInObjcWorld: YES];
}

- setOrientation: (int)arg1
{
	qt_QHeader_setOrientation((qt_QHeader *)[self qt], (int)arg1);
	return self;
}

- (int) orientation
{
	return (int) qt_QHeader_orientation((qt_QHeader *)[self qt]);
}

- setTracking: (BOOL)enable
{
	qt_QHeader_setTracking((qt_QHeader *)[self qt], (int)enable);
	return self;
}

- (BOOL) tracking
{
	return (BOOL) qt_QHeader_tracking((qt_QHeader *)[self qt]);
}

- setClickEnabled: (BOOL)arg1 section: (int)section
{
	qt_QHeader_setClickEnabled((qt_QHeader *)[self qt], (int)arg1, (int)section);
	return self;
}

- setClickEnabled: (BOOL)arg1 
{
	qt_QHeader_setClickEnabled((qt_QHeader *)[self qt], (int)arg1, -1);
	return self;
}

- setResizeEnabled: (BOOL)arg1 section: (int)section
{
	qt_QHeader_setResizeEnabled((qt_QHeader *)[self qt], (int)arg1, (int)section);
	return self;
}

- setResizeEnabled: (BOOL)arg1 
{
	qt_QHeader_setResizeEnabled((qt_QHeader *)[self qt], (int)arg1, -1);
	return self;
}

- setMovingEnabled: (BOOL)arg1
{
	qt_QHeader_setMovingEnabled((qt_QHeader *)[self qt], (int)arg1);
	return self;
}

- setStretchEnabled: (BOOL)b section: (int)section
{
	qt_QHeader_setStretchEnabled((qt_QHeader *)[self qt], (int)b, (int)section);
	return self;
}

- setStretchEnabled: (BOOL)b
{
	qt_QHeader_setStretchEnabled1((qt_QHeader *)[self qt], (int)b);
	return self;
}

- (BOOL) isClickEnabled: (int)section
{
	return (BOOL) qt_QHeader_isClickEnabled((qt_QHeader *)[self qt], (int)section);
}

- (BOOL) isClickEnabled
{
	return (BOOL) qt_QHeader_isClickEnabled((qt_QHeader *)[self qt], -1);
}

- (BOOL) isResizeEnabled: (int)section
{
	return (BOOL) qt_QHeader_isResizeEnabled((qt_QHeader *)[self qt], (int)section);
}

- (BOOL) isResizeEnabled
{
	return (BOOL) qt_QHeader_isResizeEnabled((qt_QHeader *)[self qt], -1);
}

- (BOOL) isMovingEnabled
{
	return (BOOL) qt_QHeader_isMovingEnabled((qt_QHeader *)[self qt]);
}

- (BOOL) isStretchEnabled
{
	return (BOOL) qt_QHeader_isStretchEnabled((qt_QHeader *)[self qt]);
}

- (BOOL) isStretchEnabled: (int)section
{
	return (BOOL) qt_QHeader_isStretchEnabled1((qt_QHeader *)[self qt], (int)section);
}

- resizeSection: (int)section s: (int)s
{
	qt_QHeader_resizeSection((qt_QHeader *)[self qt], (int)section, (int)s);
	return self;
}

- (int) sectionSize: (int)section
{
	return (int) qt_QHeader_sectionSize((qt_QHeader *)[self qt], (int)section);
}

- (int) sectionPos: (int)section
{
	return (int) qt_QHeader_sectionPos((qt_QHeader *)[self qt], (int)section);
}

- (int) sectionAt: (int)pos
{
	return (int) qt_QHeader_sectionAt((qt_QHeader *)[self qt], (int)pos);
}

- (int) count
{
	return (int) qt_QHeader_count((qt_QHeader *)[self qt]);
}

- (int) headerWidth
{
	return (int) qt_QHeader_headerWidth((qt_QHeader *)[self qt]);
}

- (QRect*) sectionRect: (int)section
{
	return (QRect*) [QtSupport objectForQtKey: qt_QHeader_sectionRect((qt_QHeader *)[self qt], (int)section) withClass: [QRect class] allocatedInObjcWorld: YES];
}

- setCellSize: (int)arg1 int: (int)arg2
{
	qt_QHeader_setCellSize((qt_QHeader *)[self qt], (int)arg1, (int)arg2);
	return self;
}

- (int) cellSize: (int)i
{
	return (int) qt_QHeader_cellSize((qt_QHeader *)[self qt], (int)i);
}

- (int) cellPos: (int)arg1
{
	return (int) qt_QHeader_cellPos((qt_QHeader *)[self qt], (int)arg1);
}

- (int) cellAt: (int)pos
{
	return (int) qt_QHeader_cellAt((qt_QHeader *)[self qt], (int)pos);
}

- (int) offset
{
	return (int) qt_QHeader_offset((qt_QHeader *)[self qt]);
}

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

- (int) mapToSection: (int)index
{
	return (int) qt_QHeader_mapToSection((qt_QHeader *)[self qt], (int)index);
}

- (int) mapToIndex: (int)section
{
	return (int) qt_QHeader_mapToIndex((qt_QHeader *)[self qt], (int)section);
}

- (int) mapToLogical: (int)arg1
{
	return (int) qt_QHeader_mapToLogical((qt_QHeader *)[self qt], (int)arg1);
}

- (int) mapToActual: (int)arg1
{
	return (int) qt_QHeader_mapToActual((qt_QHeader *)[self qt], (int)arg1);
}

- moveSection: (int)section toIndex: (int)toIndex
{
	qt_QHeader_moveSection((qt_QHeader *)[self qt], (int)section, (int)toIndex);
	return self;
}

- moveCell: (int)arg1 int: (int)arg2
{
	qt_QHeader_moveCell((qt_QHeader *)[self qt], (int)arg1, (int)arg2);
	return self;
}

- setSortIndicator: (int)section increasing: (BOOL)increasing
{
	qt_QHeader_setSortIndicator((qt_QHeader *)[self qt], (int)section, (int)increasing);
	return self;
}

- setSortIndicator: (int)section 
{
	qt_QHeader_setSortIndicator((qt_QHeader *)[self qt], (int)section, 1);
	return self;
}

- adjustHeaderSize
{
	qt_QHeader_adjustHeaderSize((qt_QHeader *)[self qt]);
	return self;
}

- setUpdatesEnabled: (BOOL)enable
{
	qt_QHeader_setUpdatesEnabled((qt_QHeader *)[self qt], (int)enable);
	return self;
}

- setOffset: (int)pos
{
	qt_QHeader_setOffset((qt_QHeader *)[self qt], (int)pos);
	return self;
}

- (QRect*) sRect: (int)index
{
	return (QRect*) [QtSupport objectForQtKey: qt_QHeader_sRect((qt_QHeader *)[self qt], (int)index) withClass: [QRect class] allocatedInObjcWorld: YES];
}

- paintSection: (QPainter *)p index: (int)index fr: (QRect*)fr
{
	qt_QHeader_paintSection((qt_QHeader *)[self qt], (qt_QPainter *) [p qt], (int)index, (qt_QRect*) [fr qt]);
	return self;
}

- paintSectionLabel: (QPainter *)p index: (int)index fr: (QRect*)fr
{
	qt_QHeader_paintSectionLabel((qt_QHeader *)[self qt], (qt_QPainter *) [p qt], (int)index, (qt_QRect*) [fr qt]);
	return self;
}

@end
