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

#include "sipAPI_core.h"
        #include <wx/timer.h>
        #include <wx/timer.h>
        #include <wx/object.h>
        #include <wx/event.h>
        #include <wx/object.h>
        #include <wx/object.h>


class sipwxTimerEvent : public ::wxTimerEvent
{
public:
    sipwxTimerEvent(::wxTimer&);
    sipwxTimerEvent(const ::wxTimerEvent&);
    virtual ~sipwxTimerEvent();

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

public:
    sipSimpleWrapper *sipPySelf;

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

    char sipPyMethods[2];
};

sipwxTimerEvent::sipwxTimerEvent(::wxTimer& timer): ::wxTimerEvent(timer), sipPySelf(SIP_NULLPTR)
{
    memset(sipPyMethods, 0, sizeof (sipPyMethods));
}

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

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

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

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

    if (!sipMeth)
        return 0;

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

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

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

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

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

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

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


PyDoc_STRVAR(doc_wxTimerEvent_GetInterval, "GetInterval() -> int\n"
"\n"
"Returns the interval of the timer which generated this event.");

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

    {
        const ::wxTimerEvent *sipCpp;

        if (sipParseArgs(&sipParseErr, sipArgs, "B", &sipSelf, sipType_wxTimerEvent, &sipCpp))
        {
            int sipRes;

            PyErr_Clear();

            Py_BEGIN_ALLOW_THREADS
            sipRes = sipCpp->GetInterval();
            Py_END_ALLOW_THREADS

            if (PyErr_Occurred())
                return 0;

            return PyLong_FromLong(sipRes);
        }
    }

    sipNoMethod(sipParseErr, sipName_TimerEvent, sipName_GetInterval, SIP_NULLPTR);

    return SIP_NULLPTR;
}


PyDoc_STRVAR(doc_wxTimerEvent_GetTimer, "GetTimer() -> Timer\n"
"\n"
"Returns the timer object which generated this event.");

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

    {
        const ::wxTimerEvent *sipCpp;

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

            PyErr_Clear();

            Py_BEGIN_ALLOW_THREADS
            sipRes = &sipCpp->GetTimer();
            Py_END_ALLOW_THREADS

            if (PyErr_Occurred())
                return 0;

            return sipConvertFromType(sipRes, sipType_wxTimer, SIP_NULLPTR);
        }
    }

    sipNoMethod(sipParseErr, sipName_TimerEvent, sipName_GetTimer, SIP_NULLPTR);

    return SIP_NULLPTR;
}


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

    if (targetType == sipType_wxTimerEvent)
        return sipCppV;

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

    return SIP_NULLPTR;
}


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

    if (sipState & SIP_DERIVED_CLASS)
        delete reinterpret_cast<sipwxTimerEvent *>(sipCppV);
    else
        delete reinterpret_cast< ::wxTimerEvent *>(sipCppV);

    Py_END_ALLOW_THREADS
}


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

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


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

    {
        ::wxTimer* timer;

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

        if (sipParseKwdArgs(sipParseErr, sipArgs, sipKwds, sipKwdList, sipUnused, "J9", sipType_wxTimer, &timer))
        {
            PyErr_Clear();

            Py_BEGIN_ALLOW_THREADS
            sipCpp = new sipwxTimerEvent(*timer);
            Py_END_ALLOW_THREADS

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

            sipCpp->sipPySelf = sipSelf;

            return sipCpp;
        }
    }

    {
        const ::wxTimerEvent* a0;

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

            sipCpp->sipPySelf = sipSelf;

            return sipCpp;
        }
    }

    return SIP_NULLPTR;
}


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


static PyMethodDef methods_wxTimerEvent[] = {
    {sipName_GetInterval, meth_wxTimerEvent_GetInterval, METH_VARARGS, doc_wxTimerEvent_GetInterval},
    {sipName_GetTimer, meth_wxTimerEvent_GetTimer, METH_VARARGS, doc_wxTimerEvent_GetTimer}
};

sipVariableDef variables_wxTimerEvent[] = {
    {PropertyVariable, sipName_Timer, &methods_wxTimerEvent[1], SIP_NULLPTR, SIP_NULLPTR, SIP_NULLPTR},
    {PropertyVariable, sipName_Interval, &methods_wxTimerEvent[0], SIP_NULLPTR, SIP_NULLPTR, SIP_NULLPTR},
};

PyDoc_STRVAR(doc_wxTimerEvent, "TimerEvent(timer) -> None\n"
"\n"
"wxTimerEvent object is passed to the event handler of timer events\n"
"(see wxTimer::SetOwner).");


sipClassTypeDef sipTypeDef__core_wxTimerEvent = {
    {
        -1,
        SIP_NULLPTR,
        SIP_NULLPTR,
        SIP_TYPE_ABSTRACT|SIP_TYPE_SCC|SIP_TYPE_CLASS,
        sipNameNr_wxTimerEvent,
        SIP_NULLPTR,
        SIP_NULLPTR,
    },
    {
        sipNameNr_TimerEvent,
        {0, 0, 1},
        2, methods_wxTimerEvent,
        0, SIP_NULLPTR,
        2, variables_wxTimerEvent,
        {SIP_NULLPTR, SIP_NULLPTR, SIP_NULLPTR, SIP_NULLPTR, SIP_NULLPTR, SIP_NULLPTR, SIP_NULLPTR, SIP_NULLPTR, SIP_NULLPTR, SIP_NULLPTR},
    },
    doc_wxTimerEvent,
    -1,
    -1,
    supers_wxTimerEvent,
    SIP_NULLPTR,
    init_type_wxTimerEvent,
    SIP_NULLPTR,
    SIP_NULLPTR,
    SIP_NULLPTR,
    SIP_NULLPTR,
    dealloc_wxTimerEvent,
    SIP_NULLPTR,
    SIP_NULLPTR,
    SIP_NULLPTR,
    release_wxTimerEvent,
    cast_wxTimerEvent,
    SIP_NULLPTR,
    SIP_NULLPTR,
    SIP_NULLPTR,
    SIP_NULLPTR,
    SIP_NULLPTR,
    SIP_NULLPTR,
    SIP_NULLPTR,
    sizeof (::wxTimerEvent),
};
