/***************************************************************************
                            QMainWindow.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_QMainWindow.h>
#include <qtobjc/QMainWindow.h>
#include <qtobjc/QDockArea.h>
#include <qtobjc/QPoint.h>

#include <qtobjc/QToolBar.h>
#include <qtobjc/QStyle.h>

@implementation  QMainWindow


- initWithWidget: (QWidget *)parent name: (NSString *)name f: (int)f
{
	if ([self qt] == 0L) {
		[self setQt: qt_new_QMainWindow((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_QMainWindow(0, 0, [QMainWindow WType_TopLevel])];
		[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_QMainWindow((qt_QMainWindow *)[self qt]);
		}
		[QtSupport removeQtKey: [self qt]];
		[self setQt: 0L];
	}
	[super dealloc];
}

- (QMenuBar*) menuBar
{
	return (QMenuBar*) [QtSupport objectForQtKey: qt_QMainWindow_menuBar((qt_QMainWindow *)[self qt]) withClass: [QMenuBar class] allocatedInObjcWorld: YES];
}

- (QStatusBar*) statusBar
{
	return (QStatusBar*) [QtSupport objectForQtKey: qt_QMainWindow_statusBar((qt_QMainWindow *)[self qt]) withClass: [QStatusBar class] allocatedInObjcWorld: YES];
}

- (QToolTipGroup*) toolTipGroup
{
	return (QToolTipGroup*) [QtSupport objectForQtKey: qt_QMainWindow_toolTipGroup((qt_QMainWindow *)[self qt]) withClass: [QToolTipGroup class] allocatedInObjcWorld: YES];
}

- setCentralWidget: (QWidget *)arg1
{
	qt_QMainWindow_setCentralWidget((qt_QMainWindow *)[self qt], (qt_QWidget *) [arg1 qt]);
	return self;
}

- (QWidget*) centralWidget
{
	return (QWidget*) [QtSupport objectForQtKey: qt_QMainWindow_centralWidget((qt_QMainWindow *)[self qt]) withClass: [QWidget class] allocatedInObjcWorld: YES];
}

- setDockEnabled: (int)dock enable: (BOOL)enable
{
	qt_QMainWindow_setDockEnabled((qt_QMainWindow *)[self qt], (int)dock, (int)enable);
	return self;
}

- (BOOL) isDockEnabled: (int)dock
{
	return (BOOL) qt_QMainWindow_isDockEnabled((qt_QMainWindow *)[self qt], (int)dock);
}

- (BOOL) isDockAreaEnabled: (QDockArea*)area
{
	return (BOOL) qt_QMainWindow_isDockEnabled1((qt_QMainWindow *)[self qt], (qt_QDockArea*) [area qt]);
}

- setDockEnabled: (QDockWindow*)tb dock: (int)dock enable: (BOOL)enable
{
	qt_QMainWindow_setDockEnabled1((qt_QMainWindow *)[self qt], (qt_QDockWindow*) [tb qt], (int)dock, (int)enable);
	return self;
}

- (BOOL) isDockEnabled: (QDockWindow*)tb dock: (int)dock
{
	return (BOOL) qt_QMainWindow_isDockEnabled2((qt_QMainWindow *)[self qt], (qt_QDockWindow*) [tb qt], (int)dock);
}

- (BOOL) isDockEnabled: (QDockWindow*)tb area: (QDockArea*)area
{
	return (BOOL) qt_QMainWindow_isDockEnabled3((qt_QMainWindow *)[self qt], (qt_QDockWindow*) [tb qt], (qt_QDockArea*) [area qt]);
}

- addDockWindow: (QDockWindow*)arg1 int: (int)arg2 newLine: (BOOL)newLine
{
	qt_QMainWindow_addDockWindow((qt_QMainWindow *)[self qt], (qt_QDockWindow*) [arg1 qt], (int)arg2, (int)newLine);
	return self;
}

- addDockWindow: (QDockWindow*)arg1 
{
	qt_QMainWindow_addDockWindow((qt_QMainWindow *)[self qt], (qt_QDockWindow*) [arg1 qt], [QMainWindow DockTop], 0);
	return self;
}

- addDockWindow: (QDockWindow*)arg1 label: (NSString *)label int: (int)arg2 newLine: (BOOL)newLine
{
static qt_QString * _qstring_label = 0L;
	qt_QMainWindow_addDockWindow1((qt_QMainWindow *)[self qt], (qt_QDockWindow*) [arg1 qt], (qt_QString *) [label toQString: &_qstring_label], (int)arg2, (int)newLine);
	return self;
}

- addDockWindow: (QDockWindow*)arg1 label: (NSString *)label 
{
static qt_QString * _qstring_label = 0L;
	qt_QMainWindow_addDockWindow1((qt_QMainWindow *)[self qt], (qt_QDockWindow*) [arg1 qt], (qt_QString *) [label toQString: &_qstring_label], [QMainWindow DockTop], 0);
	return self;
}

- moveDockWindow: (QDockWindow*)arg1 int: (int)arg2
{
	qt_QMainWindow_moveDockWindow((qt_QMainWindow *)[self qt], (qt_QDockWindow*) [arg1 qt], (int)arg2);
	return self;
}

- moveDockWindow: (QDockWindow*)arg1 
{
	qt_QMainWindow_moveDockWindow((qt_QMainWindow *)[self qt], (qt_QDockWindow*) [arg1 qt], [QMainWindow DockTop]);
	return self;
}

- moveDockWindow: (QDockWindow*)arg1 int: (int)arg2 nl: (BOOL)nl index: (int)index extraOffset: (int)extraOffset
{
	qt_QMainWindow_moveDockWindow1((qt_QMainWindow *)[self qt], (qt_QDockWindow*) [arg1 qt], (int)arg2, (int)nl, (int)index, (int)extraOffset);
	return self;
}

- moveDockWindow: (QDockWindow*)arg1 int: (int)arg2 nl: (BOOL)nl index: (int)index 
{
	qt_QMainWindow_moveDockWindow1((qt_QMainWindow *)[self qt], (qt_QDockWindow*) [arg1 qt], (int)arg2, (int)nl, (int)index, -1);
	return self;
}

- removeDockWindow: (QDockWindow*)arg1
{
	qt_QMainWindow_removeDockWindow((qt_QMainWindow *)[self qt], (qt_QDockWindow*) [arg1 qt]);
	return self;
}

- show
{
	qt_QMainWindow_show((qt_QMainWindow *)[self qt]);
	return self;
}

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

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

- (BOOL) rightJustification
{
	return (BOOL) qt_QMainWindow_rightJustification((qt_QMainWindow *)[self qt]);
}

- (BOOL) usesBigPixmaps
{
	return (BOOL) qt_QMainWindow_usesBigPixmaps((qt_QMainWindow *)[self qt]);
}

- (BOOL) usesTextLabel
{
	return (BOOL) qt_QMainWindow_usesTextLabel((qt_QMainWindow *)[self qt]);
}

- (BOOL) dockWindowsMovable
{
	return (BOOL) qt_QMainWindow_dockWindowsMovable((qt_QMainWindow *)[self qt]);
}

- (BOOL) opaqueMoving
{
	return (BOOL) qt_QMainWindow_opaqueMoving((qt_QMainWindow *)[self qt]);
}

- (BOOL) eventFilter: (QObject *)arg1 event: (QEvent *)arg2
{
	return (BOOL) qt_QMainWindow_eventFilter((qt_QMainWindow *)[self qt], (qt_QObject *) [arg1 qt], (qt_QEvent *) [arg2 qt]);
}

- (BOOL) getLocation: (QDockWindow*)tb dock: (int)dock index: (int)index nl: (BOOL)nl extraOffset: (int)extraOffset
{
	return (BOOL) qt_QMainWindow_getLocation((qt_QMainWindow *)[self qt], (qt_QDockWindow*) [tb qt], (int)dock, (int)index, (int)nl, (int)extraOffset);
}

- lineUpDockWindows: (BOOL)keepNewLines
{
	qt_QMainWindow_lineUpDockWindows((qt_QMainWindow *)[self qt], (int)keepNewLines);
	return self;
}

- lineUpDockWindows
{
	qt_QMainWindow_lineUpDockWindows((qt_QMainWindow *)[self qt], 0);
	return self;
}

- (BOOL) isDockMenuEnabled
{
	return (BOOL) qt_QMainWindow_isDockMenuEnabled((qt_QMainWindow *)[self qt]);
}

- (BOOL) hasDockWindow: (QDockWindow*)dw
{
	return (BOOL) qt_QMainWindow_hasDockWindow((qt_QMainWindow *)[self qt], (qt_QDockWindow*) [dw qt]);
}

- addToolBar: (QDockWindow*)arg1 int: (int)arg2 newLine: (BOOL)newLine
{
	qt_QMainWindow_addToolBar((qt_QMainWindow *)[self qt], (qt_QDockWindow*) [arg1 qt], (int)arg2, (int)newLine);
	return self;
}

- addToolBar: (QDockWindow*)arg1 
{
	qt_QMainWindow_addToolBar((qt_QMainWindow *)[self qt], (qt_QDockWindow*) [arg1 qt], [QMainWindow DockTop], 0);
	return self;
}

- addToolBar: (QDockWindow*)arg1 label: (NSString *)label int: (int)arg2 newLine: (BOOL)newLine
{
static qt_QString * _qstring_label = 0L;
	qt_QMainWindow_addToolBar1((qt_QMainWindow *)[self qt], (qt_QDockWindow*) [arg1 qt], (qt_QString *) [label toQString: &_qstring_label], (int)arg2, (int)newLine);
	return self;
}

- addToolBar: (QDockWindow*)arg1 label: (NSString *)label 
{
static qt_QString * _qstring_label = 0L;
	qt_QMainWindow_addToolBar1((qt_QMainWindow *)[self qt], (qt_QDockWindow*) [arg1 qt], (qt_QString *) [label toQString: &_qstring_label], [QMainWindow DockTop], 0);
	return self;
}

- moveToolBar: (QDockWindow*)arg1 int: (int)arg2
{
	qt_QMainWindow_moveToolBar((qt_QMainWindow *)[self qt], (qt_QDockWindow*) [arg1 qt], (int)arg2);
	return self;
}

- moveToolBar: (QDockWindow*)arg1 
{
	qt_QMainWindow_moveToolBar((qt_QMainWindow *)[self qt], (qt_QDockWindow*) [arg1 qt], [QMainWindow DockTop]);
	return self;
}

- moveToolBar: (QDockWindow*)arg1 int: (int)arg2 nl: (BOOL)nl index: (int)index extraOffset: (int)extraOffset
{
	qt_QMainWindow_moveToolBar1((qt_QMainWindow *)[self qt], (qt_QDockWindow*) [arg1 qt], (int)arg2, (int)nl, (int)index, (int)extraOffset);
	return self;
}

- moveToolBar: (QDockWindow*)arg1 int: (int)arg2 nl: (BOOL)nl index: (int)index 
{
	qt_QMainWindow_moveToolBar1((qt_QMainWindow *)[self qt], (qt_QDockWindow*) [arg1 qt], (int)arg2, (int)nl, (int)index, -1);
	return self;
}

- removeToolBar: (QDockWindow*)arg1
{
	qt_QMainWindow_removeToolBar((qt_QMainWindow *)[self qt], (qt_QDockWindow*) [arg1 qt]);
	return self;
}

- (BOOL) toolBarsMovable
{
	return (BOOL) qt_QMainWindow_toolBarsMovable((qt_QMainWindow *)[self qt]);
}

- lineUpToolBars: (BOOL)keepNewLines
{
	qt_QMainWindow_lineUpToolBars((qt_QMainWindow *)[self qt], (int)keepNewLines);
	return self;
}

- lineUpToolBars
{
	qt_QMainWindow_lineUpToolBars((qt_QMainWindow *)[self qt], 0);
	return self;
}

- (QDockArea*) dockingArea: (QPoint*)p
{
	return (QDockArea*) [QtSupport objectForQtKey: qt_QMainWindow_dockingArea((qt_QMainWindow *)[self qt], (qt_QPoint*) [p qt]) withClass: [QDockArea class] allocatedInObjcWorld: YES];
}

- (QDockArea*) leftDock
{
	return (QDockArea*) [QtSupport objectForQtKey: qt_QMainWindow_leftDock((qt_QMainWindow *)[self qt]) withClass: [QDockArea class] allocatedInObjcWorld: YES];
}

- (QDockArea*) rightDock
{
	return (QDockArea*) [QtSupport objectForQtKey: qt_QMainWindow_rightDock((qt_QMainWindow *)[self qt]) withClass: [QDockArea class] allocatedInObjcWorld: YES];
}

- (QDockArea*) topDock
{
	return (QDockArea*) [QtSupport objectForQtKey: qt_QMainWindow_topDock((qt_QMainWindow *)[self qt]) withClass: [QDockArea class] allocatedInObjcWorld: YES];
}

- (QDockArea*) bottomDock
{
	return (QDockArea*) [QtSupport objectForQtKey: qt_QMainWindow_bottomDock((qt_QMainWindow *)[self qt]) withClass: [QDockArea class] allocatedInObjcWorld: YES];
}

- (BOOL) isCustomizable
{
	return (BOOL) qt_QMainWindow_isCustomizable((qt_QMainWindow *)[self qt]);
}

- (BOOL) appropriate: (QDockWindow*)dw
{
	return (BOOL) qt_QMainWindow_appropriate((qt_QMainWindow *)[self qt], (qt_QDockWindow*) [dw qt]);
}

- (QPopupMenu*) createDockWindowMenu: (int)dockWindows
{
	return (QPopupMenu*) [QtSupport objectForQtKey: qt_QMainWindow_createDockWindowMenu((qt_QMainWindow *)[self qt], (int)dockWindows) withClass: [QPopupMenu class] allocatedInObjcWorld: YES];
}

- (QPopupMenu*) createDockWindowMenu
{
	return (QPopupMenu*) [QtSupport objectForQtKey: qt_QMainWindow_createDockWindowMenu((qt_QMainWindow *)[self qt], [QMainWindow AllDockWindows]) withClass: [QPopupMenu class] allocatedInObjcWorld: YES];
}

- setRightJustification: (BOOL)arg1
{
	qt_QMainWindow_setRightJustification((qt_QMainWindow *)[self qt], (int)arg1);
	return self;
}

- setUsesBigPixmaps: (BOOL)arg1
{
	qt_QMainWindow_setUsesBigPixmaps((qt_QMainWindow *)[self qt], (int)arg1);
	return self;
}

- setUsesTextLabel: (BOOL)arg1
{
	qt_QMainWindow_setUsesTextLabel((qt_QMainWindow *)[self qt], (int)arg1);
	return self;
}

- setDockWindowsMovable: (BOOL)arg1
{
	qt_QMainWindow_setDockWindowsMovable((qt_QMainWindow *)[self qt], (int)arg1);
	return self;
}

- setOpaqueMoving: (BOOL)arg1
{
	qt_QMainWindow_setOpaqueMoving((qt_QMainWindow *)[self qt], (int)arg1);
	return self;
}

- setDockMenuEnabled: (BOOL)arg1
{
	qt_QMainWindow_setDockMenuEnabled((qt_QMainWindow *)[self qt], (int)arg1);
	return self;
}

- whatsThis
{
	qt_QMainWindow_whatsThis((qt_QMainWindow *)[self qt]);
	return self;
}

- setAppropriate: (QDockWindow*)dw a: (BOOL)a
{
	qt_QMainWindow_setAppropriate((qt_QMainWindow *)[self qt], (qt_QDockWindow*) [dw qt], (int)a);
	return self;
}

- customize
{
	qt_QMainWindow_customize((qt_QMainWindow *)[self qt]);
	return self;
}

- setToolBarsMovable: (BOOL)arg1
{
	qt_QMainWindow_setToolBarsMovable((qt_QMainWindow *)[self qt], (int)arg1);
	return self;
}

- (BOOL) event: (QEvent *)arg1
{
	return (BOOL) qt_QMainWindow_event((qt_QMainWindow *)[self qt], (qt_QEvent *) [arg1 qt]);
}

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

- setUpLayout
{
	qt_QMainWindow_setUpLayout((qt_QMainWindow *)[self qt]);
	return self;
}

- (BOOL) showDockMenu: (QPoint*)globalPos
{
	return (BOOL) qt_QMainWindow_showDockMenu((qt_QMainWindow *)[self qt], (qt_QPoint*) [globalPos qt]);
}

- menuAboutToShow
{
	qt_QMainWindow_menuAboutToShow((qt_QMainWindow *)[self qt]);
	return self;
}

+ (int) OnlyToolBars
{
	return (int) QMAINWINDOW_OnlyToolBars;
}

+ (int) NoToolBars
{
	return (int) QMAINWINDOW_NoToolBars;
}

+ (int) AllDockWindows
{
	return (int) QMAINWINDOW_AllDockWindows;
}

@end
