/*
 * 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/versioninfo.h>
        #include <wx/webview.h>
        #include <wx/window.h>
        #include <wx/gdicmn.h>
        #include <wx/gdicmn.h>
        #include <wx/object.h>
        #include <wx/object.h>
        #include <wx/object.h>


class sipwxWebViewFactory : public ::wxWebViewFactory
{
public:
    sipwxWebViewFactory();
    sipwxWebViewFactory(const ::wxWebViewFactory&);
    virtual ~sipwxWebViewFactory();

    /*
     * There is a protected method for every virtual method visible from
     * this class.
     */
protected:
    ::wxVersionInfo GetVersionInfo() SIP_OVERRIDE;
    bool IsAvailable() SIP_OVERRIDE;
    ::wxWebView* Create(::wxWindow*, ::wxWindowID, const ::wxString&, const ::wxPoint&, const ::wxSize&, long, const ::wxString&) SIP_OVERRIDE;
    ::wxWebView* Create() SIP_OVERRIDE;

public:
    sipSimpleWrapper *sipPySelf;

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

    char sipPyMethods[4];
};

sipwxWebViewFactory::sipwxWebViewFactory(): ::wxWebViewFactory(), sipPySelf(SIP_NULLPTR)
{
    memset(sipPyMethods, 0, sizeof (sipPyMethods));
}

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

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

::wxVersionInfo sipwxWebViewFactory::GetVersionInfo()
{
    sip_gilstate_t sipGILState;
    PyObject *sipMeth;

    sipMeth = sipIsPyMethod(&sipGILState, &sipPyMethods[0], &sipPySelf, SIP_NULLPTR, sipName_GetVersionInfo);

    if (!sipMeth)
        return ::wxWebViewFactory::GetVersionInfo();

    extern ::wxVersionInfo sipVH__html2_25(sip_gilstate_t, sipVirtErrorHandlerFunc, sipSimpleWrapper *, PyObject *);

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

bool sipwxWebViewFactory::IsAvailable()
{
    sip_gilstate_t sipGILState;
    PyObject *sipMeth;

    sipMeth = sipIsPyMethod(&sipGILState, &sipPyMethods[1], &sipPySelf, SIP_NULLPTR, sipName_IsAvailable);

    if (!sipMeth)
        return ::wxWebViewFactory::IsAvailable();

    extern bool sipVH__html2_5(sip_gilstate_t, sipVirtErrorHandlerFunc, sipSimpleWrapper *, PyObject *);

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

::wxWebView* sipwxWebViewFactory::Create(::wxWindow*parent, ::wxWindowID id, const ::wxString& url, const ::wxPoint& pos, const ::wxSize& size, long style, const ::wxString& name)
{
    sip_gilstate_t sipGILState;
    PyObject *sipMeth;

    sipMeth = sipIsPyMethod(&sipGILState, &sipPyMethods[2], &sipPySelf, sipName_WebViewFactory, sipName_Create);

    if (!sipMeth)
        return 0;

    extern ::wxWebView* sipVH__html2_24(sip_gilstate_t, sipVirtErrorHandlerFunc, sipSimpleWrapper *, PyObject *, ::wxWindow*, ::wxWindowID, const ::wxString&, const ::wxPoint&, const ::wxSize&, long, const ::wxString&);

    return sipVH__html2_24(sipGILState, 0, sipPySelf, sipMeth, parent, id, url, pos, size, style, name);
}

::wxWebView* sipwxWebViewFactory::Create()
{
    sip_gilstate_t sipGILState;
    PyObject *sipMeth;

    sipMeth = sipIsPyMethod(&sipGILState, &sipPyMethods[3], &sipPySelf, sipName_WebViewFactory, sipName_Create);

    if (!sipMeth)
        return 0;

    extern ::wxWebView* sipVH__html2_23(sip_gilstate_t, sipVirtErrorHandlerFunc, sipSimpleWrapper *, PyObject *);

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


PyDoc_STRVAR(doc_wxWebViewFactory_Create, "Create() -> WebView\n"
"Create(parent, id, url=WebViewDefaultURLStr, pos=wx.DefaultPosition, size=wx.DefaultSize, style=0, name=WebViewNameStr) -> WebView\n"
"\n"
"Function to create a new wxWebView with two-step creation,\n"
"wxWebView::Create should be called on the returned object.\n"
"");

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

    {
        ::wxWebViewFactory *sipCpp;

        if (sipParseKwdArgs(&sipParseErr, sipArgs, sipKwds, SIP_NULLPTR, SIP_NULLPTR, "B", &sipSelf, sipType_wxWebViewFactory, &sipCpp))
        {
            ::wxWebView*sipRes;

            if (!sipOrigSelf)
            {
                sipAbstractMethod(sipName_WebViewFactory, sipName_Create);
                return SIP_NULLPTR;
            }

            PyErr_Clear();

            Py_BEGIN_ALLOW_THREADS
            sipRes = sipCpp->Create();
            Py_END_ALLOW_THREADS

            if (PyErr_Occurred())
                return 0;

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

    {
        ::wxWindow* parent;
        ::wxWindowID id;
        const ::wxString& urldef = wxWebViewDefaultURLStr;
        const ::wxString* url = &urldef;
        int urlState = 0;
        const ::wxPoint& posdef = wxDefaultPosition;
        const ::wxPoint* pos = &posdef;
        int posState = 0;
        const ::wxSize& sizedef = wxDefaultSize;
        const ::wxSize* size = &sizedef;
        int sizeState = 0;
        long style = 0;
        const ::wxString& namedef = wxWebViewNameStr;
        const ::wxString* name = &namedef;
        int nameState = 0;
        ::wxWebViewFactory *sipCpp;

        static const char *sipKwdList[] = {
            sipName_parent,
            sipName_id,
            sipName_url,
            sipName_pos,
            sipName_size,
            sipName_style,
            sipName_name,
        };

        if (sipParseKwdArgs(&sipParseErr, sipArgs, sipKwds, sipKwdList, SIP_NULLPTR, "BJ8i|J1J1J1lJ1", &sipSelf, sipType_wxWebViewFactory, &sipCpp, sipType_wxWindow, &parent, &id, sipType_wxString, &url, &urlState, sipType_wxPoint, &pos, &posState, sipType_wxSize, &size, &sizeState, &style, sipType_wxString, &name, &nameState))
        {
            ::wxWebView*sipRes;

            if (!sipOrigSelf)
            {
                sipAbstractMethod(sipName_WebViewFactory, sipName_Create);
                return SIP_NULLPTR;
            }

            PyErr_Clear();

            Py_BEGIN_ALLOW_THREADS
            sipRes = sipCpp->Create(parent, id, *url, *pos, *size, style, *name);
            Py_END_ALLOW_THREADS
            sipReleaseType(const_cast< ::wxString *>(url), sipType_wxString, urlState);
            sipReleaseType(const_cast< ::wxPoint *>(pos), sipType_wxPoint, posState);
            sipReleaseType(const_cast< ::wxSize *>(size), sipType_wxSize, sizeState);
            sipReleaseType(const_cast< ::wxString *>(name), sipType_wxString, nameState);

            if (PyErr_Occurred())
                return 0;

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

    sipNoMethod(sipParseErr, sipName_WebViewFactory, sipName_Create, SIP_NULLPTR);

    return SIP_NULLPTR;
}


PyDoc_STRVAR(doc_wxWebViewFactory_IsAvailable, "IsAvailable() -> bool\n"
"\n"
"Function to check if the backend is available at runtime.");

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

    {
        ::wxWebViewFactory *sipCpp;

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

            PyErr_Clear();

            Py_BEGIN_ALLOW_THREADS
            sipRes = (sipSelfWasArg ? sipCpp->::wxWebViewFactory::IsAvailable() : sipCpp->IsAvailable());
            Py_END_ALLOW_THREADS

            if (PyErr_Occurred())
                return 0;

            return PyBool_FromLong(sipRes);
        }
    }

    sipNoMethod(sipParseErr, sipName_WebViewFactory, sipName_IsAvailable, SIP_NULLPTR);

    return SIP_NULLPTR;
}


PyDoc_STRVAR(doc_wxWebViewFactory_GetVersionInfo, "GetVersionInfo() -> wx.VersionInfo\n"
"\n"
"Retrieve the version information about this backend implementation.");

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

    {
        ::wxWebViewFactory *sipCpp;

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

            PyErr_Clear();

            Py_BEGIN_ALLOW_THREADS
            sipRes = new ::wxVersionInfo((sipSelfWasArg ? sipCpp->::wxWebViewFactory::GetVersionInfo() : sipCpp->GetVersionInfo()));
            Py_END_ALLOW_THREADS

            if (PyErr_Occurred())
                return 0;

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

    sipNoMethod(sipParseErr, sipName_WebViewFactory, sipName_GetVersionInfo, SIP_NULLPTR);

    return SIP_NULLPTR;
}


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

    if (targetType == sipType_wxWebViewFactory)
        return sipCppV;

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

    return SIP_NULLPTR;
}


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

    if (sipState & SIP_DERIVED_CLASS)
        delete reinterpret_cast<sipwxWebViewFactory *>(sipCppV);
    else
        delete reinterpret_cast< ::wxWebViewFactory *>(sipCppV);

    Py_END_ALLOW_THREADS
}


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

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


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

    {
        if (sipParseKwdArgs(sipParseErr, sipArgs, sipKwds, SIP_NULLPTR, sipUnused, ""))
        {
            Py_BEGIN_ALLOW_THREADS
            sipCpp = new sipwxWebViewFactory();
            Py_END_ALLOW_THREADS

            sipCpp->sipPySelf = sipSelf;

            return sipCpp;
        }
    }

    {
        const ::wxWebViewFactory* a0;

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

            sipCpp->sipPySelf = sipSelf;

            return sipCpp;
        }
    }

    return SIP_NULLPTR;
}


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


static PyMethodDef methods_wxWebViewFactory[] = {
    {sipName_Create, SIP_MLMETH_CAST(meth_wxWebViewFactory_Create), METH_VARARGS|METH_KEYWORDS, doc_wxWebViewFactory_Create},
    {sipName_GetVersionInfo, meth_wxWebViewFactory_GetVersionInfo, METH_VARARGS, doc_wxWebViewFactory_GetVersionInfo},
    {sipName_IsAvailable, meth_wxWebViewFactory_IsAvailable, METH_VARARGS, doc_wxWebViewFactory_IsAvailable}
};

sipVariableDef variables_wxWebViewFactory[] = {
    {PropertyVariable, sipName_VersionInfo, &methods_wxWebViewFactory[1], SIP_NULLPTR, SIP_NULLPTR, SIP_NULLPTR},
};

PyDoc_STRVAR(doc_wxWebViewFactory, "An abstract factory class for creating wxWebView backends.");


sipClassTypeDef sipTypeDef__html2_wxWebViewFactory = {
    {
        -1,
        SIP_NULLPTR,
        SIP_NULLPTR,
        SIP_TYPE_ABSTRACT|SIP_TYPE_SCC|SIP_TYPE_CLASS,
        sipNameNr_wxWebViewFactory,
        SIP_NULLPTR,
        SIP_NULLPTR,
    },
    {
        sipNameNr_WebViewFactory,
        {0, 0, 1},
        3, methods_wxWebViewFactory,
        0, SIP_NULLPTR,
        1, variables_wxWebViewFactory,
        {SIP_NULLPTR, SIP_NULLPTR, SIP_NULLPTR, SIP_NULLPTR, SIP_NULLPTR, SIP_NULLPTR, SIP_NULLPTR, SIP_NULLPTR, SIP_NULLPTR, SIP_NULLPTR},
    },
    doc_wxWebViewFactory,
    -1,
    -1,
    supers_wxWebViewFactory,
    SIP_NULLPTR,
    init_type_wxWebViewFactory,
    SIP_NULLPTR,
    SIP_NULLPTR,
    SIP_NULLPTR,
    SIP_NULLPTR,
    dealloc_wxWebViewFactory,
    SIP_NULLPTR,
    SIP_NULLPTR,
    SIP_NULLPTR,
    release_wxWebViewFactory,
    cast_wxWebViewFactory,
    SIP_NULLPTR,
    SIP_NULLPTR,
    SIP_NULLPTR,
    SIP_NULLPTR,
    SIP_NULLPTR,
    SIP_NULLPTR,
    SIP_NULLPTR,
    sizeof (::wxWebViewFactory),
};
