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

#include "sipAPI_propgrid.h"

        #include <wx/propgrid/propgridiface.h>

        #include <wx/propgrid/property.h>
        #include <wx/propgrid/propgridiface.h>
    wxPGPropArgCls* _wxPGPropArgCls_ctor(const wxString* str)
    {
        wxString* name = new wxString(*str);
        return new wxPGPropArgCls(name, true);
    }


PyDoc_STRVAR(doc_wxPGPropArgCls_GetPtr, "GetPtr() -> PGProperty\n"
"GetPtr(iface) -> PGProperty\n"
"");

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

    {
        const  ::wxPGPropArgCls *sipCpp;

        if (sipParseKwdArgs(&sipParseErr, sipArgs, sipKwds, SIP_NULLPTR, SIP_NULLPTR, "B", &sipSelf, sipType_wxPGPropArgCls, &sipCpp))
        {
             ::wxPGProperty*sipRes;

            PyErr_Clear();

            Py_BEGIN_ALLOW_THREADS
            sipRes = sipCpp->GetPtr();
            Py_END_ALLOW_THREADS

            if (PyErr_Occurred())
                return 0;

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

    {
        const  ::wxPropertyGridInterface* iface;
        const  ::wxPGPropArgCls *sipCpp;

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

        if (sipParseKwdArgs(&sipParseErr, sipArgs, sipKwds, sipKwdList, SIP_NULLPTR, "BJ8", &sipSelf, sipType_wxPGPropArgCls, &sipCpp, sipType_wxPropertyGridInterface, &iface))
        {
             ::wxPGProperty*sipRes;

            PyErr_Clear();

            Py_BEGIN_ALLOW_THREADS
            sipRes = sipCpp->GetPtr(iface);
            Py_END_ALLOW_THREADS

            if (PyErr_Occurred())
                return 0;

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

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

    return SIP_NULLPTR;
}


PyDoc_STRVAR(doc_wxPGPropArgCls_GetPtr0, "GetPtr0() -> PGProperty");

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

    {
        const  ::wxPGPropArgCls *sipCpp;

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

            PyErr_Clear();

            Py_BEGIN_ALLOW_THREADS
            sipRes = sipCpp->GetPtr0();
            Py_END_ALLOW_THREADS

            if (PyErr_Occurred())
                return 0;

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

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

    return SIP_NULLPTR;
}


PyDoc_STRVAR(doc_wxPGPropArgCls_HasName, "HasName() -> bool");

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

    {
        const  ::wxPGPropArgCls *sipCpp;

        if (sipParseArgs(&sipParseErr, sipArgs, "B", &sipSelf, sipType_wxPGPropArgCls, &sipCpp))
        {
            bool sipRes;

            PyErr_Clear();

            Py_BEGIN_ALLOW_THREADS
            sipRes = sipCpp->HasName();
            Py_END_ALLOW_THREADS

            if (PyErr_Occurred())
                return 0;

            return PyBool_FromLong(sipRes);
        }
    }

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

    return SIP_NULLPTR;
}


PyDoc_STRVAR(doc_wxPGPropArgCls_GetName, "GetName() -> String");

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

    {
        const  ::wxPGPropArgCls *sipCpp;

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

            PyErr_Clear();

            Py_BEGIN_ALLOW_THREADS
            sipRes = new  ::wxString(sipCpp->GetName());
            Py_END_ALLOW_THREADS

            if (PyErr_Occurred())
                return 0;

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

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

    return SIP_NULLPTR;
}


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

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

    Py_END_ALLOW_THREADS
}


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


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

    {
        const  ::wxPGProperty* property;

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

        if (sipParseKwdArgs(sipParseErr, sipArgs, sipKwds, sipKwdList, sipUnused, "J8", sipType_wxPGProperty, &property))
        {
            PyErr_Clear();

            Py_BEGIN_ALLOW_THREADS
            sipCpp = new  ::wxPGPropArgCls(property);
            Py_END_ALLOW_THREADS

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

            return sipCpp;
        }
    }

    {
        const  ::wxString* str;
        int strState = 0;

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

        if (sipParseKwdArgs(sipParseErr, sipArgs, sipKwds, sipKwdList, sipUnused, "J1", sipType_wxString,&str, &strState))
        {
        PyErr_Clear();
        sipCpp = _wxPGPropArgCls_ctor(str);
            sipReleaseType(const_cast< ::wxString *>(str),sipType_wxString,strState);

            return sipCpp;
        }
    }

    {
        const  ::wxPGPropArgCls* id;
        int idState = 0;

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

        if (sipParseKwdArgs(sipParseErr, sipArgs, sipKwds, sipKwdList, sipUnused, "J1", sipType_wxPGPropArgCls, &id, &idState))
        {
            PyErr_Clear();

            Py_BEGIN_ALLOW_THREADS
            sipCpp = new  ::wxPGPropArgCls(*id);
            Py_END_ALLOW_THREADS
            sipReleaseType(const_cast< ::wxPGPropArgCls *>(id),sipType_wxPGPropArgCls,idState);

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

            return sipCpp;
        }
    }

    return SIP_NULLPTR;
}


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

        // Code to test a PyObject for compatibility with wxPGPropArgCls
        if (!sipIsErr) {
            if (sipCanConvertToType(sipPy, sipType_wxPGPropArgCls, SIP_NO_CONVERTORS))
                return TRUE;
            if (PyBytes_Check(sipPy) || PyUnicode_Check(sipPy))
                return TRUE;
            if (sipPy == Py_None)
                return TRUE;
            if (sipCanConvertToType(sipPy, sipType_wxPGProperty, SIP_NO_CONVERTORS))
                return TRUE;
            return FALSE;
        }
        
        // Code to convert a compatible PyObject to a wxPGPropArgCls
        if (PyBytes_Check(sipPy) || PyUnicode_Check(sipPy)) {
            wxString* name = new wxString(Py2wxString(sipPy));
            *sipCppPtr = new wxPGPropArgCls(name, true);
            return sipGetState(sipTransferObj);
        }
        else if (sipCanConvertToType(sipPy, sipType_wxPGProperty, SIP_NO_CONVERTORS)) {
            int state = 0;
            wxPGProperty* prop = reinterpret_cast<wxPGProperty*>(
                sipConvertToType(sipPy, sipType_wxPGProperty, sipTransferObj, SIP_NO_CONVERTORS, &state, sipIsErr));
            *sipCppPtr = new wxPGPropArgCls(prop);
            sipReleaseType(prop, sipType_wxPGProperty, state);
            return sipGetState(sipTransferObj);
        }
        else if (sipPy == Py_None) {
            *sipCppPtr = new wxPGPropArgCls(reinterpret_cast< wxPGProperty * >(NULL));
            return sipGetState(sipTransferObj);
        }
        else {
            // It's already a wxPGPropArgCls, just fetch the pointer and return
            *sipCppPtr = reinterpret_cast<wxPGPropArgCls*>(sipConvertToType(
                sipPy, sipType_wxPGPropArgCls, sipTransferObj,
                SIP_NO_CONVERTORS, 0, sipIsErr));
            return 0; // not a new instance
        }
}


static PyMethodDef methods_wxPGPropArgCls[] = {
    {SIP_MLNAME_CAST(sipName_GetName), meth_wxPGPropArgCls_GetName, METH_VARARGS, SIP_MLDOC_CAST(doc_wxPGPropArgCls_GetName)},
    {SIP_MLNAME_CAST(sipName_GetPtr), SIP_MLMETH_CAST(meth_wxPGPropArgCls_GetPtr), METH_VARARGS|METH_KEYWORDS, SIP_MLDOC_CAST(doc_wxPGPropArgCls_GetPtr)},
    {SIP_MLNAME_CAST(sipName_GetPtr0), meth_wxPGPropArgCls_GetPtr0, METH_VARARGS, SIP_MLDOC_CAST(doc_wxPGPropArgCls_GetPtr0)},
    {SIP_MLNAME_CAST(sipName_HasName), meth_wxPGPropArgCls_HasName, METH_VARARGS, SIP_MLDOC_CAST(doc_wxPGPropArgCls_HasName)}
};

sipVariableDef variables_wxPGPropArgCls[] = {
    {PropertyVariable, sipName_Ptr0, &methods_wxPGPropArgCls[2], SIP_NULLPTR, SIP_NULLPTR, SIP_NULLPTR},
    {PropertyVariable, sipName_Ptr, &methods_wxPGPropArgCls[1], SIP_NULLPTR, SIP_NULLPTR, SIP_NULLPTR},
    {PropertyVariable, sipName_Name, &methods_wxPGPropArgCls[0], SIP_NULLPTR, SIP_NULLPTR, SIP_NULLPTR},
};

PyDoc_STRVAR(doc_wxPGPropArgCls, "PGPropArgCls(property)\n"
"PGPropArgCls(str)\n"
"PGPropArgCls(id)\n"
"\n"
"Most property grid functions have this type as their argument, as it\n"
"can convey a property by either a pointer or name.");


sipClassTypeDef sipTypeDef__propgrid_wxPGPropArgCls = {
    {
        -1,
        SIP_NULLPTR,
        SIP_NULLPTR,
        SIP_TYPE_CLASS,
        sipNameNr_wxPGPropArgCls,
        {SIP_NULLPTR},
        SIP_NULLPTR
    },
    {
        sipNameNr_PGPropArgCls,
        {0, 0, 1},
        4, methods_wxPGPropArgCls,
        0, SIP_NULLPTR,
        3, variables_wxPGPropArgCls,
        {SIP_NULLPTR, SIP_NULLPTR, SIP_NULLPTR, SIP_NULLPTR, SIP_NULLPTR, SIP_NULLPTR, SIP_NULLPTR, SIP_NULLPTR, SIP_NULLPTR, SIP_NULLPTR},
    },
    doc_wxPGPropArgCls,
    -1,
    -1,
    SIP_NULLPTR,
    SIP_NULLPTR,
    init_type_wxPGPropArgCls,
    SIP_NULLPTR,
    SIP_NULLPTR,
#if PY_MAJOR_VERSION >= 3
    SIP_NULLPTR,
    SIP_NULLPTR,
#else
    SIP_NULLPTR,
    SIP_NULLPTR,
    SIP_NULLPTR,
    SIP_NULLPTR,
#endif
    dealloc_wxPGPropArgCls,
    SIP_NULLPTR,
    SIP_NULLPTR,
    SIP_NULLPTR,
    release_wxPGPropArgCls,
    SIP_NULLPTR,
    convertTo_wxPGPropArgCls,
    SIP_NULLPTR,
    SIP_NULLPTR,
    SIP_NULLPTR,
    SIP_NULLPTR,
    SIP_NULLPTR
};
