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

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

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


PyDoc_STRVAR(doc_wxRichTextActionList_index, "index(self, obj: Optional[RichTextAction]) -> int");

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

    {
        ::wxRichTextAction* obj;
        ::wxRichTextActionList *sipCpp;

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

        if (sipParseKwdArgs(&sipParseErr, sipArgs, sipKwds, sipKwdList, SIP_NULLPTR, "BJ8", &sipSelf, sipType_wxRichTextActionList, &sipCpp, sipType_wxRichTextAction, &obj))
        {
            int sipRes = 0;
            sipErrorState sipError = sipErrorNone;
        int idx = sipCpp->IndexOf((wxRichTextAction*)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_RichTextActionList, sipName_index, doc_wxRichTextActionList_index);

    return SIP_NULLPTR;
}


extern "C" {static PyObject *slot_wxRichTextActionList___iter__(PyObject *);}
static PyObject *slot_wxRichTextActionList___iter__(PyObject *sipSelf)
{
    ::wxRichTextActionList *sipCpp = reinterpret_cast<::wxRichTextActionList *>(sipGetCppPtr((sipSimpleWrapper *)sipSelf, sipType_wxRichTextActionList));

    if (!sipCpp)
        return SIP_NULLPTR;


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

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

    return 0;
}


extern "C" {static int slot_wxRichTextActionList___contains__(PyObject *, PyObject *);}
static int slot_wxRichTextActionList___contains__(PyObject *sipSelf, PyObject *sipArg)
{
    ::wxRichTextActionList *sipCpp = reinterpret_cast<::wxRichTextActionList *>(sipGetCppPtr((sipSimpleWrapper *)sipSelf, sipType_wxRichTextActionList));

    if (!sipCpp)
        return -1;

    PyObject *sipParseErr = SIP_NULLPTR;

    {
        const ::wxRichTextAction* obj;

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

            return sipRes;
        }
    }

    sipNoMethod(sipParseErr, sipName_RichTextActionList, sipName___contains__, SIP_NULLPTR);

    return -1;
}


extern "C" {static PyObject *slot_wxRichTextActionList___getitem__(PyObject *, PyObject *);}
static PyObject *slot_wxRichTextActionList___getitem__(PyObject *sipSelf, PyObject *sipArg)
{
    ::wxRichTextActionList *sipCpp = reinterpret_cast<::wxRichTextActionList *>(sipGetCppPtr((sipSimpleWrapper *)sipSelf, sipType_wxRichTextActionList));

    if (!sipCpp)
        return SIP_NULLPTR;

    PyObject *sipParseErr = SIP_NULLPTR;

    {
        long index;

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

        if (index < sipCpp->size() && (0 <= index)) {
            wxRichTextActionList::compatibility_iterator node = sipCpp->Item(index);
            if (node)
                sipRes = (wxRichTextAction*)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_wxRichTextAction, SIP_NULLPTR);
            }

            sipAddException(sipError, &sipParseErr);
        }
    }

    sipNoMethod(sipParseErr, sipName_RichTextActionList, sipName___getitem__, SIP_NULLPTR);

    return SIP_NULLPTR;
}


extern "C" {static Py_ssize_t slot_wxRichTextActionList___len__(PyObject *);}
static Py_ssize_t slot_wxRichTextActionList___len__(PyObject *sipSelf)
{
    ::wxRichTextActionList *sipCpp = reinterpret_cast<::wxRichTextActionList *>(sipGetCppPtr((sipSimpleWrapper *)sipSelf, sipType_wxRichTextActionList));

    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_wxRichTextActionList(void *, int);}
static void release_wxRichTextActionList(void *sipCppV, int)
{
    Py_BEGIN_ALLOW_THREADS

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

    Py_END_ALLOW_THREADS
}


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


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


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


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


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

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

            return sipCpp;
        }
    }

    {
        const ::wxRichTextActionList* a0;

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

            return sipCpp;
        }
    }

    return SIP_NULLPTR;
}


/* Define this type's Python slots. */
static sipPySlotDef slots_wxRichTextActionList[] = {
    {(void *)slot_wxRichTextActionList___iter__, iter_slot},
    {(void *)slot_wxRichTextActionList___contains__, contains_slot},
    {(void *)slot_wxRichTextActionList___getitem__, getitem_slot},
    {(void *)slot_wxRichTextActionList___len__, len_slot},
    {0, (sipPySlotType)0}
};


static PyMethodDef methods_wxRichTextActionList[] = {
    {sipName_index, SIP_MLMETH_CAST(meth_wxRichTextActionList_index), METH_VARARGS|METH_KEYWORDS, doc_wxRichTextActionList_index}
};

PyDoc_STRVAR(doc_wxRichTextActionList, "\1RichTextActionList()\n"
"RichTextActionList(a0: RichTextActionList)");


sipClassTypeDef sipTypeDef__richtext_wxRichTextActionList = {
    {
        -1,
        SIP_NULLPTR,
        SIP_NULLPTR,
        SIP_TYPE_CLASS,
        sipNameNr_wxRichTextActionList,
        SIP_NULLPTR,
        SIP_NULLPTR,
    },
    {
        sipNameNr_RichTextActionList,
        {0, 0, 1},
        1, methods_wxRichTextActionList,
        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_wxRichTextActionList,
    -1,
    -1,
    SIP_NULLPTR,
    slots_wxRichTextActionList,
    init_type_wxRichTextActionList,
    SIP_NULLPTR,
    SIP_NULLPTR,
    SIP_NULLPTR,
    SIP_NULLPTR,
    dealloc_wxRichTextActionList,
    assign_wxRichTextActionList,
    array_wxRichTextActionList,
    copy_wxRichTextActionList,
    release_wxRichTextActionList,
    SIP_NULLPTR,
    SIP_NULLPTR,
    SIP_NULLPTR,
    SIP_NULLPTR,
    SIP_NULLPTR,
    SIP_NULLPTR,
    SIP_NULLPTR,
};
