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

#include "sipAPI_grid.h"
        #include <wx/grid.h>


PyDoc_STRVAR(doc_wxGridCellCoordsArray_append, "append(self, obj: GridCellCoords)");

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

    {
         ::wxGridCellCoords* obj;
        int objState = 0;
         ::wxGridCellCoordsArray *sipCpp;

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

        if (sipParseKwdArgs(&sipParseErr, sipArgs, sipKwds, sipKwdList, SIP_NULLPTR, "BJ1", &sipSelf, sipType_wxGridCellCoordsArray, &sipCpp, sipType_wxGridCellCoords, &obj, &objState))
        {
        sipCpp->Add(*obj);
            sipReleaseType(obj, sipType_wxGridCellCoords, objState);

            Py_INCREF(Py_None);
            return Py_None;
        }
    }

    sipNoMethod(sipParseErr, sipName_GridCellCoordsArray, sipName_append, doc_wxGridCellCoordsArray_append);

    return SIP_NULLPTR;
}


PyDoc_STRVAR(doc_wxGridCellCoordsArray_index, "index(self, obj: GridCellCoords) -> int");

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

    {
         ::wxGridCellCoords* obj;
        int objState = 0;
         ::wxGridCellCoordsArray *sipCpp;

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

        if (sipParseKwdArgs(&sipParseErr, sipArgs, sipKwds, sipKwdList, SIP_NULLPTR, "BJ1", &sipSelf, sipType_wxGridCellCoordsArray, &sipCpp, sipType_wxGridCellCoords, &obj, &objState))
        {
            int sipRes = 0;
            sipErrorState sipError = sipErrorNone;
        int idx = sipCpp->Index(*obj, false);
        if (idx == wxNOT_FOUND) {
            sipError = sipErrorFail;
            wxPyErr_SetString(PyExc_ValueError,
                              "sequence.index(x): x not in sequence");
            }
        sipRes = idx;
            sipReleaseType(obj, sipType_wxGridCellCoords, objState);

            if (sipError == sipErrorFail)
                return 0;

            if (sipError == sipErrorNone)
            {
            return PyLong_FromLong(sipRes);
            }

            sipAddException(sipError, &sipParseErr);
        }
    }

    sipNoMethod(sipParseErr, sipName_GridCellCoordsArray, sipName_index, doc_wxGridCellCoordsArray_index);

    return SIP_NULLPTR;
}


extern "C" {static int slot_wxGridCellCoordsArray___contains__(PyObject *,PyObject *);}
static int slot_wxGridCellCoordsArray___contains__(PyObject *sipSelf,PyObject *sipArg)
{
     ::wxGridCellCoordsArray *sipCpp = reinterpret_cast< ::wxGridCellCoordsArray *>(sipGetCppPtr((sipSimpleWrapper *)sipSelf,sipType_wxGridCellCoordsArray));

    if (!sipCpp)
        return -1;

    PyObject *sipParseErr = SIP_NULLPTR;

    {
         ::wxGridCellCoords* obj;
        int objState = 0;

        if (sipParseArgs(&sipParseErr, sipArg, "1J1", sipType_wxGridCellCoords, &obj, &objState))
        {
            int sipRes = 0;
        int idx = sipCpp->Index(*obj, false);
        sipRes = idx != wxNOT_FOUND;
            sipReleaseType(obj, sipType_wxGridCellCoords, objState);

            return sipRes;
        }
    }

    sipNoMethod(sipParseErr, sipName_GridCellCoordsArray, sipName___contains__, SIP_NULLPTR);

    return -1;
}


extern "C" {static PyObject *slot_wxGridCellCoordsArray___getitem__(PyObject *,PyObject *);}
static PyObject *slot_wxGridCellCoordsArray___getitem__(PyObject *sipSelf,PyObject *sipArg)
{
     ::wxGridCellCoordsArray *sipCpp = reinterpret_cast< ::wxGridCellCoordsArray *>(sipGetCppPtr((sipSimpleWrapper *)sipSelf,sipType_wxGridCellCoordsArray));

    if (!sipCpp)
        return SIP_NULLPTR;

    PyObject *sipParseErr = SIP_NULLPTR;

    {
        long index;

        if (sipParseArgs(&sipParseErr, sipArg, "1l", &index))
        {
             ::wxGridCellCoords*sipRes = 0;
            sipErrorState sipError = sipErrorNone;
            if (0 > index)
                index += sipCpp->GetCount();
            if ((index < sipCpp->GetCount()) && (0 <= index)) {
                sipRes = new wxGridCellCoords(sipCpp->Item(index));
            }
            else {
                wxPyErr_SetString(PyExc_IndexError, "sequence index out of range");
                sipError = sipErrorFail;
            }

            if (sipError == sipErrorFail)
                return 0;

            if (sipError == sipErrorNone)
            {
            return sipConvertFromNewType(sipRes,sipType_wxGridCellCoords,SIP_NULLPTR);
            }

            sipAddException(sipError, &sipParseErr);
        }
    }

    sipNoMethod(sipParseErr, sipName_GridCellCoordsArray, sipName___getitem__, SIP_NULLPTR);

    return SIP_NULLPTR;
}


extern "C" {static Py_ssize_t slot_wxGridCellCoordsArray___len__(PyObject *);}
static Py_ssize_t slot_wxGridCellCoordsArray___len__(PyObject *sipSelf)
{
     ::wxGridCellCoordsArray *sipCpp = reinterpret_cast< ::wxGridCellCoordsArray *>(sipGetCppPtr((sipSimpleWrapper *)sipSelf,sipType_wxGridCellCoordsArray));

    if (!sipCpp)
        return 0;


    {
        {
            Py_ssize_t sipRes = 0;
        sipRes = sipCpp->GetCount();

            return sipRes;
        }
    }

    return 0;
}


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

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

    Py_END_ALLOW_THREADS
}


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


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


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


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


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

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

            return sipCpp;
        }
    }

    {
        const  ::wxGridCellCoordsArray* a0;

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

            return sipCpp;
        }
    }

    return SIP_NULLPTR;
}


/* Define this type's Python slots. */
static sipPySlotDef slots_wxGridCellCoordsArray[] = {
    {(void *)slot_wxGridCellCoordsArray___contains__, contains_slot},
    {(void *)slot_wxGridCellCoordsArray___getitem__, getitem_slot},
    {(void *)slot_wxGridCellCoordsArray___len__, len_slot},
    {0, (sipPySlotType)0}
};


static PyMethodDef methods_wxGridCellCoordsArray[] = {
    {sipName_append, SIP_MLMETH_CAST(meth_wxGridCellCoordsArray_append), METH_VARARGS|METH_KEYWORDS, doc_wxGridCellCoordsArray_append},
    {sipName_index, SIP_MLMETH_CAST(meth_wxGridCellCoordsArray_index), METH_VARARGS|METH_KEYWORDS, doc_wxGridCellCoordsArray_index}
};

PyDoc_STRVAR(doc_wxGridCellCoordsArray, "\1GridCellCoordsArray()\n"
"GridCellCoordsArray(GridCellCoordsArray)");


sipClassTypeDef sipTypeDef__grid_wxGridCellCoordsArray = {
    {
        -1,
        SIP_NULLPTR,
        SIP_NULLPTR,
        SIP_TYPE_CLASS,
        sipNameNr_wxGridCellCoordsArray,
        SIP_NULLPTR,
        SIP_NULLPTR
    },
    {
        sipNameNr_GridCellCoordsArray,
        {0, 0, 1},
        2, methods_wxGridCellCoordsArray,
        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_wxGridCellCoordsArray,
    -1,
    -1,
    SIP_NULLPTR,
    slots_wxGridCellCoordsArray,
    init_type_wxGridCellCoordsArray,
    SIP_NULLPTR,
    SIP_NULLPTR,
    SIP_NULLPTR,
    SIP_NULLPTR,
    dealloc_wxGridCellCoordsArray,
    assign_wxGridCellCoordsArray,
    array_wxGridCellCoordsArray,
    copy_wxGridCellCoordsArray,
    release_wxGridCellCoordsArray,
    SIP_NULLPTR,
    SIP_NULLPTR,
    SIP_NULLPTR,
    SIP_NULLPTR,
    SIP_NULLPTR,
    SIP_NULLPTR,
    SIP_NULLPTR,
};
