#pragma once
#include <QProxyStyle>
#include <QStyleFactory>
#include <QFileSystemWatcher>
#include <QEvent>
#include "ThemeConfig.h"

class BianbuStyle : public QProxyStyle {
    Q_OBJECT
public:
    explicit BianbuStyle(const QString &configPath = QString());
    // Complex controls
    void drawComplexControl(ComplexControl cc, const QStyleOptionComplex *opt, QPainter *p, const QWidget *w = nullptr) const override;
    // Primitives and controls
    void drawPrimitive(PrimitiveElement pe, const QStyleOption *opt, QPainter *p, const QWidget *w = nullptr) const override;
    void drawControl(ControlElement element, const QStyleOption *option, QPainter *p, const QWidget *w = nullptr) const override;
    QSize sizeFromContents(ContentsType type, const QStyleOption *option, const QSize &contentsSize, const QWidget *w = nullptr) const override;
    int pixelMetric(PixelMetric m, const QStyleOption *opt = nullptr, const QWidget *w = nullptr) const override;
    QPalette standardPalette() const override;
    void polish(QPalette &pal) override;
    void polish(QWidget *w) override;
    void unpolish(QWidget *w) override;
    bool eventFilter(QObject *obj, QEvent *ev) override;
    // Menu-specific QWidget polish/eventFilter removed
signals:
    void themeReloaded();
public slots:
    void reloadConfig();
private:
    void setupWatcher();
    QString m_configPath;
    ThemeConfig m_cfg;
    QFileSystemWatcher m_watcher;
    // Removed menu dispatch handlers and drawing functions
};
