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

#include "sipAPI_richtext.h"
        #include <wx/richtext/richtextbuffer.h>
        #include <wx/richtext/richtextbuffer.h>
        #include <wx/richtext/richtextbuffer.h>
        #include <wx/richtext/richtextctrl.h>
        
        typedef wxList wxRichTextActionList;
        #include <wx/richtext/richtextbuffer.h>
        #include <wx/object.h>
        #include <wx/object.h>
        #include <wx/object.h>


class sipwxRichTextCommand : public ::wxRichTextCommand
{
public:
    sipwxRichTextCommand(const ::wxString&, ::wxRichTextCommandId, ::wxRichTextBuffer*, ::wxRichTextParagraphLayoutBox*, ::wxRichTextCtrl*, bool);
    sipwxRichTextCommand(const ::wxString&);
    virtual ~sipwxRichTextCommand();

    /*
     * There is a protected method for every virtual method visible from
     * this class.
     */
protected:
    bool CanUndo() const SIP_OVERRIDE;
    bool Do() SIP_OVERRIDE;
    ::wxString GetName() const SIP_OVERRIDE;
    bool Undo() SIP_OVERRIDE;

public:
    sipSimpleWrapper *sipPySelf;

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

    char sipPyMethods[4];
};

sipwxRichTextCommand::sipwxRichTextCommand(const ::wxString& name, ::wxRichTextCommandId id, ::wxRichTextBuffer*buffer, ::wxRichTextParagraphLayoutBox*container, ::wxRichTextCtrl*ctrl, bool ignoreFirstTime): ::wxRichTextCommand(name, id, buffer, container, ctrl, ignoreFirstTime), sipPySelf(SIP_NULLPTR)
{
    memset(sipPyMethods, 0, sizeof (sipPyMethods));
}

sipwxRichTextCommand::sipwxRichTextCommand(const ::wxString& name): ::wxRichTextCommand(name), sipPySelf(SIP_NULLPTR)
{
    memset(sipPyMethods, 0, sizeof (sipPyMethods));
}

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

bool sipwxRichTextCommand::CanUndo() const
{
    sip_gilstate_t sipGILState;
    PyObject *sipMeth;

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

    if (!sipMeth)
        return ::wxRichTextCommand::CanUndo();

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

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

bool sipwxRichTextCommand::Do()
{
    sip_gilstate_t sipGILState;
    PyObject *sipMeth;

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

    if (!sipMeth)
        return ::wxRichTextCommand::Do();

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

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

::wxString sipwxRichTextCommand::GetName() const
{
    sip_gilstate_t sipGILState;
    PyObject *sipMeth;

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

    if (!sipMeth)
        return ::wxRichTextCommand::GetName();

    extern ::wxString sipVH__richtext_16(sip_gilstate_t, sipVirtErrorHandlerFunc, sipSimpleWrapper *, PyObject *);

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

bool sipwxRichTextCommand::Undo()
{
    sip_gilstate_t sipGILState;
    PyObject *sipMeth;

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

    if (!sipMeth)
        return ::wxRichTextCommand::Undo();

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

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


PyDoc_STRVAR(doc_wxRichTextCommand_Do, "Do() -> bool\n"
"\n"
"Performs the command.");

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

    {
        ::wxRichTextCommand *sipCpp;

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

            PyErr_Clear();

            Py_BEGIN_ALLOW_THREADS
            sipRes = (sipSelfWasArg ? sipCpp->::wxRichTextCommand::Do() : sipCpp->Do());
            Py_END_ALLOW_THREADS

            if (PyErr_Occurred())
                return 0;

            return PyBool_FromLong(sipRes);
        }
    }

    sipNoMethod(sipParseErr, sipName_RichTextCommand, sipName_Do, SIP_NULLPTR);

    return SIP_NULLPTR;
}


PyDoc_STRVAR(doc_wxRichTextCommand_Undo, "Undo() -> bool\n"
"\n"
"Undoes the command.");

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

    {
        ::wxRichTextCommand *sipCpp;

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

            PyErr_Clear();

            Py_BEGIN_ALLOW_THREADS
            sipRes = (sipSelfWasArg ? sipCpp->::wxRichTextCommand::Undo() : sipCpp->Undo());
            Py_END_ALLOW_THREADS

            if (PyErr_Occurred())
                return 0;

            return PyBool_FromLong(sipRes);
        }
    }

    sipNoMethod(sipParseErr, sipName_RichTextCommand, sipName_Undo, SIP_NULLPTR);

    return SIP_NULLPTR;
}


PyDoc_STRVAR(doc_wxRichTextCommand_AddAction, "AddAction(action) -> None\n"
"\n"
"Adds an action to the action list.");

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

    {
        ::wxRichTextAction* action;
        ::wxRichTextCommand *sipCpp;

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

        if (sipParseKwdArgs(&sipParseErr, sipArgs, sipKwds, sipKwdList, SIP_NULLPTR, "BJ:", &sipSelf, sipType_wxRichTextCommand, &sipCpp, sipType_wxRichTextAction, &action))
        {
            PyErr_Clear();

            Py_BEGIN_ALLOW_THREADS
            sipCpp->AddAction(action);
            Py_END_ALLOW_THREADS

            if (PyErr_Occurred())
                return 0;

            Py_INCREF(Py_None);
            return Py_None;
        }
    }

    sipNoMethod(sipParseErr, sipName_RichTextCommand, sipName_AddAction, SIP_NULLPTR);

    return SIP_NULLPTR;
}


PyDoc_STRVAR(doc_wxRichTextCommand_ClearActions, "ClearActions() -> None\n"
"\n"
"Clears the action list.");

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

    {
        ::wxRichTextCommand *sipCpp;

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

            Py_BEGIN_ALLOW_THREADS
            sipCpp->ClearActions();
            Py_END_ALLOW_THREADS

            if (PyErr_Occurred())
                return 0;

            Py_INCREF(Py_None);
            return Py_None;
        }
    }

    sipNoMethod(sipParseErr, sipName_RichTextCommand, sipName_ClearActions, SIP_NULLPTR);

    return SIP_NULLPTR;
}


PyDoc_STRVAR(doc_wxRichTextCommand_GetActions, "GetActions() -> RichTextActionList\n"
"\n"
"Returns the action list.");

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

    {
        ::wxRichTextCommand *sipCpp;

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

            PyErr_Clear();

            Py_BEGIN_ALLOW_THREADS
            sipRes = &sipCpp->GetActions();
            Py_END_ALLOW_THREADS

            if (PyErr_Occurred())
                return 0;

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

    sipNoMethod(sipParseErr, sipName_RichTextCommand, sipName_GetActions, SIP_NULLPTR);

    return SIP_NULLPTR;
}


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

    if (targetType == sipType_wxRichTextCommand)
        return sipCppV;

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

    return SIP_NULLPTR;
}


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

    if (sipState & SIP_DERIVED_CLASS)
        delete reinterpret_cast<sipwxRichTextCommand *>(sipCppV);
    else
        delete reinterpret_cast< ::wxRichTextCommand *>(sipCppV);

    Py_END_ALLOW_THREADS
}


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

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


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

    {
        const ::wxString* name;
        int nameState = 0;
        ::wxRichTextCommandId id;
        ::wxRichTextBuffer* buffer;
        ::wxRichTextParagraphLayoutBox* container;
        ::wxRichTextCtrl* ctrl;
        bool ignoreFirstTime = 0;

        static const char *sipKwdList[] = {
            sipName_name,
            sipName_id,
            sipName_buffer,
            sipName_container,
            sipName_ctrl,
            sipName_ignoreFirstTime,
        };

        if (sipParseKwdArgs(sipParseErr, sipArgs, sipKwds, sipKwdList, sipUnused, "J1EJ8J8J8|b", sipType_wxString, &name, &nameState, sipType_wxRichTextCommandId, &id, sipType_wxRichTextBuffer, &buffer, sipType_wxRichTextParagraphLayoutBox, &container, sipType_wxRichTextCtrl, &ctrl, &ignoreFirstTime))
        {
            PyErr_Clear();

            Py_BEGIN_ALLOW_THREADS
            sipCpp = new sipwxRichTextCommand(*name, id, buffer, container, ctrl, ignoreFirstTime);
            Py_END_ALLOW_THREADS
            sipReleaseType(const_cast< ::wxString *>(name), sipType_wxString, nameState);

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

            sipCpp->sipPySelf = sipSelf;

            return sipCpp;
        }
    }

    {
        const ::wxString* name;
        int nameState = 0;

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

        if (sipParseKwdArgs(sipParseErr, sipArgs, sipKwds, sipKwdList, sipUnused, "J1", sipType_wxString, &name, &nameState))
        {
            PyErr_Clear();

            Py_BEGIN_ALLOW_THREADS
            sipCpp = new sipwxRichTextCommand(*name);
            Py_END_ALLOW_THREADS
            sipReleaseType(const_cast< ::wxString *>(name), sipType_wxString, nameState);

            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_wxRichTextCommand[] = {{11, 0, 1}};


static PyMethodDef methods_wxRichTextCommand[] = {
    {sipName_AddAction, SIP_MLMETH_CAST(meth_wxRichTextCommand_AddAction), METH_VARARGS|METH_KEYWORDS, doc_wxRichTextCommand_AddAction},
    {sipName_ClearActions, meth_wxRichTextCommand_ClearActions, METH_VARARGS, doc_wxRichTextCommand_ClearActions},
    {sipName_Do, meth_wxRichTextCommand_Do, METH_VARARGS, doc_wxRichTextCommand_Do},
    {sipName_GetActions, meth_wxRichTextCommand_GetActions, METH_VARARGS, doc_wxRichTextCommand_GetActions},
    {sipName_Undo, meth_wxRichTextCommand_Undo, METH_VARARGS, doc_wxRichTextCommand_Undo}
};

sipVariableDef variables_wxRichTextCommand[] = {
    {PropertyVariable, sipName_Actions, &methods_wxRichTextCommand[3], SIP_NULLPTR, SIP_NULLPTR, SIP_NULLPTR},
};

PyDoc_STRVAR(doc_wxRichTextCommand, "RichTextCommand(name, id, buffer, container, ctrl, ignoreFirstTime=False) -> None\n"
"RichTextCommand(name) -> None\n"
"\n"
"Implements a command on the undo/redo stack.");


sipClassTypeDef sipTypeDef__richtext_wxRichTextCommand = {
    {
        -1,
        SIP_NULLPTR,
        SIP_NULLPTR,
        SIP_TYPE_SCC|SIP_TYPE_CLASS,
        sipNameNr_wxRichTextCommand,
        SIP_NULLPTR,
        SIP_NULLPTR,
    },
    {
        sipNameNr_RichTextCommand,
        {0, 0, 1},
        5, methods_wxRichTextCommand,
        0, SIP_NULLPTR,
        1, variables_wxRichTextCommand,
        {SIP_NULLPTR, SIP_NULLPTR, SIP_NULLPTR, SIP_NULLPTR, SIP_NULLPTR, SIP_NULLPTR, SIP_NULLPTR, SIP_NULLPTR, SIP_NULLPTR, SIP_NULLPTR},
    },
    doc_wxRichTextCommand,
    -1,
    -1,
    supers_wxRichTextCommand,
    SIP_NULLPTR,
    init_type_wxRichTextCommand,
    SIP_NULLPTR,
    SIP_NULLPTR,
    SIP_NULLPTR,
    SIP_NULLPTR,
    dealloc_wxRichTextCommand,
    SIP_NULLPTR,
    SIP_NULLPTR,
    SIP_NULLPTR,
    release_wxRichTextCommand,
    cast_wxRichTextCommand,
    SIP_NULLPTR,
    SIP_NULLPTR,
    SIP_NULLPTR,
    SIP_NULLPTR,
    SIP_NULLPTR,
    SIP_NULLPTR,
    SIP_NULLPTR,
    sizeof (::wxRichTextCommand),
};
