/***************************************************************************
 **
 **  Copyright (C) 2018-2023 wangjianjun <wangjianjun1018@qq.com>
 **  Contact: https://blog.csdn.net/wocanimei007?type=blog
 **
 **
****************************************************************************/
#ifndef FANCYBUTTON_H
#define FANCYBUTTON_H

//
//  W A R N I N G
//  -------------
//
// This file is not part of the Qt API.  It exists purely as an
// implementation detail.  This header file may change from version to
// version without notice, or even be removed.
//
// We mean it.
//

#include <QToolButton>
#include "frameless_global.h"



class FancyButtonPrivate;
class FancyButton : public QToolButton
{
    Q_OBJECT
public:
    explicit FancyButton(QWidget *parent = nullptr);
    virtual ~FancyButton();

    virtual void select(bool selected);

    void setHoverColor(const QColor &color);
    QColor hoverColor() const;

    void setPressColor(const QColor &color);
    QColor pressColor() const;

    void setTextColor(const QColor &color);
    QColor textColor() const;

    void setColor(const QColor &color);

    void setNormalColor(const QColor &color);
    QColor normalColor() const;

    void setHasMenu(bool has);
    bool hasMenu();

    void setHasBorder(bool has);
    void setRound(bool round);

signals:
    void menuTriggered(QMouseEvent *e);
    void doubleClicked();

protected:
    virtual void enterEvent(QEvent *event);
    virtual void leaveEvent(QEvent *event);
    virtual void mousePressEvent(QMouseEvent *event);
    virtual void mouseDoubleClickEvent(QMouseEvent *event);
    virtual void mouseReleaseEvent(QMouseEvent *event);

    virtual void paintEvent(QPaintEvent *event);

private:
    FancyButtonPrivate *d;
};



#endif // FANCYBUTTON_H
