/***************************************************************************
                            QGLFormat.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_QGLFormat.h>
#include <qtobjc/QGLFormat.h>

@implementation  QGLFormat


- init
{
	if ([self qt] == 0L) {
		[self setQt: qt_new_QGLFormat()];
		[self setAllocatedInObjcWorld: YES];
		[QtSupport setObject: self forQtKey: [self qt]];
	}
	[super init];
	return self;
}

- initWithInt: (int)options plane: (int)plane
{
	if ([self qt] == 0L) {
		[self setQt: qt_new_QGLFormat1((int)options, (int)plane)];
		[self setAllocatedInObjcWorld: YES];
		[QtSupport setObject: self forQtKey: [self qt]];
	}
	[super init];
	return self;
}

- initWithInt: (int)options 
{
	if ([self qt] == 0L) {
		[self setQt: qt_new_QGLFormat1((int)options, 0)];
		[self setAllocatedInObjcWorld: YES];
		[QtSupport setObject: self forQtKey: [self qt]];
	}
	[super init];
	return self;
}

- (BOOL) doubleBuffer
{
	return (BOOL) qt_QGLFormat_doubleBuffer((qt_QGLFormat *)[self qt]);
}

- setDoubleBuffer: (BOOL)enable
{
	qt_QGLFormat_setDoubleBuffer((qt_QGLFormat *)[self qt], (int)enable);
	return self;
}

- (BOOL) depth
{
	return (BOOL) qt_QGLFormat_depth((qt_QGLFormat *)[self qt]);
}

- setDepth: (BOOL)enable
{
	qt_QGLFormat_setDepth((qt_QGLFormat *)[self qt], (int)enable);
	return self;
}

- (BOOL) rgba
{
	return (BOOL) qt_QGLFormat_rgba((qt_QGLFormat *)[self qt]);
}

- setRgba: (BOOL)enable
{
	qt_QGLFormat_setRgba((qt_QGLFormat *)[self qt], (int)enable);
	return self;
}

- (BOOL) alpha
{
	return (BOOL) qt_QGLFormat_alpha((qt_QGLFormat *)[self qt]);
}

- setAlpha: (BOOL)enable
{
	qt_QGLFormat_setAlpha((qt_QGLFormat *)[self qt], (int)enable);
	return self;
}

- (BOOL) accum
{
	return (BOOL) qt_QGLFormat_accum((qt_QGLFormat *)[self qt]);
}

- setAccum: (BOOL)enable
{
	qt_QGLFormat_setAccum((qt_QGLFormat *)[self qt], (int)enable);
	return self;
}

- (BOOL) stencil
{
	return (BOOL) qt_QGLFormat_stencil((qt_QGLFormat *)[self qt]);
}

- setStencil: (BOOL)enable
{
	qt_QGLFormat_setStencil((qt_QGLFormat *)[self qt], (int)enable);
	return self;
}

- (BOOL) stereo
{
	return (BOOL) qt_QGLFormat_stereo((qt_QGLFormat *)[self qt]);
}

- setStereo: (BOOL)enable
{
	qt_QGLFormat_setStereo((qt_QGLFormat *)[self qt], (int)enable);
	return self;
}

- (BOOL) directRendering
{
	return (BOOL) qt_QGLFormat_directRendering((qt_QGLFormat *)[self qt]);
}

- setDirectRendering: (BOOL)enable
{
	qt_QGLFormat_setDirectRendering((qt_QGLFormat *)[self qt], (int)enable);
	return self;
}

- (BOOL) hasOverlay
{
	return (BOOL) qt_QGLFormat_hasOverlay((qt_QGLFormat *)[self qt]);
}

- setOverlay: (BOOL)enable
{
	qt_QGLFormat_setOverlay((qt_QGLFormat *)[self qt], (int)enable);
	return self;
}

- (int) plane
{
	return (int) qt_QGLFormat_plane((qt_QGLFormat *)[self qt]);
}

- setPlane: (int)plane
{
	qt_QGLFormat_setPlane((qt_QGLFormat *)[self qt], (int)plane);
	return self;
}

- setOption: (int)opt
{
	qt_QGLFormat_setOption((qt_QGLFormat *)[self qt], (int)opt);
	return self;
}

- (BOOL) testOption: (int)opt
{
	return (BOOL) qt_QGLFormat_testOption((qt_QGLFormat *)[self qt], (int)opt);
}

+ (QGLFormat*) defaultFormat
{
	return (QGLFormat*) [QtSupport objectForQtKey: qt_QGLFormat_defaultFormat() withClass: [QGLFormat class] allocatedInObjcWorld: YES];
}

+ setDefaultFormat: (QGLFormat*)f
{
	qt_QGLFormat_setDefaultFormat((qt_QGLFormat*) [f qt]);
	return self;
}

+ (QGLFormat*) defaultOverlayFormat
{
	return (QGLFormat*) [QtSupport objectForQtKey: qt_QGLFormat_defaultOverlayFormat() withClass: [QGLFormat class] allocatedInObjcWorld: YES];
}

+ setDefaultOverlayFormat: (QGLFormat*)f
{
	qt_QGLFormat_setDefaultOverlayFormat((qt_QGLFormat*) [f qt]);
	return self;
}

+ (BOOL) hasOpenGL
{
	return (BOOL) qt_QGLFormat_hasOpenGL();
}

+ (BOOL) hasOpenGLOverlays
{
	return (BOOL) qt_QGLFormat_hasOpenGLOverlays();
}

@end
