/***************************************************************************
                            KDockMainWindow.m -  description
                             -------------------
    begin                : Fri Mar  8 13:55:08 2002
    copyright            : (C) 2000-2002 Lost Highway Ltd. All rights reserved.
    email                : Lost_Highway@tipitina.demon.co.uk
    generated by         : duke@tipitina on Fri Mar  8 13:55:08 2002, 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 <kdec/kde_KDockMainWindow.h>
#include <kdeobjc/KDESupport.h>
#include <kdeobjc/KDockMainWindow.h>
#include <kdeobjc/KConfig.h>
#include <kdeobjc/KDockWidget.h>
#include <qtobjc/QDomElement.h>
#include <qtobjc/QPixmap.h>


@implementation  KDockMainWindow


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

- (KDockManager*) manager
{
	return (KDockManager*) [QtSupport objectForQtKey: kde_KDockMainWindow_manager((kde_KDockMainWindow *)[self qt]) withClass: [KDockManager class] allocatedInObjcWorld: YES];
}

- setMainDockWidget: (KDockWidget*)arg1
{
	kde_KDockMainWindow_setMainDockWidget((kde_KDockMainWindow *)[self qt], (kde_KDockWidget*) [arg1 qt]);
	return self;
}

- (KDockWidget*) getMainDockWidget
{
	return (KDockWidget*) [QtSupport objectForQtKey: kde_KDockMainWindow_getMainDockWidget((kde_KDockMainWindow *)[self qt]) withClass: [KDockWidget class] allocatedInObjcWorld: YES];
}

- (KDockWidget*) createDockWidget: (NSString *)name pixmap: (QPixmap *)pixmap parent: (QWidget *)parent strCaption: (NSString *)strCaption strTabPageLabel: (NSString *)strTabPageLabel
{
static qt_QString * _qstring_strTabPageLabel = 0L;
static qt_QString * _qstring_strCaption = 0L;
static qt_QString * _qstring_name = 0L;
	return (KDockWidget*) [QtSupport objectForQtKey: kde_KDockMainWindow_createDockWidget((kde_KDockMainWindow *)[self qt], (qt_QString *) [name toQString: &_qstring_name], (qt_QPixmap *) [pixmap qt], (qt_QWidget *) [parent qt], (qt_QString *) [strCaption toQString: &_qstring_strCaption], (qt_QString *) [strTabPageLabel toQString: &_qstring_strTabPageLabel]) withClass: [KDockWidget class] allocatedInObjcWorld: YES];
}

- (KDockWidget*) createDockWidget: (NSString *)name pixmap: (QPixmap *)pixmap 
{
static qt_QString * _qstring_name = 0L;
	return (KDockWidget*) [QtSupport objectForQtKey: kde_KDockMainWindow_createDockWidget((kde_KDockMainWindow *)[self qt], (qt_QString *) [name toQString: &_qstring_name], (qt_QPixmap *) [pixmap qt], 0L, 0L, " ") withClass: [KDockWidget class] allocatedInObjcWorld: YES];
}

- writeDockConfig: (QDomElement*)base
{
	kde_KDockMainWindow_writeDockConfig((kde_KDockMainWindow *)[self qt], (qt_QDomElement*) [base qt]);
	return self;
}

- readDockConfig: (QDomElement*)base
{
	kde_KDockMainWindow_readDockConfig((kde_KDockMainWindow *)[self qt], (qt_QDomElement*) [base qt]);
	return self;
}

- writeDockConfig: (KConfig*)c group: (NSString *)group
{
static qt_QString * _qstring_group = 0L;
	kde_KDockMainWindow_writeDockConfig1((kde_KDockMainWindow *)[self qt], (kde_KConfig*) [c qt], (qt_QString *) [group toQString: &_qstring_group]);
	return self;
}

- writeDockConfig
{
	kde_KDockMainWindow_writeDockConfig1((kde_KDockMainWindow *)[self qt], 0L, qt_QString_null());
	return self;
}

- readDockConfig: (KConfig*)c group: (NSString *)group
{
static qt_QString * _qstring_group = 0L;
	kde_KDockMainWindow_readDockConfig1((kde_KDockMainWindow *)[self qt], (kde_KConfig*) [c qt], (qt_QString *) [group toQString: &_qstring_group]);
	return self;
}

- readDockConfig
{
	kde_KDockMainWindow_readDockConfig1((kde_KDockMainWindow *)[self qt], 0L, qt_QString_null());
	return self;
}

- activateDock
{
	kde_KDockMainWindow_activateDock((kde_KDockMainWindow *)[self qt]);
	return self;
}

- (QPopupMenu*) dockHideShowMenu
{
	return (QPopupMenu*) [QtSupport objectForQtKey: kde_KDockMainWindow_dockHideShowMenu((kde_KDockMainWindow *)[self qt]) withClass: [QPopupMenu class] allocatedInObjcWorld: YES];
}

- makeDockVisible: (KDockWidget*)dock
{
	kde_KDockMainWindow_makeDockVisible((kde_KDockMainWindow *)[self qt], (kde_KDockWidget*) [dock qt]);
	return self;
}

- makeDockInvisible: (KDockWidget*)dock
{
	kde_KDockMainWindow_makeDockInvisible((kde_KDockMainWindow *)[self qt], (kde_KDockWidget*) [dock qt]);
	return self;
}

- makeWidgetDockVisible: (QWidget *)widget
{
	kde_KDockMainWindow_makeWidgetDockVisible((kde_KDockMainWindow *)[self qt], (qt_QWidget *) [widget qt]);
	return self;
}

- setView: (QWidget *)arg1
{
	kde_KDockMainWindow_setView((kde_KDockMainWindow *)[self qt], (qt_QWidget *) [arg1 qt]);
	return self;
}

- slotDockWidgetUndocked
{
	kde_KDockMainWindow_slotDockWidgetUndocked((kde_KDockMainWindow *)[self qt]);
	return self;
}

@end
