/*
 * Interface wrapper code.
 *
 * Generated by SIP 6.15.1
 *
 *     Copyright: (c) 2020 by Total Control Software
 *     License:   wxWindows License
 */

#include "sipAPI_core.h"
        #include <wx/metafile.h>
        #include <wx/metafile.h>
    #include <wx/setup.h>
    #include <wxPython/wxpy_api.h>
        #include <wx/gdicmn.h>
        #include <wx/graphics.h>
        #include <wx/bitmap.h>
        #include <wx/gdicmn.h>
        #include <wx/palette.h>
        #include <wx/gdicmn.h>
        #include <wx/colour.h>
        #include <wx/dc.h>
        #include <wx/affinematrix2d.h>
        #include <wx/pen.h>
        #include "arrayholder.h"
        #include <wx/brush.h>
        #include <wx/font.h>
        #include <wx/dc.h>
        #include <wx/region.h>
        #include <wx/icon.h>
        #include <wx/object.h>
        #include <wx/object.h>
        #include <wx/object.h>


class sipwxMetafileDC : public ::wxMetafileDC
{
public:
    sipwxMetafileDC(const ::wxString&);
    ~sipwxMetafileDC();

public:
    sipSimpleWrapper *sipPySelf;

private:
    sipwxMetafileDC(const sipwxMetafileDC &);
    sipwxMetafileDC &operator = (const sipwxMetafileDC &);
};

sipwxMetafileDC::sipwxMetafileDC(const ::wxString& filename): ::wxMetafileDC(filename), sipPySelf(SIP_NULLPTR)
{
}

sipwxMetafileDC::~sipwxMetafileDC()
{
    sipInstanceDestroyedEx(&sipPySelf);
}


PyDoc_STRVAR(doc_wxMetafileDC_Close, "Close() -> Metafile\n"
"\n"
"This must be called after the device context is finished with.");

extern "C" {static PyObject *meth_wxMetafileDC_Close(PyObject *, PyObject *);}
static PyObject *meth_wxMetafileDC_Close(PyObject *sipSelf, PyObject *sipArgs)
{
    PyObject *sipParseErr = SIP_NULLPTR;

    {
        ::wxMetafileDC *sipCpp;

        if (sipParseArgs(&sipParseErr, sipArgs, "B", &sipSelf, sipType_wxMetafileDC, &sipCpp))
        {
            ::wxMetafile*sipRes;

            PyErr_Clear();

            Py_BEGIN_ALLOW_THREADS
            sipRes = sipCpp->Close();
            Py_END_ALLOW_THREADS

            if (PyErr_Occurred())
                return 0;

            return sipConvertFromType(sipRes, sipType_wxMetafile, SIP_NULLPTR);
        }
    }

    sipNoMethod(sipParseErr, sipName_MetafileDC, sipName_Close, SIP_NULLPTR);

    return SIP_NULLPTR;
}


/* Cast a pointer to a type somewhere in its inheritance hierarchy. */
extern "C" {static void *cast_wxMetafileDC(void *, const sipTypeDef *);}
static void *cast_wxMetafileDC(void *sipCppV, const sipTypeDef *targetType)
{
    ::wxMetafileDC *sipCpp = reinterpret_cast< ::wxMetafileDC *>(sipCppV);

    if (targetType == sipType_wxMetafileDC)
        return sipCppV;

    sipCppV = ((const sipClassTypeDef *)sipType_wxDC)->ctd_cast(static_cast< ::wxDC *>(sipCpp), targetType);
    if (sipCppV)
        return sipCppV;

    return SIP_NULLPTR;
}


/* Call the instance's destructor. */
extern "C" {static void release_wxMetafileDC(void *, int);}
static void release_wxMetafileDC(void *sipCppV, int sipState)
{
    Py_BEGIN_ALLOW_THREADS

    if (sipState & SIP_DERIVED_CLASS)
        delete reinterpret_cast<sipwxMetafileDC *>(sipCppV);
    else
        delete reinterpret_cast< ::wxMetafileDC *>(sipCppV);

    Py_END_ALLOW_THREADS
}


extern "C" {static void *array_wxMetafileDC(Py_ssize_t);}
static void *array_wxMetafileDC(Py_ssize_t sipNrElem)
{
    return new ::wxMetafileDC[sipNrElem];
}


extern "C" {static void array_delete_wxMetafileDC(void *);}
static void array_delete_wxMetafileDC(void *sipCpp)
{
    delete[] reinterpret_cast< ::wxMetafileDC *>(sipCpp);
}


extern "C" {static void dealloc_wxMetafileDC(sipSimpleWrapper *);}
static void dealloc_wxMetafileDC(sipSimpleWrapper *sipSelf)
{
    if (sipIsDerivedClass(sipSelf))
        reinterpret_cast<sipwxMetafileDC *>(sipGetAddress(sipSelf))->sipPySelf = SIP_NULLPTR;

    if (sipIsOwnedByPython(sipSelf))
    {
        release_wxMetafileDC(sipGetAddress(sipSelf), sipIsDerivedClass(sipSelf));
    }
}


extern "C" {static void *init_type_wxMetafileDC(sipSimpleWrapper *, PyObject *, PyObject *, PyObject **, PyObject **, PyObject **);}
static void *init_type_wxMetafileDC(sipSimpleWrapper *sipSelf, PyObject *sipArgs, PyObject *sipKwds, PyObject **sipUnused, PyObject **, PyObject **sipParseErr)
{
    sipwxMetafileDC *sipCpp = SIP_NULLPTR;

    {
        const ::wxString& filenamedef = wxEmptyString;
        const ::wxString* filename = &filenamedef;
        int filenameState = 0;

        static const char *sipKwdList[] = {
            sipName_filename,
        };

        if (sipParseKwdArgs(sipParseErr, sipArgs, sipKwds, sipKwdList, sipUnused, "|J1", sipType_wxString, &filename, &filenameState))
        {
            PyErr_Clear();

            Py_BEGIN_ALLOW_THREADS
            sipCpp = new sipwxMetafileDC(*filename);
            Py_END_ALLOW_THREADS
            sipReleaseType(const_cast< ::wxString *>(filename), sipType_wxString, filenameState);

            if (PyErr_Occurred())
            {
                delete sipCpp;
                return SIP_NULLPTR;
            }

            sipCpp->sipPySelf = sipSelf;

            return sipCpp;
        }
    }

    return SIP_NULLPTR;
}


/* Define this type's super-types. */
static sipEncodedTypeDef supers_wxMetafileDC[] = {{101, 255, 1}};


static PyMethodDef methods_wxMetafileDC[] = {
    {sipName_Close, meth_wxMetafileDC_Close, METH_VARARGS, doc_wxMetafileDC_Close}
};

PyDoc_STRVAR(doc_wxMetafileDC, "MetafileDC(filename='') -> None\n"
"\n"
"This is a type of device context that allows a metafile object to be\n"
"created (Windows only), and has most of the characteristics of a\n"
"normal wxDC.");


sipClassTypeDef sipTypeDef__core_wxMetafileDC = {
    {
        -1,
        SIP_NULLPTR,
        SIP_NULLPTR,
        SIP_TYPE_SCC|SIP_TYPE_CLASS,
        sipNameNr_wxMetafileDC,
        SIP_NULLPTR,
        SIP_NULLPTR,
    },
    {
        sipNameNr_MetafileDC,
        {0, 0, 1},
        1, methods_wxMetafileDC,
        0, SIP_NULLPTR,
        0, SIP_NULLPTR,
        {SIP_NULLPTR, SIP_NULLPTR, SIP_NULLPTR, SIP_NULLPTR, SIP_NULLPTR, SIP_NULLPTR, SIP_NULLPTR, SIP_NULLPTR, SIP_NULLPTR, SIP_NULLPTR},
    },
    doc_wxMetafileDC,
    -1,
    -1,
    supers_wxMetafileDC,
    SIP_NULLPTR,
    init_type_wxMetafileDC,
    SIP_NULLPTR,
    SIP_NULLPTR,
    SIP_NULLPTR,
    SIP_NULLPTR,
    dealloc_wxMetafileDC,
    SIP_NULLPTR,
    array_wxMetafileDC,
    SIP_NULLPTR,
    release_wxMetafileDC,
    cast_wxMetafileDC,
    SIP_NULLPTR,
    SIP_NULLPTR,
    SIP_NULLPTR,
    SIP_NULLPTR,
    SIP_NULLPTR,
    SIP_NULLPTR,
    array_delete_wxMetafileDC,
    sizeof (::wxMetafileDC),
};
