#ifndef SUI_TITLE_H
#define SUI_TITLE_H

#include <QFrame>
#include <QLabel>
#include <QPushButton>
#include <QHBoxLayout>
#include <QMouseEvent>
#include <QApplication>
#include <QStyleOption>
#include <QPainter>
#include <QFile>
#include <QFileInfo>
#include <QMenu>
#include <QDir>
#include <QSlider>
#include <QWidgetAction>
#include <QStyleFactory>
#include <QActionGroup>
#include <QFontDatabase>
#include <QStyleFactory>
#include <QtConcurrent/QtConcurrent>
#include "sui_base_ex.h"
#include "sui_sys_style.h"

//QD_CLOSE->表示子窗口状态
//QD_EXIT->表示主窗口状态
typedef enum{
   QD_CLOSE,
   QD_EXIT
} QD_TYPE;

class sui_title: public QWidget
{
    Q_OBJECT
public:
    explicit sui_title(QWidget *parent = nullptr);
    ~sui_title();
    void set_title(QString str);
    void set_type(QD_TYPE _type);
protected:
    //双击标题栏进行界面的最大化/还原
     void mouseDoubleClickEvent(QMouseEvent *event);
private:
    //最大化/还原
    void up_maximize();  
    void connect_slots();
    void btn_ico_menu();
    void init_font_style();
private:
    QWidget        *m_parent;
    QHBoxLayout    *m_layout;
    QLabel         *m_title_label;
    std::vector<QPushButton*> m_btn_vectors;
    QSpacerItem    *sparcer_item = new QSpacerItem(0,0,QSizePolicy::Expanding,QSizePolicy::Fixed);
    QMenu          *m_menu;
    QMenu          *s_menu;
    QMenu          *f_menu;
    QMenu          *l_menu;
    QMenu          *t_menu;
    QD_TYPE        m_type;
    QThread        *m_thread=nullptr;
    sui_sys_style  *m_style=nullptr;
    QStringList    m_btn_obj_str={"btn_opt","btn_min","btn_max","btn_close"};
    QStringList    m_btn_tips_str={"功能","最小化","最大化","关闭"};
public slots:   
    void slots_on_clicked();
    void slots_change_font();
    void slots_change_style();
    void slots_change_style_sys(bool);
    void slots_change_font_bold(bool); 
    void slots_track_style_off_on_sys();
signals:
    void signals_close();
};
#endif