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

#include "sipAPI_grid.h"

        #include <wx/grid.h>

    PyObject* _wxGridCellCoords_Get(wxGridCellCoords* self)
    {
        wxPyThreadBlocker blocker;
        return sipBuildResult(0, "(ii)", self->GetRow(), self->GetCol());
    }


PyDoc_STRVAR(doc_wxGridCellCoords_GetRow, "GetRow() -> int\n"
"\n"
"Return the row of the coordinate.");

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

    {
        const  ::wxGridCellCoords *sipCpp;

        if (sipParseArgs(&sipParseErr, sipArgs, "B", &sipSelf, sipType_wxGridCellCoords, &sipCpp))
        {
            int sipRes;

            PyErr_Clear();

            Py_BEGIN_ALLOW_THREADS
            sipRes = sipCpp->GetRow();
            Py_END_ALLOW_THREADS

            if (PyErr_Occurred())
                return 0;

            return SIPLong_FromLong(sipRes);
        }
    }

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

    return SIP_NULLPTR;
}


PyDoc_STRVAR(doc_wxGridCellCoords_SetRow, "SetRow(n)\n"
"\n"
"Set the row of the coordinate.");

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

    {
        int n;
         ::wxGridCellCoords *sipCpp;

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

        if (sipParseKwdArgs(&sipParseErr, sipArgs, sipKwds, sipKwdList, SIP_NULLPTR, "Bi", &sipSelf, sipType_wxGridCellCoords, &sipCpp, &n))
        {
            PyErr_Clear();

            Py_BEGIN_ALLOW_THREADS
            sipCpp->SetRow(n);
            Py_END_ALLOW_THREADS

            if (PyErr_Occurred())
                return 0;

            Py_INCREF(Py_None);
            return Py_None;
        }
    }

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

    return SIP_NULLPTR;
}


PyDoc_STRVAR(doc_wxGridCellCoords_GetCol, "GetCol() -> int\n"
"\n"
"Return the column of the coordinate.");

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

    {
        const  ::wxGridCellCoords *sipCpp;

        if (sipParseArgs(&sipParseErr, sipArgs, "B", &sipSelf, sipType_wxGridCellCoords, &sipCpp))
        {
            int sipRes;

            PyErr_Clear();

            Py_BEGIN_ALLOW_THREADS
            sipRes = sipCpp->GetCol();
            Py_END_ALLOW_THREADS

            if (PyErr_Occurred())
                return 0;

            return SIPLong_FromLong(sipRes);
        }
    }

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

    return SIP_NULLPTR;
}


PyDoc_STRVAR(doc_wxGridCellCoords_SetCol, "SetCol(n)\n"
"\n"
"Set the column of the coordinate.");

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

    {
        int n;
         ::wxGridCellCoords *sipCpp;

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

        if (sipParseKwdArgs(&sipParseErr, sipArgs, sipKwds, sipKwdList, SIP_NULLPTR, "Bi", &sipSelf, sipType_wxGridCellCoords, &sipCpp, &n))
        {
            PyErr_Clear();

            Py_BEGIN_ALLOW_THREADS
            sipCpp->SetCol(n);
            Py_END_ALLOW_THREADS

            if (PyErr_Occurred())
                return 0;

            Py_INCREF(Py_None);
            return Py_None;
        }
    }

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

    return SIP_NULLPTR;
}


PyDoc_STRVAR(doc_wxGridCellCoords_Set, "Set(row, col)\n"
"\n"
"Set the row and column of the coordinate.");

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

    {
        int row;
        int col;
         ::wxGridCellCoords *sipCpp;

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

        if (sipParseKwdArgs(&sipParseErr, sipArgs, sipKwds, sipKwdList, SIP_NULLPTR, "Bii", &sipSelf, sipType_wxGridCellCoords, &sipCpp, &row, &col))
        {
            PyErr_Clear();

            Py_BEGIN_ALLOW_THREADS
            sipCpp->Set(row,col);
            Py_END_ALLOW_THREADS

            if (PyErr_Occurred())
                return 0;

            Py_INCREF(Py_None);
            return Py_None;
        }
    }

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

    return SIP_NULLPTR;
}


PyDoc_STRVAR(doc_wxGridCellCoords_Get, "Get() -> (row,col)\n"
"\n"
"Return the row and col properties as a tuple.");

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

    {
         ::wxGridCellCoords *sipCpp;

        if (sipParseArgs(&sipParseErr, sipArgs, "B", &sipSelf, sipType_wxGridCellCoords, &sipCpp))
        {
            PyObject * sipRes = SIP_NULLPTR;
            int sipIsErr = 0;

        PyErr_Clear();
        Py_BEGIN_ALLOW_THREADS
        sipRes = _wxGridCellCoords_Get(sipCpp);
        Py_END_ALLOW_THREADS
        if (PyErr_Occurred()) sipIsErr = 1;

            if (sipIsErr)
                return 0;

            return sipRes;
        }
    }

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

    return SIP_NULLPTR;
}


extern "C" {static PyObject *slot_wxGridCellCoords___ne__(PyObject *,PyObject *);}
static PyObject *slot_wxGridCellCoords___ne__(PyObject *sipSelf,PyObject *sipArg)
{
     ::wxGridCellCoords *sipCpp = reinterpret_cast< ::wxGridCellCoords *>(sipGetCppPtr((sipSimpleWrapper *)sipSelf,sipType_wxGridCellCoords));

    if (!sipCpp)
        return SIP_NULLPTR;

    PyObject *sipParseErr = SIP_NULLPTR;

    {
        const  ::wxGridCellCoords* other;
        int otherState = 0;

        if (sipParseArgs(&sipParseErr, sipArg, "1J1", sipType_wxGridCellCoords, &other, &otherState))
        {
            bool sipRes;

            PyErr_Clear();

            Py_BEGIN_ALLOW_THREADS
            sipRes = sipCpp-> ::wxGridCellCoords::operator!=(*other);
            Py_END_ALLOW_THREADS
            sipReleaseType(const_cast< ::wxGridCellCoords *>(other),sipType_wxGridCellCoords,otherState);

            if (PyErr_Occurred())
                return 0;

            return PyBool_FromLong(sipRes);
        }
    }

    Py_XDECREF(sipParseErr);

    if (sipParseErr == Py_None)
        return SIP_NULLPTR;

    return sipPySlotExtend(&sipModuleAPI__grid, ne_slot, sipType_wxGridCellCoords, sipSelf, sipArg);
}


extern "C" {static PyObject *slot_wxGridCellCoords___eq__(PyObject *,PyObject *);}
static PyObject *slot_wxGridCellCoords___eq__(PyObject *sipSelf,PyObject *sipArg)
{
     ::wxGridCellCoords *sipCpp = reinterpret_cast< ::wxGridCellCoords *>(sipGetCppPtr((sipSimpleWrapper *)sipSelf,sipType_wxGridCellCoords));

    if (!sipCpp)
        return SIP_NULLPTR;

    PyObject *sipParseErr = SIP_NULLPTR;

    {
        const  ::wxGridCellCoords* other;
        int otherState = 0;

        if (sipParseArgs(&sipParseErr, sipArg, "1J1", sipType_wxGridCellCoords, &other, &otherState))
        {
            bool sipRes;

            PyErr_Clear();

            Py_BEGIN_ALLOW_THREADS
            sipRes = sipCpp-> ::wxGridCellCoords::operator==(*other);
            Py_END_ALLOW_THREADS
            sipReleaseType(const_cast< ::wxGridCellCoords *>(other),sipType_wxGridCellCoords,otherState);

            if (PyErr_Occurred())
                return 0;

            return PyBool_FromLong(sipRes);
        }
    }

    Py_XDECREF(sipParseErr);

    if (sipParseErr == Py_None)
        return SIP_NULLPTR;

    return sipPySlotExtend(&sipModuleAPI__grid, eq_slot, sipType_wxGridCellCoords, sipSelf, sipArg);
}


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

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

    Py_END_ALLOW_THREADS
}


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


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


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


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


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

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

            Py_BEGIN_ALLOW_THREADS
            sipCpp = new  ::wxGridCellCoords();
            Py_END_ALLOW_THREADS

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

            return sipCpp;
        }
    }

    {
        int row;
        int col;

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

        if (sipParseKwdArgs(sipParseErr, sipArgs, sipKwds, sipKwdList, sipUnused, "ii", &row, &col))
        {
            PyErr_Clear();

            Py_BEGIN_ALLOW_THREADS
            sipCpp = new  ::wxGridCellCoords(row,col);
            Py_END_ALLOW_THREADS

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

            return sipCpp;
        }
    }

    {
        const  ::wxGridCellCoords* a0;
        int a0State = 0;

        if (sipParseKwdArgs(sipParseErr, sipArgs, sipKwds, SIP_NULLPTR, sipUnused, "J1", sipType_wxGridCellCoords, &a0, &a0State))
        {
            Py_BEGIN_ALLOW_THREADS
            sipCpp = new  ::wxGridCellCoords(*a0);
            Py_END_ALLOW_THREADS
            sipReleaseType(const_cast< ::wxGridCellCoords *>(a0),sipType_wxGridCellCoords,a0State);

            return sipCpp;
        }
    }

    return SIP_NULLPTR;
}


extern "C" {static int convertTo_wxGridCellCoords(PyObject *, void **, int *, PyObject *);}
static int convertTo_wxGridCellCoords(PyObject *sipPy,void **sipCppPtrV,int *sipIsErr,PyObject *sipTransferObj)
{
     ::wxGridCellCoords **sipCppPtr = reinterpret_cast< ::wxGridCellCoords **>(sipCppPtrV);

        // is it just a typecheck?
        if (!sipIsErr) {
            // is it already an instance of wxGridCellCoords?
            if (sipCanConvertToType(sipPy, sipType_wxGridCellCoords, SIP_NO_CONVERTORS))
                return 1;
        
            if (wxPyNumberSequenceCheck(sipPy, 2)) {
                return 1;
            }
            return 0;
        }
        
         // otherwise do the conversion
         if (sipCanConvertToType(sipPy, sipType_wxGridCellCoords, SIP_NO_CONVERTORS)) {
             // Just fetch the existing instance
             *sipCppPtr = reinterpret_cast<wxGridCellCoords*>(sipConvertToType(
                     sipPy, sipType_wxGridCellCoords, sipTransferObj, SIP_NO_CONVERTORS, 0, sipIsErr));
             return 0;  // not a new instance
         }
        
         // or create a new instance
         PyObject* o1 = PySequence_ITEM(sipPy, 0);
         PyObject* o2 = PySequence_ITEM(sipPy, 1);
         *sipCppPtr = new wxGridCellCoords(wxPyInt_AsLong(o1), wxPyInt_AsLong(o2));
         Py_DECREF(o1);
         Py_DECREF(o2);
         return SIP_TEMPORARY;
}


/* Define this type's Python slots. */
static sipPySlotDef slots_wxGridCellCoords[] = {
    {(void *)slot_wxGridCellCoords___ne__, ne_slot},
    {(void *)slot_wxGridCellCoords___eq__, eq_slot},
    {0, (sipPySlotType)0}
};


static PyMethodDef methods_wxGridCellCoords[] = {
    {SIP_MLNAME_CAST(sipName_Get), meth_wxGridCellCoords_Get, METH_VARARGS, SIP_MLDOC_CAST(doc_wxGridCellCoords_Get)},
    {SIP_MLNAME_CAST(sipName_GetCol), meth_wxGridCellCoords_GetCol, METH_VARARGS, SIP_MLDOC_CAST(doc_wxGridCellCoords_GetCol)},
    {SIP_MLNAME_CAST(sipName_GetRow), meth_wxGridCellCoords_GetRow, METH_VARARGS, SIP_MLDOC_CAST(doc_wxGridCellCoords_GetRow)},
    {SIP_MLNAME_CAST(sipName_Set), SIP_MLMETH_CAST(meth_wxGridCellCoords_Set), METH_VARARGS|METH_KEYWORDS, SIP_MLDOC_CAST(doc_wxGridCellCoords_Set)},
    {SIP_MLNAME_CAST(sipName_SetCol), SIP_MLMETH_CAST(meth_wxGridCellCoords_SetCol), METH_VARARGS|METH_KEYWORDS, SIP_MLDOC_CAST(doc_wxGridCellCoords_SetCol)},
    {SIP_MLNAME_CAST(sipName_SetRow), SIP_MLMETH_CAST(meth_wxGridCellCoords_SetRow), METH_VARARGS|METH_KEYWORDS, SIP_MLDOC_CAST(doc_wxGridCellCoords_SetRow)}
};

sipVariableDef variables_wxGridCellCoords[] = {
    {PropertyVariable, sipName_Row, &methods_wxGridCellCoords[2], &methods_wxGridCellCoords[5], SIP_NULLPTR, SIP_NULLPTR},
    {PropertyVariable, sipName_Col, &methods_wxGridCellCoords[1], &methods_wxGridCellCoords[4], SIP_NULLPTR, SIP_NULLPTR},
};

PyDoc_STRVAR(doc_wxGridCellCoords, "GridCellCoords()\n"
"GridCellCoords(row, col)\n"
"\n"
"Represents coordinates of a grid cell.");


sipClassTypeDef sipTypeDef__grid_wxGridCellCoords = {
    {
        -1,
        SIP_NULLPTR,
        SIP_NULLPTR,
        SIP_TYPE_CLASS,
        sipNameNr_wxGridCellCoords,
        {SIP_NULLPTR},
        SIP_NULLPTR
    },
    {
        sipNameNr_GridCellCoords,
        {0, 0, 1},
        6, methods_wxGridCellCoords,
        0, SIP_NULLPTR,
        2, variables_wxGridCellCoords,
        {SIP_NULLPTR, SIP_NULLPTR, SIP_NULLPTR, SIP_NULLPTR, SIP_NULLPTR, SIP_NULLPTR, SIP_NULLPTR, SIP_NULLPTR, SIP_NULLPTR, SIP_NULLPTR},
    },
    doc_wxGridCellCoords,
    -1,
    -1,
    SIP_NULLPTR,
    slots_wxGridCellCoords,
    init_type_wxGridCellCoords,
    SIP_NULLPTR,
    SIP_NULLPTR,
#if PY_MAJOR_VERSION >= 3
    SIP_NULLPTR,
    SIP_NULLPTR,
#else
    SIP_NULLPTR,
    SIP_NULLPTR,
    SIP_NULLPTR,
    SIP_NULLPTR,
#endif
    dealloc_wxGridCellCoords,
    assign_wxGridCellCoords,
    array_wxGridCellCoords,
    copy_wxGridCellCoords,
    release_wxGridCellCoords,
    SIP_NULLPTR,
    convertTo_wxGridCellCoords,
    SIP_NULLPTR,
    SIP_NULLPTR,
    SIP_NULLPTR,
    SIP_NULLPTR,
    SIP_NULLPTR
};
