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

#include "sipAPI_richtext.h"

        
        typedef wxList wxRichTextObjectList_;

        #include <wx/richtext/richtextbuffer.h>
        
        typedef wxList wxRichTextObjectList_;
        class wxRichTextObjectList__iterator {
        public:
            wxRichTextObjectList__iterator(wxRichTextObjectList_::compatibility_iterator start)
                : m_node(start) {}

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


PyDoc_STRVAR(doc_wxRichTextObjectList__index, "index(self, obj: RichTextObject) -> int");

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

    {
         ::wxRichTextObject* obj;
         ::wxRichTextObjectList_ *sipCpp;

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

        if (sipParseKwdArgs(&sipParseErr, sipArgs, sipKwds, sipKwdList, SIP_NULLPTR, "BJ8", &sipSelf, sipType_wxRichTextObjectList_, &sipCpp, sipType_wxRichTextObject, &obj))
        {
            int sipRes = 0;
            sipErrorState sipError = sipErrorNone;

        int idx = sipCpp->IndexOf((wxRichTextObject*)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 SIPLong_FromLong(sipRes);
            }

            sipAddException(sipError, &sipParseErr);
        }
    }

    sipNoMethod(sipParseErr, sipName_RichTextObjectList_, sipName_index, doc_wxRichTextObjectList__index);

    return SIP_NULLPTR;
}


extern "C" {static PyObject *slot_wxRichTextObjectList____iter__(PyObject *);}
static PyObject *slot_wxRichTextObjectList____iter__(PyObject *sipSelf)
{
     ::wxRichTextObjectList_ *sipCpp = reinterpret_cast< ::wxRichTextObjectList_ *>(sipGetCppPtr((sipSimpleWrapper *)sipSelf,sipType_wxRichTextObjectList_));

    if (!sipCpp)
        return SIP_NULLPTR;


    {
        {
             ::wxRichTextObjectList__iterator*sipRes = 0;

        sipRes =  new wxRichTextObjectList__iterator(sipCpp->GetFirst());

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

    return 0;
}


extern "C" {static int slot_wxRichTextObjectList____contains__(PyObject *,PyObject *);}
static int slot_wxRichTextObjectList____contains__(PyObject *sipSelf,PyObject *sipArg)
{
     ::wxRichTextObjectList_ *sipCpp = reinterpret_cast< ::wxRichTextObjectList_ *>(sipGetCppPtr((sipSimpleWrapper *)sipSelf,sipType_wxRichTextObjectList_));

    if (!sipCpp)
        return -1;

    PyObject *sipParseErr = SIP_NULLPTR;

    {
        const  ::wxRichTextObject* obj;

        if (sipParseArgs(&sipParseErr, sipArg, "1J8", sipType_wxRichTextObject, &obj))
        {
            int sipRes = 0;

        wxRichTextObjectList_::compatibility_iterator node;
        node = sipCpp->Find((wxRichTextObject*)obj);
        sipRes = node != NULL;

            return sipRes;
        }
    }

    sipNoMethod(sipParseErr, sipName_RichTextObjectList_, sipName___contains__, SIP_NULLPTR);

    return -1;
}


extern "C" {static PyObject *slot_wxRichTextObjectList____getitem__(PyObject *,PyObject *);}
static PyObject *slot_wxRichTextObjectList____getitem__(PyObject *sipSelf,PyObject *sipArg)
{
     ::wxRichTextObjectList_ *sipCpp = reinterpret_cast< ::wxRichTextObjectList_ *>(sipGetCppPtr((sipSimpleWrapper *)sipSelf,sipType_wxRichTextObjectList_));

    if (!sipCpp)
        return SIP_NULLPTR;

    PyObject *sipParseErr = SIP_NULLPTR;

    {
        long index;

        if (sipParseArgs(&sipParseErr, sipArg, "1l", &index))
        {
             ::wxRichTextObject*sipRes = 0;
            sipErrorState sipError = sipErrorNone;

        if (0 > index)
            index += sipCpp->size();

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

            sipAddException(sipError, &sipParseErr);
        }
    }

    sipNoMethod(sipParseErr, sipName_RichTextObjectList_, sipName___getitem__, SIP_NULLPTR);

    return SIP_NULLPTR;
}


extern "C" {static SIP_SSIZE_T slot_wxRichTextObjectList____len__(PyObject *);}
static SIP_SSIZE_T slot_wxRichTextObjectList____len__(PyObject *sipSelf)
{
     ::wxRichTextObjectList_ *sipCpp = reinterpret_cast< ::wxRichTextObjectList_ *>(sipGetCppPtr((sipSimpleWrapper *)sipSelf,sipType_wxRichTextObjectList_));

    if (!sipCpp)
        return 0;


    {
        {
            SIP_SSIZE_T sipRes = 0;

        sipRes = sipCpp->size();

            return sipRes;
        }
    }

    return 0;
}


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

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

    Py_END_ALLOW_THREADS
}


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


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


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


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


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

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

            return sipCpp;
        }
    }

    {
        const  ::wxRichTextObjectList_* a0;

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

            return sipCpp;
        }
    }

    return SIP_NULLPTR;
}


/* Define this type's Python slots. */
static sipPySlotDef slots_wxRichTextObjectList_[] = {
    {(void *)slot_wxRichTextObjectList____iter__, iter_slot},
    {(void *)slot_wxRichTextObjectList____contains__, contains_slot},
    {(void *)slot_wxRichTextObjectList____getitem__, getitem_slot},
    {(void *)slot_wxRichTextObjectList____len__, len_slot},
    {0, (sipPySlotType)0}
};


static PyMethodDef methods_wxRichTextObjectList_[] = {
    {SIP_MLNAME_CAST(sipName_index), SIP_MLMETH_CAST(meth_wxRichTextObjectList__index), METH_VARARGS|METH_KEYWORDS, SIP_MLDOC_CAST(doc_wxRichTextObjectList__index)}
};

PyDoc_STRVAR(doc_wxRichTextObjectList_, "\1RichTextObjectList_()\n"
"RichTextObjectList_(RichTextObjectList_)");


sipClassTypeDef sipTypeDef__richtext_wxRichTextObjectList_ = {
    {
        -1,
        SIP_NULLPTR,
        SIP_NULLPTR,
        SIP_TYPE_CLASS,
        sipNameNr_wxRichTextObjectList_,
        {SIP_NULLPTR},
        SIP_NULLPTR
    },
    {
        sipNameNr_RichTextObjectList_,
        {0, 0, 1},
        1, methods_wxRichTextObjectList_,
        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_wxRichTextObjectList_,
    -1,
    -1,
    SIP_NULLPTR,
    slots_wxRichTextObjectList_,
    init_type_wxRichTextObjectList_,
    SIP_NULLPTR,
    SIP_NULLPTR,
#if PY_MAJOR_VERSION >= 3
    SIP_NULLPTR,
    SIP_NULLPTR,
#else
    SIP_NULLPTR,
    SIP_NULLPTR,
    SIP_NULLPTR,
    SIP_NULLPTR,
#endif
    dealloc_wxRichTextObjectList_,
    assign_wxRichTextObjectList_,
    array_wxRichTextObjectList_,
    copy_wxRichTextObjectList_,
    release_wxRichTextObjectList_,
    SIP_NULLPTR,
    SIP_NULLPTR,
    SIP_NULLPTR,
    SIP_NULLPTR,
    SIP_NULLPTR,
    SIP_NULLPTR,
    SIP_NULLPTR
};
