/***************************************************************************
                            QToolBar.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_QToolBar.h>
#include <qtobjc/QToolBar.h>
#include <qtobjc/QMainWindow.h>

#include <qtobjc/QStyle.h>

@implementation  QToolBar


- initWithText: (NSString *)label mainwindow: (QMainWindow*)arg1 int: (int)arg2 newLine: (BOOL)newLine name: (NSString *)name
{
static qt_QString * _qstring_label = 0L;
	if ([self qt] == 0L) {
		[self setQt: qt_new_QToolBar((qt_QString *) [label toQString: &_qstring_label], (qt_QMainWindow*) [arg1 qt], (int)arg2, (int)newLine, (char*) [name cString])];
		[self setAllocatedInObjcWorld: YES];
		[QtSupport setObject: self forQtKey: [self qt]];
	}
	[super init];
	return self;
}

- initWithText: (NSString *)label mainwindow: (QMainWindow*)arg1 
{
static qt_QString * _qstring_label = 0L;
	if ([self qt] == 0L) {
		[self setQt: qt_new_QToolBar((qt_QString *) [label toQString: &_qstring_label], (qt_QMainWindow*) [arg1 qt], [QToolBar DockTop], 0, 0)];
		[self setAllocatedInObjcWorld: YES];
		[QtSupport setObject: self forQtKey: [self qt]];
	}
	[super init];
	return self;
}

- initWithText: (NSString *)label mainwindow: (QMainWindow*)arg1 widget: (QWidget *)arg2 newLine: (BOOL)newLine name: (NSString *)name f: (int)f
{
static qt_QString * _qstring_label = 0L;
	if ([self qt] == 0L) {
		[self setQt: qt_new_QToolBar1((qt_QString *) [label toQString: &_qstring_label], (qt_QMainWindow*) [arg1 qt], (qt_QWidget *) [arg2 qt], (int)newLine, (char*) [name cString], (int)f)];
		[self setAllocatedInObjcWorld: YES];
		[QtSupport setObject: self forQtKey: [self qt]];
	}
	[super init];
	return self;
}

- initWithText: (NSString *)label mainwindow: (QMainWindow*)arg1 widget: (QWidget *)arg2 
{
static qt_QString * _qstring_label = 0L;
	if ([self qt] == 0L) {
		[self setQt: qt_new_QToolBar1((qt_QString *) [label toQString: &_qstring_label], (qt_QMainWindow*) [arg1 qt], (qt_QWidget *) [arg2 qt], 0, 0, 0)];
		[self setAllocatedInObjcWorld: YES];
		[QtSupport setObject: self forQtKey: [self qt]];
	}
	[super init];
	return self;
}

- initWithMainWindow: (QMainWindow*)parent name: (NSString *)name
{
	if ([self qt] == 0L) {
		[self setQt: qt_new_QToolBar2((qt_QMainWindow*) [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_QToolBar2(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_QToolBar((qt_QToolBar *)[self qt]);
		}
		[QtSupport removeQtKey: [self qt]];
		[self setQt: 0L];
	}
	[super dealloc];
}

- addSeparator
{
	qt_QToolBar_addSeparator((qt_QToolBar *)[self qt]);
	return self;
}

- show
{
	qt_QToolBar_show((qt_QToolBar *)[self qt]);
	return self;
}

- hide
{
	qt_QToolBar_hide((qt_QToolBar *)[self qt]);
	return self;
}

- (QMainWindow*) mainWindow
{
	return (QMainWindow*) [QtSupport objectForQtKey: qt_QToolBar_mainWindow((qt_QToolBar *)[self qt]) withClass: [QMainWindow class] allocatedInObjcWorld: YES];
}

- setStretchableWidget: (QWidget *)arg1
{
	qt_QToolBar_setStretchableWidget((qt_QToolBar *)[self qt], (qt_QWidget *) [arg1 qt]);
	return self;
}

- (BOOL) event: (QEvent *)e
{
	return (BOOL) qt_QToolBar_event((qt_QToolBar *)[self qt], (qt_QEvent *) [e qt]);
}

- setLabel: (NSString *)arg1
{
static qt_QString * _qstring_arg1 = 0L;
	qt_QToolBar_setLabel((qt_QToolBar *)[self qt], (qt_QString *) [arg1 toQString: &_qstring_arg1]);
	return self;
}

- (NSString *) label
{
static qt_QString * _qstring = 0L;
	_qstring = qt_QToolBar_label((qt_QToolBar *)[self qt]);
	return [NSString fromQString: _qstring];
}

- clear
{
	qt_QToolBar_clear((qt_QToolBar *)[self qt]);
	return self;
}

- (QSize*) minimumSize
{
	return (QSize*) [QtSupport objectForQtKey: qt_QToolBar_minimumSize((qt_QToolBar *)[self qt]) withClass: [QSize class] allocatedInObjcWorld: YES];
}

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

- setOrientation: (int)o
{
	qt_QToolBar_setOrientation((qt_QToolBar *)[self qt], (int)o);
	return self;
}

- setMinimumSize: (int)minw minh: (int)minh
{
	qt_QToolBar_setMinimumSize((qt_QToolBar *)[self qt], (int)minw, (int)minh);
	return self;
}

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

@end
