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

#include "sipAPI_core.h"

        #include <wx/bitmap.h>

        #include <wx/bitmap.h>
        #include <wx/colour.h>
        #include <wx/object.h>
        #include <wx/object.h>
        #include <wx/object.h>


class sipwxMask : public  ::wxMask
{
public:
    sipwxMask();
    sipwxMask(const  ::wxBitmap&,int);
    sipwxMask(const  ::wxBitmap&);
    sipwxMask(const  ::wxBitmap&,const  ::wxColour&);
    sipwxMask(const  ::wxMask&);
    ~sipwxMask();

public:
    sipSimpleWrapper *sipPySelf;

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

sipwxMask::sipwxMask():  ::wxMask(), sipPySelf(SIP_NULLPTR)
{
}

sipwxMask::sipwxMask(const  ::wxBitmap& bitmap,int index):  ::wxMask(bitmap,index), sipPySelf(SIP_NULLPTR)
{
}

sipwxMask::sipwxMask(const  ::wxBitmap& bitmap):  ::wxMask(bitmap), sipPySelf(SIP_NULLPTR)
{
}

sipwxMask::sipwxMask(const  ::wxBitmap& bitmap,const  ::wxColour& colour):  ::wxMask(bitmap,colour), sipPySelf(SIP_NULLPTR)
{
}

sipwxMask::sipwxMask(const  ::wxMask& a0):  ::wxMask(a0), sipPySelf(SIP_NULLPTR)
{
}

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


PyDoc_STRVAR(doc_wxMask_Create, "Create(bitmap, index) -> bool\n"
"Create(bitmap) -> bool\n"
"Create(bitmap, colour) -> bool\n"
"\n"
"Constructs a mask from a bitmap and a palette index that indicates the\n"
"background.\n"
"\n"
"");

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

    {
        const  ::wxBitmap* bitmap;
        int index;
         ::wxMask *sipCpp;

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

        if (sipParseKwdArgs(&sipParseErr, sipArgs, sipKwds, sipKwdList, SIP_NULLPTR, "BJ9i", &sipSelf, sipType_wxMask, &sipCpp, sipType_wxBitmap, &bitmap, &index))
        {
            bool sipRes;

            PyErr_Clear();

            Py_BEGIN_ALLOW_THREADS
            sipRes = sipCpp->Create(*bitmap,index);
            Py_END_ALLOW_THREADS

            if (PyErr_Occurred())
                return 0;

            return PyBool_FromLong(sipRes);
        }
    }

    {
        const  ::wxBitmap* bitmap;
         ::wxMask *sipCpp;

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

        if (sipParseKwdArgs(&sipParseErr, sipArgs, sipKwds, sipKwdList, SIP_NULLPTR, "BJ9", &sipSelf, sipType_wxMask, &sipCpp, sipType_wxBitmap, &bitmap))
        {
            bool sipRes;

            PyErr_Clear();

            Py_BEGIN_ALLOW_THREADS
            sipRes = sipCpp->Create(*bitmap);
            Py_END_ALLOW_THREADS

            if (PyErr_Occurred())
                return 0;

            return PyBool_FromLong(sipRes);
        }
    }

    {
        const  ::wxBitmap* bitmap;
        const  ::wxColour* colour;
        int colourState = 0;
         ::wxMask *sipCpp;

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

        if (sipParseKwdArgs(&sipParseErr, sipArgs, sipKwds, sipKwdList, SIP_NULLPTR, "BJ9J1", &sipSelf, sipType_wxMask, &sipCpp, sipType_wxBitmap, &bitmap, sipType_wxColour, &colour, &colourState))
        {
            bool sipRes;

            PyErr_Clear();

            Py_BEGIN_ALLOW_THREADS
            sipRes = sipCpp->Create(*bitmap,*colour);
            Py_END_ALLOW_THREADS
            sipReleaseType(const_cast< ::wxColour *>(colour),sipType_wxColour,colourState);

            if (PyErr_Occurred())
                return 0;

            return PyBool_FromLong(sipRes);
        }
    }

    /* Raise an exception if the arguments couldn't be parsed. */
    sipNoMethod(sipParseErr, sipName_Mask, sipName_Create, SIP_NULLPTR);

    return SIP_NULLPTR;
}


PyDoc_STRVAR(doc_wxMask_GetBitmap, "GetBitmap() -> Bitmap\n"
"\n"
"Returns the mask as a monochrome bitmap.");

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

    {
        const  ::wxMask *sipCpp;

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

            PyErr_Clear();

            Py_BEGIN_ALLOW_THREADS
            sipRes = new  ::wxBitmap(sipCpp->GetBitmap());
            Py_END_ALLOW_THREADS

            if (PyErr_Occurred())
                return 0;

            return sipConvertFromNewType(sipRes,sipType_wxBitmap,SIP_NULLPTR);
        }
    }

    /* Raise an exception if the arguments couldn't be parsed. */
    sipNoMethod(sipParseErr, sipName_Mask, sipName_GetBitmap, SIP_NULLPTR);

    return SIP_NULLPTR;
}


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

    if (targetType == sipType_wxObject)
        return static_cast< ::wxObject *>(sipCpp);

    return sipCppV;
}


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

    if (sipState & SIP_DERIVED_CLASS)
        delete reinterpret_cast<sipwxMask *>(sipCppV);
    else
        delete reinterpret_cast< ::wxMask *>(sipCppV);

    Py_END_ALLOW_THREADS
}


extern "C" {static void assign_wxMask(void *, SIP_SSIZE_T, void *);}
static void assign_wxMask(void *sipDst, SIP_SSIZE_T sipDstIdx, void *sipSrc)
{
    reinterpret_cast< ::wxMask *>(sipDst)[sipDstIdx] = *reinterpret_cast< ::wxMask *>(sipSrc);
}


extern "C" {static void *array_wxMask(SIP_SSIZE_T);}
static void *array_wxMask(SIP_SSIZE_T sipNrElem)
{
    return new  ::wxMask[sipNrElem];
}


extern "C" {static void *copy_wxMask(const void *, SIP_SSIZE_T);}
static void *copy_wxMask(const void *sipSrc, SIP_SSIZE_T sipSrcIdx)
{
    return new  ::wxMask(reinterpret_cast<const  ::wxMask *>(sipSrc)[sipSrcIdx]);
}


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

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


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

    {
        if (sipParseKwdArgs(sipParseErr, sipArgs, sipKwds, SIP_NULLPTR, sipUnused, ""))
        {

        if (!wxPyCheckForApp()) return NULL;

            PyErr_Clear();

            Py_BEGIN_ALLOW_THREADS
            sipCpp = new sipwxMask();
            Py_END_ALLOW_THREADS

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

            sipCpp->sipPySelf = sipSelf;

            return sipCpp;
        }
    }

    {
        const  ::wxBitmap* bitmap;
        int index;

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

        if (sipParseKwdArgs(sipParseErr, sipArgs, sipKwds, sipKwdList, sipUnused, "J9i", sipType_wxBitmap, &bitmap, &index))
        {

        if (!wxPyCheckForApp()) return NULL;

            PyErr_Clear();

            Py_BEGIN_ALLOW_THREADS
            sipCpp = new sipwxMask(*bitmap,index);
            Py_END_ALLOW_THREADS

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

            sipCpp->sipPySelf = sipSelf;

            return sipCpp;
        }
    }

    {
        const  ::wxBitmap* bitmap;

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

        if (sipParseKwdArgs(sipParseErr, sipArgs, sipKwds, sipKwdList, sipUnused, "J9", sipType_wxBitmap, &bitmap))
        {

        if (!wxPyCheckForApp()) return NULL;

            PyErr_Clear();

            Py_BEGIN_ALLOW_THREADS
            sipCpp = new sipwxMask(*bitmap);
            Py_END_ALLOW_THREADS

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

            sipCpp->sipPySelf = sipSelf;

            return sipCpp;
        }
    }

    {
        const  ::wxBitmap* bitmap;
        const  ::wxColour* colour;
        int colourState = 0;

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

        if (sipParseKwdArgs(sipParseErr, sipArgs, sipKwds, sipKwdList, sipUnused, "J9J1", sipType_wxBitmap, &bitmap, sipType_wxColour, &colour, &colourState))
        {

        if (!wxPyCheckForApp()) return NULL;

            PyErr_Clear();

            Py_BEGIN_ALLOW_THREADS
            sipCpp = new sipwxMask(*bitmap,*colour);
            Py_END_ALLOW_THREADS
            sipReleaseType(const_cast< ::wxColour *>(colour),sipType_wxColour,colourState);

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

            sipCpp->sipPySelf = sipSelf;

            return sipCpp;
        }
    }

    {
        const  ::wxMask* a0;

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

            sipCpp->sipPySelf = sipSelf;

            return sipCpp;
        }
    }

    return SIP_NULLPTR;
}


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


static PyMethodDef methods_wxMask[] = {
    {SIP_MLNAME_CAST(sipName_Create), SIP_MLMETH_CAST(meth_wxMask_Create), METH_VARARGS|METH_KEYWORDS, SIP_MLDOC_CAST(doc_wxMask_Create)},
    {SIP_MLNAME_CAST(sipName_GetBitmap), meth_wxMask_GetBitmap, METH_VARARGS, SIP_MLDOC_CAST(doc_wxMask_GetBitmap)}
};

sipVariableDef variables_wxMask[] = {
    {PropertyVariable, sipName_Bitmap, &methods_wxMask[1], SIP_NULLPTR, SIP_NULLPTR, SIP_NULLPTR},
};

PyDoc_STRVAR(doc_wxMask, "Mask()\n"
"Mask(bitmap, index)\n"
"Mask(bitmap)\n"
"Mask(bitmap, colour)\n"
"\n"
"This class encapsulates a monochrome mask bitmap, where the masked\n"
"area is black and the unmasked area is white.");


sipClassTypeDef sipTypeDef__core_wxMask = {
    {
        -1,
        SIP_NULLPTR,
        SIP_NULLPTR,
        SIP_TYPE_SCC|SIP_TYPE_CLASS,
        sipNameNr_wxMask,
        {SIP_NULLPTR},
        SIP_NULLPTR
    },
    {
        sipNameNr_Mask,
        {0, 0, 1},
        2, methods_wxMask,
        0, SIP_NULLPTR,
        1, variables_wxMask,
        {SIP_NULLPTR, SIP_NULLPTR, SIP_NULLPTR, SIP_NULLPTR, SIP_NULLPTR, SIP_NULLPTR, SIP_NULLPTR, SIP_NULLPTR, SIP_NULLPTR, SIP_NULLPTR},
    },
    doc_wxMask,
    -1,
    -1,
    supers_wxMask,
    SIP_NULLPTR,
    init_type_wxMask,
    SIP_NULLPTR,
    SIP_NULLPTR,
#if PY_MAJOR_VERSION >= 3
    SIP_NULLPTR,
    SIP_NULLPTR,
#else
    SIP_NULLPTR,
    SIP_NULLPTR,
    SIP_NULLPTR,
    SIP_NULLPTR,
#endif
    dealloc_wxMask,
    assign_wxMask,
    array_wxMask,
    copy_wxMask,
    release_wxMask,
    cast_wxMask,
    SIP_NULLPTR,
    SIP_NULLPTR,
    SIP_NULLPTR,
    SIP_NULLPTR,
    SIP_NULLPTR,
    SIP_NULLPTR
};
