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

#include "sipAPI_core.h"

        

        #include <wx/sizer.h>
        
        class wxSizerItemList_iterator {
        public:
            wxSizerItemList_iterator(wxSizerItemList::compatibility_iterator start)
                : m_node(start) {}

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


PyDoc_STRVAR(doc_wxSizerItemList_index, "index(self, obj: SizerItem) -> int");

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

    {
         ::wxSizerItem* obj;
         ::wxSizerItemList *sipCpp;

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

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

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

    /* Raise an exception if the arguments couldn't be parsed. */
    sipNoMethod(sipParseErr, sipName_SizerItemList, sipName_index, doc_wxSizerItemList_index);

    return SIP_NULLPTR;
}


extern "C" {static PyObject *slot_wxSizerItemList___iter__(PyObject *);}
static PyObject *slot_wxSizerItemList___iter__(PyObject *sipSelf)
{
     ::wxSizerItemList *sipCpp = reinterpret_cast< ::wxSizerItemList *>(sipGetCppPtr((sipSimpleWrapper *)sipSelf,sipType_wxSizerItemList));

    if (!sipCpp)
        return SIP_NULLPTR;


    {
        {
             ::wxSizerItemList_iterator*sipRes = 0;

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

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

    return 0;
}


extern "C" {static int slot_wxSizerItemList___contains__(PyObject *,PyObject *);}
static int slot_wxSizerItemList___contains__(PyObject *sipSelf,PyObject *sipArg)
{
     ::wxSizerItemList *sipCpp = reinterpret_cast< ::wxSizerItemList *>(sipGetCppPtr((sipSimpleWrapper *)sipSelf,sipType_wxSizerItemList));

    if (!sipCpp)
        return -1;

    PyObject *sipParseErr = SIP_NULLPTR;

    {
        const  ::wxSizerItem* obj;

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

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

            return sipRes;
        }
    }

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

    return -1;
}


extern "C" {static PyObject *slot_wxSizerItemList___getitem__(PyObject *,PyObject *);}
static PyObject *slot_wxSizerItemList___getitem__(PyObject *sipSelf,PyObject *sipArg)
{
     ::wxSizerItemList *sipCpp = reinterpret_cast< ::wxSizerItemList *>(sipGetCppPtr((sipSimpleWrapper *)sipSelf,sipType_wxSizerItemList));

    if (!sipCpp)
        return SIP_NULLPTR;

    PyObject *sipParseErr = SIP_NULLPTR;

    {
        long index;

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

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

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

            sipAddException(sipError, &sipParseErr);
        }
    }

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

    return SIP_NULLPTR;
}


extern "C" {static SIP_SSIZE_T slot_wxSizerItemList___len__(PyObject *);}
static SIP_SSIZE_T slot_wxSizerItemList___len__(PyObject *sipSelf)
{
     ::wxSizerItemList *sipCpp = reinterpret_cast< ::wxSizerItemList *>(sipGetCppPtr((sipSimpleWrapper *)sipSelf,sipType_wxSizerItemList));

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

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

    Py_END_ALLOW_THREADS
}


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


extern "C" {static void *array_wxSizerItemList(SIP_SSIZE_T);}
static void *array_wxSizerItemList(SIP_SSIZE_T sipNrElem)
{
    return new  ::wxSizerItemList[sipNrElem];
}


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


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


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

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

            return sipCpp;
        }
    }

    {
        const  ::wxSizerItemList* a0;

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

            return sipCpp;
        }
    }

    return SIP_NULLPTR;
}


/* Define this type's Python slots. */
static sipPySlotDef slots_wxSizerItemList[] = {
    {(void *)slot_wxSizerItemList___iter__, iter_slot},
    {(void *)slot_wxSizerItemList___contains__, contains_slot},
    {(void *)slot_wxSizerItemList___getitem__, getitem_slot},
    {(void *)slot_wxSizerItemList___len__, len_slot},
    {0, (sipPySlotType)0}
};


static PyMethodDef methods_wxSizerItemList[] = {
    {SIP_MLNAME_CAST(sipName_index), SIP_MLMETH_CAST(meth_wxSizerItemList_index), METH_VARARGS|METH_KEYWORDS, SIP_MLDOC_CAST(doc_wxSizerItemList_index)}
};

PyDoc_STRVAR(doc_wxSizerItemList, "\1SizerItemList()\n"
"SizerItemList(SizerItemList)");


sipClassTypeDef sipTypeDef__core_wxSizerItemList = {
    {
        -1,
        SIP_NULLPTR,
        SIP_NULLPTR,
        SIP_TYPE_CLASS,
        sipNameNr_wxSizerItemList,
        {SIP_NULLPTR},
        SIP_NULLPTR
    },
    {
        sipNameNr_SizerItemList,
        {0, 0, 1},
        1, methods_wxSizerItemList,
        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_wxSizerItemList,
    -1,
    -1,
    SIP_NULLPTR,
    slots_wxSizerItemList,
    init_type_wxSizerItemList,
    SIP_NULLPTR,
    SIP_NULLPTR,
#if PY_MAJOR_VERSION >= 3
    SIP_NULLPTR,
    SIP_NULLPTR,
#else
    SIP_NULLPTR,
    SIP_NULLPTR,
    SIP_NULLPTR,
    SIP_NULLPTR,
#endif
    dealloc_wxSizerItemList,
    assign_wxSizerItemList,
    array_wxSizerItemList,
    copy_wxSizerItemList,
    release_wxSizerItemList,
    SIP_NULLPTR,
    SIP_NULLPTR,
    SIP_NULLPTR,
    SIP_NULLPTR,
    SIP_NULLPTR,
    SIP_NULLPTR,
    SIP_NULLPTR
};
