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

#include "sipAPI_html2.h"
        #include <wx/webview.h>
        #include <wx/event.h>
        #include <wx/object.h>
        #include <wx/object.h>
        #include <wx/object.h>


class sipwxWebViewEvent : public ::wxWebViewEvent
{
public:
    sipwxWebViewEvent();
    sipwxWebViewEvent(::wxEventType, int, const ::wxString, const ::wxString, ::wxWebViewNavigationActionFlags, const ::wxString&);
    sipwxWebViewEvent(const ::wxWebViewEvent&);
    virtual ~sipwxWebViewEvent();

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

    char sipPyMethods[2];
};

sipwxWebViewEvent::sipwxWebViewEvent(): ::wxWebViewEvent(), sipPySelf(SIP_NULLPTR)
{
    memset(sipPyMethods, 0, sizeof (sipPyMethods));
}

sipwxWebViewEvent::sipwxWebViewEvent(::wxEventType type, int id, const ::wxString href, const ::wxString target, ::wxWebViewNavigationActionFlags flags, const ::wxString& messageHandler): ::wxWebViewEvent(type, id, href, target, flags, messageHandler), sipPySelf(SIP_NULLPTR)
{
    memset(sipPyMethods, 0, sizeof (sipPyMethods));
}

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

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

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

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

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

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

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

::wxEventCategory sipwxWebViewEvent::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 ::wxWebViewEvent::GetEventCategory();

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

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


PyDoc_STRVAR(doc_wxWebViewEvent_GetTarget, "GetTarget() -> str\n"
"\n"
"Get the name of the target frame which the url of this event has been\n"
"or will be loaded into.");

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

    {
        const ::wxWebViewEvent *sipCpp;

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

            PyErr_Clear();

            Py_BEGIN_ALLOW_THREADS
            sipRes = new ::wxString(sipCpp->GetTarget());
            Py_END_ALLOW_THREADS

            if (PyErr_Occurred())
                return 0;

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

    sipNoMethod(sipParseErr, sipName_WebViewEvent, sipName_GetTarget, SIP_NULLPTR);

    return SIP_NULLPTR;
}


PyDoc_STRVAR(doc_wxWebViewEvent_GetURL, "GetURL() -> str\n"
"\n"
"Get the URL being visited.");

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

    {
        const ::wxWebViewEvent *sipCpp;

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

            PyErr_Clear();

            Py_BEGIN_ALLOW_THREADS
            sipRes = new ::wxString(sipCpp->GetURL());
            Py_END_ALLOW_THREADS

            if (PyErr_Occurred())
                return 0;

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

    sipNoMethod(sipParseErr, sipName_WebViewEvent, sipName_GetURL, SIP_NULLPTR);

    return SIP_NULLPTR;
}


PyDoc_STRVAR(doc_wxWebViewEvent_GetNavigationAction, "GetNavigationAction() -> WebViewNavigationActionFlags\n"
"\n"
"Get the type of navigation action.");

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

    {
        const ::wxWebViewEvent *sipCpp;

        if (sipParseArgs(&sipParseErr, sipArgs, "B", &sipSelf, sipType_wxWebViewEvent, &sipCpp))
        {
            ::wxWebViewNavigationActionFlags sipRes;

            PyErr_Clear();

            Py_BEGIN_ALLOW_THREADS
            sipRes = sipCpp->GetNavigationAction();
            Py_END_ALLOW_THREADS

            if (PyErr_Occurred())
                return 0;

            return sipConvertFromEnum(static_cast<int>(sipRes), sipType_wxWebViewNavigationActionFlags);
        }
    }

    sipNoMethod(sipParseErr, sipName_WebViewEvent, sipName_GetNavigationAction, SIP_NULLPTR);

    return SIP_NULLPTR;
}


PyDoc_STRVAR(doc_wxWebViewEvent_GetMessageHandler, "GetMessageHandler() -> str\n"
"\n"
"Get the name of the script handler.");

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

    {
        const ::wxWebViewEvent *sipCpp;

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

            PyErr_Clear();

            Py_BEGIN_ALLOW_THREADS
            sipRes = new ::wxString(sipCpp->GetMessageHandler());
            Py_END_ALLOW_THREADS

            if (PyErr_Occurred())
                return 0;

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

    sipNoMethod(sipParseErr, sipName_WebViewEvent, sipName_GetMessageHandler, SIP_NULLPTR);

    return SIP_NULLPTR;
}


PyDoc_STRVAR(doc_wxWebViewEvent_IsError, "IsError() -> bool\n"
"\n"
"Returns true the script execution failed.");

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

    {
        const ::wxWebViewEvent *sipCpp;

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

            PyErr_Clear();

            Py_BEGIN_ALLOW_THREADS
            sipRes = sipCpp->IsError();
            Py_END_ALLOW_THREADS

            if (PyErr_Occurred())
                return 0;

            return PyBool_FromLong(sipRes);
        }
    }

    sipNoMethod(sipParseErr, sipName_WebViewEvent, sipName_IsError, SIP_NULLPTR);

    return SIP_NULLPTR;
}


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

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

    {
        const ::wxWebViewEvent *sipCpp;

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

            PyErr_Clear();

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

            if (PyErr_Occurred())
                return 0;

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

    sipNoMethod(sipParseErr, sipName_WebViewEvent, sipName_Clone, doc_wxWebViewEvent_Clone);

    return SIP_NULLPTR;
}


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

    if (targetType == sipType_wxWebViewEvent)
        return sipCppV;

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

    return SIP_NULLPTR;
}


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

    if (sipState & SIP_DERIVED_CLASS)
        delete reinterpret_cast<sipwxWebViewEvent *>(sipCppV);
    else
        delete reinterpret_cast< ::wxWebViewEvent *>(sipCppV);

    Py_END_ALLOW_THREADS
}


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

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


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

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

            Py_BEGIN_ALLOW_THREADS
            sipCpp = new sipwxWebViewEvent();
            Py_END_ALLOW_THREADS

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

            sipCpp->sipPySelf = sipSelf;

            return sipCpp;
        }
    }

    {
        ::wxEventType type;
        int id;
        const ::wxString* href;
        int hrefState = 0;
        const ::wxString* target;
        int targetState = 0;
        ::wxWebViewNavigationActionFlags flags = wxWEBVIEW_NAV_ACTION_NONE;
        const ::wxString& messageHandlerdef = wxString();
        const ::wxString* messageHandler = &messageHandlerdef;
        int messageHandlerState = 0;

        static const char *sipKwdList[] = {
            sipName_type,
            sipName_id,
            sipName_href,
            sipName_target,
            sipName_flags,
            sipName_messageHandler,
        };

        if (sipParseKwdArgs(sipParseErr, sipArgs, sipKwds, sipKwdList, sipUnused, "iiJ1J1|EJ1", &type, &id, sipType_wxString, &href, &hrefState, sipType_wxString, &target, &targetState, sipType_wxWebViewNavigationActionFlags, &flags, sipType_wxString, &messageHandler, &messageHandlerState))
        {
            PyErr_Clear();

            Py_BEGIN_ALLOW_THREADS
            sipCpp = new sipwxWebViewEvent(type, id, *href, *target, flags, *messageHandler);
            Py_END_ALLOW_THREADS
            sipReleaseType(const_cast< ::wxString *>(href), sipType_wxString, hrefState);
            sipReleaseType(const_cast< ::wxString *>(target), sipType_wxString, targetState);
            sipReleaseType(const_cast< ::wxString *>(messageHandler), sipType_wxString, messageHandlerState);

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

            sipCpp->sipPySelf = sipSelf;

            return sipCpp;
        }
    }

    {
        const ::wxWebViewEvent* a0;

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

            sipCpp->sipPySelf = sipSelf;

            return sipCpp;
        }
    }

    return SIP_NULLPTR;
}


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


static PyMethodDef methods_wxWebViewEvent[] = {
    {sipName_Clone, meth_wxWebViewEvent_Clone, METH_VARARGS, doc_wxWebViewEvent_Clone},
    {sipName_GetMessageHandler, meth_wxWebViewEvent_GetMessageHandler, METH_VARARGS, doc_wxWebViewEvent_GetMessageHandler},
    {sipName_GetNavigationAction, meth_wxWebViewEvent_GetNavigationAction, METH_VARARGS, doc_wxWebViewEvent_GetNavigationAction},
    {sipName_GetTarget, meth_wxWebViewEvent_GetTarget, METH_VARARGS, doc_wxWebViewEvent_GetTarget},
    {sipName_GetURL, meth_wxWebViewEvent_GetURL, METH_VARARGS, doc_wxWebViewEvent_GetURL},
    {sipName_IsError, meth_wxWebViewEvent_IsError, METH_VARARGS, doc_wxWebViewEvent_IsError}
};

sipVariableDef variables_wxWebViewEvent[] = {
    {PropertyVariable, sipName_URL, &methods_wxWebViewEvent[4], SIP_NULLPTR, SIP_NULLPTR, SIP_NULLPTR},
    {PropertyVariable, sipName_Target, &methods_wxWebViewEvent[3], SIP_NULLPTR, SIP_NULLPTR, SIP_NULLPTR},
    {PropertyVariable, sipName_NavigationAction, &methods_wxWebViewEvent[2], SIP_NULLPTR, SIP_NULLPTR, SIP_NULLPTR},
    {PropertyVariable, sipName_MessageHandler, &methods_wxWebViewEvent[1], SIP_NULLPTR, SIP_NULLPTR, SIP_NULLPTR},
};

PyDoc_STRVAR(doc_wxWebViewEvent, "WebViewEvent() -> None\n"
"WebViewEvent(type, id, href, target, flags=WEBVIEW_NAV_ACTION_NONE, messageHandler=\"\") -> None\n"
"\n"
"A navigation event holds information about events associated with\n"
"wxWebView objects.");


sipClassTypeDef sipTypeDef__html2_wxWebViewEvent = {
    {
        -1,
        SIP_NULLPTR,
        SIP_NULLPTR,
        SIP_TYPE_SCC|SIP_TYPE_CLASS,
        sipNameNr_wxWebViewEvent,
        SIP_NULLPTR,
        SIP_NULLPTR,
    },
    {
        sipNameNr_WebViewEvent,
        {0, 0, 1},
        6, methods_wxWebViewEvent,
        0, SIP_NULLPTR,
        4, variables_wxWebViewEvent,
        {SIP_NULLPTR, SIP_NULLPTR, SIP_NULLPTR, SIP_NULLPTR, SIP_NULLPTR, SIP_NULLPTR, SIP_NULLPTR, SIP_NULLPTR, SIP_NULLPTR, SIP_NULLPTR},
    },
    doc_wxWebViewEvent,
    -1,
    -1,
    supers_wxWebViewEvent,
    SIP_NULLPTR,
    init_type_wxWebViewEvent,
    SIP_NULLPTR,
    SIP_NULLPTR,
    SIP_NULLPTR,
    SIP_NULLPTR,
    dealloc_wxWebViewEvent,
    SIP_NULLPTR,
    SIP_NULLPTR,
    SIP_NULLPTR,
    release_wxWebViewEvent,
    cast_wxWebViewEvent,
    SIP_NULLPTR,
    SIP_NULLPTR,
    SIP_NULLPTR,
    SIP_NULLPTR,
    SIP_NULLPTR,
    SIP_NULLPTR,
    SIP_NULLPTR,
    sizeof (::wxWebViewEvent),
};
