SineStriker
2023-12-28 5bfd136473edc506b860177bf88626e35a5a1ba4
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
#ifndef WINDOWBAR_H
#define WINDOWBAR_H
 
#include <QFrame>
#include <QAbstractButton>
#include <QMenuBar>
#include <QLabel>
 
namespace QWK {
 
    class WindowBarPrivate;
 
    class WindowBar : public QFrame {
        Q_OBJECT
        Q_DECLARE_PRIVATE(WindowBar)
    public:
        explicit WindowBar(QWidget *parent = nullptr);
        ~WindowBar();
 
    public:
        QMenuBar *menuBar() const;
        QLabel *titleLabel() const;
        QAbstractButton *iconButton() const;
        QAbstractButton *minButton() const;
        QAbstractButton *maxButton() const;
        QAbstractButton *closeButton() const;
 
        void setMenuBar(QMenuBar *menuBar);
        void setTitleLabel(QLabel *label);
        void setIconButton(QAbstractButton *btn);
        void setMinButton(QAbstractButton *btn);
        void setMaxButton(QAbstractButton *btn);
        void setCloseButton(QAbstractButton *btn);
 
        QMenuBar *takeMenuBar();
        QLabel *takeTitleLabel();
        QAbstractButton *takeIconButton();
        QAbstractButton *takeMinButton();
        QAbstractButton *takeMaxButton();
        QAbstractButton *takeCloseButton();
 
        QWidget *hostWidget() const;
        void setHostWidget(QWidget *w);
 
        bool titleFollowWindow() const;
        void setTitleFollowWindow(bool value);
 
        bool iconFollowWindow() const;
        void setIconFollowWindow(bool value);
 
    Q_SIGNALS:
        void minimizeRequested();
        void maximizeRequested(bool max = false);
        void closeRequested();
 
    protected:
        bool eventFilter(QObject *obj, QEvent *event) override;
 
        virtual void titleChanged(const QString &text);
        virtual void iconChanged(const QIcon &icon);
 
    protected:
        WindowBar(WindowBarPrivate &d, QWidget *parent = nullptr);
 
        const std::unique_ptr<WindowBarPrivate> d_ptr;
    };
 
}
 
#endif // WINDOWBAR_H