
// default includes
#include <shiboken.h>
#include <sbkpep.h>
#include <sbkpepbuffer.h>

#define PYSIDE6_COMOPT_COMPRESS 1

#ifndef QT_NO_VERSION_TAGGING
#  define QT_NO_VERSION_TAGGING
#endif
#include <QtCore/QDebug>
#include <pysideqenum.h>
#include <pysideutils.h>
#include <feature_select.h>
QT_WARNING_DISABLE_DEPRECATED


// module include
#include "pyfalkon_python.h"

// main header
#include "abstractbuttoninterface_clickcontroller_wrapper.h"

// Argument includes
#include <qpoint.h>
#include <qsize.h>

#include <cctype>
#include <cstring>
#include <iterator>
#include <type_traits>
#include <typeinfo>

extern "C" {
static PyTypeObject *Sbk_AbstractButtonInterface_ClickController_TypeF(void)
{
    return SbkPyFalkonTypeStructs[SBK_AbstractButtonInterface_ClickController_IDX].type;
}
} // extern "C"


// Target ---------------------------------------------------------

extern "C" {
static int
Sbk_AbstractButtonInterface_ClickController_Init(PyObject *self, [[maybe_unused]] PyObject *args, [[maybe_unused]] PyObject *kwds)
{
    auto *sbkSelf = reinterpret_cast<SbkObject *>(self);
    PySide::Feature::Select(self);
    if (Shiboken::Object::isUserType(self) && !Shiboken::ObjectType::canCallConstructor(self->ob_type, Shiboken::SbkType< ::AbstractButtonInterface::ClickController >()))
        return -1;

    ::AbstractButtonInterface::ClickController *cptr{};
    Shiboken::PythonContextMarker pcm;


    // PyMI support
    Shiboken::callInheritedInit(self, args, kwds, SbkPyFalkonTypeStructs[SBK_AbstractButtonInterface_ClickController_IDX]);
    if (Shiboken::Errors::occurred() != nullptr)
        return -1;

    // Call function/method
    {

        // ClickController::ClickController()
        cptr = new ::AbstractButtonInterface::ClickController();
    }

    if (Shiboken::Errors::occurred() != nullptr || !Shiboken::Object::setCppPointer(sbkSelf, Shiboken::SbkType< ::AbstractButtonInterface::ClickController >(), cptr)) {
        delete cptr;
        return -1;
    }
    Shiboken::Object::setValidCpp(sbkSelf, true);
    Shiboken::BindingManager::instance().registerWrapper(sbkSelf, cptr);


    return 1;
}

static PyObject *Sbk_AbstractButtonInterface_ClickControllerFunc_callPopupClosed(PyObject *self)
{
    if (!Shiboken::Object::isValid(self))
        return {};
    [[maybe_unused]] auto *cppSelf = reinterpret_cast< ::AbstractButtonInterface::ClickController *>(Shiboken::Conversions::cppPointer(Shiboken::Module::get(SbkPyFalkonTypeStructs[SBK_AbstractButtonInterface_ClickController_IDX]), reinterpret_cast<SbkObject *>(self)));
    Shiboken::PythonContextMarker pcm;

    // Call function/method
    {

        // ClickController::callPopupClosed()const
        const_cast<const ::AbstractButtonInterface::ClickController *>(cppSelf)->callPopupClosed();
    }

     return Sbk_ReturnFromPython_None();
}

static PyObject *Sbk_AbstractButtonInterface_ClickControllerFunc_callPopupPosition(PyObject *self, PyObject *pyArg)
{
    if (!Shiboken::Object::isValid(self))
        return {};
    [[maybe_unused]] auto *cppSelf = reinterpret_cast< ::AbstractButtonInterface::ClickController *>(Shiboken::Conversions::cppPointer(Shiboken::Module::get(SbkPyFalkonTypeStructs[SBK_AbstractButtonInterface_ClickController_IDX]), reinterpret_cast<SbkObject *>(self)));
    PyObject *pyResult{};
    Shiboken::AutoDecRef errInfo{};
    Shiboken::PythonContextMarker pcm;
    int overloadId = -1;
    [[maybe_unused]] Shiboken::Conversions::PythonToCppConversion pythonToCpp;

    // Overloaded function decisor
    // 0: ClickController::callPopupPosition(const QSize&)const->QPoint
    if ((pythonToCpp = Shiboken::Conversions::pythonToCppReferenceConversion(Shiboken::Module::get(SbkPySide6_QtCoreTypeStructs[SBK_QSize_IDX]), (pyArg)))) {
        overloadId = 0; // ClickController::callPopupPosition(const QSize&)const->QPoint
    }

    // Function signature not found.
    if (overloadId == -1)
        return Shiboken::returnWrongArguments(pyArg, "callPopupPosition", SbkPyFalkonTypeStructs[SBK_AbstractButtonInterface_ClickController_IDX]);

    // Call function/method
    {
        if (!Shiboken::Object::isValid(pyArg))
            return {};
        ::QSize cppArg0_local;
        ::QSize *cppArg0 = &cppArg0_local;
        if (pythonToCpp.isValue())
            pythonToCpp(pyArg, &cppArg0_local);
        else
            pythonToCpp(pyArg, &cppArg0);


        if (Shiboken::Errors::occurred() == nullptr) {
            // ClickController::callPopupPosition(const QSize&)const->QPoint
            QPoint cppResult = const_cast<const ::AbstractButtonInterface::ClickController *>(cppSelf)->callPopupPosition(*cppArg0);
            pyResult = Shiboken::Conversions::copyToPython(Shiboken::Module::get(SbkPySide6_QtCoreTypeStructs[SBK_QPoint_IDX]), &cppResult);
        }
    }

    return Sbk_ReturnFromPython_Result(pyResult);
}


static const char *Sbk_AbstractButtonInterface_ClickController_PropertyStrings[] = {
    nullptr // Sentinel
};

static PyMethodDef Sbk_AbstractButtonInterface_ClickController_methods[] = {
    {"callPopupClosed", reinterpret_cast<PyCFunction>(Sbk_AbstractButtonInterface_ClickControllerFunc_callPopupClosed), METH_NOARGS, nullptr},
    {"callPopupPosition", reinterpret_cast<PyCFunction>(Sbk_AbstractButtonInterface_ClickControllerFunc_callPopupPosition), METH_O, nullptr},
    {nullptr, nullptr, 0, nullptr} // Sentinel
};

static PyObject *Sbk_AbstractButtonInterface_ClickController_get_visualParent(PyObject *self, void * /* closure */)
{
    if (!Shiboken::Object::isValid(self))
        return {};
    [[maybe_unused]] auto *cppSelf = reinterpret_cast< ::AbstractButtonInterface::ClickController *>(Shiboken::Conversions::cppPointer(Shiboken::Module::get(SbkPyFalkonTypeStructs[SBK_AbstractButtonInterface_ClickController_IDX]), reinterpret_cast<SbkObject *>(self)));
    return Shiboken::Conversions::pointerToPython(Shiboken::Module::get(SbkPySide6_QtWidgetsTypeStructs[SBK_QWidget_IDX]), cppSelf->visualParent);
}
static int Sbk_AbstractButtonInterface_ClickController_set_visualParent(PyObject *self, PyObject *pyIn, void * /* closure */)
{
    if (!Shiboken::Object::isValid(self))
        return 0;
    [[maybe_unused]] auto *cppSelf = reinterpret_cast< ::AbstractButtonInterface::ClickController *>(Shiboken::Conversions::cppPointer(Shiboken::Module::get(SbkPyFalkonTypeStructs[SBK_AbstractButtonInterface_ClickController_IDX]), reinterpret_cast<SbkObject *>(self)));
    if (pyIn == nullptr) {
        Shiboken::Errors::setInvalidTypeDeletion("visualParent");
        return -1;
    }
    Shiboken::Conversions::PythonToCppConversion pythonToCpp;
    if (!(pythonToCpp = Shiboken::Conversions::pythonToCppPointerConversion(Shiboken::Module::get(SbkPySide6_QtWidgetsTypeStructs[SBK_QWidget_IDX]), (pyIn)))) {
        Shiboken::Errors::setSetterTypeError("visualParent", "QWidget");
        return -1;
    }

    auto *&cppOut_ptr = cppSelf->visualParent;
    pythonToCpp(pyIn, &cppOut_ptr);

    Shiboken::Object::keepReference(reinterpret_cast<SbkObject *>(self), "visualParent", pyIn);
    return 0;
}

static PyObject *Sbk_AbstractButtonInterface_ClickController_get_popupOpened(PyObject *self, void * /* closure */)
{
    if (!Shiboken::Object::isValid(self))
        return {};
    [[maybe_unused]] auto *cppSelf = reinterpret_cast< ::AbstractButtonInterface::ClickController *>(Shiboken::Conversions::cppPointer(Shiboken::Module::get(SbkPyFalkonTypeStructs[SBK_AbstractButtonInterface_ClickController_IDX]), reinterpret_cast<SbkObject *>(self)));
    bool cppOut_local = cppSelf->popupOpened;
    return Shiboken::Conversions::copyToPython(Shiboken::Conversions::PrimitiveTypeConverter<bool>(), &cppOut_local);
}
static int Sbk_AbstractButtonInterface_ClickController_set_popupOpened(PyObject *self, PyObject *pyIn, void * /* closure */)
{
    if (!Shiboken::Object::isValid(self))
        return 0;
    [[maybe_unused]] auto *cppSelf = reinterpret_cast< ::AbstractButtonInterface::ClickController *>(Shiboken::Conversions::cppPointer(Shiboken::Module::get(SbkPyFalkonTypeStructs[SBK_AbstractButtonInterface_ClickController_IDX]), reinterpret_cast<SbkObject *>(self)));
    if (pyIn == nullptr) {
        Shiboken::Errors::setInvalidTypeDeletion("popupOpened");
        return -1;
    }
    Shiboken::Conversions::PythonToCppConversion pythonToCpp;
    if (!(pythonToCpp = Shiboken::Conversions::pythonToCppConversion(Shiboken::Conversions::PrimitiveTypeConverter<bool>(), (pyIn)))) {
        Shiboken::Errors::setSetterTypeError("popupOpened", "bool");
        return -1;
    }

    auto cppOut_local = cppSelf->popupOpened;
    pythonToCpp(pyIn, &cppOut_local);
    cppSelf->popupOpened = cppOut_local;

    return 0;
}

// Getters and Setters for ClickController
static PyGetSetDef Sbk_AbstractButtonInterface_ClickController_getsetlist[] = {
    {"visualParent", Sbk_AbstractButtonInterface_ClickController_get_visualParent, Sbk_AbstractButtonInterface_ClickController_set_visualParent, "PySide6.QtWidgets.QWidget", nullptr},
    {"popupOpened", Sbk_AbstractButtonInterface_ClickController_get_popupOpened, Sbk_AbstractButtonInterface_ClickController_set_popupOpened, "bool", nullptr},
    {nullptr, nullptr, nullptr, nullptr, nullptr} // Sentinel
};

} // extern "C"

static int Sbk_AbstractButtonInterface_ClickController_traverse(PyObject *self, visitproc visit, void *arg)
{
    auto traverseProc = reinterpret_cast<traverseproc>(PyType_GetSlot(SbkObject_TypeF(), Py_tp_traverse));
    ;
    return traverseProc(self, visit, arg);
}
static int Sbk_AbstractButtonInterface_ClickController_clear(PyObject *self)
{
    auto clearProc = reinterpret_cast<inquiry>(PyType_GetSlot(SbkObject_TypeF(), Py_tp_clear));
    ;
    return clearProc(self);
}

// Class Definition -----------------------------------------------
extern "C" {

static PyType_Slot Sbk_AbstractButtonInterface_ClickController_slots[] = {
    {Py_tp_base,        nullptr}, // inserted by introduceWrapperType
    {Py_tp_dealloc,     reinterpret_cast<void *>(&SbkDeallocWrapper)},
    {Py_tp_traverse,    reinterpret_cast<void *>(Sbk_AbstractButtonInterface_ClickController_traverse)},
    {Py_tp_clear,       reinterpret_cast<void *>(Sbk_AbstractButtonInterface_ClickController_clear)},
    {Py_tp_methods,     reinterpret_cast<void *>(Sbk_AbstractButtonInterface_ClickController_methods)},
    {Py_tp_getset,      reinterpret_cast<void *>(Sbk_AbstractButtonInterface_ClickController_getsetlist)},
    {Py_tp_init,        reinterpret_cast<void *>(Sbk_AbstractButtonInterface_ClickController_Init)},
    {Py_tp_new,         reinterpret_cast<void *>(SbkObject_tp_new)},
    {0, nullptr}
};
static PyType_Spec Sbk_AbstractButtonInterface_ClickController_spec = {
    "1:PyFalkon.AbstractButtonInterface.ClickController",
    sizeof(SbkObject),
    0,
    Py_TPFLAGS_DEFAULT|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC,
    Sbk_AbstractButtonInterface_ClickController_slots
};

} //extern "C"

// Type conversion functions.

// Python to C++ pointer conversion - returns the C++ object of the Python wrapper (keeps object identity).
static void ClickController_PythonToCpp_ClickController_PTR(PyObject *pyIn, void *cppOut)
{
    Shiboken::Conversions::pythonToCppPointer(Sbk_AbstractButtonInterface_ClickController_TypeF(), pyIn, cppOut);
}
static PythonToCppFunc is_ClickController_PythonToCpp_ClickController_PTR_Convertible(PyObject *pyIn)
{
    if (pyIn == Py_None)
        return Shiboken::Conversions::nonePythonToCppNullPtr;
    if (PyObject_TypeCheck(pyIn, Sbk_AbstractButtonInterface_ClickController_TypeF()))
        return ClickController_PythonToCpp_ClickController_PTR;
    return {};
}

// C++ to Python pointer conversion - tries to find the Python wrapper for the C++ object (keeps object identity).
static PyObject *ClickController_PTR_CppToPython_ClickController(const void *cppIn)
{
    auto *pyOut = reinterpret_cast<PyObject *>(Shiboken::BindingManager::instance().retrieveWrapper(cppIn, Sbk_AbstractButtonInterface_ClickController_TypeF()));
    if (pyOut) {
        Py_INCREF(pyOut);
        return pyOut;
    }
    return Shiboken::Object::newObjectWithHeuristics(Sbk_AbstractButtonInterface_ClickController_TypeF(), const_cast<void *>(cppIn), false);

}

// The signatures string for the functions.
// Multiple signatures have their index "n:" in front.
#if PYSIDE6_COMOPT_COMPRESS == 0
static const char *AbstractButtonInterface_ClickController_SignatureStrings[] = {
    "PyFalkon.AbstractButtonInterface.ClickController(self)",
    "PyFalkon.AbstractButtonInterface.ClickController.callPopupClosed(self)",
    "PyFalkon.AbstractButtonInterface.ClickController.callPopupPosition(self,size:PySide6.QtCore.QSize)->PySide6.QtCore.QPoint",
    nullptr}; // Sentinel
#else
static constexpr size_t AbstractButtonInterface_ClickController_SignatureByteSize = 124;
static constexpr uint8_t AbstractButtonInterface_ClickController_SignatureBytes[124] = {
    0x78, 0xda, 0xa5, 0xcc, 0xb1, 0x0a, 0xc2, 0x40, 0x0c, 0x80, 0xe1, 0xbd, 0x4f, 0x62, 0xa1, 0x66,
    0x74, 0x70, 0x28, 0xe8, 0x81, 0xe0, 0x96, 0xd2, 0x27, 0x38, 0xaf, 0x29, 0x84, 0x86, 0xa4, 0xe4,
    0xd2, 0xa1, 0x3e, 0xbd, 0xe2, 0xe8, 0x26, 0xae, 0x1f, 0xfc, 0x3f, 0xee, 0xb7, 0x2c, 0x8b, 0x29,
    0x5c, 0x1e, 0x35, 0x3c, 0x97, 0xb8, 0x6e, 0x11, 0xa6, 0x77, 0x0d, 0xf2, 0x39, 0x17, 0x82, 0x24,
    0x5c, 0x96, 0x64, 0x1a, 0x6e, 0x22, 0xe4, 0x87, 0x4a, 0x32, 0xb7, 0x0d, 0xfe, 0x98, 0x41, 0xc9,
    0x22, 0x68, 0xeb, 0xb6, 0x26, 0xb1, 0x4a, 0xd3, 0xdf, 0x1b, 0xb4, 0xca, 0xc1, 0xa6, 0x9f, 0x51,
    0x57, 0xf9, 0x49, 0x67, 0xdc, 0x47, 0x9e, 0xe8, 0x04, 0x43, 0x24, 0x73, 0x82, 0x61, 0x7c, 0x63,
    0x7b, 0xec, 0xbf, 0x19, 0x8d, 0x35, 0x9a, 0x17, 0xfa, 0x89, 0x5d, 0x0b
};
#endif

PyTypeObject *init_AbstractButtonInterface_ClickController(PyObject *enclosingClass)
{
    auto &typeStruct = SbkPyFalkonTypeStructs[SBK_AbstractButtonInterface_ClickController_IDX];
    if (typeStruct.type != nullptr)
        return typeStruct.type;

    auto *base1 = SbkObject_TypeF();
    Shiboken::AutoDecRef Sbk_AbstractButtonInterface_ClickController_Type_bases(PyTuple_Pack(1, base1));

    PyTypeObject *pyType = Shiboken::ObjectType::introduceWrapperType(
        enclosingClass,
        "ClickController",
        "AbstractButtonInterface::ClickController*",
        &Sbk_AbstractButtonInterface_ClickController_spec,
        &Shiboken::callCppDestructor< ::AbstractButtonInterface::ClickController >,
        Sbk_AbstractButtonInterface_ClickController_Type_bases.object(),
        Shiboken::ObjectType::WrapperFlags::InnerClass);
#if PYSIDE6_COMOPT_COMPRESS == 0
    InitSignatureStrings(pyType, AbstractButtonInterface_ClickController_SignatureStrings);
#else
    InitSignatureBytes(pyType, AbstractButtonInterface_ClickController_SignatureBytes, AbstractButtonInterface_ClickController_SignatureByteSize);
#endif
    SbkObjectType_SetPropertyStrings(pyType, Sbk_AbstractButtonInterface_ClickController_PropertyStrings);
    typeStruct.type = pyType;

    // Register Converter
    SbkConverter *converter = Shiboken::Conversions::createConverter(pyType,
        ClickController_PythonToCpp_ClickController_PTR,
        is_ClickController_PythonToCpp_ClickController_PTR_Convertible,
        ClickController_PTR_CppToPython_ClickController);

    Shiboken::Conversions::registerConverterName(converter, "AbstractButtonInterface::ClickController");
    Shiboken::Conversions::registerConverterName(converter, "AbstractButtonInterface::ClickController*");
    Shiboken::Conversions::registerConverterName(converter, "AbstractButtonInterface::ClickController&");
    Shiboken::Conversions::registerConverterAlias(converter, "ClickController");
    Shiboken::Conversions::registerConverterAlias(converter, "ClickController*");
    Shiboken::Conversions::registerConverterAlias(converter, "ClickController&");
    Shiboken::Conversions::registerConverterName(converter, typeid(::AbstractButtonInterface::ClickController).name());

    qRegisterMetaType< ::AbstractButtonInterface::ClickController *>();

    return pyType;
}
