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

#include "sipAPI_core.h"
        #include <wx/sizer.h>
        #include <wx/gdicmn.h>
        #include <wx/sizer.h>
        #include <wx/window.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 sipwxBoxSizer : public ::wxBoxSizer
{
public:
    sipwxBoxSizer(int);
    virtual ~sipwxBoxSizer();

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

public:
    sipSimpleWrapper *sipPySelf;

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

    char sipPyMethods[4];
};

sipwxBoxSizer::sipwxBoxSizer(int orient): ::wxBoxSizer(orient), sipPySelf(SIP_NULLPTR)
{
    memset(sipPyMethods, 0, sizeof (sipPyMethods));
}

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

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

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

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

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

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

bool sipwxBoxSizer::InformFirstDirection(int direction, int size, int availableOtherDir)
{
    sip_gilstate_t sipGILState;
    PyObject *sipMeth;

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

    if (!sipMeth)
        return ::wxBoxSizer::InformFirstDirection(direction, size, availableOtherDir);

    extern bool sipVH__core_105(sip_gilstate_t, sipVirtErrorHandlerFunc, sipSimpleWrapper *, PyObject *, int, int, int);

    return sipVH__core_105(sipGILState, 0, sipPySelf, sipMeth, direction, size, availableOtherDir);
}

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

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

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

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

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

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

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

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

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

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


PyDoc_STRVAR(doc_wxBoxSizer_AddSpacer, "AddSpacer(size) -> SizerItem\n"
"\n"
"Adds non-stretchable space to the main orientation of the sizer only.");

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

    {
        int size;
        ::wxBoxSizer *sipCpp;

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

        if (sipParseKwdArgs(&sipParseErr, sipArgs, sipKwds, sipKwdList, SIP_NULLPTR, "Bi", &sipSelf, sipType_wxBoxSizer, &sipCpp, &size))
        {
            ::wxSizerItem*sipRes;

            PyErr_Clear();

            Py_BEGIN_ALLOW_THREADS
            sipRes = sipCpp->AddSpacer(size);
            Py_END_ALLOW_THREADS

            if (PyErr_Occurred())
                return 0;

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

    sipNoMethod(sipParseErr, sipName_BoxSizer, sipName_AddSpacer, SIP_NULLPTR);

    return SIP_NULLPTR;
}


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

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

    {
        ::wxBoxSizer *sipCpp;

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

            PyErr_Clear();

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

            if (PyErr_Occurred())
                return 0;

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

    sipNoMethod(sipParseErr, sipName_BoxSizer, sipName_CalcMin, SIP_NULLPTR);

    return SIP_NULLPTR;
}


PyDoc_STRVAR(doc_wxBoxSizer_GetOrientation, "GetOrientation() -> int\n"
"\n"
"Returns the orientation of the box sizer, either wxVERTICAL or\n"
"wxHORIZONTAL.");

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

    {
        const ::wxBoxSizer *sipCpp;

        if (sipParseArgs(&sipParseErr, sipArgs, "B", &sipSelf, sipType_wxBoxSizer, &sipCpp))
        {
            int sipRes;

            PyErr_Clear();

            Py_BEGIN_ALLOW_THREADS
            sipRes = sipCpp->GetOrientation();
            Py_END_ALLOW_THREADS

            if (PyErr_Occurred())
                return 0;

            return PyLong_FromLong(sipRes);
        }
    }

    sipNoMethod(sipParseErr, sipName_BoxSizer, sipName_GetOrientation, SIP_NULLPTR);

    return SIP_NULLPTR;
}


PyDoc_STRVAR(doc_wxBoxSizer_SetOrientation, "SetOrientation(orient) -> None\n"
"\n"
"Sets the orientation of the box sizer, either wxVERTICAL or\n"
"wxHORIZONTAL.");

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

    {
        int orient;
        ::wxBoxSizer *sipCpp;

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

        if (sipParseKwdArgs(&sipParseErr, sipArgs, sipKwds, sipKwdList, SIP_NULLPTR, "Bi", &sipSelf, sipType_wxBoxSizer, &sipCpp, &orient))
        {
            PyErr_Clear();

            Py_BEGIN_ALLOW_THREADS
            sipCpp->SetOrientation(orient);
            Py_END_ALLOW_THREADS

            if (PyErr_Occurred())
                return 0;

            Py_INCREF(Py_None);
            return Py_None;
        }
    }

    sipNoMethod(sipParseErr, sipName_BoxSizer, sipName_SetOrientation, SIP_NULLPTR);

    return SIP_NULLPTR;
}


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

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

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

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

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

            Py_BEGIN_ALLOW_THREADS
            (sipSelfWasArg ? sipCpp->::wxBoxSizer::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_BoxSizer, sipName_RepositionChildren, SIP_NULLPTR);

    return SIP_NULLPTR;
}


PyDoc_STRVAR(doc_wxBoxSizer_InformFirstDirection, "InformFirstDirection(direction, size, availableOtherDir) -> bool\n"
"\n"
"Inform sizer about the first direction that has been decided (by\n"
"parent item).");

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

    {
        int direction;
        int size;
        int availableOtherDir;
        ::wxBoxSizer *sipCpp;

        static const char *sipKwdList[] = {
            sipName_direction,
            sipName_size,
            sipName_availableOtherDir,
        };

        if (sipParseKwdArgs(&sipParseErr, sipArgs, sipKwds, sipKwdList, SIP_NULLPTR, "Biii", &sipSelf, sipType_wxBoxSizer, &sipCpp, &direction, &size, &availableOtherDir))
        {
            bool sipRes;

            PyErr_Clear();

            Py_BEGIN_ALLOW_THREADS
            sipRes = (sipSelfWasArg ? sipCpp->::wxBoxSizer::InformFirstDirection(direction, size, availableOtherDir) : sipCpp->InformFirstDirection(direction, size, availableOtherDir));
            Py_END_ALLOW_THREADS

            if (PyErr_Occurred())
                return 0;

            return PyBool_FromLong(sipRes);
        }
    }

    sipNoMethod(sipParseErr, sipName_BoxSizer, sipName_InformFirstDirection, SIP_NULLPTR);

    return SIP_NULLPTR;
}


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

    if (targetType == sipType_wxBoxSizer)
        return sipCppV;

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

    return SIP_NULLPTR;
}


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

    if (sipState & SIP_DERIVED_CLASS)
        delete reinterpret_cast<sipwxBoxSizer *>(sipCppV);
    else
        delete reinterpret_cast<::wxBoxSizer *>(sipCppV);

    Py_END_ALLOW_THREADS
}


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

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


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

    {
        int orient = wxHORIZONTAL;

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

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

            Py_BEGIN_ALLOW_THREADS
            sipCpp = new sipwxBoxSizer(orient);
            Py_END_ALLOW_THREADS

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


static PyMethodDef methods_wxBoxSizer[] = {
    {sipName_AddSpacer, SIP_MLMETH_CAST(meth_wxBoxSizer_AddSpacer), METH_VARARGS|METH_KEYWORDS, doc_wxBoxSizer_AddSpacer},
    {sipName_CalcMin, meth_wxBoxSizer_CalcMin, METH_VARARGS, doc_wxBoxSizer_CalcMin},
    {sipName_GetOrientation, meth_wxBoxSizer_GetOrientation, METH_VARARGS, doc_wxBoxSizer_GetOrientation},
    {sipName_InformFirstDirection, SIP_MLMETH_CAST(meth_wxBoxSizer_InformFirstDirection), METH_VARARGS|METH_KEYWORDS, doc_wxBoxSizer_InformFirstDirection},
    {sipName_RepositionChildren, SIP_MLMETH_CAST(meth_wxBoxSizer_RepositionChildren), METH_VARARGS|METH_KEYWORDS, doc_wxBoxSizer_RepositionChildren},
    {sipName_SetOrientation, SIP_MLMETH_CAST(meth_wxBoxSizer_SetOrientation), METH_VARARGS|METH_KEYWORDS, doc_wxBoxSizer_SetOrientation}
};

sipVariableDef variables_wxBoxSizer[] = {
    {PropertyVariable, sipName_Orientation, &methods_wxBoxSizer[2], &methods_wxBoxSizer[5], SIP_NULLPTR, SIP_NULLPTR},
};

PyDoc_STRVAR(doc_wxBoxSizer, "BoxSizer(orient=HORIZONTAL) -> None\n"
"\n"
"The basic idea behind a box sizer is that windows will most often be\n"
"laid out in rather simple basic geometry, typically in a row or a\n"
"column or several hierarchies of either.");


sipClassTypeDef sipTypeDef__core_wxBoxSizer = {
    {
        -1,
        SIP_NULLPTR,
        SIP_NULLPTR,
        SIP_TYPE_SCC|SIP_TYPE_CLASS,
        sipNameNr_wxBoxSizer,
        SIP_NULLPTR,
        SIP_NULLPTR,
    },
    {
        sipNameNr_BoxSizer,
        {0, 0, 1},
        6, methods_wxBoxSizer,
        0, SIP_NULLPTR,
        1, variables_wxBoxSizer,
        {SIP_NULLPTR, SIP_NULLPTR, SIP_NULLPTR, SIP_NULLPTR, SIP_NULLPTR, SIP_NULLPTR, SIP_NULLPTR, SIP_NULLPTR, SIP_NULLPTR, SIP_NULLPTR},
    },
    doc_wxBoxSizer,
    -1,
    -1,
    supers_wxBoxSizer,
    SIP_NULLPTR,
    init_type_wxBoxSizer,
    SIP_NULLPTR,
    SIP_NULLPTR,
    SIP_NULLPTR,
    SIP_NULLPTR,
    dealloc_wxBoxSizer,
    SIP_NULLPTR,
    SIP_NULLPTR,
    SIP_NULLPTR,
    release_wxBoxSizer,
    cast_wxBoxSizer,
    SIP_NULLPTR,
    SIP_NULLPTR,
    SIP_NULLPTR,
    SIP_NULLPTR,
    SIP_NULLPTR,
    SIP_NULLPTR,
    SIP_NULLPTR,
    sizeof (::wxBoxSizer),
};
