/*
 * 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/textcompleter.h>



class sipwxTextCompleter : public ::wxTextCompleter
{
public:
    sipwxTextCompleter();
    virtual ~sipwxTextCompleter();

    /*
     * There is a protected method for every virtual method visible from
     * this class.
     */
protected:
    ::wxString GetNext() SIP_OVERRIDE;
    bool Start(const ::wxString&) SIP_OVERRIDE;

public:
    sipSimpleWrapper *sipPySelf;

private:
    sipwxTextCompleter(const sipwxTextCompleter &);
    sipwxTextCompleter &operator = (const sipwxTextCompleter &);

    char sipPyMethods[2];
};

sipwxTextCompleter::sipwxTextCompleter(): ::wxTextCompleter(), sipPySelf(SIP_NULLPTR)
{
    memset(sipPyMethods, 0, sizeof (sipPyMethods));
}

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

::wxString sipwxTextCompleter::GetNext()
{
    sip_gilstate_t sipGILState;
    PyObject *sipMeth;

    sipMeth = sipIsPyMethod(&sipGILState, &sipPyMethods[0], &sipPySelf, sipName_TextCompleter, sipName_GetNext);

    if (!sipMeth)
        return ::wxString();

    extern ::wxString sipVH__core_11(sip_gilstate_t, sipVirtErrorHandlerFunc, sipSimpleWrapper *, PyObject *);

    return sipVH__core_11(sipGILState, 0, sipPySelf, sipMeth);
}

bool sipwxTextCompleter::Start(const ::wxString& prefix)
{
    sip_gilstate_t sipGILState;
    PyObject *sipMeth;

    sipMeth = sipIsPyMethod(&sipGILState, &sipPyMethods[1], &sipPySelf, sipName_TextCompleter, sipName_Start);

    if (!sipMeth)
        return 0;

    extern bool sipVH__core_9(sip_gilstate_t, sipVirtErrorHandlerFunc, sipSimpleWrapper *, PyObject *, const ::wxString&);

    return sipVH__core_9(sipGILState, 0, sipPySelf, sipMeth, prefix);
}


PyDoc_STRVAR(doc_wxTextCompleter_Start, "Start(prefix) -> bool\n"
"\n"
"Function called to start iteration over the completions for the given\n"
"prefix.");

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

    {
        const ::wxString* prefix;
        int prefixState = 0;
        ::wxTextCompleter *sipCpp;

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

        if (sipParseKwdArgs(&sipParseErr, sipArgs, sipKwds, sipKwdList, SIP_NULLPTR, "BJ1", &sipSelf, sipType_wxTextCompleter, &sipCpp, sipType_wxString, &prefix, &prefixState))
        {
            bool sipRes;

            if (!sipOrigSelf)
            {
                sipAbstractMethod(sipName_TextCompleter, sipName_Start);
                return SIP_NULLPTR;
            }

            PyErr_Clear();

            Py_BEGIN_ALLOW_THREADS
            sipRes = sipCpp->Start(*prefix);
            Py_END_ALLOW_THREADS
            sipReleaseType(const_cast< ::wxString *>(prefix), sipType_wxString, prefixState);

            if (PyErr_Occurred())
                return 0;

            return PyBool_FromLong(sipRes);
        }
    }

    sipNoMethod(sipParseErr, sipName_TextCompleter, sipName_Start, SIP_NULLPTR);

    return SIP_NULLPTR;
}


PyDoc_STRVAR(doc_wxTextCompleter_GetNext, "GetNext() -> str\n"
"\n"
"Called to retrieve the next completion.");

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

    {
        ::wxTextCompleter *sipCpp;

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

            if (!sipOrigSelf)
            {
                sipAbstractMethod(sipName_TextCompleter, sipName_GetNext);
                return SIP_NULLPTR;
            }

            PyErr_Clear();

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

            if (PyErr_Occurred())
                return 0;

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

    sipNoMethod(sipParseErr, sipName_TextCompleter, sipName_GetNext, SIP_NULLPTR);

    return SIP_NULLPTR;
}


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

    if (sipState & SIP_DERIVED_CLASS)
        delete reinterpret_cast<sipwxTextCompleter *>(sipCppV);
    else
        delete reinterpret_cast< ::wxTextCompleter *>(sipCppV);

    Py_END_ALLOW_THREADS
}


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

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


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

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

            Py_BEGIN_ALLOW_THREADS
            sipCpp = new sipwxTextCompleter();
            Py_END_ALLOW_THREADS

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

            sipCpp->sipPySelf = sipSelf;

            return sipCpp;
        }
    }

    return SIP_NULLPTR;
}


static PyMethodDef methods_wxTextCompleter[] = {
    {sipName_GetNext, meth_wxTextCompleter_GetNext, METH_VARARGS, doc_wxTextCompleter_GetNext},
    {sipName_Start, SIP_MLMETH_CAST(meth_wxTextCompleter_Start), METH_VARARGS|METH_KEYWORDS, doc_wxTextCompleter_Start}
};

sipVariableDef variables_wxTextCompleter[] = {
    {PropertyVariable, sipName_Next, &methods_wxTextCompleter[0], SIP_NULLPTR, SIP_NULLPTR, SIP_NULLPTR},
};

PyDoc_STRVAR(doc_wxTextCompleter, "Base class for custom text completer objects.");


sipClassTypeDef sipTypeDef__core_wxTextCompleter = {
    {
        -1,
        SIP_NULLPTR,
        SIP_NULLPTR,
        SIP_TYPE_ABSTRACT|SIP_TYPE_CLASS,
        sipNameNr_wxTextCompleter,
        SIP_NULLPTR,
        SIP_NULLPTR,
    },
    {
        sipNameNr_TextCompleter,
        {0, 0, 1},
        2, methods_wxTextCompleter,
        0, SIP_NULLPTR,
        1, variables_wxTextCompleter,
        {SIP_NULLPTR, SIP_NULLPTR, SIP_NULLPTR, SIP_NULLPTR, SIP_NULLPTR, SIP_NULLPTR, SIP_NULLPTR, SIP_NULLPTR, SIP_NULLPTR, SIP_NULLPTR},
    },
    doc_wxTextCompleter,
    -1,
    -1,
    SIP_NULLPTR,
    SIP_NULLPTR,
    init_type_wxTextCompleter,
    SIP_NULLPTR,
    SIP_NULLPTR,
    SIP_NULLPTR,
    SIP_NULLPTR,
    dealloc_wxTextCompleter,
    SIP_NULLPTR,
    SIP_NULLPTR,
    SIP_NULLPTR,
    release_wxTextCompleter,
    SIP_NULLPTR,
    SIP_NULLPTR,
    SIP_NULLPTR,
    SIP_NULLPTR,
    SIP_NULLPTR,
    SIP_NULLPTR,
    SIP_NULLPTR,
    SIP_NULLPTR,
    sizeof (::wxTextCompleter),
};
