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

#include "sipAPI_core.h"
        #include <wx/dcsvg.h>
        #include <wx/bitmap.h>
        #include <wx/stream.h>


class sipwxSVGBitmapHandler : public ::wxSVGBitmapHandler
{
public:
    sipwxSVGBitmapHandler();
    sipwxSVGBitmapHandler(const ::wxSVGBitmapHandler&);
    virtual ~sipwxSVGBitmapHandler();

    /*
     * There is a protected method for every virtual method visible from
     * this class.
     */
protected:
    bool ProcessBitmap(const ::wxBitmap&, ::wxCoord, ::wxCoord, ::wxOutputStream&) const SIP_OVERRIDE;

public:
    sipSimpleWrapper *sipPySelf;

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

    char sipPyMethods[1];
};

sipwxSVGBitmapHandler::sipwxSVGBitmapHandler(): ::wxSVGBitmapHandler(), sipPySelf(SIP_NULLPTR)
{
    memset(sipPyMethods, 0, sizeof (sipPyMethods));
}

sipwxSVGBitmapHandler::sipwxSVGBitmapHandler(const ::wxSVGBitmapHandler& a0): ::wxSVGBitmapHandler(a0), sipPySelf(SIP_NULLPTR)
{
    memset(sipPyMethods, 0, sizeof (sipPyMethods));
}

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

bool sipwxSVGBitmapHandler::ProcessBitmap(const ::wxBitmap& bitmap, ::wxCoord x, ::wxCoord y, ::wxOutputStream& stream) const
{
    sip_gilstate_t sipGILState;
    PyObject *sipMeth;

    sipMeth = sipIsPyMethod(&sipGILState, const_cast<char *>(&sipPyMethods[0]), const_cast<sipSimpleWrapper **>(&sipPySelf), sipName_SVGBitmapHandler, sipName_ProcessBitmap);

    if (!sipMeth)
        return 0;

    extern bool sipVH__core_31(sip_gilstate_t, sipVirtErrorHandlerFunc, sipSimpleWrapper *, PyObject *, const ::wxBitmap&, ::wxCoord, ::wxCoord, ::wxOutputStream&);

    return sipVH__core_31(sipGILState, 0, sipPySelf, sipMeth, bitmap, x, y, stream);
}


PyDoc_STRVAR(doc_wxSVGBitmapHandler_ProcessBitmap, "ProcessBitmap(bitmap, x, y, stream) -> bool\n"
"\n"
"Writes the bitmap representation as SVG to the given stream.");

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

    {
        const ::wxBitmap* bitmap;
        ::wxCoord x;
        ::wxCoord y;
        ::wxOutputStream* stream;
        int streamState = 0;
        const ::wxSVGBitmapHandler *sipCpp;

        static const char *sipKwdList[] = {
            sipName_bitmap,
            sipName_x,
            sipName_y,
            sipName_stream,
        };

        if (sipParseKwdArgs(&sipParseErr, sipArgs, sipKwds, sipKwdList, SIP_NULLPTR, "BJ9iiJ1", &sipSelf, sipType_wxSVGBitmapHandler, &sipCpp, sipType_wxBitmap, &bitmap, &x, &y, sipType_wxOutputStream, &stream, &streamState))
        {
            bool sipRes;

            if (!sipOrigSelf)
            {
                sipAbstractMethod(sipName_SVGBitmapHandler, sipName_ProcessBitmap);
                return SIP_NULLPTR;
            }

            PyErr_Clear();

            Py_BEGIN_ALLOW_THREADS
            sipRes = sipCpp->ProcessBitmap(*bitmap, x, y, *stream);
            Py_END_ALLOW_THREADS
            sipReleaseType(stream, sipType_wxOutputStream, streamState);

            if (PyErr_Occurred())
                return 0;

            return PyBool_FromLong(sipRes);
        }
    }

    sipNoMethod(sipParseErr, sipName_SVGBitmapHandler, sipName_ProcessBitmap, SIP_NULLPTR);

    return SIP_NULLPTR;
}


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

    if (sipState & SIP_DERIVED_CLASS)
        delete reinterpret_cast<sipwxSVGBitmapHandler *>(sipCppV);
    else
        delete reinterpret_cast<::wxSVGBitmapHandler *>(sipCppV);

    Py_END_ALLOW_THREADS
}


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

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


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

    {
        if (sipParseKwdArgs(sipParseErr, sipArgs, sipKwds, SIP_NULLPTR, sipUnused, ""))
        {
            Py_BEGIN_ALLOW_THREADS
            sipCpp = new sipwxSVGBitmapHandler();
            Py_END_ALLOW_THREADS

            sipCpp->sipPySelf = sipSelf;

            return sipCpp;
        }
    }

    {
        const ::wxSVGBitmapHandler* a0;

        if (sipParseKwdArgs(sipParseErr, sipArgs, sipKwds, SIP_NULLPTR, sipUnused, "J9", sipType_wxSVGBitmapHandler, &a0))
        {
            Py_BEGIN_ALLOW_THREADS
            sipCpp = new sipwxSVGBitmapHandler(*a0);
            Py_END_ALLOW_THREADS

            sipCpp->sipPySelf = sipSelf;

            return sipCpp;
        }
    }

    return SIP_NULLPTR;
}


static PyMethodDef methods_wxSVGBitmapHandler[] = {
    {sipName_ProcessBitmap, SIP_MLMETH_CAST(meth_wxSVGBitmapHandler_ProcessBitmap), METH_VARARGS|METH_KEYWORDS, doc_wxSVGBitmapHandler_ProcessBitmap}
};

PyDoc_STRVAR(doc_wxSVGBitmapHandler, "Abstract base class for handling bitmaps inside a wxSVGFileDC.");


sipClassTypeDef sipTypeDef__core_wxSVGBitmapHandler = {
    {
        -1,
        SIP_NULLPTR,
        SIP_NULLPTR,
        SIP_TYPE_ABSTRACT|SIP_TYPE_CLASS,
        sipNameNr_wxSVGBitmapHandler,
        SIP_NULLPTR,
        SIP_NULLPTR,
    },
    {
        sipNameNr_SVGBitmapHandler,
        {0, 0, 1},
        1, methods_wxSVGBitmapHandler,
        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_wxSVGBitmapHandler,
    -1,
    -1,
    SIP_NULLPTR,
    SIP_NULLPTR,
    init_type_wxSVGBitmapHandler,
    SIP_NULLPTR,
    SIP_NULLPTR,
    SIP_NULLPTR,
    SIP_NULLPTR,
    dealloc_wxSVGBitmapHandler,
    SIP_NULLPTR,
    SIP_NULLPTR,
    SIP_NULLPTR,
    release_wxSVGBitmapHandler,
    SIP_NULLPTR,
    SIP_NULLPTR,
    SIP_NULLPTR,
    SIP_NULLPTR,
    SIP_NULLPTR,
    SIP_NULLPTR,
    SIP_NULLPTR,
};
