Debian Codegraph @

kysdk-qtwidgets/src/kwindowbuttonbar.h

raw
1 /*
2 * libkysdk-qtwidgets's Library
3 *
4 * Copyright (C) 2023, KylinSoft Co., Ltd.
5 *
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 3 of the License, or (at your option) any later version.
10 *
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this library. If not, see <https://www.gnu.org/licenses/>.
18 *
19 * Authors: Zhen Sun <[email protected]>
20 *
21 */
22
23 #ifndef KTITLEBAR_H
24 #define KTITLEBAR_H
25
26 #include "gui_g.h"
27 #include "kmenubutton.h"
28 #include <QDebug>
29 #include <QFrame>
30 #include <QMouseEvent>
31 #include <QPushButton>
32
33 namespace kdk
34 {
35
36 /** @defgroup BarModule
37 * @{
38 */
39
40 /**
41 * @brief 最大化按钮提供两种状态响应
42 * @since 1.0.0
43 */
44 enum MaximumButtonState {
45 Maximum,
46 Restore
47 };
48 class KWindowButtonBarPrivate;
49
50 /**
51 * @brief 窗口三联按钮和菜单按钮的集合
52 */
53 class GUI_EXPORT KWindowButtonBar : public QFrame
54 {
55 Q_OBJECT
56
57 public:
58 KWindowButtonBar(QWidget *parent = nullptr);
59 ~KWindowButtonBar();
60
61 /**
62 * @brief 获取最小化按钮
63 * @return
64 */
65 QPushButton *minimumButton();
66
67 /**
68 * @brief 获取最大化按钮
69 * @return
70 */
71 QPushButton *maximumButton();
72
73 /**
74 * @brief 获取关闭按钮
75 * @return
76 */
77 QPushButton *closeButton();
78
79 /**
80 * @brief 获取菜单按钮
81 * @return
82 */
83 KMenuButton *menuButton();
84
85 /**
86 * @brief 获取最大化按钮的状态(最大化/恢复)
87 * @return
88 */
89 MaximumButtonState maximumButtonState();
90
91 /**
92 * @brief 设置最大化按钮图标状态(最大化/恢复)
93 * @param state
94 */
95 void setMaximumButtonState(MaximumButtonState state);
96
97 /**
98 * @brief 设置是否遵循模式
99 * @since 2.0
100 * @param flag
101 */
102 void setFollowMode(bool flag);
103
104 /**
105 * @brief 返回是否遵循模式
106 * @since 2.0
107 * @return
108 */
109 bool followMode();
110
111 /**
112 * @brief setSplitScreenGeometry
113 * @param 弹出界面的显示位置rect
114 * @since 3.0.1.0
115 */
116 void setSplitScreenGeometry(QRect rect);
117 Q_SIGNALS:
118 /**
119 * @brief 双击会发出双击信号,父widget可以绑定相应槽函数
120 */
121 void doubleClick();
122
123 protected:
124 void mouseDoubleClickEvent(QMouseEvent *event);
125 bool eventFilter(QObject *watched, QEvent *event);
126 QSize sizeHint() const override;
127
128 private:
129 Q_DECLARE_PRIVATE(KWindowButtonBar)
130 KWindowButtonBarPrivate *d_ptr;
131 };
132 }
133 /**
134 * @example testWidget/testwidget.h
135 * @example testWidget/testwidget.cpp
136 * @}
137 */
138
139 #endif // KTITLEBAR_H