-
Notifications
You must be signed in to change notification settings - Fork 78
/
windowbar.h
74 lines (56 loc) · 2 KB
/
windowbar.h
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
71
72
73
74
// Copyright (C) 2023-2024 Stdware Collections (https://www.github.com/stdware)
// Copyright (C) 2021-2023 wangwenx190 (Yuhang Zhao)
// SPDX-License-Identifier: Apache-2.0
#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);
QScopedPointer<WindowBarPrivate> d_ptr;
};
}
#endif // WINDOWBAR_H