/***************************************************************************
                            QDockArea.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_QDockArea.h>
#include <qtobjc/QDockArea.h>
#include <qtobjc/QDockWindow.h>
#include <qtobjc/QPoint.h>
#include <qtobjc/QRect.h>


@implementation  QDockArea


- initWithInt: (int)o h: (int)h parent: (QWidget *)parent name: (NSString *)name
{
	if ([self qt] == 0L) {
		[self setQt: qt_new_QDockArea((int)o, (int)h, (qt_QWidget *) [parent qt], (char*) [name cString])];
		[self setAllocatedInObjcWorld: YES];
		[QtSupport setObject: self forQtKey: [self qt]];
	}
	[super init];
	return self;
}

- initWithInt: (int)o 
{
	if ([self qt] == 0L) {
		[self setQt: qt_new_QDockArea((int)o, [QDockArea Normal], 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_QDockArea((qt_QDockArea *)[self qt]);
		}
		[QtSupport removeQtKey: [self qt]];
		[self setQt: 0L];
	}
	[super dealloc];
}

- moveDockWindow: (QDockWindow*)w globalPos: (QPoint*)globalPos rect: (QRect*)rect swap: (BOOL)swap
{
	qt_QDockArea_moveDockWindow((qt_QDockArea *)[self qt], (qt_QDockWindow*) [w qt], (qt_QPoint*) [globalPos qt], (qt_QRect*) [rect qt], (int)swap);
	return self;
}

- removeDockWindow: (QDockWindow*)w makeFloating: (BOOL)makeFloating swap: (BOOL)swap fixNewLines: (BOOL)fixNewLines
{
	qt_QDockArea_removeDockWindow((qt_QDockArea *)[self qt], (qt_QDockWindow*) [w qt], (int)makeFloating, (int)swap, (int)fixNewLines);
	return self;
}

- removeDockWindow: (QDockWindow*)w makeFloating: (BOOL)makeFloating swap: (BOOL)swap 
{
	qt_QDockArea_removeDockWindow((qt_QDockArea *)[self qt], (qt_QDockWindow*) [w qt], (int)makeFloating, (int)swap, 1);
	return self;
}

- moveDockWindow: (QDockWindow*)w index: (int)index
{
	qt_QDockArea_moveDockWindow1((qt_QDockArea *)[self qt], (qt_QDockWindow*) [w qt], (int)index);
	return self;
}

- moveDockWindow: (QDockWindow*)w 
{
	qt_QDockArea_moveDockWindow1((qt_QDockArea *)[self qt], (qt_QDockWindow*) [w qt], -1);
	return self;
}

- (BOOL) hasDockWindow: (QDockWindow*)w index: (int*)index
{
	return (BOOL) qt_QDockArea_hasDockWindow((qt_QDockArea *)[self qt], (qt_QDockWindow*) [w qt], (int*)index);
}

- (BOOL) hasDockWindow: (QDockWindow*)w 
{
	return (BOOL) qt_QDockArea_hasDockWindow((qt_QDockArea *)[self qt], (qt_QDockWindow*) [w qt], 0);
}

- invalidNextOffset: (QDockWindow*)dw
{
	qt_QDockArea_invalidNextOffset((qt_QDockArea *)[self qt], (qt_QDockWindow*) [dw qt]);
	return self;
}

- (int) orientation
{
	return (int) qt_QDockArea_orientation((qt_QDockArea *)[self qt]);
}

- (int) handlePosition
{
	return (int) qt_QDockArea_handlePosition((qt_QDockArea *)[self qt]);
}

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

- (BOOL) isEmpty
{
	return (BOOL) qt_QDockArea_isEmpty((qt_QDockArea *)[self qt]);
}

- (int) count
{
	return (int) qt_QDockArea_count((qt_QDockArea *)[self qt]);
}

- (BOOL) isDockWindowAccepted: (QDockWindow*)dw
{
	return (BOOL) qt_QDockArea_isDockWindowAccepted((qt_QDockArea *)[self qt], (qt_QDockWindow*) [dw qt]);
}

- setAcceptDockWindow: (QDockWindow*)dw accept: (BOOL)accept
{
	qt_QDockArea_setAcceptDockWindow((qt_QDockArea *)[self qt], (qt_QDockWindow*) [dw qt], (int)accept);
	return self;
}

- lineUp: (BOOL)keepNewLines
{
	qt_QDockArea_lineUp((qt_QDockArea *)[self qt], (int)keepNewLines);
	return self;
}

+ (int) Normal
{
	return (int) QDOCKAREA_Normal;
}

+ (int) Reverse
{
	return (int) QDOCKAREA_Reverse;
}

@end
