/*
 * 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/dcgraph.h>
        #include <wx/dcclient.h>
        #include <wx/dcmemory.h>
        #include <wx/dcprint.h>
        #include <wx/graphics.h>
    #include <wx/setup.h>
    #include <wxPython/wxpy_api.h>
        #include <wx/gdicmn.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 sipwxGCDC : public ::wxGCDC
{
public:
    sipwxGCDC(const ::wxWindowDC&);
    sipwxGCDC(const ::wxMemoryDC&);
    sipwxGCDC(const ::wxPrinterDC&);
    sipwxGCDC(::wxGraphicsContext*);
    sipwxGCDC();
    virtual ~sipwxGCDC();

    /*
     * There is a protected method for every virtual method visible from
     * this class.
     */
protected:
    void SetGraphicsContext(::wxGraphicsContext*) SIP_OVERRIDE;
    ::wxGraphicsContext* GetGraphicsContext() const SIP_OVERRIDE;

public:
    sipSimpleWrapper *sipPySelf;

private:
    sipwxGCDC(const sipwxGCDC &);
    sipwxGCDC &operator = (const sipwxGCDC &);

    char sipPyMethods[2];
};

sipwxGCDC::sipwxGCDC(const ::wxWindowDC& windowDC): ::wxGCDC(windowDC), sipPySelf(SIP_NULLPTR)
{
    memset(sipPyMethods, 0, sizeof (sipPyMethods));
}

sipwxGCDC::sipwxGCDC(const ::wxMemoryDC& memoryDC): ::wxGCDC(memoryDC), sipPySelf(SIP_NULLPTR)
{
    memset(sipPyMethods, 0, sizeof (sipPyMethods));
}

sipwxGCDC::sipwxGCDC(const ::wxPrinterDC& printerDC): ::wxGCDC(printerDC), sipPySelf(SIP_NULLPTR)
{
    memset(sipPyMethods, 0, sizeof (sipPyMethods));
}

sipwxGCDC::sipwxGCDC(::wxGraphicsContext*context): ::wxGCDC(context), sipPySelf(SIP_NULLPTR)
{
    memset(sipPyMethods, 0, sizeof (sipPyMethods));
}

sipwxGCDC::sipwxGCDC(): ::wxGCDC(), sipPySelf(SIP_NULLPTR)
{
    memset(sipPyMethods, 0, sizeof (sipPyMethods));
}

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

void sipwxGCDC::SetGraphicsContext(::wxGraphicsContext*context)
{
    sip_gilstate_t sipGILState;
    PyObject *sipMeth;

    sipMeth = sipIsPyMethod(&sipGILState, &sipPyMethods[0], &sipPySelf, SIP_NULLPTR, sipName_SetGraphicsContext);

    if (!sipMeth)
    {
        ::wxGCDC::SetGraphicsContext(context);
        return;
    }

    extern void sipVH__core_30(sip_gilstate_t, sipVirtErrorHandlerFunc, sipSimpleWrapper *, PyObject *, ::wxGraphicsContext*);

    sipVH__core_30(sipGILState, 0, sipPySelf, sipMeth, context);
}

::wxGraphicsContext* sipwxGCDC::GetGraphicsContext() const
{
    sip_gilstate_t sipGILState;
    PyObject *sipMeth;

    sipMeth = sipIsPyMethod(&sipGILState, const_cast<char *>(&sipPyMethods[1]), const_cast<sipSimpleWrapper **>(&sipPySelf), SIP_NULLPTR, sipName_GetGraphicsContext);

    if (!sipMeth)
        return ::wxGCDC::GetGraphicsContext();

    extern ::wxGraphicsContext* sipVH__core_29(sip_gilstate_t, sipVirtErrorHandlerFunc, sipSimpleWrapper *, PyObject *);

    return sipVH__core_29(sipGILState, 0, sipPySelf, sipMeth);
}


PyDoc_STRVAR(doc_wxGCDC_GetGraphicsContext, "GetGraphicsContext() -> GraphicsContext\n"
"\n"
"Retrieves associated wxGraphicsContext.");

extern "C" {static PyObject *meth_wxGCDC_GetGraphicsContext(PyObject *, PyObject *);}
static PyObject *meth_wxGCDC_GetGraphicsContext(PyObject *sipSelf, PyObject *sipArgs)
{
    PyObject *sipParseErr = SIP_NULLPTR;
    bool sipSelfWasArg = (!sipSelf || sipIsDerivedClass((sipSimpleWrapper *)sipSelf));

    {
        const ::wxGCDC *sipCpp;

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

            PyErr_Clear();

            Py_BEGIN_ALLOW_THREADS
            sipRes = (sipSelfWasArg ? sipCpp->::wxGCDC::GetGraphicsContext() : sipCpp->GetGraphicsContext());
            Py_END_ALLOW_THREADS

            if (PyErr_Occurred())
                return 0;

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

    sipNoMethod(sipParseErr, sipName_GCDC, sipName_GetGraphicsContext, SIP_NULLPTR);

    return SIP_NULLPTR;
}


PyDoc_STRVAR(doc_wxGCDC_SetGraphicsContext, "SetGraphicsContext(context) -> None\n"
"\n"
"Set the graphics context to be used for this wxGCDC.");

extern "C" {static PyObject *meth_wxGCDC_SetGraphicsContext(PyObject *, PyObject *, PyObject *);}
static PyObject *meth_wxGCDC_SetGraphicsContext(PyObject *sipSelf, PyObject *sipArgs, PyObject *sipKwds)
{
    PyObject *sipParseErr = SIP_NULLPTR;
    bool sipSelfWasArg = (!sipSelf || sipIsDerivedClass((sipSimpleWrapper *)sipSelf));

    {
        ::wxGraphicsContext* context;
        ::wxGCDC *sipCpp;

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

        if (sipParseKwdArgs(&sipParseErr, sipArgs, sipKwds, sipKwdList, SIP_NULLPTR, "BJ:", &sipSelf, sipType_wxGCDC, &sipCpp, sipType_wxGraphicsContext, &context))
        {
            PyErr_Clear();

            Py_BEGIN_ALLOW_THREADS
            (sipSelfWasArg ? sipCpp->::wxGCDC::SetGraphicsContext(context) : sipCpp->SetGraphicsContext(context));
            Py_END_ALLOW_THREADS

            if (PyErr_Occurred())
                return 0;

            Py_INCREF(Py_None);
            return Py_None;
        }
    }

    sipNoMethod(sipParseErr, sipName_GCDC, sipName_SetGraphicsContext, SIP_NULLPTR);

    return SIP_NULLPTR;
}


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

    if (targetType == sipType_wxGCDC)
        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_wxGCDC(void *, int);}
static void release_wxGCDC(void *sipCppV, int sipState)
{
    Py_BEGIN_ALLOW_THREADS

    if (sipState & SIP_DERIVED_CLASS)
        delete reinterpret_cast<sipwxGCDC *>(sipCppV);
    else
        delete reinterpret_cast< ::wxGCDC *>(sipCppV);

    Py_END_ALLOW_THREADS
}


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


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


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

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


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

    {
        const ::wxWindowDC* windowDC;
        PyObject *windowDCKeep;

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

        if (sipParseKwdArgs(sipParseErr, sipArgs, sipKwds, sipKwdList, sipUnused, "@J9", &windowDCKeep, sipType_wxWindowDC, &windowDC))
        {
        if (!wxPyCheckForApp()) return NULL;

            PyErr_Clear();

            Py_BEGIN_ALLOW_THREADS
            sipCpp = new sipwxGCDC(*windowDC);
            Py_END_ALLOW_THREADS

            sipKeepReference((PyObject *)sipSelf, -9, windowDCKeep);

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

            sipCpp->sipPySelf = sipSelf;

            return sipCpp;
        }
    }

    {
        const ::wxMemoryDC* memoryDC;
        PyObject *memoryDCKeep;

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

        if (sipParseKwdArgs(sipParseErr, sipArgs, sipKwds, sipKwdList, sipUnused, "@J9", &memoryDCKeep, sipType_wxMemoryDC, &memoryDC))
        {
        if (!wxPyCheckForApp()) return NULL;

            PyErr_Clear();

            Py_BEGIN_ALLOW_THREADS
            sipCpp = new sipwxGCDC(*memoryDC);
            Py_END_ALLOW_THREADS

            sipKeepReference((PyObject *)sipSelf, -10, memoryDCKeep);

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

            sipCpp->sipPySelf = sipSelf;

            return sipCpp;
        }
    }

    {
        const ::wxPrinterDC* printerDC;
        PyObject *printerDCKeep;

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

        if (sipParseKwdArgs(sipParseErr, sipArgs, sipKwds, sipKwdList, sipUnused, "@J9", &printerDCKeep, sipType_wxPrinterDC, &printerDC))
        {
        if (!wxPyCheckForApp()) return NULL;

            PyErr_Clear();

            Py_BEGIN_ALLOW_THREADS
            sipCpp = new sipwxGCDC(*printerDC);
            Py_END_ALLOW_THREADS

            sipKeepReference((PyObject *)sipSelf, -11, printerDCKeep);

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

            sipCpp->sipPySelf = sipSelf;

            return sipCpp;
        }
    }

    {
        ::wxGraphicsContext* context;

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

        if (sipParseKwdArgs(sipParseErr, sipArgs, sipKwds, sipKwdList, sipUnused, "#J:", sipSelf, sipType_wxGraphicsContext, &context))
        {
        if (!wxPyCheckForApp()) return NULL;

            PyErr_Clear();

            Py_BEGIN_ALLOW_THREADS
            sipCpp = new sipwxGCDC(context);
            Py_END_ALLOW_THREADS

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

            sipCpp->sipPySelf = sipSelf;

            return sipCpp;
        }
    }

    {
        if (sipParseKwdArgs(sipParseErr, sipArgs, sipKwds, SIP_NULLPTR, sipUnused, ""))
        {
        if (!wxPyCheckForApp()) return NULL;

            PyErr_Clear();

            Py_BEGIN_ALLOW_THREADS
            sipCpp = new sipwxGCDC();
            Py_END_ALLOW_THREADS

            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_wxGCDC[] = {{101, 255, 1}};


static PyMethodDef methods_wxGCDC[] = {
    {sipName_GetGraphicsContext, meth_wxGCDC_GetGraphicsContext, METH_VARARGS, doc_wxGCDC_GetGraphicsContext},
    {sipName_SetGraphicsContext, SIP_MLMETH_CAST(meth_wxGCDC_SetGraphicsContext), METH_VARARGS|METH_KEYWORDS, doc_wxGCDC_SetGraphicsContext}
};

sipVariableDef variables_wxGCDC[] = {
    {PropertyVariable, sipName_GraphicsContext, &methods_wxGCDC[0], &methods_wxGCDC[1], SIP_NULLPTR, SIP_NULLPTR},
};

PyDoc_STRVAR(doc_wxGCDC, "GCDC(windowDC) -> None\n"
"GCDC(memoryDC) -> None\n"
"GCDC(printerDC) -> None\n"
"GCDC(context) -> None\n"
"GCDC() -> None\n"
"\n"
"wxGCDC is a device context that draws on a wxGraphicsContext.");


sipClassTypeDef sipTypeDef__core_wxGCDC = {
    {
        -1,
        SIP_NULLPTR,
        SIP_NULLPTR,
        SIP_TYPE_SCC|SIP_TYPE_CLASS,
        sipNameNr_wxGCDC,
        SIP_NULLPTR,
        SIP_NULLPTR,
    },
    {
        sipNameNr_GCDC,
        {0, 0, 1},
        2, methods_wxGCDC,
        0, SIP_NULLPTR,
        1, variables_wxGCDC,
        {SIP_NULLPTR, SIP_NULLPTR, SIP_NULLPTR, SIP_NULLPTR, SIP_NULLPTR, SIP_NULLPTR, SIP_NULLPTR, SIP_NULLPTR, SIP_NULLPTR, SIP_NULLPTR},
    },
    doc_wxGCDC,
    -1,
    -1,
    supers_wxGCDC,
    SIP_NULLPTR,
    init_type_wxGCDC,
    SIP_NULLPTR,
    SIP_NULLPTR,
    SIP_NULLPTR,
    SIP_NULLPTR,
    dealloc_wxGCDC,
    SIP_NULLPTR,
    array_wxGCDC,
    SIP_NULLPTR,
    release_wxGCDC,
    cast_wxGCDC,
    SIP_NULLPTR,
    SIP_NULLPTR,
    SIP_NULLPTR,
    SIP_NULLPTR,
    SIP_NULLPTR,
    SIP_NULLPTR,
    array_delete_wxGCDC,
    sizeof (::wxGCDC),
};
