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

#include "sipAPI_richtext.h"
        
        typedef wxList wxRichTextDrawingHandlerList;
        #include <wx/richtext/richtextbuffer.h>
        
        typedef wxList wxRichTextDrawingHandlerList;
        class wxRichTextDrawingHandlerList_iterator {
        public:
            wxRichTextDrawingHandlerList_iterator(wxRichTextDrawingHandlerList::compatibility_iterator start)
                : m_node(start) {}

            wxRichTextDrawingHandler* __next__() {
                wxRichTextDrawingHandler* obj = NULL;
                if (m_node) {
                    obj = (wxRichTextDrawingHandler*) m_node->GetData();
                    m_node = m_node->GetNext();
                }
                else {
                    PyErr_SetString(PyExc_StopIteration, "");
                }
                return (wxRichTextDrawingHandler*)obj;
            }
        private:
            wxRichTextDrawingHandlerList::compatibility_iterator m_node;
        };


PyDoc_STRVAR(doc_wxRichTextDrawingHandlerList_index, "index(self, obj: RichTextDrawingHandler|None) -> int");

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

    {
        ::wxRichTextDrawingHandler* obj;
        ::wxRichTextDrawingHandlerList *sipCpp;

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

        if (sipParseKwdArgs(&sipParseErr, sipArgs, sipKwds, sipKwdList, SIP_NULLPTR, "BJ8", &sipSelf, sipType_wxRichTextDrawingHandlerList, &sipCpp, sipType_wxRichTextDrawingHandler, &obj))
        {
            int sipRes = 0;
            sipErrorState sipError = sipErrorNone;
        int idx = sipCpp->IndexOf((wxRichTextDrawingHandler*)obj);
        if (idx == wxNOT_FOUND) {
            sipError = sipErrorFail;
            wxPyErr_SetString(PyExc_ValueError,
                              "sequence.index(x): x not in sequence");
        }
        sipRes = idx;

            if (sipError == sipErrorFail)
                return 0;

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

            sipAddException(sipError, &sipParseErr);
        }
    }

    sipNoMethod(sipParseErr, sipName_RichTextDrawingHandlerList, sipName_index, doc_wxRichTextDrawingHandlerList_index);

    return SIP_NULLPTR;
}


extern "C" {static PyObject *slot_wxRichTextDrawingHandlerList___iter__(PyObject *);}
static PyObject *slot_wxRichTextDrawingHandlerList___iter__(PyObject *sipSelf)
{
    ::wxRichTextDrawingHandlerList *sipCpp = reinterpret_cast< ::wxRichTextDrawingHandlerList *>(sipGetCppPtr((sipSimpleWrapper *)sipSelf, sipType_wxRichTextDrawingHandlerList));

    if (!sipCpp)
        return SIP_NULLPTR;


    {
        {
            ::wxRichTextDrawingHandlerList_iterator*sipRes = 0;
        sipRes =  new wxRichTextDrawingHandlerList_iterator(sipCpp->GetFirst());

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

    return 0;
}


extern "C" {static int slot_wxRichTextDrawingHandlerList___contains__(PyObject *, PyObject *);}
static int slot_wxRichTextDrawingHandlerList___contains__(PyObject *sipSelf, PyObject *sipArg)
{
    ::wxRichTextDrawingHandlerList *sipCpp = reinterpret_cast< ::wxRichTextDrawingHandlerList *>(sipGetCppPtr((sipSimpleWrapper *)sipSelf, sipType_wxRichTextDrawingHandlerList));

    if (!sipCpp)
        return -1;

    PyObject *sipParseErr = SIP_NULLPTR;

    {
        const ::wxRichTextDrawingHandler* obj;

        if (sipParseArgs(&sipParseErr, sipArg, "1J8", sipType_wxRichTextDrawingHandler, &obj))
        {
            int sipRes = 0;
        wxRichTextDrawingHandlerList::compatibility_iterator node;
        node = sipCpp->Find((wxRichTextDrawingHandler*)obj);
        sipRes = node != NULL;

            return sipRes;
        }
    }

    sipNoMethod(sipParseErr, sipName_RichTextDrawingHandlerList, sipName___contains__, SIP_NULLPTR);

    return -1;
}


extern "C" {static PyObject *slot_wxRichTextDrawingHandlerList___getitem__(PyObject *, PyObject *);}
static PyObject *slot_wxRichTextDrawingHandlerList___getitem__(PyObject *sipSelf, PyObject *sipArg)
{
    ::wxRichTextDrawingHandlerList *sipCpp = reinterpret_cast< ::wxRichTextDrawingHandlerList *>(sipGetCppPtr((sipSimpleWrapper *)sipSelf, sipType_wxRichTextDrawingHandlerList));

    if (!sipCpp)
        return SIP_NULLPTR;

    PyObject *sipParseErr = SIP_NULLPTR;

    {
        long index;

        if (sipParseArgs(&sipParseErr, sipArg, "1l", &index))
        {
            ::wxRichTextDrawingHandler*sipRes = 0;
            sipErrorState sipError = sipErrorNone;
        if (0 > index)
            index += sipCpp->size();

        if (index < sipCpp->size() && (0 <= index)) {
            wxRichTextDrawingHandlerList::compatibility_iterator node = sipCpp->Item(index);
            if (node)
                sipRes = (wxRichTextDrawingHandler*)node->GetData();
        }
        else {
            wxPyErr_SetString(PyExc_IndexError, "sequence index out of range");
            sipError = sipErrorFail;
        }

            if (sipError == sipErrorFail)
                return 0;

            if (sipError == sipErrorNone)
            {
            return sipConvertFromType(sipRes, sipType_wxRichTextDrawingHandler, SIP_NULLPTR);
            }

            sipAddException(sipError, &sipParseErr);
        }
    }

    sipNoMethod(sipParseErr, sipName_RichTextDrawingHandlerList, sipName___getitem__, SIP_NULLPTR);

    return SIP_NULLPTR;
}


extern "C" {static Py_ssize_t slot_wxRichTextDrawingHandlerList___len__(PyObject *);}
static Py_ssize_t slot_wxRichTextDrawingHandlerList___len__(PyObject *sipSelf)
{
    ::wxRichTextDrawingHandlerList *sipCpp = reinterpret_cast< ::wxRichTextDrawingHandlerList *>(sipGetCppPtr((sipSimpleWrapper *)sipSelf, sipType_wxRichTextDrawingHandlerList));

    if (!sipCpp)
        return 0;


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

            return sipRes;
        }
    }

    return 0;
}


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

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

    Py_END_ALLOW_THREADS
}


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


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


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


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


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


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

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

            return sipCpp;
        }
    }

    {
        const ::wxRichTextDrawingHandlerList* a0;

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

            return sipCpp;
        }
    }

    return SIP_NULLPTR;
}


/* Define this type's Python slots. */
static sipPySlotDef slots_wxRichTextDrawingHandlerList[] = {
    {(void *)slot_wxRichTextDrawingHandlerList___iter__, iter_slot},
    {(void *)slot_wxRichTextDrawingHandlerList___contains__, contains_slot},
    {(void *)slot_wxRichTextDrawingHandlerList___getitem__, getitem_slot},
    {(void *)slot_wxRichTextDrawingHandlerList___len__, len_slot},
    {0, (sipPySlotType)0}
};


static PyMethodDef methods_wxRichTextDrawingHandlerList[] = {
    {sipName_index, SIP_MLMETH_CAST(meth_wxRichTextDrawingHandlerList_index), METH_VARARGS|METH_KEYWORDS, doc_wxRichTextDrawingHandlerList_index}
};

PyDoc_STRVAR(doc_wxRichTextDrawingHandlerList, "\1RichTextDrawingHandlerList()\n"
"RichTextDrawingHandlerList(a0: RichTextDrawingHandlerList)");


sipClassTypeDef sipTypeDef__richtext_wxRichTextDrawingHandlerList = {
    {
        -1,
        SIP_NULLPTR,
        SIP_NULLPTR,
        SIP_TYPE_CLASS,
        sipNameNr_wxRichTextDrawingHandlerList,
        SIP_NULLPTR,
        SIP_NULLPTR,
    },
    {
        sipNameNr_RichTextDrawingHandlerList,
        {0, 0, 1},
        1, methods_wxRichTextDrawingHandlerList,
        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_wxRichTextDrawingHandlerList,
    -1,
    -1,
    SIP_NULLPTR,
    slots_wxRichTextDrawingHandlerList,
    init_type_wxRichTextDrawingHandlerList,
    SIP_NULLPTR,
    SIP_NULLPTR,
    SIP_NULLPTR,
    SIP_NULLPTR,
    dealloc_wxRichTextDrawingHandlerList,
    assign_wxRichTextDrawingHandlerList,
    array_wxRichTextDrawingHandlerList,
    copy_wxRichTextDrawingHandlerList,
    release_wxRichTextDrawingHandlerList,
    SIP_NULLPTR,
    SIP_NULLPTR,
    SIP_NULLPTR,
    SIP_NULLPTR,
    SIP_NULLPTR,
    SIP_NULLPTR,
    SIP_NULLPTR,
    array_delete_wxRichTextDrawingHandlerList,
    sizeof (::wxRichTextDrawingHandlerList),
};
