#ifndef SBK_KTOGGLETOOLBARACTIONWRAPPER_H
#define SBK_KTOGGLETOOLBARACTIONWRAPPER_H

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

#include <ktoggletoolbaraction.h>

#include <sbkpython.h>

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

class KToggleToolBarActionWrapper : public KToggleToolBarAction
{
public:
    KToggleToolBarActionWrapper(::KToolBar * toolBar, const ::QString & text, ::QObject * parent);
    KToggleToolBarActionWrapper(const KToggleToolBarActionWrapper &) = delete;
    KToggleToolBarActionWrapper& operator=(const KToggleToolBarActionWrapper &) = delete;
    KToggleToolBarActionWrapper(KToggleToolBarActionWrapper &&) = delete;
    KToggleToolBarActionWrapper& operator=(KToggleToolBarActionWrapper &&) = delete;
    ~KToggleToolBarActionWrapper() override;

    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);
    static void pysideInitQtMetaTypes();

    void resetPyMethodCache();

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

#endif // SBK_KTOGGLETOOLBARACTIONWRAPPER_H
