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

#include "sipAPI_adv.h"
        #include <wx/dateevt.h>
        #include <wx/window.h>
        #include <wx/datetime.h>
        #include <wx/event.h>
        #include <wx/object.h>
        #include <wx/object.h>
        #include <wx/object.h>


class sipwxDateEvent : public ::wxDateEvent
{
public:
    sipwxDateEvent();
    sipwxDateEvent(::wxWindow*, const ::wxDateTime&, ::wxEventType);
    sipwxDateEvent(const ::wxDateEvent&);
    virtual ~sipwxDateEvent();

    /*
     * 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:
    sipwxDateEvent(const sipwxDateEvent &);
    sipwxDateEvent &operator = (const sipwxDateEvent &);

    char sipPyMethods[2];
};

sipwxDateEvent::sipwxDateEvent(): ::wxDateEvent(), sipPySelf(SIP_NULLPTR)
{
    memset(sipPyMethods, 0, sizeof (sipPyMethods));
}

sipwxDateEvent::sipwxDateEvent(::wxWindow*win, const ::wxDateTime& dt, ::wxEventType type): ::wxDateEvent(win, dt, type), sipPySelf(SIP_NULLPTR)
{
    memset(sipPyMethods, 0, sizeof (sipPyMethods));
}

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

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

::wxEventCategory sipwxDateEvent::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 ::wxDateEvent::GetEventCategory();

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

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

::wxEvent* sipwxDateEvent::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 ::wxDateEvent::Clone();

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

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


PyDoc_STRVAR(doc_wxDateEvent_GetDate, "GetDate() -> wx.DateTime\n"
"\n"
"Returns the date.");

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

    {
        const ::wxDateEvent *sipCpp;

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

            PyErr_Clear();

            Py_BEGIN_ALLOW_THREADS
            sipRes = new ::wxDateTime(sipCpp->GetDate());
            Py_END_ALLOW_THREADS

            if (PyErr_Occurred())
                return 0;

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

    sipNoMethod(sipParseErr, sipName_DateEvent, sipName_GetDate, SIP_NULLPTR);

    return SIP_NULLPTR;
}


PyDoc_STRVAR(doc_wxDateEvent_SetDate, "SetDate(date) -> None\n"
"\n"
"Sets the date carried by the event, normally only used by the library\n"
"internally.");

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

    {
        const ::wxDateTime* date;
        int dateState = 0;
        ::wxDateEvent *sipCpp;

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

        if (sipParseKwdArgs(&sipParseErr, sipArgs, sipKwds, sipKwdList, SIP_NULLPTR, "BJ1", &sipSelf, sipType_wxDateEvent, &sipCpp, sipType_wxDateTime, &date, &dateState))
        {
            PyErr_Clear();

            Py_BEGIN_ALLOW_THREADS
            sipCpp->SetDate(*date);
            Py_END_ALLOW_THREADS
            sipReleaseType(const_cast< ::wxDateTime *>(date), sipType_wxDateTime, dateState);

            if (PyErr_Occurred())
                return 0;

            Py_INCREF(Py_None);
            return Py_None;
        }
    }

    sipNoMethod(sipParseErr, sipName_DateEvent, sipName_SetDate, SIP_NULLPTR);

    return SIP_NULLPTR;
}


PyDoc_STRVAR(doc_wxDateEvent_Clone, "Clone(self) -> Event|None");

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

    {
        const ::wxDateEvent *sipCpp;

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

            PyErr_Clear();

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

            if (PyErr_Occurred())
                return 0;

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

    sipNoMethod(sipParseErr, sipName_DateEvent, sipName_Clone, doc_wxDateEvent_Clone);

    return SIP_NULLPTR;
}


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

    if (targetType == sipType_wxDateEvent)
        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_wxDateEvent(void *, int);}
static void release_wxDateEvent(void *sipCppV, int sipState)
{
    Py_BEGIN_ALLOW_THREADS

    if (sipState & SIP_DERIVED_CLASS)
        delete reinterpret_cast<sipwxDateEvent *>(sipCppV);
    else
        delete reinterpret_cast< ::wxDateEvent *>(sipCppV);

    Py_END_ALLOW_THREADS
}


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

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


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

    {
        if (sipParseKwdArgs(sipParseErr, sipArgs, sipKwds, SIP_NULLPTR, sipUnused, ""))
        {
            PyErr_Clear();

            Py_BEGIN_ALLOW_THREADS
            sipCpp = new sipwxDateEvent();
            Py_END_ALLOW_THREADS

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

            sipCpp->sipPySelf = sipSelf;

            return sipCpp;
        }
    }

    {
        ::wxWindow* win;
        const ::wxDateTime* dt;
        int dtState = 0;
        ::wxEventType type;

        static const char *sipKwdList[] = {
            sipName_win,
            sipName_dt,
            sipName_type,
        };

        if (sipParseKwdArgs(sipParseErr, sipArgs, sipKwds, sipKwdList, sipUnused, "J8J1i", sipType_wxWindow, &win, sipType_wxDateTime, &dt, &dtState, &type))
        {
            PyErr_Clear();

            Py_BEGIN_ALLOW_THREADS
            sipCpp = new sipwxDateEvent(win, *dt, type);
            Py_END_ALLOW_THREADS
            sipReleaseType(const_cast< ::wxDateTime *>(dt), sipType_wxDateTime, dtState);

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

            sipCpp->sipPySelf = sipSelf;

            return sipCpp;
        }
    }

    {
        const ::wxDateEvent* a0;

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

            sipCpp->sipPySelf = sipSelf;

            return sipCpp;
        }
    }

    return SIP_NULLPTR;
}


/* Define this type's super-types. */
static sipEncodedTypeDef supers_wxDateEvent[] = {{14, 0, 1}};


static PyMethodDef methods_wxDateEvent[] = {
    {sipName_Clone, meth_wxDateEvent_Clone, METH_VARARGS, doc_wxDateEvent_Clone},
    {sipName_GetDate, meth_wxDateEvent_GetDate, METH_VARARGS, doc_wxDateEvent_GetDate},
    {sipName_SetDate, SIP_MLMETH_CAST(meth_wxDateEvent_SetDate), METH_VARARGS|METH_KEYWORDS, doc_wxDateEvent_SetDate}
};

sipVariableDef variables_wxDateEvent[] = {
    {PropertyVariable, sipName_Date, &methods_wxDateEvent[1], &methods_wxDateEvent[2], SIP_NULLPTR, SIP_NULLPTR},
};

PyDoc_STRVAR(doc_wxDateEvent, "DateEvent() -> None\n"
"DateEvent(win, dt, type) -> None\n"
"\n"
"This event class holds information about a date change and is used\n"
"together with wxDatePickerCtrl.");


sipClassTypeDef sipTypeDef__adv_wxDateEvent = {
    {
        -1,
        SIP_NULLPTR,
        SIP_NULLPTR,
        SIP_TYPE_SCC|SIP_TYPE_CLASS,
        sipNameNr_wxDateEvent,
        SIP_NULLPTR,
        SIP_NULLPTR,
    },
    {
        sipNameNr_DateEvent,
        {0, 0, 1},
        3, methods_wxDateEvent,
        0, SIP_NULLPTR,
        1, variables_wxDateEvent,
        {SIP_NULLPTR, SIP_NULLPTR, SIP_NULLPTR, SIP_NULLPTR, SIP_NULLPTR, SIP_NULLPTR, SIP_NULLPTR, SIP_NULLPTR, SIP_NULLPTR, SIP_NULLPTR},
    },
    doc_wxDateEvent,
    -1,
    -1,
    supers_wxDateEvent,
    SIP_NULLPTR,
    init_type_wxDateEvent,
    SIP_NULLPTR,
    SIP_NULLPTR,
    SIP_NULLPTR,
    SIP_NULLPTR,
    dealloc_wxDateEvent,
    SIP_NULLPTR,
    SIP_NULLPTR,
    SIP_NULLPTR,
    release_wxDateEvent,
    cast_wxDateEvent,
    SIP_NULLPTR,
    SIP_NULLPTR,
    SIP_NULLPTR,
    SIP_NULLPTR,
    SIP_NULLPTR,
    SIP_NULLPTR,
    SIP_NULLPTR,
    sizeof (::wxDateEvent),
};
