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

#include "sipAPI_propgrid.h"
        #include <wx/propgrid/property.h>
        #include <wx/gdicmn.h>
        #include <wx/propgrid/property.h>
        #include <wx/dc.h>
        #include <wx/gdicmn.h>
        #include <wx/propgrid/propgrid.h>
        #include <wx/propgrid/property.h>
        #include <wx/propgrid/editors.h>


class sipwxPGDefaultRenderer : public ::wxPGDefaultRenderer
{
public:
    sipwxPGDefaultRenderer();
    virtual ~sipwxPGDefaultRenderer();

    /*
     * There is a protected method for every virtual method visible from
     * this class.
     */
protected:
    bool Render(::wxDC&, const ::wxRect&, const ::wxPropertyGrid*, ::wxPGProperty*, int, int, int) const SIP_OVERRIDE;
    ::wxSize GetImageSize(const ::wxPGProperty*, int, int) const SIP_OVERRIDE;
    void DrawCaptionSelectionRect(::wxDC&, int, int, int, int) const SIP_OVERRIDE;

public:
    sipSimpleWrapper *sipPySelf;

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

    char sipPyMethods[3];
};

sipwxPGDefaultRenderer::sipwxPGDefaultRenderer(): ::wxPGDefaultRenderer(), sipPySelf(SIP_NULLPTR)
{
    memset(sipPyMethods, 0, sizeof (sipPyMethods));
}

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

bool sipwxPGDefaultRenderer::Render(::wxDC& dc, const ::wxRect& rect, const ::wxPropertyGrid*propertyGrid, ::wxPGProperty*property, int column, int item, int flags) const
{
    sip_gilstate_t sipGILState;
    PyObject *sipMeth;

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

    if (!sipMeth)
        return ::wxPGDefaultRenderer::Render(dc, rect, propertyGrid, property, column, item, flags);

    extern bool sipVH__propgrid_0(sip_gilstate_t, sipVirtErrorHandlerFunc, sipSimpleWrapper *, PyObject *, ::wxDC&, const ::wxRect&, const ::wxPropertyGrid*, ::wxPGProperty*, int, int, int);

    return sipVH__propgrid_0(sipGILState, 0, sipPySelf, sipMeth, dc, rect, propertyGrid, property, column, item, flags);
}

::wxSize sipwxPGDefaultRenderer::GetImageSize(const ::wxPGProperty*property, int column, int item) const
{
    sip_gilstate_t sipGILState;
    PyObject *sipMeth;

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

    if (!sipMeth)
        return ::wxPGDefaultRenderer::GetImageSize(property, column, item);

    extern ::wxSize sipVH__propgrid_1(sip_gilstate_t, sipVirtErrorHandlerFunc, sipSimpleWrapper *, PyObject *, const ::wxPGProperty*, int, int);

    return sipVH__propgrid_1(sipGILState, 0, sipPySelf, sipMeth, property, column, item);
}

void sipwxPGDefaultRenderer::DrawCaptionSelectionRect(::wxDC& dc, int x, int y, int w, int h) const
{
    sip_gilstate_t sipGILState;
    PyObject *sipMeth;

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

    if (!sipMeth)
    {
        ::wxPGDefaultRenderer::DrawCaptionSelectionRect(dc, x, y, w, h);
        return;
    }

    extern void sipVH__propgrid_2(sip_gilstate_t, sipVirtErrorHandlerFunc, sipSimpleWrapper *, PyObject *, ::wxDC&, int, int, int, int);

    sipVH__propgrid_2(sipGILState, 0, sipPySelf, sipMeth, dc, x, y, w, h);
}


PyDoc_STRVAR(doc_wxPGDefaultRenderer_Render, "Render(dc, rect, propertyGrid, property, column, item, flags) -> bool\n"
"\n"
"Returns true if rendered something in the foreground (text or bitmap.");

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

    {
        ::wxDC* dc;
        const ::wxRect* rect;
        int rectState = 0;
        const ::wxPropertyGrid* propertyGrid;
        ::wxPGProperty* property;
        int column;
        int item;
        int flags;
        const ::wxPGDefaultRenderer *sipCpp;

        static const char *sipKwdList[] = {
            sipName_dc,
            sipName_rect,
            sipName_propertyGrid,
            sipName_property,
            sipName_column,
            sipName_item,
            sipName_flags,
        };

        if (sipParseKwdArgs(&sipParseErr, sipArgs, sipKwds, sipKwdList, SIP_NULLPTR, "BJ9J1J8J8iii", &sipSelf, sipType_wxPGDefaultRenderer, &sipCpp, sipType_wxDC, &dc, sipType_wxRect, &rect, &rectState, sipType_wxPropertyGrid, &propertyGrid, sipType_wxPGProperty, &property, &column, &item, &flags))
        {
            bool sipRes;

            PyErr_Clear();

            Py_BEGIN_ALLOW_THREADS
            sipRes = (sipSelfWasArg ? sipCpp->::wxPGDefaultRenderer::Render(*dc, *rect, propertyGrid, property, column, item, flags) : sipCpp->Render(*dc, *rect, propertyGrid, property, column, item, flags));
            Py_END_ALLOW_THREADS
            sipReleaseType(const_cast< ::wxRect *>(rect), sipType_wxRect, rectState);

            if (PyErr_Occurred())
                return 0;

            return PyBool_FromLong(sipRes);
        }
    }

    sipNoMethod(sipParseErr, sipName_PGDefaultRenderer, sipName_Render, SIP_NULLPTR);

    return SIP_NULLPTR;
}


PyDoc_STRVAR(doc_wxPGDefaultRenderer_GetImageSize, "GetImageSize(property, column, item) -> wx.Size\n"
"\n"
"Returns size of the image in front of the editable area.");

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

    {
        const ::wxPGProperty* property;
        int column;
        int item;
        const ::wxPGDefaultRenderer *sipCpp;

        static const char *sipKwdList[] = {
            sipName_property,
            sipName_column,
            sipName_item,
        };

        if (sipParseKwdArgs(&sipParseErr, sipArgs, sipKwds, sipKwdList, SIP_NULLPTR, "BJ8ii", &sipSelf, sipType_wxPGDefaultRenderer, &sipCpp, sipType_wxPGProperty, &property, &column, &item))
        {
            ::wxSize*sipRes;

            PyErr_Clear();

            Py_BEGIN_ALLOW_THREADS
            sipRes = new ::wxSize((sipSelfWasArg ? sipCpp->::wxPGDefaultRenderer::GetImageSize(property, column, item) : sipCpp->GetImageSize(property, column, item)));
            Py_END_ALLOW_THREADS

            if (PyErr_Occurred())
                return 0;

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

    sipNoMethod(sipParseErr, sipName_PGDefaultRenderer, sipName_GetImageSize, SIP_NULLPTR);

    return SIP_NULLPTR;
}


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

    if (targetType == sipType_wxPGDefaultRenderer)
        return sipCppV;

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

    return SIP_NULLPTR;
}


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

    if (sipState & SIP_DERIVED_CLASS)
        delete reinterpret_cast<sipwxPGDefaultRenderer *>(sipCppV);
    else
        delete reinterpret_cast< ::wxPGDefaultRenderer *>(sipCppV);

    Py_END_ALLOW_THREADS
}


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


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


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

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


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

    {
        if (sipParseKwdArgs(sipParseErr, sipArgs, sipKwds, SIP_NULLPTR, sipUnused, ""))
        {
            Py_BEGIN_ALLOW_THREADS
            sipCpp = new sipwxPGDefaultRenderer();
            Py_END_ALLOW_THREADS

            sipCpp->sipPySelf = sipSelf;

            return sipCpp;
        }
    }

    return SIP_NULLPTR;
}


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


static PyMethodDef methods_wxPGDefaultRenderer[] = {
    {sipName_GetImageSize, SIP_MLMETH_CAST(meth_wxPGDefaultRenderer_GetImageSize), METH_VARARGS|METH_KEYWORDS, doc_wxPGDefaultRenderer_GetImageSize},
    {sipName_Render, SIP_MLMETH_CAST(meth_wxPGDefaultRenderer_Render), METH_VARARGS|METH_KEYWORDS, doc_wxPGDefaultRenderer_Render}
};

PyDoc_STRVAR(doc_wxPGDefaultRenderer, "Default cell renderer, that can handles the common scenarios.");


sipClassTypeDef sipTypeDef__propgrid_wxPGDefaultRenderer = {
    {
        -1,
        SIP_NULLPTR,
        SIP_NULLPTR,
        SIP_TYPE_CLASS,
        sipNameNr_wxPGDefaultRenderer,
        SIP_NULLPTR,
        SIP_NULLPTR,
    },
    {
        sipNameNr_PGDefaultRenderer,
        {0, 0, 1},
        2, methods_wxPGDefaultRenderer,
        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_wxPGDefaultRenderer,
    -1,
    -1,
    supers_wxPGDefaultRenderer,
    SIP_NULLPTR,
    init_type_wxPGDefaultRenderer,
    SIP_NULLPTR,
    SIP_NULLPTR,
    SIP_NULLPTR,
    SIP_NULLPTR,
    dealloc_wxPGDefaultRenderer,
    SIP_NULLPTR,
    array_wxPGDefaultRenderer,
    SIP_NULLPTR,
    release_wxPGDefaultRenderer,
    cast_wxPGDefaultRenderer,
    SIP_NULLPTR,
    SIP_NULLPTR,
    SIP_NULLPTR,
    SIP_NULLPTR,
    SIP_NULLPTR,
    SIP_NULLPTR,
    array_delete_wxPGDefaultRenderer,
    sizeof (::wxPGDefaultRenderer),
};
