#ifndef BASEWIN_H
#define BASEWIN_H

#include <QWidget>
#include <QPen>

class BaseWin : public QWidget {
    Q_OBJECT
public:
    explicit BaseWin(QWidget *parent = nullptr);
    QWidget *center{nullptr};
    QPen borderPenAct{Qt::gray};
    QPen borderPenUnact{Qt::lightGray};
    qreal roundRadius{6.0};
    QPointF titlePos{36, 26};
    QPixmap icon;
    QPointF iconPos{13, 13};
protected:
    void paintEvent(QPaintEvent *) override;
    void mousePressEvent(QMouseEvent *) override;
    void mouseReleaseEvent(QMouseEvent *) override;
    void mouseMoveEvent(QMouseEvent *) override;
    void leaveEvent(QEvent *) override;
    bool eventFilter(QObject *, QEvent *) override;
    void changeEvent(QEvent *) override;
    void mouseDoubleClickEvent(QMouseEvent *) override;
#ifdef Q_OS_WINDOWS
#if(QT_VERSION_MAJOR > 5)
    bool nativeEvent(const QByteArray &eventType, void *message, qintptr *result) override;
#else
    bool nativeEvent(const QByteArray &, void *, long *) override;
#endif
#endif

    void setFrmSec(const QPoint &pos);
    void setFrmSecIfNeed(Qt::WindowFrameSection frmSec, Qt::CursorShape cursor);

    QPoint mPressRel{INT_MAX, INT_MAX};
    Qt::WindowFrameSection mFrmSec{Qt::NoSection};
    bool isActive{false};
};

#endif // BASEWIN_H
