/*
 * 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/brush.h>
        #include <wx/brush.h>
        #include <wx/colour.h>


PyDoc_STRVAR(doc_wxBrushList_FindOrCreateBrush, "FindOrCreateBrush(colour, style=BRUSHSTYLE_SOLID) -> Brush\n"
"\n"
"Finds a brush with the specified attributes and returns it, else\n"
"creates a new brush, adds it to the brush list, and returns it.");

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

    {
        const ::wxColour* colour;
        int colourState = 0;
        ::wxBrushStyle style = wxBRUSHSTYLE_SOLID;
        ::wxBrushList *sipCpp;

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

        if (sipParseKwdArgs(&sipParseErr, sipArgs, sipKwds, sipKwdList, SIP_NULLPTR, "BJ1|E", &sipSelf, sipType_wxBrushList, &sipCpp, sipType_wxColour, &colour, &colourState, sipType_wxBrushStyle, &style))
        {
            ::wxBrush*sipRes;

            PyErr_Clear();

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

            if (PyErr_Occurred())
                return 0;

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

    sipNoMethod(sipParseErr, sipName_BrushList, sipName_FindOrCreateBrush, SIP_NULLPTR);

    return SIP_NULLPTR;
}


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

    delete reinterpret_cast< ::wxBrushList *>(sipCppV);

    Py_END_ALLOW_THREADS
}


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


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


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


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


extern "C" {static void dealloc_wxBrushList(sipSimpleWrapper *);}
static void dealloc_wxBrushList(sipSimpleWrapper *sipSelf)
{
    if (sipIsOwnedByPython(sipSelf))
    {
        release_wxBrushList(sipGetAddress(sipSelf), 0);
    }
}


extern "C" {static void *init_type_wxBrushList(sipSimpleWrapper *, PyObject *, PyObject *, PyObject **, PyObject **, PyObject **);}
static void *init_type_wxBrushList(sipSimpleWrapper *, PyObject *sipArgs, PyObject *sipKwds, PyObject **sipUnused, PyObject **, PyObject **sipParseErr)
{
    ::wxBrushList *sipCpp = SIP_NULLPTR;

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

            return sipCpp;
        }
    }

    {
        const ::wxBrushList* a0;

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

            return sipCpp;
        }
    }

    return SIP_NULLPTR;
}


static PyMethodDef methods_wxBrushList[] = {
    {sipName_FindOrCreateBrush, SIP_MLMETH_CAST(meth_wxBrushList_FindOrCreateBrush), METH_VARARGS|METH_KEYWORDS, doc_wxBrushList_FindOrCreateBrush}
};

PyDoc_STRVAR(doc_wxBrushList, "A brush list is a list containing all brushes which have been created.");


sipClassTypeDef sipTypeDef__core_wxBrushList = {
    {
        -1,
        SIP_NULLPTR,
        SIP_NULLPTR,
        SIP_TYPE_CLASS,
        sipNameNr_wxBrushList,
        SIP_NULLPTR,
        SIP_NULLPTR,
    },
    {
        sipNameNr_BrushList,
        {0, 0, 1},
        1, methods_wxBrushList,
        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_wxBrushList,
    -1,
    -1,
    SIP_NULLPTR,
    SIP_NULLPTR,
    init_type_wxBrushList,
    SIP_NULLPTR,
    SIP_NULLPTR,
    SIP_NULLPTR,
    SIP_NULLPTR,
    dealloc_wxBrushList,
    assign_wxBrushList,
    array_wxBrushList,
    copy_wxBrushList,
    release_wxBrushList,
    SIP_NULLPTR,
    SIP_NULLPTR,
    SIP_NULLPTR,
    SIP_NULLPTR,
    SIP_NULLPTR,
    SIP_NULLPTR,
    SIP_NULLPTR,
    array_delete_wxBrushList,
    sizeof (::wxBrushList),
};
