/***************************************************************************
 **
 **  Copyright (C) 2018-2023 wangjianjun <wangjianjun1018@qq.com>
 **  Contact: https://blog.csdn.net/wocanimei007?type=blog
 **
 **
****************************************************************************/
#ifndef FANCYNAVBUTTON_H
#define FANCYNAVBUTTON_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 <QIcon>
#include <QColor>
#include "frameless_global.h"



class FancyNavButton : public QToolButton
{
    Q_OBJECT
public:
    explicit FancyNavButton(QWidget *parent = nullptr);

    enum ButtonType { Button, Action};

    void select(bool selected);

    void setType(ButtonType type) { m_type = type;}
    ButtonType type() const { return m_type;}

    void setHoverColor(const QColor &color) { m_hoverColor = color;}
    QColor hoverColor() const { return m_hoverColor;}

    void setPressColor(const QColor &color) { m_pressColor = color;}
    QColor pressColor() const { return m_pressColor;}

    void setTextColor(const QColor &color);

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

    void paintEvent(QPaintEvent *event);
    void painterInfo(QColor &color);

private:
    bool m_isMouseOver;
    bool m_isMousePress;
    ButtonType m_type;

    QColor m_hoverColor;
    QColor m_pressColor;
};



#endif // FANCYNAVBUTTON_H
