/*
 * 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/dcsvg.h>
        #include <wx/bitmap.h>
        #include <wx/stream.h>


class sipwxSVGBitmapEmbedHandler : public ::wxSVGBitmapEmbedHandler
{
public:
    sipwxSVGBitmapEmbedHandler();
    sipwxSVGBitmapEmbedHandler(const ::wxSVGBitmapEmbedHandler&);
    virtual ~sipwxSVGBitmapEmbedHandler();

    /*
     * 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:
    sipwxSVGBitmapEmbedHandler(const sipwxSVGBitmapEmbedHandler &);
    sipwxSVGBitmapEmbedHandler &operator = (const sipwxSVGBitmapEmbedHandler &);

    char sipPyMethods[1];
};

sipwxSVGBitmapEmbedHandler::sipwxSVGBitmapEmbedHandler(): ::wxSVGBitmapEmbedHandler(), sipPySelf(SIP_NULLPTR)
{
    memset(sipPyMethods, 0, sizeof (sipPyMethods));
}

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

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

bool sipwxSVGBitmapEmbedHandler::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), SIP_NULLPTR, sipName_ProcessBitmap);

    if (!sipMeth)
        return ::wxSVGBitmapEmbedHandler::ProcessBitmap(bitmap, x, y, stream);

    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_wxSVGBitmapEmbedHandler_ProcessBitmap, "ProcessBitmap(bitmap, x, y, stream) -> bool\n"
"\n"
"Writes the bitmap representation as SVG to the given stream.");

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

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

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

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

            PyErr_Clear();

            Py_BEGIN_ALLOW_THREADS
            sipRes = (sipSelfWasArg ? sipCpp->::wxSVGBitmapEmbedHandler::ProcessBitmap(*bitmap, x, y, *stream) : 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_SVGBitmapEmbedHandler, sipName_ProcessBitmap, SIP_NULLPTR);

    return SIP_NULLPTR;
}


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

    if (targetType == sipType_wxSVGBitmapEmbedHandler)
        return sipCppV;

    if (targetType == sipType_wxSVGBitmapHandler)
        return static_cast< ::wxSVGBitmapHandler *>(sipCpp);

    return SIP_NULLPTR;
}


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

    if (sipState & SIP_DERIVED_CLASS)
        delete reinterpret_cast<sipwxSVGBitmapEmbedHandler *>(sipCppV);
    else
        delete reinterpret_cast< ::wxSVGBitmapEmbedHandler *>(sipCppV);

    Py_END_ALLOW_THREADS
}


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


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


extern "C" {static void assign_wxSVGBitmapEmbedHandler(void *, Py_ssize_t, void *);}
static void assign_wxSVGBitmapEmbedHandler(void *sipDst, Py_ssize_t sipDstIdx, void *sipSrc)
{
    reinterpret_cast< ::wxSVGBitmapEmbedHandler *>(sipDst)[sipDstIdx] = *reinterpret_cast< ::wxSVGBitmapEmbedHandler *>(sipSrc);
}


extern "C" {static void *copy_wxSVGBitmapEmbedHandler(const void *, Py_ssize_t);}
static void *copy_wxSVGBitmapEmbedHandler(const void *sipSrc, Py_ssize_t sipSrcIdx)
{
    return new ::wxSVGBitmapEmbedHandler(reinterpret_cast<const ::wxSVGBitmapEmbedHandler *>(sipSrc)[sipSrcIdx]);
}


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

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


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

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

            sipCpp->sipPySelf = sipSelf;

            return sipCpp;
        }
    }

    {
        const ::wxSVGBitmapEmbedHandler* a0;

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

            sipCpp->sipPySelf = sipSelf;

            return sipCpp;
        }
    }

    return SIP_NULLPTR;
}


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


static PyMethodDef methods_wxSVGBitmapEmbedHandler[] = {
    {sipName_ProcessBitmap, SIP_MLMETH_CAST(meth_wxSVGBitmapEmbedHandler_ProcessBitmap), METH_VARARGS|METH_KEYWORDS, doc_wxSVGBitmapEmbedHandler_ProcessBitmap}
};

PyDoc_STRVAR(doc_wxSVGBitmapEmbedHandler, "Handler embedding bitmaps as base64-encoded PNGs into the SVG.");


sipClassTypeDef sipTypeDef__core_wxSVGBitmapEmbedHandler = {
    {
        -1,
        SIP_NULLPTR,
        SIP_NULLPTR,
        SIP_TYPE_CLASS,
        sipNameNr_wxSVGBitmapEmbedHandler,
        SIP_NULLPTR,
        SIP_NULLPTR,
    },
    {
        sipNameNr_SVGBitmapEmbedHandler,
        {0, 0, 1},
        1, methods_wxSVGBitmapEmbedHandler,
        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_wxSVGBitmapEmbedHandler,
    -1,
    -1,
    supers_wxSVGBitmapEmbedHandler,
    SIP_NULLPTR,
    init_type_wxSVGBitmapEmbedHandler,
    SIP_NULLPTR,
    SIP_NULLPTR,
    SIP_NULLPTR,
    SIP_NULLPTR,
    dealloc_wxSVGBitmapEmbedHandler,
    assign_wxSVGBitmapEmbedHandler,
    array_wxSVGBitmapEmbedHandler,
    copy_wxSVGBitmapEmbedHandler,
    release_wxSVGBitmapEmbedHandler,
    cast_wxSVGBitmapEmbedHandler,
    SIP_NULLPTR,
    SIP_NULLPTR,
    SIP_NULLPTR,
    SIP_NULLPTR,
    SIP_NULLPTR,
    SIP_NULLPTR,
    array_delete_wxSVGBitmapEmbedHandler,
    sizeof (::wxSVGBitmapEmbedHandler),
};
