/***************************************************************************
                            KDockWidget.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_KDockWidget.h>
#include <kdeobjc/KDESupport.h>
#include <kdeobjc/KDockWidget.h>
#include <kdeobjc/KDockManager.h>
#include <kdeobjc/KDockWidgetAbstractHeader.h>
#include <qtobjc/QPixmap.h>
#include <qtobjc/QPoint.h>


@implementation  KDockWidget


- initWithDockManager: (KDockManager*)dockManager name: (NSString *)name pixmap: (QPixmap *)pixmap parent: (QWidget *)parent strCaption: (NSString *)strCaption strTabPageLabel: (NSString *)strTabPageLabel f: (int)f
{
static qt_QString * _qstring_strTabPageLabel = 0L;
static qt_QString * _qstring_strCaption = 0L;
	if ([self qt] == 0L) {
		[self setQt: kde_new_KDockWidget((kde_KDockManager*) [dockManager qt], (char*) [name cString], (qt_QPixmap *) [pixmap qt], (qt_QWidget *) [parent qt], (qt_QString *) [strCaption toQString: &_qstring_strCaption], (qt_QString *) [strTabPageLabel toQString: &_qstring_strTabPageLabel], (int)f)];
		[self setAllocatedInObjcWorld: YES];
		[QtSupport setObject: self forQtKey: [self qt]];
	}
	[super init];
	return self;
}

- initWithDockManager: (KDockManager*)dockManager name: (NSString *)name pixmap: (QPixmap *)pixmap 
{
	if ([self qt] == 0L) {
		[self setQt: kde_new_KDockWidget((kde_KDockManager*) [dockManager qt], (char*) [name cString], (qt_QPixmap *) [pixmap qt], 0L, 0L, " ", 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) {
			kde_del_KDockWidget((kde_KDockWidget *)[self qt]);
		}
		[QtSupport removeQtKey: [self qt]];
		[self setQt: 0L];
	}
	[super dealloc];
}

- (KDockWidget*) manualDock: (KDockWidget*)target dockPos: (int)dockPos spliPos: (int)spliPos point: (QPoint*) pos check: (BOOL)check tabIndex: (int)tabIndex
{
	return (KDockWidget*) [QtSupport objectForQtKey: kde_KDockWidget_manualDock((kde_KDockWidget *)[self qt], (kde_KDockWidget*) [target qt], (int)dockPos, (int)spliPos, (qt_QPoint*) [pos qt], (int)check, (int)tabIndex) withClass: [KDockWidget class] allocatedInObjcWorld: YES];
}

- (KDockWidget*) manualDock: (KDockWidget*)target dockPos: (int)dockPos 
{
	return (KDockWidget*) [QtSupport objectForQtKey: kde_KDockWidget_manualDock((kde_KDockWidget *)[self qt], (kde_KDockWidget*) [target qt], (int)dockPos, 50, 0, 0, -1) withClass: [KDockWidget class] allocatedInObjcWorld: YES];
}

- setEnableDocking: (int)pos
{
	kde_KDockWidget_setEnableDocking((kde_KDockWidget *)[self qt], (int)pos);
	return self;
}

- (int) enableDocking
{
	return (int) kde_KDockWidget_enableDocking((kde_KDockWidget *)[self qt]);
}

- setDockSite: (int)pos
{
	kde_KDockWidget_setDockSite((kde_KDockWidget *)[self qt], (int)pos);
	return self;
}

- (int) dockSite
{
	return (int) kde_KDockWidget_dockSite((kde_KDockWidget *)[self qt]);
}

- setWidget: (QWidget *)w
{
	kde_KDockWidget_setWidget((kde_KDockWidget *)[self qt], (qt_QWidget *) [w qt]);
	return self;
}

- (QWidget*) getWidget
{
	return (QWidget*) [QtSupport objectForQtKey: kde_KDockWidget_getWidget((kde_KDockWidget *)[self qt]) withClass: [QWidget class] allocatedInObjcWorld: YES];
}

- setHeader: (KDockWidgetAbstractHeader*)ah
{
	kde_KDockWidget_setHeader((kde_KDockWidget *)[self qt], (kde_KDockWidgetAbstractHeader*) [ah qt]);
	return self;
}

- makeDockVisible
{
	kde_KDockWidget_makeDockVisible((kde_KDockWidget *)[self qt]);
	return self;
}

- (BOOL) mayBeHide
{
	return (BOOL) kde_KDockWidget_mayBeHide((kde_KDockWidget *)[self qt]);
}

- (BOOL) mayBeShow
{
	return (BOOL) kde_KDockWidget_mayBeShow((kde_KDockWidget *)[self qt]);
}

- (KDockManager*) dockManager
{
	return (KDockManager*) [QtSupport objectForQtKey: kde_KDockWidget_dockManager((kde_KDockWidget *)[self qt]) withClass: [KDockManager class] allocatedInObjcWorld: YES];
}

- setToolTipString: (NSString *)ttStr
{
static qt_QString * _qstring_ttStr = 0L;
	kde_KDockWidget_setToolTipString((kde_KDockWidget *)[self qt], (qt_QString *) [ttStr toQString: &_qstring_ttStr]);
	return self;
}

- (NSString *) toolTipString
{
static qt_QString * _qstring = 0L;
	_qstring = kde_KDockWidget_toolTipString((kde_KDockWidget *)[self qt]);
	return [NSString fromQString: _qstring];
}

- (BOOL) isDockBackPossible
{
	return (BOOL) kde_KDockWidget_isDockBackPossible((kde_KDockWidget *)[self qt]);
}

- setTabPageLabel: (NSString *)label
{
static qt_QString * _qstring_label = 0L;
	kde_KDockWidget_setTabPageLabel((kde_KDockWidget *)[self qt], (qt_QString *) [label toQString: &_qstring_label]);
	return self;
}

- (NSString *) tabPageLabel
{
static qt_QString * _qstring = 0L;
	_qstring = kde_KDockWidget_tabPageLabel((kde_KDockWidget *)[self qt]);
	return [NSString fromQString: _qstring];
}

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

- show
{
	kde_KDockWidget_show((kde_KDockWidget *)[self qt]);
	return self;
}

- (KDockTabGroup*) parentDockTabGroup
{
	return (KDockTabGroup*) [QtSupport objectForQtKey: kde_KDockWidget_parentDockTabGroup((kde_KDockWidget *)[self qt]) withClass: [KDockTabGroup class] allocatedInObjcWorld: YES];
}

- setDockWindowType: (int)windowType
{
	kde_KDockWidget_setDockWindowType((kde_KDockWidget *)[self qt], (int)windowType);
	return self;
}

- setDockWindowTransient: (QWidget *)parent transientEnabled: (BOOL)transientEnabled
{
	kde_KDockWidget_setDockWindowTransient((kde_KDockWidget *)[self qt], (qt_QWidget *) [parent qt], (int)transientEnabled);
	return self;
}

- dockBack
{
	kde_KDockWidget_dockBack((kde_KDockWidget *)[self qt]);
	return self;
}

- changeHideShowState
{
	kde_KDockWidget_changeHideShowState((kde_KDockWidget *)[self qt]);
	return self;
}

- undock
{
	kde_KDockWidget_undock((kde_KDockWidget *)[self qt]);
	return self;
}

- updateHeader
{
	kde_KDockWidget_updateHeader((kde_KDockWidget *)[self qt]);
	return self;
}

- loseFormerBrotherDockWidget
{
	kde_KDockWidget_loseFormerBrotherDockWidget((kde_KDockWidget *)[self qt]);
	return self;
}

+ (int) DockNone
{
	return (int) KDOCKWIDGET_DockNone;
}

+ (int) DockTop
{
	return (int) KDOCKWIDGET_DockTop;
}

+ (int) DockLeft
{
	return (int) KDOCKWIDGET_DockLeft;
}

+ (int) DockRight
{
	return (int) KDOCKWIDGET_DockRight;
}

+ (int) DockBottom
{
	return (int) KDOCKWIDGET_DockBottom;
}

+ (int) DockCenter
{
	return (int) KDOCKWIDGET_DockCenter;
}

+ (int) DockDesktop
{
	return (int) KDOCKWIDGET_DockDesktop;
}

+ (int) DockCorner
{
	return (int) KDOCKWIDGET_DockCorner;
}

+ (int) DockFullSite
{
	return (int) KDOCKWIDGET_DockFullSite;
}

+ (int) DockFullDocking
{
	return (int) KDOCKWIDGET_DockFullDocking;
}

@end
