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

#include "sipAPI_core.h"
        #include "pyevent.h"
        #include <wx/event.h>
        #include <wx/object.h>
        #include <wx/object.h>
        #include <wx/object.h>
        IMPLEMENT_DYNAMIC_CLASS(wxPyCommandEvent, wxCommandEvent);


class sipwxPyCommandEvent : public ::wxPyCommandEvent
{
public:
    sipwxPyCommandEvent(::wxEventType, int);
    sipwxPyCommandEvent(const ::wxPyCommandEvent&);
    virtual ~sipwxPyCommandEvent();

    /*
     * There is a protected method for every virtual method visible from
     * this class.
     */
protected:
    ::wxEventCategory GetEventCategory() const SIP_OVERRIDE;
    ::wxEvent* Clone() const SIP_OVERRIDE;

public:
    sipSimpleWrapper *sipPySelf;

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

    char sipPyMethods[2];
};

sipwxPyCommandEvent::sipwxPyCommandEvent(::wxEventType eventType, int id): ::wxPyCommandEvent(eventType, id), sipPySelf(SIP_NULLPTR)
{
    memset(sipPyMethods, 0, sizeof (sipPyMethods));
}

sipwxPyCommandEvent::sipwxPyCommandEvent(const ::wxPyCommandEvent& a0): ::wxPyCommandEvent(a0), sipPySelf(SIP_NULLPTR)
{
    memset(sipPyMethods, 0, sizeof (sipPyMethods));
}

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

::wxEventCategory sipwxPyCommandEvent::GetEventCategory() const
{
    sip_gilstate_t sipGILState;
    PyObject *sipMeth;

    sipMeth = sipIsPyMethod(&sipGILState, const_cast<char *>(&sipPyMethods[0]), const_cast<sipSimpleWrapper **>(&sipPySelf), SIP_NULLPTR, sipName_GetEventCategory);

    if (!sipMeth)
        return ::wxPyCommandEvent::GetEventCategory();

    extern ::wxEventCategory sipVH__core_104(sip_gilstate_t, sipVirtErrorHandlerFunc, sipSimpleWrapper *, PyObject *);

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

::wxEvent* sipwxPyCommandEvent::Clone() const
{
    sip_gilstate_t sipGILState;
    PyObject *sipMeth;

    sipMeth = sipIsPyMethod(&sipGILState, const_cast<char *>(&sipPyMethods[1]), const_cast<sipSimpleWrapper **>(&sipPySelf), SIP_NULLPTR, sipName_Clone);

    if (!sipMeth)
        return ::wxPyCommandEvent::Clone();

    extern ::wxEvent* sipVH__core_103(sip_gilstate_t, sipVirtErrorHandlerFunc, sipSimpleWrapper *, PyObject *);

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


PyDoc_STRVAR(doc_wxPyCommandEvent___getattr__, "__getattr__(name) -> Any");

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

    {
        PyObject * name;
        ::wxPyCommandEvent *sipCpp;

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

        if (sipParseKwdArgs(&sipParseErr, sipArgs, sipKwds, sipKwdList, SIP_NULLPTR, "BP0", &sipSelf, sipType_wxPyCommandEvent, &sipCpp, &name))
        {
            PyObject * sipRes = SIP_NULLPTR;
        sipRes = sipCpp->__getattr__(name);

            return sipRes;
        }
    }

    sipNoMethod(sipParseErr, sipName_PyCommandEvent, sipName___getattr__, SIP_NULLPTR);

    return SIP_NULLPTR;
}


PyDoc_STRVAR(doc_wxPyCommandEvent_Clone, "Clone() -> Event");

extern "C" {static PyObject *meth_wxPyCommandEvent_Clone(PyObject *, PyObject *);}
static PyObject *meth_wxPyCommandEvent_Clone(PyObject *sipSelf, PyObject *sipArgs)
{
    PyObject *sipParseErr = SIP_NULLPTR;
    bool sipSelfWasArg = (!sipSelf || sipIsDerivedClass((sipSimpleWrapper *)sipSelf));

    {
        const ::wxPyCommandEvent *sipCpp;

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

            PyErr_Clear();

            Py_BEGIN_ALLOW_THREADS
            sipRes = (sipSelfWasArg ? sipCpp->::wxPyCommandEvent::Clone() : sipCpp->Clone());
            Py_END_ALLOW_THREADS

            if (PyErr_Occurred())
                return 0;

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

    sipNoMethod(sipParseErr, sipName_PyCommandEvent, sipName_Clone, SIP_NULLPTR);

    return SIP_NULLPTR;
}


PyDoc_STRVAR(doc_wxPyCommandEvent__getAttrDict, "_getAttrDict() -> Any\n"
"\n"
"Gives access to the internal object that is tracking the event's\n"
"python attributes.");

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

    {
        ::wxPyCommandEvent *sipCpp;

        if (sipParseArgs(&sipParseErr, sipArgs, "B", &sipSelf, sipType_wxPyCommandEvent, &sipCpp))
        {
            PyObject * sipRes;

            PyErr_Clear();

            Py_BEGIN_ALLOW_THREADS
            sipRes = sipCpp->_getAttrDict();
            Py_END_ALLOW_THREADS

            if (PyErr_Occurred())
                return 0;

            return sipRes;
        }
    }

    sipNoMethod(sipParseErr, sipName_PyCommandEvent, sipName__getAttrDict, SIP_NULLPTR);

    return SIP_NULLPTR;
}


extern "C" {static int slot_wxPyCommandEvent___setattr__(PyObject *, PyObject *, PyObject *);}
static int slot_wxPyCommandEvent___setattr__(PyObject *sipSelf, PyObject *sipName, PyObject *sipValue)
{
    ::wxPyCommandEvent *sipCpp = reinterpret_cast< ::wxPyCommandEvent *>(sipGetCppPtr((sipSimpleWrapper *)sipSelf, sipType_wxPyCommandEvent));

    if (!sipCpp)
        return -1;

    PyObject *sipParseErr = SIP_NULLPTR;

    {
        PyObject * name;

        if (sipValue == SIP_NULLPTR && sipParsePair(&sipParseErr, sipName, SIP_NULLPTR, "P0", &name))
        {
        sipCpp->__delattr__(name);

            return 0;
        }
    }

    {
        PyObject * name;
        PyObject * value;

        if (sipValue != SIP_NULLPTR && sipParsePair(&sipParseErr, sipName, sipValue, "P0P0", &name, &value))
        {
        sipCpp->__setattr__(name, value);

            return 0;
        }
    }

    sipNoMethod(sipParseErr, sipName_PyCommandEvent, (sipValue != SIP_NULLPTR ? sipName___setattr__ : sipName___delattr__), SIP_NULLPTR);

    return -1;
}


/* Cast a pointer to a type somewhere in its inheritance hierarchy. */
extern "C" {static void *cast_wxPyCommandEvent(void *, const sipTypeDef *);}
static void *cast_wxPyCommandEvent(void *sipCppV, const sipTypeDef *targetType)
{
    ::wxPyCommandEvent *sipCpp = reinterpret_cast< ::wxPyCommandEvent *>(sipCppV);

    if (targetType == sipType_wxPyCommandEvent)
        return sipCppV;

    sipCppV = ((const sipClassTypeDef *)sipType_wxCommandEvent)->ctd_cast(static_cast< ::wxCommandEvent *>(sipCpp), targetType);
    if (sipCppV)
        return sipCppV;

    return SIP_NULLPTR;
}


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

    if (sipState & SIP_DERIVED_CLASS)
        delete reinterpret_cast<sipwxPyCommandEvent *>(sipCppV);
    else
        delete reinterpret_cast< ::wxPyCommandEvent *>(sipCppV);

    Py_END_ALLOW_THREADS
}


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

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


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

    {
        ::wxEventType eventType = wxEVT_NULL;
        int id = 0;

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

        if (sipParseKwdArgs(sipParseErr, sipArgs, sipKwds, sipKwdList, sipUnused, "|ii", &eventType, &id))
        {
            PyErr_Clear();

            Py_BEGIN_ALLOW_THREADS
            sipCpp = new sipwxPyCommandEvent(eventType, id);
            Py_END_ALLOW_THREADS

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

            sipCpp->sipPySelf = sipSelf;

            return sipCpp;
        }
    }

    {
        const ::wxPyCommandEvent* a0;

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

            sipCpp->sipPySelf = sipSelf;

            return sipCpp;
        }
    }

    return SIP_NULLPTR;
}


/* Define this type's super-types. */
static sipEncodedTypeDef supers_wxPyCommandEvent[] = {{84, 255, 1}};


/* Define this type's Python slots. */
static sipPySlotDef slots_wxPyCommandEvent[] = {
    {(void *)slot_wxPyCommandEvent___setattr__, setattr_slot},
    {0, (sipPySlotType)0}
};


static PyMethodDef methods_wxPyCommandEvent[] = {
    {sipName_Clone, meth_wxPyCommandEvent_Clone, METH_VARARGS, doc_wxPyCommandEvent_Clone},
    {sipName___getattr__, SIP_MLMETH_CAST(meth_wxPyCommandEvent___getattr__), METH_VARARGS|METH_KEYWORDS, doc_wxPyCommandEvent___getattr__},
    {sipName__getAttrDict, meth_wxPyCommandEvent__getAttrDict, METH_VARARGS, doc_wxPyCommandEvent__getAttrDict}
};

PyDoc_STRVAR(doc_wxPyCommandEvent, "PyCommandEvent(eventType=wxEVT_NULL, id=0) -> None\n"
"\n"
":class:`PyCommandEvent` can be used as a base class for implementing\n"
"custom event types in Python. You should derive from this class\n"
"instead of :class:`CommandEvent` because this class is Python-aware\n"
"and is able to transport its Python bits safely through the\n"
"wxWidgets event system and have them still be there when the\n"
"event handler is invoked. Note that since :class:`PyCommandEvent` is\n"
"taking care of preserving the extra attributes that have been set\n"
"then you do not need to override the Clone method in your\n"
"derived classes.\n"
"\n"
":see: :class:`PyEvent`");


sipClassTypeDef sipTypeDef__core_wxPyCommandEvent = {
    {
        -1,
        SIP_NULLPTR,
        SIP_NULLPTR,
        SIP_TYPE_SCC|SIP_TYPE_NONLAZY|SIP_TYPE_CLASS,
        sipNameNr_wxPyCommandEvent,
        SIP_NULLPTR,
        SIP_NULLPTR,
    },
    {
        sipNameNr_PyCommandEvent,
        {0, 0, 1},
        3, methods_wxPyCommandEvent,
        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_wxPyCommandEvent,
    -1,
    -1,
    supers_wxPyCommandEvent,
    slots_wxPyCommandEvent,
    init_type_wxPyCommandEvent,
    SIP_NULLPTR,
    SIP_NULLPTR,
    SIP_NULLPTR,
    SIP_NULLPTR,
    dealloc_wxPyCommandEvent,
    SIP_NULLPTR,
    SIP_NULLPTR,
    SIP_NULLPTR,
    release_wxPyCommandEvent,
    cast_wxPyCommandEvent,
    SIP_NULLPTR,
    SIP_NULLPTR,
    SIP_NULLPTR,
    SIP_NULLPTR,
    SIP_NULLPTR,
    SIP_NULLPTR,
    SIP_NULLPTR,
    sizeof (::wxPyCommandEvent),
};
