#ifndef FRAMELESSBASE_H
#define FRAMELESSBASE_H

#include <QWidget>

#include <QMainWindow>
#include <QMenuBar>
#include <QMessageBox>

class QVBoxLayout;

namespace QWK {
class WidgetWindowAgent;
class StyleAgent;
} // namespace QWK

class TMainWindow : public QMainWindow
{
    Q_OBJECT
public:
    explicit TMainWindow(QWidget *parent = nullptr);
    ~TMainWindow() override {}

protected:
    bool event(QEvent *event) override;

private:
    void installWindowAgent();
    QWK::WidgetWindowAgent *windowAgent;
};

class TWidget : public QWidget
{
    Q_OBJECT
public:
    explicit TWidget(QWidget *parent = nullptr);
    ~TWidget() override {}

    QVBoxLayout *mainLayout() const { return m_mainLayout; }

    QWidget *menuWidget() const;         // 获取当前标题栏
    void setMenuWidget(QWidget *widget); // 设置新的标题栏
protected:
    bool event(QEvent *event) override;

private:
    void installWindowAgent();
    QWK::WidgetWindowAgent *windowAgent;

    QWidget *m_menuWidget = nullptr;     // 存储当前标题栏
    QVBoxLayout *m_mainLayout = nullptr; // 主布局
};

#endif // FRAMELESSBASE_H
