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

#include "sipAPI_core.h"
        #include <wx/sizer.h>
        #include <wx/statbox.h>
        #include <wx/window.h>
        #include <wx/gdicmn.h>
        #include <wx/sizer.h>
        #include <wx/sizer.h>
        #include <wx/gdicmn.h>
        #include <wx/sizer.h>
        #include <wx/object.h>
        #include <wx/object.h>
        #include <wx/object.h>


class sipwxStaticBoxSizer : public ::wxStaticBoxSizer
{
public:
    sipwxStaticBoxSizer(::wxStaticBox*, int);
    sipwxStaticBoxSizer(int, ::wxWindow*, const ::wxString&);
    virtual ~sipwxStaticBoxSizer();

    /*
     * There is a protected method for every virtual method visible from
     * this class.
     */
protected:
    void RecalcSizes() SIP_OVERRIDE;
    void RepositionChildren(const ::wxSize&) SIP_OVERRIDE;
    ::wxSize CalcMin() SIP_OVERRIDE;

public:
    sipSimpleWrapper *sipPySelf;

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

    char sipPyMethods[3];
};

sipwxStaticBoxSizer::sipwxStaticBoxSizer(::wxStaticBox*box, int orient): ::wxStaticBoxSizer(box, orient), sipPySelf(SIP_NULLPTR)
{
    memset(sipPyMethods, 0, sizeof (sipPyMethods));
}

sipwxStaticBoxSizer::sipwxStaticBoxSizer(int orient, ::wxWindow*parent, const ::wxString& label): ::wxStaticBoxSizer(orient, parent, label), sipPySelf(SIP_NULLPTR)
{
    memset(sipPyMethods, 0, sizeof (sipPyMethods));
}

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

void sipwxStaticBoxSizer::RecalcSizes()
{
    sip_gilstate_t sipGILState;
    PyObject *sipMeth;

    sipMeth = sipIsPyMethod(&sipGILState, &sipPyMethods[0], &sipPySelf, SIP_NULLPTR, sipName_RecalcSizes);

    if (!sipMeth)
    {
        ::wxStaticBoxSizer::RecalcSizes();
        return;
    }

    extern void sipVH__core_57(sip_gilstate_t, sipVirtErrorHandlerFunc, sipSimpleWrapper *, PyObject *);

    sipVH__core_57(sipGILState, 0, sipPySelf, sipMeth);
}

void sipwxStaticBoxSizer::RepositionChildren(const ::wxSize& minSize)
{
    sip_gilstate_t sipGILState;
    PyObject *sipMeth;

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

    if (!sipMeth)
    {
        ::wxStaticBoxSizer::RepositionChildren(minSize);
        return;
    }

    extern void sipVH__core_105(sip_gilstate_t, sipVirtErrorHandlerFunc, sipSimpleWrapper *, PyObject *, const ::wxSize&);

    sipVH__core_105(sipGILState, 0, sipPySelf, sipMeth, minSize);
}

::wxSize sipwxStaticBoxSizer::CalcMin()
{
    sip_gilstate_t sipGILState;
    PyObject *sipMeth;

    sipMeth = sipIsPyMethod(&sipGILState, &sipPyMethods[2], &sipPySelf, SIP_NULLPTR, sipName_CalcMin);

    if (!sipMeth)
        return ::wxStaticBoxSizer::CalcMin();

    extern ::wxSize sipVH__core_25(sip_gilstate_t, sipVirtErrorHandlerFunc, sipSimpleWrapper *, PyObject *);

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


PyDoc_STRVAR(doc_wxStaticBoxSizer_GetStaticBox, "GetStaticBox() -> StaticBox\n"
"\n"
"Returns the static box associated with the sizer.");

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

    {
        const ::wxStaticBoxSizer *sipCpp;

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

            PyErr_Clear();

            Py_BEGIN_ALLOW_THREADS
            sipRes = sipCpp->GetStaticBox();
            Py_END_ALLOW_THREADS

            if (PyErr_Occurred())
                return 0;

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

    sipNoMethod(sipParseErr, sipName_StaticBoxSizer, sipName_GetStaticBox, SIP_NULLPTR);

    return SIP_NULLPTR;
}


PyDoc_STRVAR(doc_wxStaticBoxSizer_CalcMin, "CalcMin() -> Size\n"
"\n"
"Implements the calculation of a box sizer's minimal.");

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

    {
        ::wxStaticBoxSizer *sipCpp;

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

            PyErr_Clear();

            Py_BEGIN_ALLOW_THREADS
            sipRes = new ::wxSize((sipSelfWasArg ? sipCpp->::wxStaticBoxSizer::CalcMin() : sipCpp->CalcMin()));
            Py_END_ALLOW_THREADS

            if (PyErr_Occurred())
                return 0;

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

    sipNoMethod(sipParseErr, sipName_StaticBoxSizer, sipName_CalcMin, SIP_NULLPTR);

    return SIP_NULLPTR;
}


PyDoc_STRVAR(doc_wxStaticBoxSizer_RepositionChildren, "RepositionChildren(minSize)\n"
"\n"
"Method which must be overridden in the derived sizer classes.");

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

    {
        const ::wxSize* minSize;
        int minSizeState = 0;
        ::wxStaticBoxSizer *sipCpp;

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

        if (sipParseKwdArgs(&sipParseErr, sipArgs, sipKwds, sipKwdList, SIP_NULLPTR, "BJ1", &sipSelf, sipType_wxStaticBoxSizer, &sipCpp, sipType_wxSize, &minSize, &minSizeState))
        {
            PyErr_Clear();

            Py_BEGIN_ALLOW_THREADS
            (sipSelfWasArg ? sipCpp->::wxStaticBoxSizer::RepositionChildren(*minSize) : sipCpp->RepositionChildren(*minSize));
            Py_END_ALLOW_THREADS
            sipReleaseType(const_cast<::wxSize *>(minSize), sipType_wxSize, minSizeState);

            if (PyErr_Occurred())
                return 0;

            Py_INCREF(Py_None);
            return Py_None;
        }
    }

    sipNoMethod(sipParseErr, sipName_StaticBoxSizer, sipName_RepositionChildren, SIP_NULLPTR);

    return SIP_NULLPTR;
}


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

    if (targetType == sipType_wxStaticBoxSizer)
        return sipCppV;

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

    return SIP_NULLPTR;
}


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

    if (sipState & SIP_DERIVED_CLASS)
        delete reinterpret_cast<sipwxStaticBoxSizer *>(sipCppV);
    else
        delete reinterpret_cast<::wxStaticBoxSizer *>(sipCppV);

    Py_END_ALLOW_THREADS
}


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

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


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

    {
        ::wxStaticBox* box;
        int orient = wxHORIZONTAL;

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

        if (sipParseKwdArgs(sipParseErr, sipArgs, sipKwds, sipKwdList, sipUnused, "J8|i", sipType_wxStaticBox, &box, &orient))
        {
            PyErr_Clear();

            Py_BEGIN_ALLOW_THREADS
            sipCpp = new sipwxStaticBoxSizer(box, orient);
            Py_END_ALLOW_THREADS

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

            sipCpp->sipPySelf = sipSelf;

            return sipCpp;
        }
    }

    {
        int orient;
        ::wxWindow* parent;
        const ::wxString& labeldef = wxEmptyString;
        const ::wxString* label = &labeldef;
        int labelState = 0;

        static const char *sipKwdList[] = {
            sipName_orient,
            sipName_parent,
            sipName_label,
        };

        if (sipParseKwdArgs(sipParseErr, sipArgs, sipKwds, sipKwdList, sipUnused, "iJ8|J1", &orient, sipType_wxWindow, &parent, sipType_wxString, &label, &labelState))
        {
            PyErr_Clear();

            Py_BEGIN_ALLOW_THREADS
            sipCpp = new sipwxStaticBoxSizer(orient, parent, *label);
            Py_END_ALLOW_THREADS
            sipReleaseType(const_cast<::wxString *>(label), sipType_wxString, labelState);

            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_wxStaticBoxSizer[] = {{44, 255, 1}};


static PyMethodDef methods_wxStaticBoxSizer[] = {
    {sipName_CalcMin, meth_wxStaticBoxSizer_CalcMin, METH_VARARGS, doc_wxStaticBoxSizer_CalcMin},
    {sipName_GetStaticBox, meth_wxStaticBoxSizer_GetStaticBox, METH_VARARGS, doc_wxStaticBoxSizer_GetStaticBox},
    {sipName_RepositionChildren, SIP_MLMETH_CAST(meth_wxStaticBoxSizer_RepositionChildren), METH_VARARGS|METH_KEYWORDS, doc_wxStaticBoxSizer_RepositionChildren}
};

sipVariableDef variables_wxStaticBoxSizer[] = {
    {PropertyVariable, sipName_StaticBox, &methods_wxStaticBoxSizer[1], SIP_NULLPTR, SIP_NULLPTR, SIP_NULLPTR},
};

PyDoc_STRVAR(doc_wxStaticBoxSizer, "StaticBoxSizer(box, orient=HORIZONTAL)\n"
"StaticBoxSizer(orient, parent, label=EmptyString)\n"
"\n"
"wxStaticBoxSizer is a sizer derived from wxBoxSizer but adds a static\n"
"box around the sizer.");


sipClassTypeDef sipTypeDef__core_wxStaticBoxSizer = {
    {
        -1,
        SIP_NULLPTR,
        SIP_NULLPTR,
        SIP_TYPE_SCC|SIP_TYPE_CLASS,
        sipNameNr_wxStaticBoxSizer,
        SIP_NULLPTR,
        SIP_NULLPTR,
    },
    {
        sipNameNr_StaticBoxSizer,
        {0, 0, 1},
        3, methods_wxStaticBoxSizer,
        0, SIP_NULLPTR,
        1, variables_wxStaticBoxSizer,
        {SIP_NULLPTR, SIP_NULLPTR, SIP_NULLPTR, SIP_NULLPTR, SIP_NULLPTR, SIP_NULLPTR, SIP_NULLPTR, SIP_NULLPTR, SIP_NULLPTR, SIP_NULLPTR},
    },
    doc_wxStaticBoxSizer,
    -1,
    -1,
    supers_wxStaticBoxSizer,
    SIP_NULLPTR,
    init_type_wxStaticBoxSizer,
    SIP_NULLPTR,
    SIP_NULLPTR,
    SIP_NULLPTR,
    SIP_NULLPTR,
    dealloc_wxStaticBoxSizer,
    SIP_NULLPTR,
    SIP_NULLPTR,
    SIP_NULLPTR,
    release_wxStaticBoxSizer,
    cast_wxStaticBoxSizer,
    SIP_NULLPTR,
    SIP_NULLPTR,
    SIP_NULLPTR,
    SIP_NULLPTR,
    SIP_NULLPTR,
    SIP_NULLPTR,
};
