/*
 * Interface wrapper code.
 *
 * Generated by SIP 4.19.16
 *
 *     Copyright: (c) 2018 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]),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]),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);
        }
    }

    /* Raise an exception if the arguments couldn't be parsed. */
    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);
        }
    }

    /* Raise an exception if the arguments couldn't be parsed. */
    sipNoMethod(sipParseErr, sipName_RichTextCommand, sipName_Undo, SIP_NULLPTR);

    return SIP_NULLPTR;
}


PyDoc_STRVAR(doc_wxRichTextCommand_AddAction, "AddAction(action)\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;
        }
    }

    /* Raise an exception if the arguments couldn't be parsed. */
    sipNoMethod(sipParseErr, sipName_RichTextCommand, sipName_AddAction, SIP_NULLPTR);

    return SIP_NULLPTR;
}


PyDoc_STRVAR(doc_wxRichTextCommand_ClearActions, "ClearActions()\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;
        }
    }

    /* Raise an exception if the arguments couldn't be parsed. */
    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);
        }
    }

    /* Raise an exception if the arguments couldn't be parsed. */
    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_wxCommand)
        return static_cast< ::wxCommand *>(sipCpp);

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

    return sipCppV;
}


/* 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[] = {{10, 0, 1}};


static PyMethodDef methods_wxRichTextCommand[] = {
    {SIP_MLNAME_CAST(sipName_AddAction), SIP_MLMETH_CAST(meth_wxRichTextCommand_AddAction), METH_VARARGS|METH_KEYWORDS, SIP_MLDOC_CAST(doc_wxRichTextCommand_AddAction)},
    {SIP_MLNAME_CAST(sipName_ClearActions), meth_wxRichTextCommand_ClearActions, METH_VARARGS, SIP_MLDOC_CAST(doc_wxRichTextCommand_ClearActions)},
    {SIP_MLNAME_CAST(sipName_Do), meth_wxRichTextCommand_Do, METH_VARARGS, SIP_MLDOC_CAST(doc_wxRichTextCommand_Do)},
    {SIP_MLNAME_CAST(sipName_GetActions), meth_wxRichTextCommand_GetActions, METH_VARARGS, SIP_MLDOC_CAST(doc_wxRichTextCommand_GetActions)},
    {SIP_MLNAME_CAST(sipName_Undo), meth_wxRichTextCommand_Undo, METH_VARARGS, SIP_MLDOC_CAST(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)\n"
"RichTextCommand(name)\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,
#if PY_MAJOR_VERSION >= 3
    SIP_NULLPTR,
    SIP_NULLPTR,
#else
    SIP_NULLPTR,
    SIP_NULLPTR,
    SIP_NULLPTR,
    SIP_NULLPTR,
#endif
    dealloc_wxRichTextCommand,
    SIP_NULLPTR,
    SIP_NULLPTR,
    SIP_NULLPTR,
    release_wxRichTextCommand,
    cast_wxRichTextCommand,
    SIP_NULLPTR,
    SIP_NULLPTR,
    SIP_NULLPTR,
    SIP_NULLPTR,
    SIP_NULLPTR,
    SIP_NULLPTR
};
