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

#include "sipAPI_grid.h"

        #include <wx/grid.h>

        #include <wx/grid.h>
        #include <wx/dc.h>
        #include <wx/gdicmn.h>


class sipwxGridHeaderLabelsRenderer : public  ::wxGridHeaderLabelsRenderer
{
public:
    sipwxGridHeaderLabelsRenderer();
    sipwxGridHeaderLabelsRenderer(const  ::wxGridHeaderLabelsRenderer&);
    virtual ~sipwxGridHeaderLabelsRenderer();

    /*
     * There is a protected method for every virtual method visible from
     * this class.
     */
protected:
    void DrawLabel(const  ::wxGrid&, ::wxDC&,const  ::wxString&,const  ::wxRect&,int,int,int) const SIP_OVERRIDE;
    void DrawBorder(const  ::wxGrid&, ::wxDC&, ::wxRect&) const SIP_OVERRIDE;

public:
    sipSimpleWrapper *sipPySelf;

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

    char sipPyMethods[2];
};

sipwxGridHeaderLabelsRenderer::sipwxGridHeaderLabelsRenderer():  ::wxGridHeaderLabelsRenderer(), sipPySelf(SIP_NULLPTR)
{
    memset(sipPyMethods, 0, sizeof (sipPyMethods));
}

sipwxGridHeaderLabelsRenderer::sipwxGridHeaderLabelsRenderer(const  ::wxGridHeaderLabelsRenderer& a0):  ::wxGridHeaderLabelsRenderer(a0), sipPySelf(SIP_NULLPTR)
{
    memset(sipPyMethods, 0, sizeof (sipPyMethods));
}

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

void sipwxGridHeaderLabelsRenderer::DrawLabel(const  ::wxGrid& grid, ::wxDC& dc,const  ::wxString& value,const  ::wxRect& rect,int horizAlign,int vertAlign,int textOrientation) const
{
    sip_gilstate_t sipGILState;
    PyObject *sipMeth;

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

    if (!sipMeth)
    {
         ::wxGridHeaderLabelsRenderer::DrawLabel(grid,dc,value,rect,horizAlign,vertAlign,textOrientation);
        return;
    }

    extern void sipVH__grid_16(sip_gilstate_t, sipVirtErrorHandlerFunc, sipSimpleWrapper *, PyObject *, const  ::wxGrid&, ::wxDC&,const  ::wxString&,const  ::wxRect&,int,int,int);

    sipVH__grid_16(sipGILState, 0, sipPySelf, sipMeth, grid, dc, value, rect, horizAlign, vertAlign, textOrientation);
}

void sipwxGridHeaderLabelsRenderer::DrawBorder(const  ::wxGrid& grid, ::wxDC& dc, ::wxRect& rect) const
{
    sip_gilstate_t sipGILState;
    PyObject *sipMeth;

    sipMeth = sipIsPyMethod(&sipGILState,const_cast<char *>(&sipPyMethods[1]),sipPySelf,sipName_GridHeaderLabelsRenderer,sipName_DrawBorder);

    if (!sipMeth)
        return;

    extern void sipVH__grid_15(sip_gilstate_t, sipVirtErrorHandlerFunc, sipSimpleWrapper *, PyObject *, const  ::wxGrid&, ::wxDC&, ::wxRect&);

    sipVH__grid_15(sipGILState, 0, sipPySelf, sipMeth, grid, dc, rect);
}


PyDoc_STRVAR(doc_wxGridHeaderLabelsRenderer_DrawLabel, "DrawLabel(grid, dc, value, rect, horizAlign, vertAlign, textOrientation)\n"
"\n"
"Called by the grid to draw the specified label.");

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

    {
        const  ::wxGrid* grid;
         ::wxDC* dc;
        const  ::wxString* value;
        int valueState = 0;
        const  ::wxRect* rect;
        int rectState = 0;
        int horizAlign;
        int vertAlign;
        int textOrientation;
        const  ::wxGridHeaderLabelsRenderer *sipCpp;

        static const char *sipKwdList[] = {
            sipName_grid,
            sipName_dc,
            sipName_value,
            sipName_rect,
            sipName_horizAlign,
            sipName_vertAlign,
            sipName_textOrientation,
        };

        if (sipParseKwdArgs(&sipParseErr, sipArgs, sipKwds, sipKwdList, SIP_NULLPTR, "BJ9J9J1J1iii", &sipSelf, sipType_wxGridHeaderLabelsRenderer, &sipCpp, sipType_wxGrid, &grid, sipType_wxDC, &dc, sipType_wxString,&value, &valueState, sipType_wxRect, &rect, &rectState, &horizAlign, &vertAlign, &textOrientation))
        {
            PyErr_Clear();

            Py_BEGIN_ALLOW_THREADS
            (sipSelfWasArg ? sipCpp-> ::wxGridHeaderLabelsRenderer::DrawLabel(*grid,*dc,*value,*rect,horizAlign,vertAlign,textOrientation) : sipCpp->DrawLabel(*grid,*dc,*value,*rect,horizAlign,vertAlign,textOrientation));
            Py_END_ALLOW_THREADS
            sipReleaseType(const_cast< ::wxString *>(value),sipType_wxString,valueState);
            sipReleaseType(const_cast< ::wxRect *>(rect),sipType_wxRect,rectState);

            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_GridHeaderLabelsRenderer, sipName_DrawLabel, SIP_NULLPTR);

    return SIP_NULLPTR;
}


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

    if (targetType == sipType_wxGridCornerHeaderRenderer)
        return static_cast< ::wxGridCornerHeaderRenderer *>(sipCpp);

    return sipCppV;
}


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

    if (sipState & SIP_DERIVED_CLASS)
        delete reinterpret_cast<sipwxGridHeaderLabelsRenderer *>(sipCppV);
    else
        delete reinterpret_cast< ::wxGridHeaderLabelsRenderer *>(sipCppV);

    Py_END_ALLOW_THREADS
}


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

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


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

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

            sipCpp->sipPySelf = sipSelf;

            return sipCpp;
        }
    }

    {
        const  ::wxGridHeaderLabelsRenderer* a0;

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

            sipCpp->sipPySelf = sipSelf;

            return sipCpp;
        }
    }

    return SIP_NULLPTR;
}


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


static PyMethodDef methods_wxGridHeaderLabelsRenderer[] = {
    {SIP_MLNAME_CAST(sipName_DrawLabel), SIP_MLMETH_CAST(meth_wxGridHeaderLabelsRenderer_DrawLabel), METH_VARARGS|METH_KEYWORDS, SIP_MLDOC_CAST(doc_wxGridHeaderLabelsRenderer_DrawLabel)}
};

PyDoc_STRVAR(doc_wxGridHeaderLabelsRenderer, "Common base class for row and column headers renderers.");


sipClassTypeDef sipTypeDef__grid_wxGridHeaderLabelsRenderer = {
    {
        -1,
        SIP_NULLPTR,
        SIP_NULLPTR,
        SIP_TYPE_ABSTRACT|SIP_TYPE_CLASS,
        sipNameNr_wxGridHeaderLabelsRenderer,
        {SIP_NULLPTR},
        SIP_NULLPTR
    },
    {
        sipNameNr_GridHeaderLabelsRenderer,
        {0, 0, 1},
        1, methods_wxGridHeaderLabelsRenderer,
        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_wxGridHeaderLabelsRenderer,
    -1,
    -1,
    supers_wxGridHeaderLabelsRenderer,
    SIP_NULLPTR,
    init_type_wxGridHeaderLabelsRenderer,
    SIP_NULLPTR,
    SIP_NULLPTR,
#if PY_MAJOR_VERSION >= 3
    SIP_NULLPTR,
    SIP_NULLPTR,
#else
    SIP_NULLPTR,
    SIP_NULLPTR,
    SIP_NULLPTR,
    SIP_NULLPTR,
#endif
    dealloc_wxGridHeaderLabelsRenderer,
    SIP_NULLPTR,
    SIP_NULLPTR,
    SIP_NULLPTR,
    release_wxGridHeaderLabelsRenderer,
    cast_wxGridHeaderLabelsRenderer,
    SIP_NULLPTR,
    SIP_NULLPTR,
    SIP_NULLPTR,
    SIP_NULLPTR,
    SIP_NULLPTR,
    SIP_NULLPTR
};
