// C++ interface wrapper code.
//
// Generated by SIP 3.7 (build 102) on Fri Jul 25 00:26:03 2003
//
// Copyright (c) 2003
// 	Riverbank Computing Limited <info@riverbankcomputing.co.uk>
// 
// This file is part of PyQt.
// 
// This copy of PyQt is free software; you can redistribute it and/or modify it
// under the terms of the GNU General Public License as published by the Free
// Software Foundation; either version 2, or (at your option) any later
// version.
// 
// PyQt is supplied in the hope that it will be useful, but WITHOUT ANY
// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
// FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more
// details.
// 
// You should have received a copy of the GNU General Public License along with
// PyQt; see the file LICENSE.  If not, write to the Free Software Foundation,
// Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.

#include "sipqtcanvasDeclqtcanvas.h"
#include "sipqtcanvasQCanvasPixmap.h"


PyObject *sipClass_QCanvasPixmap;

static void sipDealloc_QCanvasPixmap(sipThisType *);

static PyTypeObject sipType_QCanvasPixmap = {
	PyObject_HEAD_INIT(&PyType_Type)
	0,
	sipWrapperTypeName,
	sizeof (sipThisType),
	0,
	(destructor)sipDealloc_QCanvasPixmap,
	0,
	0,
	0,
	0,
	0,
	0,
	0,
	0,
	0,
	0,
	0,
	0,
	0,
	0,
	Py_TPFLAGS_DEFAULT,
};

sipQCanvasPixmap::sipQCanvasPixmap(const QString& a0) : QCanvasPixmap(a0), sipPyThis(0)
{
	sipCommonCtor(sipPyMethods,3);
}

sipQCanvasPixmap::sipQCanvasPixmap(const QImage& a0) : QCanvasPixmap(a0), sipPyThis(0)
{
	sipCommonCtor(sipPyMethods,3);
}

sipQCanvasPixmap::sipQCanvasPixmap(const QPixmap& a0,const QPoint& a1) : QCanvasPixmap(a0,a1), sipPyThis(0)
{
	sipCommonCtor(sipPyMethods,3);
}

sipQCanvasPixmap::~sipQCanvasPixmap()
{
	sipCommonDtor(sipPyThis);
}

int sipQCanvasPixmap::resolution() const
{
	return sipIsPyMethod((sipMethodCache *)&sipPyMethods[0],sipPyThis,NULL,sipName_resolution) ?
		sipQPaintDevice::sipVH_resolution(&sipPyMethods[0],sipPyThis) :
		QPaintDevice::resolution();
}

void sipQCanvasPixmap::setResolution(int a0)
{
	if (sipIsPyMethod(&sipPyMethods[1],sipPyThis,NULL,sipName_setResolution))
		sipQPaintDevice::sipVH_setResolution(&sipPyMethods[1],sipPyThis,a0);
	else
		QPaintDevice::setResolution(a0);
}

void sipQCanvasPixmap::detach()
{
	if (sipIsPyMethod(&sipPyMethods[2],sipPyThis,NULL,sipName_detach))
		sipQPixmap::sipVH_detach(&sipPyMethods[2],sipPyThis);
	else
		QPixmap::detach();
}

static PyObject *sipDo_QCanvasPixmap_offsetX(PyObject *sipThisObj,PyObject *sipArgs)
{
	int sipArgsParsed = 0;

	{
		QCanvasPixmap *sipCpp;

		if (sipParseArgs(&sipArgsParsed,sipArgs,"m",sipThisObj,sipClass_QCanvasPixmap,&sipCpp))
		{
			int res;

			Py_BEGIN_ALLOW_THREADS
			res = sipCpp -> QCanvasPixmap::offsetX();
			Py_END_ALLOW_THREADS

			return PyInt_FromLong((long)res);
		}
	}

	// Report an error if the arguments couldn't be parsed.

	sipNoMethod(sipArgsParsed,sipName_QCanvasPixmap,sipName_offsetX);

	return NULL;
}

static PyObject *sipDo_QCanvasPixmap_offsetY(PyObject *sipThisObj,PyObject *sipArgs)
{
	int sipArgsParsed = 0;

	{
		QCanvasPixmap *sipCpp;

		if (sipParseArgs(&sipArgsParsed,sipArgs,"m",sipThisObj,sipClass_QCanvasPixmap,&sipCpp))
		{
			int res;

			Py_BEGIN_ALLOW_THREADS
			res = sipCpp -> QCanvasPixmap::offsetY();
			Py_END_ALLOW_THREADS

			return PyInt_FromLong((long)res);
		}
	}

	// Report an error if the arguments couldn't be parsed.

	sipNoMethod(sipArgsParsed,sipName_QCanvasPixmap,sipName_offsetY);

	return NULL;
}

static PyObject *sipDo_QCanvasPixmap_setOffset(PyObject *sipThisObj,PyObject *sipArgs)
{
	int sipArgsParsed = 0;

	{
		int a0;
		int a1;
		QCanvasPixmap *sipCpp;

		if (sipParseArgs(&sipArgsParsed,sipArgs,"mii",sipThisObj,sipClass_QCanvasPixmap,&sipCpp,&a0,&a1))
		{
			Py_BEGIN_ALLOW_THREADS
			sipCpp -> QCanvasPixmap::setOffset(a0,a1);
			Py_END_ALLOW_THREADS

			Py_INCREF(Py_None);
			return Py_None;
		}
	}

	// Report an error if the arguments couldn't be parsed.

	sipNoMethod(sipArgsParsed,sipName_QCanvasPixmap,sipName_setOffset);

	return NULL;
}

// Cast a pointer to a type somewhere in its superclass hierarchy.

const void *sipCast_QCanvasPixmap(const void *ptr,PyObject *targetClass)
{
	const void *res;

	if (targetClass == sipClass_QCanvasPixmap)
		return ptr;

	if ((res = sipCast_QPixmap((QPixmap *)(QCanvasPixmap *)ptr,targetClass)) != NULL)
		return res;

	return NULL;
}

static void sipDealloc_QCanvasPixmap(sipThisType *sipThis)
{
	if (sipThis -> u.cppPtr != NULL)
	{
		if (!sipIsSimple(sipThis))
			((sipQCanvasPixmap *)sipThis -> u.cppPtr) -> sipPyThis = NULL;

		if (sipIsPyOwned(sipThis))
		{
			Py_BEGIN_ALLOW_THREADS

			if (!sipIsSimple(sipThis))
				delete (sipQCanvasPixmap *)sipThis -> u.cppPtr;
			else
				delete (QCanvasPixmap *)sipThis -> u.cppPtr;

			Py_END_ALLOW_THREADS
		}
	}

	sipDeleteThis(sipThis);
}

PyObject *sipNew_QCanvasPixmap(PyObject *sipSelf,PyObject *sipArgs)
{
	static sipExtraType et = {
		sipCast_QCanvasPixmap,
		(void *)sipNewProxy_qtcanvas,
		NULL
	};

	sipThisType *sipThis = NULL;
	const void *sipNew = NULL;
	int sipFlags = SIP_PY_OWNED;
	int sipArgsParsed = 0;

	// See if there is something pending.

	sipNew = sipGetPending(&sipFlags);

	if (sipNew == NULL)
	{
		QString * a0;
		int a0IsTemp = 0;

		if (sipParseArgs(&sipArgsParsed,sipArgs,"M1",sipConvertTo_QString,&a0,&a0IsTemp))
		{
			Py_BEGIN_ALLOW_THREADS
			sipNew = new sipQCanvasPixmap(*a0);
			Py_END_ALLOW_THREADS

			if (a0IsTemp)
				delete a0;
		}
	}

	if (sipNew == NULL)
	{
		QImage * a0;

		if (sipParseArgs(&sipArgsParsed,sipArgs,"J1",sipClass_QImage,&a0))
		{
			Py_BEGIN_ALLOW_THREADS
			sipNew = new sipQCanvasPixmap(*a0);
			Py_END_ALLOW_THREADS
		}
	}

	if (sipNew == NULL)
	{
		QPixmap * a0;
		QPoint * a1;

		if (sipParseArgs(&sipArgsParsed,sipArgs,"J1J1",sipClass_QPixmap,&a0,sipClass_QPoint,&a1))
		{
			Py_BEGIN_ALLOW_THREADS
			sipNew = new sipQCanvasPixmap(*a0,*a1);
			Py_END_ALLOW_THREADS
		}
	}

	if (sipNew == NULL)
	{
		sipNoCtor(sipArgsParsed,sipName_QCanvasPixmap);
		return NULL;
	}

	// Wrap the object.

	if ((sipThis = sipCreateThis(sipSelf,sipNew,&sipType_QCanvasPixmap,sipFlags,&et)) == NULL)
	{
		if (sipFlags & SIP_PY_OWNED)
		{
			Py_BEGIN_ALLOW_THREADS

			if (!(sipFlags & SIP_SIMPLE))
				delete (sipQCanvasPixmap *)sipNew;
			else
				delete (QCanvasPixmap *)sipNew;

			Py_END_ALLOW_THREADS
		}

		return NULL;
	}

	if (!(sipFlags & SIP_SIMPLE))
		((sipQCanvasPixmap *)sipNew) -> sipPyThis = sipThis;

	Py_INCREF(Py_None);
	return Py_None;
}

static PyMethodDef lazyMethods_QCanvasPixmap[] = {
	{sipName_offsetX, sipDo_QCanvasPixmap_offsetX, METH_VARARGS, NULL},
	{sipName_offsetY, sipDo_QCanvasPixmap_offsetY, METH_VARARGS, NULL},
	{sipName_setOffset, sipDo_QCanvasPixmap_setOffset, METH_VARARGS, NULL}
};

sipLazyAttrDef sipClassAttrTab_QCanvasPixmap = {
	0, NULL,
	sizeof (lazyMethods_QCanvasPixmap) / sizeof (PyMethodDef), lazyMethods_QCanvasPixmap,
	0, NULL
};

QCanvasPixmap *sipForceConvertTo_QCanvasPixmap(PyObject *valobj,int *iserrp)
{
	if (*iserrp || valobj == NULL)
		return NULL;

	if (valobj == Py_None || sipIsSubClassInstance(valobj,sipClass_QCanvasPixmap))
		return (QCanvasPixmap *)sipConvertToCpp(valobj,sipClass_QCanvasPixmap,iserrp);

	sipBadClass(sipName_QCanvasPixmap);

	*iserrp = 1;

	return NULL;
}
