/***************************************************************************
                            QTabBar.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_QTabBar.h>

#include <qtobjc/QTabBar.h>
#include <qtobjc/QFont.h>

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

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

@implementation  QTabBar


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

- (int) shape
{
	return (int) qt_QTabBar_shape((qt_QTabBar *)[self qt]);
}

- setShape: (int)arg1
{
	qt_QTabBar_setShape((qt_QTabBar *)[self qt], (int)arg1);
	return self;
}

- show
{
	qt_QTabBar_show((qt_QTabBar *)[self qt]);
	return self;
}

- (int) addTab: (QTab*)arg1
{
	return (int) qt_QTabBar_addTab((qt_QTabBar *)[self qt], (qt_QTab*) [arg1 qt]);
}

- (int) insertTab: (QTab*)arg1 index: (int)index
{
	return (int) qt_QTabBar_insertTab((qt_QTabBar *)[self qt], (qt_QTab*) [arg1 qt], (int)index);
}

- (int) insertTab: (QTab*)arg1 
{
	return (int) qt_QTabBar_insertTab((qt_QTabBar *)[self qt], (qt_QTab*) [arg1 qt], -1);
}

- removeTab: (QTab*)arg1
{
	qt_QTabBar_removeTab((qt_QTabBar *)[self qt], (qt_QTab*) [arg1 qt]);
	return self;
}

- setTabEnabled: (int)arg1 bool: (BOOL)arg2
{
	qt_QTabBar_setTabEnabled((qt_QTabBar *)[self qt], (int)arg1, (int)arg2);
	return self;
}

- (BOOL) isTabEnabled: (int)arg1
{
	return (BOOL) qt_QTabBar_isTabEnabled((qt_QTabBar *)[self qt], (int)arg1);
}

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

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

- (int) currentTab
{
	return (int) qt_QTabBar_currentTab((qt_QTabBar *)[self qt]);
}

- (int) keyboardFocusTab
{
	return (int) qt_QTabBar_keyboardFocusTab((qt_QTabBar *)[self qt]);
}

- (QTab*) tab: (int)arg1
{
	return (QTab*) [QtSupport objectForQtKey: qt_QTabBar_tab((qt_QTabBar *)[self qt], (int)arg1) withClass: [QTab class] allocatedInObjcWorld: YES];
}

- (QTab*) tabAt: (int)arg1
{
	return (QTab*) [QtSupport objectForQtKey: qt_QTabBar_tabAt((qt_QTabBar *)[self qt], (int)arg1) withClass: [QTab class] allocatedInObjcWorld: YES];
}

- (int) indexOf: (int)arg1
{
	return (int) qt_QTabBar_indexOf((qt_QTabBar *)[self qt], (int)arg1);
}

- (int) count
{
	return (int) qt_QTabBar_count((qt_QTabBar *)[self qt]);
}

- layoutTabs
{
	qt_QTabBar_layoutTabs((qt_QTabBar *)[self qt]);
	return self;
}

- (QTab*) selectTab: (QPoint*)p
{
	return (QTab*) [QtSupport objectForQtKey: qt_QTabBar_selectTab((qt_QTabBar *)[self qt], (qt_QPoint*) [p qt]) withClass: [QTab class] allocatedInObjcWorld: YES];
}

- removeToolTip: (int)index
{
	qt_QTabBar_removeToolTip((qt_QTabBar *)[self qt], (int)index);
	return self;
}

- setToolTip: (int)index tip: (NSString *)tip
{
static qt_QString * _qstring_tip = 0L;
	qt_QTabBar_setToolTip((qt_QTabBar *)[self qt], (int)index, (qt_QString *) [tip toQString: &_qstring_tip]);
	return self;
}

- (NSString *) toolTip: (int)index
{
static qt_QString * _qstring = 0L;
	_qstring = qt_QTabBar_toolTip((qt_QTabBar *)[self qt], (int)index);
	return [NSString fromQString: _qstring];
}

- setCurrentTabAtId: (int)arg1
{
	qt_QTabBar_setCurrentTab((qt_QTabBar *)[self qt], (int)arg1);
	return self;
}

- setCurrentTab: (QTab*)arg1
{
	qt_QTabBar_setCurrentTab1((qt_QTabBar *)[self qt], (qt_QTab*) [arg1 qt]);
	return self;
}

- paint: (QPainter *)arg1 tab: (QTab*)arg2 bool: (BOOL)arg3
{
	qt_QTabBar_paint((qt_QTabBar *)[self qt], (qt_QPainter *) [arg1 qt], (qt_QTab*) [arg2 qt], (int)arg3);
	return self;
}

- paintLabel: (QPainter *)arg1 rect: (QRect*)arg2 tab: (QTab*)arg3 bool: (BOOL)arg4
{
	qt_QTabBar_paintLabel((qt_QTabBar *)[self qt], (qt_QPainter *) [arg1 qt], (qt_QRect*) [arg2 qt], (qt_QTab*) [arg3 qt], (int)arg4);
	return self;
}

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

- fontChange: (QFont *)arg1
{
	qt_QTabBar_fontChange((qt_QTabBar *)[self qt], (qt_QFont *) [arg1 qt]);
	return self;
}

+ (int) RoundedAbove
{
	return (int) QTABBAR_RoundedAbove;
}

+ (int) RoundedBelow
{
	return (int) QTABBAR_RoundedBelow;
}

+ (int) TriangularAbove
{
	return (int) QTABBAR_TriangularAbove;
}

+ (int) TriangularBelow
{
	return (int) QTABBAR_TriangularBelow;
}

@end
