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

#include "sipAPI_core.h"
        #include <wx/dnd.h>
        #include <wx/dataobj.h>


class sipwxFileDropTarget : public ::wxFileDropTarget
{
public:
    sipwxFileDropTarget();
    virtual ~sipwxFileDropTarget();

    /*
     * There is a protected method for every virtual method visible from
     * this class.
     */
protected:
    bool OnDropFiles(::wxCoord, ::wxCoord, const ::wxArrayString&) SIP_OVERRIDE;
    bool GetData() SIP_OVERRIDE;
    ::wxDragResult OnData(::wxCoord, ::wxCoord, ::wxDragResult) SIP_OVERRIDE;
    ::wxDragResult OnDragOver(::wxCoord, ::wxCoord, ::wxDragResult) SIP_OVERRIDE;
    bool OnDrop(::wxCoord, ::wxCoord) SIP_OVERRIDE;
    ::wxDragResult OnEnter(::wxCoord, ::wxCoord, ::wxDragResult) SIP_OVERRIDE;
    void OnLeave() SIP_OVERRIDE;

public:
    sipSimpleWrapper *sipPySelf;

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

    char sipPyMethods[7];
};

sipwxFileDropTarget::sipwxFileDropTarget(): ::wxFileDropTarget(), sipPySelf(SIP_NULLPTR)
{
    memset(sipPyMethods, 0, sizeof (sipPyMethods));
}

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

bool sipwxFileDropTarget::OnDropFiles(::wxCoord x, ::wxCoord y, const ::wxArrayString& filenames)
{
    sip_gilstate_t sipGILState;
    PyObject *sipMeth;

    sipMeth = sipIsPyMethod(&sipGILState, &sipPyMethods[0], &sipPySelf, sipName_FileDropTarget, sipName_OnDropFiles);

    if (!sipMeth)
        return 0;

    extern bool sipVH__core_92(sip_gilstate_t, sipVirtErrorHandlerFunc, sipSimpleWrapper *, PyObject *, ::wxCoord, ::wxCoord, const ::wxArrayString&);

    return sipVH__core_92(sipGILState, 0, sipPySelf, sipMeth, x, y, filenames);
}

bool sipwxFileDropTarget::GetData()
{
    sip_gilstate_t sipGILState;
    PyObject *sipMeth;

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

    if (!sipMeth)
        return ::wxFileDropTarget::GetData();

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

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

::wxDragResult sipwxFileDropTarget::OnData(::wxCoord x, ::wxCoord y, ::wxDragResult def)
{
    sip_gilstate_t sipGILState;
    PyObject *sipMeth;

    sipMeth = sipIsPyMethod(&sipGILState, &sipPyMethods[2], &sipPySelf, SIP_NULLPTR, sipName_OnData);

    if (!sipMeth)
        return ::wxFileDropTarget::OnData(x, y, def);

    extern ::wxDragResult sipVH__core_89(sip_gilstate_t, sipVirtErrorHandlerFunc, sipSimpleWrapper *, PyObject *, ::wxCoord, ::wxCoord, ::wxDragResult);

    return sipVH__core_89(sipGILState, 0, sipPySelf, sipMeth, x, y, def);
}

::wxDragResult sipwxFileDropTarget::OnDragOver(::wxCoord x, ::wxCoord y, ::wxDragResult defResult)
{
    sip_gilstate_t sipGILState;
    PyObject *sipMeth;

    sipMeth = sipIsPyMethod(&sipGILState, &sipPyMethods[3], &sipPySelf, SIP_NULLPTR, sipName_OnDragOver);

    if (!sipMeth)
        return ::wxFileDropTarget::OnDragOver(x, y, defResult);

    extern ::wxDragResult sipVH__core_89(sip_gilstate_t, sipVirtErrorHandlerFunc, sipSimpleWrapper *, PyObject *, ::wxCoord, ::wxCoord, ::wxDragResult);

    return sipVH__core_89(sipGILState, 0, sipPySelf, sipMeth, x, y, defResult);
}

bool sipwxFileDropTarget::OnDrop(::wxCoord x, ::wxCoord y)
{
    sip_gilstate_t sipGILState;
    PyObject *sipMeth;

    sipMeth = sipIsPyMethod(&sipGILState, &sipPyMethods[4], &sipPySelf, SIP_NULLPTR, sipName_OnDrop);

    if (!sipMeth)
        return ::wxFileDropTarget::OnDrop(x, y);

    extern bool sipVH__core_90(sip_gilstate_t, sipVirtErrorHandlerFunc, sipSimpleWrapper *, PyObject *, ::wxCoord, ::wxCoord);

    return sipVH__core_90(sipGILState, 0, sipPySelf, sipMeth, x, y);
}

::wxDragResult sipwxFileDropTarget::OnEnter(::wxCoord x, ::wxCoord y, ::wxDragResult defResult)
{
    sip_gilstate_t sipGILState;
    PyObject *sipMeth;

    sipMeth = sipIsPyMethod(&sipGILState, &sipPyMethods[5], &sipPySelf, SIP_NULLPTR, sipName_OnEnter);

    if (!sipMeth)
        return ::wxFileDropTarget::OnEnter(x, y, defResult);

    extern ::wxDragResult sipVH__core_89(sip_gilstate_t, sipVirtErrorHandlerFunc, sipSimpleWrapper *, PyObject *, ::wxCoord, ::wxCoord, ::wxDragResult);

    return sipVH__core_89(sipGILState, 0, sipPySelf, sipMeth, x, y, defResult);
}

void sipwxFileDropTarget::OnLeave()
{
    sip_gilstate_t sipGILState;
    PyObject *sipMeth;

    sipMeth = sipIsPyMethod(&sipGILState, &sipPyMethods[6], &sipPySelf, SIP_NULLPTR, sipName_OnLeave);

    if (!sipMeth)
    {
        ::wxFileDropTarget::OnLeave();
        return;
    }

    extern void sipVH__core_57(sip_gilstate_t, sipVirtErrorHandlerFunc, sipSimpleWrapper *, PyObject *);

    sipVH__core_57(sipGILState, 0, sipPySelf, sipMeth);
}


PyDoc_STRVAR(doc_wxFileDropTarget_OnDrop, "OnDrop(x, y) -> bool\n"
"\n"
"See wxDropTarget::OnDrop().");

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

    {
        ::wxCoord x;
        ::wxCoord y;
        ::wxFileDropTarget *sipCpp;

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

        if (sipParseKwdArgs(&sipParseErr, sipArgs, sipKwds, sipKwdList, SIP_NULLPTR, "Bii", &sipSelf, sipType_wxFileDropTarget, &sipCpp, &x, &y))
        {
            bool sipRes;

            PyErr_Clear();

            Py_BEGIN_ALLOW_THREADS
            sipRes = (sipSelfWasArg ? sipCpp->::wxFileDropTarget::OnDrop(x, y) : sipCpp->OnDrop(x, y));
            Py_END_ALLOW_THREADS

            if (PyErr_Occurred())
                return 0;

            return PyBool_FromLong(sipRes);
        }
    }

    sipNoMethod(sipParseErr, sipName_FileDropTarget, sipName_OnDrop, SIP_NULLPTR);

    return SIP_NULLPTR;
}


PyDoc_STRVAR(doc_wxFileDropTarget_OnDropFiles, "OnDropFiles(x, y, filenames) -> bool\n"
"\n"
"Override this function to receive dropped files.");

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

    {
        ::wxCoord x;
        ::wxCoord y;
        const ::wxArrayString* filenames;
        int filenamesState = 0;
        ::wxFileDropTarget *sipCpp;

        static const char *sipKwdList[] = {
            sipName_x,
            sipName_y,
            sipName_filenames,
        };

        if (sipParseKwdArgs(&sipParseErr, sipArgs, sipKwds, sipKwdList, SIP_NULLPTR, "BiiJ1", &sipSelf, sipType_wxFileDropTarget, &sipCpp, &x, &y, sipType_wxArrayString, &filenames, &filenamesState))
        {
            bool sipRes;

            if (!sipOrigSelf)
            {
                sipAbstractMethod(sipName_FileDropTarget, sipName_OnDropFiles);
                return SIP_NULLPTR;
            }

            PyErr_Clear();

            Py_BEGIN_ALLOW_THREADS
            sipRes = sipCpp->OnDropFiles(x, y, *filenames);
            Py_END_ALLOW_THREADS
            sipReleaseType(const_cast<::wxArrayString *>(filenames), sipType_wxArrayString, filenamesState);

            if (PyErr_Occurred())
                return 0;

            return PyBool_FromLong(sipRes);
        }
    }

    sipNoMethod(sipParseErr, sipName_FileDropTarget, sipName_OnDropFiles, SIP_NULLPTR);

    return SIP_NULLPTR;
}


PyDoc_STRVAR(doc_wxFileDropTarget_OnData, "OnData(self, x: int, y: int, def_: DragResult) -> DragResult");

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

    {
        ::wxCoord x;
        ::wxCoord y;
        ::wxDragResult def;
        ::wxFileDropTarget *sipCpp;

        static const char *sipKwdList[] = {
            sipName_x,
            sipName_y,
            sipName_def,
        };

        if (sipParseKwdArgs(&sipParseErr, sipArgs, sipKwds, sipKwdList, SIP_NULLPTR, "BiiE", &sipSelf, sipType_wxFileDropTarget, &sipCpp, &x, &y, sipType_wxDragResult, &def))
        {
            ::wxDragResult sipRes;

            PyErr_Clear();

            Py_BEGIN_ALLOW_THREADS
            sipRes = (sipSelfWasArg ? sipCpp->::wxFileDropTarget::OnData(x, y, def) : sipCpp->OnData(x, y, def));
            Py_END_ALLOW_THREADS

            if (PyErr_Occurred())
                return 0;

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

    sipNoMethod(sipParseErr, sipName_FileDropTarget, sipName_OnData, doc_wxFileDropTarget_OnData);

    return SIP_NULLPTR;
}


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

    if (targetType == sipType_wxFileDropTarget)
        return sipCppV;

    if (targetType == sipType_wxDropTarget)
        return static_cast<::wxDropTarget *>(sipCpp);

    return SIP_NULLPTR;
}


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

    if (sipState & SIP_DERIVED_CLASS)
        delete reinterpret_cast<sipwxFileDropTarget *>(sipCppV);
    else
        delete reinterpret_cast<::wxFileDropTarget *>(sipCppV);

    Py_END_ALLOW_THREADS
}


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

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


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

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

            Py_BEGIN_ALLOW_THREADS
            sipCpp = new sipwxFileDropTarget();
            Py_END_ALLOW_THREADS

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

            sipCpp->sipPySelf = sipSelf;

            return sipCpp;
        }
    }

    return SIP_NULLPTR;
}


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


static PyMethodDef methods_wxFileDropTarget[] = {
    {sipName_OnData, SIP_MLMETH_CAST(meth_wxFileDropTarget_OnData), METH_VARARGS|METH_KEYWORDS, doc_wxFileDropTarget_OnData},
    {sipName_OnDrop, SIP_MLMETH_CAST(meth_wxFileDropTarget_OnDrop), METH_VARARGS|METH_KEYWORDS, doc_wxFileDropTarget_OnDrop},
    {sipName_OnDropFiles, SIP_MLMETH_CAST(meth_wxFileDropTarget_OnDropFiles), METH_VARARGS|METH_KEYWORDS, doc_wxFileDropTarget_OnDropFiles}
};

PyDoc_STRVAR(doc_wxFileDropTarget, "FileDropTarget()\n"
"\n"
"This is a drop target which accepts files (dragged from File Manager\n"
"or Explorer).");


sipClassTypeDef sipTypeDef__core_wxFileDropTarget = {
    {
        -1,
        SIP_NULLPTR,
        SIP_NULLPTR,
        SIP_TYPE_ABSTRACT|SIP_TYPE_CLASS,
        sipNameNr_wxFileDropTarget,
        SIP_NULLPTR,
        SIP_NULLPTR,
    },
    {
        sipNameNr_FileDropTarget,
        {0, 0, 1},
        3, methods_wxFileDropTarget,
        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_wxFileDropTarget,
    -1,
    -1,
    supers_wxFileDropTarget,
    SIP_NULLPTR,
    init_type_wxFileDropTarget,
    SIP_NULLPTR,
    SIP_NULLPTR,
    SIP_NULLPTR,
    SIP_NULLPTR,
    dealloc_wxFileDropTarget,
    SIP_NULLPTR,
    SIP_NULLPTR,
    SIP_NULLPTR,
    release_wxFileDropTarget,
    cast_wxFileDropTarget,
    SIP_NULLPTR,
    SIP_NULLPTR,
    SIP_NULLPTR,
    SIP_NULLPTR,
    SIP_NULLPTR,
    SIP_NULLPTR,
};
