/*
 * 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/event.h>

        #include <wx/menu.h>
        #include <wx/event.h>
        #include <wx/object.h>
        #include <wx/object.h>
        #include <wx/object.h>


class sipwxMenuEvent : public  ::wxMenuEvent
{
public:
    sipwxMenuEvent( ::wxEventType,int, ::wxMenu*);
    sipwxMenuEvent(const  ::wxMenuEvent&);
    virtual ~sipwxMenuEvent();

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

    char sipPyMethods[2];
};

sipwxMenuEvent::sipwxMenuEvent( ::wxEventType type,int id, ::wxMenu*menu):  ::wxMenuEvent(type,id,menu), sipPySelf(SIP_NULLPTR)
{
    memset(sipPyMethods, 0, sizeof (sipPyMethods));
}

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

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

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

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

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

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

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

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

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

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

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

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


PyDoc_STRVAR(doc_wxMenuEvent_GetMenu, "GetMenu() -> Menu\n"
"\n"
"Returns the menu which is being opened or closed.");

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

    {
        const  ::wxMenuEvent *sipCpp;

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

            PyErr_Clear();

            Py_BEGIN_ALLOW_THREADS
            sipRes = sipCpp->GetMenu();
            Py_END_ALLOW_THREADS

            if (PyErr_Occurred())
                return 0;

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

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

    return SIP_NULLPTR;
}


PyDoc_STRVAR(doc_wxMenuEvent_GetMenuId, "GetMenuId() -> int\n"
"\n"
"Returns the menu identifier associated with the event.");

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

    {
        const  ::wxMenuEvent *sipCpp;

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

            PyErr_Clear();

            Py_BEGIN_ALLOW_THREADS
            sipRes = sipCpp->GetMenuId();
            Py_END_ALLOW_THREADS

            if (PyErr_Occurred())
                return 0;

            return SIPLong_FromLong(sipRes);
        }
    }

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

    return SIP_NULLPTR;
}


PyDoc_STRVAR(doc_wxMenuEvent_IsPopup, "IsPopup() -> bool\n"
"\n"
"Returns true if the menu which is being opened or closed is a popup\n"
"menu, false if it is a normal one.");

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

    {
        const  ::wxMenuEvent *sipCpp;

        if (sipParseArgs(&sipParseErr, sipArgs, "B", &sipSelf, sipType_wxMenuEvent, &sipCpp))
        {
            bool sipRes;

            PyErr_Clear();

            Py_BEGIN_ALLOW_THREADS
            sipRes = sipCpp->IsPopup();
            Py_END_ALLOW_THREADS

            if (PyErr_Occurred())
                return 0;

            return PyBool_FromLong(sipRes);
        }
    }

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

    return SIP_NULLPTR;
}


PyDoc_STRVAR(doc_wxMenuEvent_Clone, "Clone(self) -> Event");

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

    {
        const  ::wxMenuEvent *sipCpp;

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

            PyErr_Clear();

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

            if (PyErr_Occurred())
                return 0;

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

    /* Raise an exception if the arguments couldn't be parsed. */
    sipNoMethod(sipParseErr, sipName_MenuEvent, sipName_Clone, doc_wxMenuEvent_Clone);

    return SIP_NULLPTR;
}


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

    if (targetType == sipType_wxEvent)
        return static_cast< ::wxEvent *>(sipCpp);

    if (targetType == sipType_wxObject)
        return static_cast< ::wxObject *>(sipCpp);

    return sipCppV;
}


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

    if (sipState & SIP_DERIVED_CLASS)
        delete reinterpret_cast<sipwxMenuEvent *>(sipCppV);
    else
        delete reinterpret_cast< ::wxMenuEvent *>(sipCppV);

    Py_END_ALLOW_THREADS
}


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

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


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

    {
         ::wxEventType type = wxEVT_NULL;
        int id = 0;
         ::wxMenu* menu = 0;

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

        if (sipParseKwdArgs(sipParseErr, sipArgs, sipKwds, sipKwdList, sipUnused, "|iiJ8", &type, &id, sipType_wxMenu, &menu))
        {
            PyErr_Clear();

            Py_BEGIN_ALLOW_THREADS
            sipCpp = new sipwxMenuEvent(type,id,menu);
            Py_END_ALLOW_THREADS

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

            sipCpp->sipPySelf = sipSelf;

            return sipCpp;
        }
    }

    {
        const  ::wxMenuEvent* a0;

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

            sipCpp->sipPySelf = sipSelf;

            return sipCpp;
        }
    }

    return SIP_NULLPTR;
}


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


static PyMethodDef methods_wxMenuEvent[] = {
    {SIP_MLNAME_CAST(sipName_Clone), meth_wxMenuEvent_Clone, METH_VARARGS, SIP_MLDOC_CAST(doc_wxMenuEvent_Clone)},
    {SIP_MLNAME_CAST(sipName_GetMenu), meth_wxMenuEvent_GetMenu, METH_VARARGS, SIP_MLDOC_CAST(doc_wxMenuEvent_GetMenu)},
    {SIP_MLNAME_CAST(sipName_GetMenuId), meth_wxMenuEvent_GetMenuId, METH_VARARGS, SIP_MLDOC_CAST(doc_wxMenuEvent_GetMenuId)},
    {SIP_MLNAME_CAST(sipName_IsPopup), meth_wxMenuEvent_IsPopup, METH_VARARGS, SIP_MLDOC_CAST(doc_wxMenuEvent_IsPopup)}
};

sipVariableDef variables_wxMenuEvent[] = {
    {PropertyVariable, sipName_MenuId, &methods_wxMenuEvent[2], SIP_NULLPTR, SIP_NULLPTR, SIP_NULLPTR},
    {PropertyVariable, sipName_Menu, &methods_wxMenuEvent[1], SIP_NULLPTR, SIP_NULLPTR, SIP_NULLPTR},
};

PyDoc_STRVAR(doc_wxMenuEvent, "MenuEvent(type=wxEVT_NULL, id=0, menu=None)\n"
"\n"
"This class is used for a variety of menu-related events.");


sipClassTypeDef sipTypeDef__core_wxMenuEvent = {
    {
        -1,
        SIP_NULLPTR,
        SIP_NULLPTR,
        SIP_TYPE_SCC|SIP_TYPE_CLASS,
        sipNameNr_wxMenuEvent,
        {SIP_NULLPTR},
        SIP_NULLPTR
    },
    {
        sipNameNr_MenuEvent,
        {0, 0, 1},
        4, methods_wxMenuEvent,
        0, SIP_NULLPTR,
        2, variables_wxMenuEvent,
        {SIP_NULLPTR, SIP_NULLPTR, SIP_NULLPTR, SIP_NULLPTR, SIP_NULLPTR, SIP_NULLPTR, SIP_NULLPTR, SIP_NULLPTR, SIP_NULLPTR, SIP_NULLPTR},
    },
    doc_wxMenuEvent,
    -1,
    -1,
    supers_wxMenuEvent,
    SIP_NULLPTR,
    init_type_wxMenuEvent,
    SIP_NULLPTR,
    SIP_NULLPTR,
#if PY_MAJOR_VERSION >= 3
    SIP_NULLPTR,
    SIP_NULLPTR,
#else
    SIP_NULLPTR,
    SIP_NULLPTR,
    SIP_NULLPTR,
    SIP_NULLPTR,
#endif
    dealloc_wxMenuEvent,
    SIP_NULLPTR,
    SIP_NULLPTR,
    SIP_NULLPTR,
    release_wxMenuEvent,
    cast_wxMenuEvent,
    SIP_NULLPTR,
    SIP_NULLPTR,
    SIP_NULLPTR,
    SIP_NULLPTR,
    SIP_NULLPTR,
    SIP_NULLPTR
};
