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

#include "sipAPI_core.h"
        #include <wx/stopwatch.h>
    #include <wx/longlong.h>


PyDoc_STRVAR(doc_wxStopWatch_Pause, "Pause() -> None\n"
"\n"
"Pauses the stop watch.");

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

    {
        ::wxStopWatch *sipCpp;

        if (sipParseArgs(&sipParseErr, sipArgs, "B", &sipSelf, sipType_wxStopWatch, &sipCpp))
        {
            PyErr_Clear();

            Py_BEGIN_ALLOW_THREADS
            sipCpp->Pause();
            Py_END_ALLOW_THREADS

            if (PyErr_Occurred())
                return 0;

            Py_INCREF(Py_None);
            return Py_None;
        }
    }

    sipNoMethod(sipParseErr, sipName_StopWatch, sipName_Pause, SIP_NULLPTR);

    return SIP_NULLPTR;
}


PyDoc_STRVAR(doc_wxStopWatch_Resume, "Resume() -> None\n"
"\n"
"Resumes the stop watch which had been paused with Pause().");

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

    {
        ::wxStopWatch *sipCpp;

        if (sipParseArgs(&sipParseErr, sipArgs, "B", &sipSelf, sipType_wxStopWatch, &sipCpp))
        {
            PyErr_Clear();

            Py_BEGIN_ALLOW_THREADS
            sipCpp->Resume();
            Py_END_ALLOW_THREADS

            if (PyErr_Occurred())
                return 0;

            Py_INCREF(Py_None);
            return Py_None;
        }
    }

    sipNoMethod(sipParseErr, sipName_StopWatch, sipName_Resume, SIP_NULLPTR);

    return SIP_NULLPTR;
}


PyDoc_STRVAR(doc_wxStopWatch_Start, "Start(milliseconds=0) -> None\n"
"\n"
"(Re)starts the stop watch with a given initial value.");

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

    {
        long milliseconds = 0;
        ::wxStopWatch *sipCpp;

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

        if (sipParseKwdArgs(&sipParseErr, sipArgs, sipKwds, sipKwdList, SIP_NULLPTR, "B|l", &sipSelf, sipType_wxStopWatch, &sipCpp, &milliseconds))
        {
            PyErr_Clear();

            Py_BEGIN_ALLOW_THREADS
            sipCpp->Start(milliseconds);
            Py_END_ALLOW_THREADS

            if (PyErr_Occurred())
                return 0;

            Py_INCREF(Py_None);
            return Py_None;
        }
    }

    sipNoMethod(sipParseErr, sipName_StopWatch, sipName_Start, SIP_NULLPTR);

    return SIP_NULLPTR;
}


PyDoc_STRVAR(doc_wxStopWatch_Time, "Time() -> int\n"
"\n"
"Returns the time in milliseconds since the start (or restart) or the\n"
"last call of Pause().");

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

    {
        const ::wxStopWatch *sipCpp;

        if (sipParseArgs(&sipParseErr, sipArgs, "B", &sipSelf, sipType_wxStopWatch, &sipCpp))
        {
            long sipRes;

            PyErr_Clear();

            Py_BEGIN_ALLOW_THREADS
            sipRes = sipCpp->Time();
            Py_END_ALLOW_THREADS

            if (PyErr_Occurred())
                return 0;

            return PyLong_FromLong(sipRes);
        }
    }

    sipNoMethod(sipParseErr, sipName_StopWatch, sipName_Time, SIP_NULLPTR);

    return SIP_NULLPTR;
}


PyDoc_STRVAR(doc_wxStopWatch_TimeInMicro, "TimeInMicro() -> int\n"
"\n"
"Returns elapsed time in microseconds.");

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

    {
        const ::wxStopWatch *sipCpp;

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

            PyErr_Clear();

            Py_BEGIN_ALLOW_THREADS
            sipRes = new ::wxLongLong(sipCpp->TimeInMicro());
            Py_END_ALLOW_THREADS

            if (PyErr_Occurred())
                return 0;

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

    sipNoMethod(sipParseErr, sipName_StopWatch, sipName_TimeInMicro, SIP_NULLPTR);

    return SIP_NULLPTR;
}


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

    delete reinterpret_cast< ::wxStopWatch *>(sipCppV);

    Py_END_ALLOW_THREADS
}


extern "C" {static void *array_wxStopWatch(Py_ssize_t);}
static void *array_wxStopWatch(Py_ssize_t sipNrElem)
{
    return new ::wxStopWatch[sipNrElem];
}


extern "C" {static void array_delete_wxStopWatch(void *);}
static void array_delete_wxStopWatch(void *sipCpp)
{
    delete[] reinterpret_cast< ::wxStopWatch *>(sipCpp);
}


extern "C" {static void assign_wxStopWatch(void *, Py_ssize_t, void *);}
static void assign_wxStopWatch(void *sipDst, Py_ssize_t sipDstIdx, void *sipSrc)
{
    reinterpret_cast< ::wxStopWatch *>(sipDst)[sipDstIdx] = *reinterpret_cast< ::wxStopWatch *>(sipSrc);
}


extern "C" {static void *copy_wxStopWatch(const void *, Py_ssize_t);}
static void *copy_wxStopWatch(const void *sipSrc, Py_ssize_t sipSrcIdx)
{
    return new ::wxStopWatch(reinterpret_cast<const ::wxStopWatch *>(sipSrc)[sipSrcIdx]);
}


extern "C" {static void dealloc_wxStopWatch(sipSimpleWrapper *);}
static void dealloc_wxStopWatch(sipSimpleWrapper *sipSelf)
{
    if (sipIsOwnedByPython(sipSelf))
    {
        release_wxStopWatch(sipGetAddress(sipSelf), 0);
    }
}


extern "C" {static void *init_type_wxStopWatch(sipSimpleWrapper *, PyObject *, PyObject *, PyObject **, PyObject **, PyObject **);}
static void *init_type_wxStopWatch(sipSimpleWrapper *, PyObject *sipArgs, PyObject *sipKwds, PyObject **sipUnused, PyObject **, PyObject **sipParseErr)
{
    ::wxStopWatch *sipCpp = SIP_NULLPTR;

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

            Py_BEGIN_ALLOW_THREADS
            sipCpp = new ::wxStopWatch();
            Py_END_ALLOW_THREADS

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

            return sipCpp;
        }
    }

    {
        const ::wxStopWatch* a0;

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

            return sipCpp;
        }
    }

    return SIP_NULLPTR;
}


static PyMethodDef methods_wxStopWatch[] = {
    {sipName_Pause, meth_wxStopWatch_Pause, METH_VARARGS, doc_wxStopWatch_Pause},
    {sipName_Resume, meth_wxStopWatch_Resume, METH_VARARGS, doc_wxStopWatch_Resume},
    {sipName_Start, SIP_MLMETH_CAST(meth_wxStopWatch_Start), METH_VARARGS|METH_KEYWORDS, doc_wxStopWatch_Start},
    {sipName_Time, meth_wxStopWatch_Time, METH_VARARGS, doc_wxStopWatch_Time},
    {sipName_TimeInMicro, meth_wxStopWatch_TimeInMicro, METH_VARARGS, doc_wxStopWatch_TimeInMicro}
};

PyDoc_STRVAR(doc_wxStopWatch, "StopWatch() -> None\n"
"\n"
"The wxStopWatch class allow you to measure time intervals.");


sipClassTypeDef sipTypeDef__core_wxStopWatch = {
    {
        -1,
        SIP_NULLPTR,
        SIP_NULLPTR,
        SIP_TYPE_CLASS,
        sipNameNr_wxStopWatch,
        SIP_NULLPTR,
        SIP_NULLPTR,
    },
    {
        sipNameNr_StopWatch,
        {0, 0, 1},
        5, methods_wxStopWatch,
        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_wxStopWatch,
    -1,
    -1,
    SIP_NULLPTR,
    SIP_NULLPTR,
    init_type_wxStopWatch,
    SIP_NULLPTR,
    SIP_NULLPTR,
    SIP_NULLPTR,
    SIP_NULLPTR,
    dealloc_wxStopWatch,
    assign_wxStopWatch,
    array_wxStopWatch,
    copy_wxStopWatch,
    release_wxStopWatch,
    SIP_NULLPTR,
    SIP_NULLPTR,
    SIP_NULLPTR,
    SIP_NULLPTR,
    SIP_NULLPTR,
    SIP_NULLPTR,
    SIP_NULLPTR,
    array_delete_wxStopWatch,
    sizeof (::wxStopWatch),
};
