#ifndef SAWINDOWBUTTONGROUP_H
#define SAWINDOWBUTTONGROUP_H

#include <QWidget>
#include <QToolButton>

class WindowButtonGroupPrivate;
///
/// \brief 窗口的最大最小化按钮
///
class WindowButtonGroup : public QWidget
{
    Q_OBJECT
public:
	WindowButtonGroup(QWidget* parent, qreal iconscale = 0.5);
	~WindowButtonGroup();
    void setupMinimizeButton(bool on,qreal iconscale = 0.5);
    void setupMaximizeButton(bool on,qreal iconscale = 0.5);
    void setupCloseButton(bool on,qreal iconscale = 0.5);
    void updateWindowFlag(qreal iconscale = 0.5);
protected:
    QSize sizeHint() const override;
    virtual bool eventFilter(QObject *watched, QEvent *e) override;
    virtual void parentResize();
private:
    void updateMaximizeButtonIcon();
protected slots:
    Q_SLOT void closeWindow();
    Q_SLOT void minimizeWindow();
    Q_SLOT void maximizeWindow();
private:
    friend class WindowButtonGroupPrivate;
    WindowButtonGroupPrivate* m_d;
	QWidget *rootWidget;
};

class WindowToolButton : public QToolButton
{
    Q_OBJECT
public:
	WindowToolButton(QWidget* p = nullptr);
};
#endif // SAWINDOWBUTTONGROUP_H
