#ifndef SBK_KXMLGUIFACTORYWRAPPER_H
#define SBK_KXMLGUIFACTORYWRAPPER_H

// Workaround to access protected functions
#ifndef protected
#  define protected public
#endif

#include <kxmlguifactory.h>

#include <sbkpython.h>

#include <array>
namespace Shiboken { struct AutoDecRef; class GilState; }

namespace PySide { class DynamicQMetaObject; }

class KXMLGUIFactoryWrapper : public KXMLGUIFactory
{
public:
    KXMLGUIFactoryWrapper(::KXMLGUIBuilder * builder, ::QObject * parent = nullptr);
    KXMLGUIFactoryWrapper(const KXMLGUIFactoryWrapper &) = delete;
    KXMLGUIFactoryWrapper& operator=(const KXMLGUIFactoryWrapper &) = delete;
    KXMLGUIFactoryWrapper(KXMLGUIFactoryWrapper &&) = delete;
    KXMLGUIFactoryWrapper& operator=(KXMLGUIFactoryWrapper &&) = delete;
    ~KXMLGUIFactoryWrapper() override;

    void childEvent(::QChildEvent * event) override;
    static void sbk_o_childEvent([[maybe_unused]] const char *ownerClassName, [[maybe_unused]] const char *funcName, [[maybe_unused]] Shiboken::GilState &gil, [[maybe_unused]] const Shiboken::AutoDecRef &pyOverride, [[maybe_unused]] ::QChildEvent * event);
    void connectNotify(const ::QMetaMethod & signal) override;
    static void sbk_o_connectNotify([[maybe_unused]] const char *ownerClassName, [[maybe_unused]] const char *funcName, [[maybe_unused]] Shiboken::GilState &gil, [[maybe_unused]] const Shiboken::AutoDecRef &pyOverride, [[maybe_unused]] const ::QMetaMethod & signal);
    void customEvent(::QEvent * event) override;
    static void sbk_o_customEvent([[maybe_unused]] const char *ownerClassName, [[maybe_unused]] const char *funcName, [[maybe_unused]] Shiboken::GilState &gil, [[maybe_unused]] const Shiboken::AutoDecRef &pyOverride, [[maybe_unused]] ::QEvent * event);
    void disconnectNotify(const ::QMetaMethod & signal) override;
    bool event(::QEvent * event) override;
    static bool sbk_o_event([[maybe_unused]] const char *ownerClassName, [[maybe_unused]] const char *funcName, [[maybe_unused]] Shiboken::GilState &gil, [[maybe_unused]] const Shiboken::AutoDecRef &pyOverride, [[maybe_unused]] ::QEvent * event);
    bool eventFilter(::QObject * watched, ::QEvent * event) override;
    static bool sbk_o_eventFilter([[maybe_unused]] const char *ownerClassName, [[maybe_unused]] const char *funcName, [[maybe_unused]] Shiboken::GilState &gil, [[maybe_unused]] const Shiboken::AutoDecRef &pyOverride, [[maybe_unused]] ::QObject * watched, [[maybe_unused]] ::QEvent * event);
    void timerEvent(::QTimerEvent * event) override;
    static void sbk_o_timerEvent([[maybe_unused]] const char *ownerClassName, [[maybe_unused]] const char *funcName, [[maybe_unused]] Shiboken::GilState &gil, [[maybe_unused]] const Shiboken::AutoDecRef &pyOverride, [[maybe_unused]] ::QTimerEvent * event);

    const ::QMetaObject * metaObject() const override;
    int qt_metacall(QMetaObject::Call call, int id, void **args) override;
    void *qt_metacast(const char *_clname) override;
    static void pysideInitQtMetaTypes();

    void resetPyMethodCache();

private:
    mutable std::array<PyObject *, 7> m_PyMethodCache = {nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr};
};

#endif // SBK_KXMLGUIFACTORYWRAPPER_H
