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

#include "sipAPI_html2.h"

        #include <wx/webview.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:
     ::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[2];
};

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);
}

 ::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[0],sipPySelf,sipName_WebViewFactory,sipName_Create);

    if (!sipMeth)
        return 0;

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

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

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

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

    if (!sipMeth)
        return 0;

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

    return sipVH__html2_22(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);
        }
    }

    /* Raise an exception if the arguments couldn't be parsed. */
    sipNoMethod(sipParseErr, sipName_WebViewFactory, sipName_Create, 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_wxObject)
        return static_cast< ::wxObject *>(sipCpp);

    return sipCppV;
}


/* 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[] = {
    {SIP_MLNAME_CAST(sipName_Create), SIP_MLMETH_CAST(meth_wxWebViewFactory_Create), METH_VARARGS|METH_KEYWORDS, SIP_MLDOC_CAST(doc_wxWebViewFactory_Create)}
};

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},
        1, methods_wxWebViewFactory,
        0, SIP_NULLPTR,
        0, SIP_NULLPTR,
        {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,
#if PY_MAJOR_VERSION >= 3
    SIP_NULLPTR,
    SIP_NULLPTR,
#else
    SIP_NULLPTR,
    SIP_NULLPTR,
    SIP_NULLPTR,
    SIP_NULLPTR,
#endif
    dealloc_wxWebViewFactory,
    SIP_NULLPTR,
    SIP_NULLPTR,
    SIP_NULLPTR,
    release_wxWebViewFactory,
    cast_wxWebViewFactory,
    SIP_NULLPTR,
    SIP_NULLPTR,
    SIP_NULLPTR,
    SIP_NULLPTR,
    SIP_NULLPTR,
    SIP_NULLPTR
};
