/***************************************************************************
                            QDesktopWidget.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_QDesktopWidget.h>
#include <qtobjc/QDesktopWidget.h>
#include <qtobjc/QPoint.h>


@implementation  QDesktopWidget


- init
{
	if ([self qt] == 0L) {
		[self setQt: qt_new_QDesktopWidget()];
		[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_QDesktopWidget((qt_QDesktopWidget *)[self qt]);
		}
		[QtSupport removeQtKey: [self qt]];
		[self setQt: 0L];
	}
	[super dealloc];
}

- (BOOL) isVirtualDesktop
{
	return (BOOL) qt_QDesktopWidget_isVirtualDesktop((qt_QDesktopWidget *)[self qt]);
}

- (int) numScreens
{
	return (int) qt_QDesktopWidget_numScreens((qt_QDesktopWidget *)[self qt]);
}

- (int) primaryScreen
{
	return (int) qt_QDesktopWidget_primaryScreen((qt_QDesktopWidget *)[self qt]);
}

- (int) screenNumber: (QWidget *)widget
{
	return (int) qt_QDesktopWidget_screenNumber((qt_QDesktopWidget *)[self qt], (qt_QWidget *) [widget qt]);
}

- (int) screenNumber
{
	return (int) qt_QDesktopWidget_screenNumber((qt_QDesktopWidget *)[self qt], 0);
}

- (int) screenNumberAtPoint: (QPoint*)arg1
{
	return (int) qt_QDesktopWidget_screenNumber1((qt_QDesktopWidget *)[self qt], (qt_QPoint*) [arg1 qt]);
}

- (QWidget*) screen: (int)screen
{
	return (QWidget*) [QtSupport objectForQtKey: qt_QDesktopWidget_screen((qt_QDesktopWidget *)[self qt], (int)screen) withClass: [QWidget class] allocatedInObjcWorld: YES];
}

- (QWidget*) screen
{
	return (QWidget*) [QtSupport objectForQtKey: qt_QDesktopWidget_screen((qt_QDesktopWidget *)[self qt], -1) withClass: [QWidget class] allocatedInObjcWorld: YES];
}

- (QRect*) screenGeometry: (int)screen
{
	return (QRect*) [QtSupport objectForQtKey: qt_QDesktopWidget_screenGeometry((qt_QDesktopWidget *)[self qt], (int)screen) withClass: [QRect class] allocatedInObjcWorld: YES];
}

- (QRect*) screenGeometry
{
	return (QRect*) [QtSupport objectForQtKey: qt_QDesktopWidget_screenGeometry((qt_QDesktopWidget *)[self qt], -1) withClass: [QRect class] allocatedInObjcWorld: YES];
}

//- (GDHandle) handle: (int)screen
//{
//	return (GDHandle) qt_QDesktopWidget_handle((qt_QDesktopWidget *)[self qt], (int)screen);
//}

@end
