-
Notifications
You must be signed in to change notification settings - Fork 0
/
mytitlebar.h
57 lines (43 loc) · 1.13 KB
/
mytitlebar.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
#ifndef MYTITLEBAR_H
#define MYTITLEBAR_H
#include <QWidget>
class MyTitleBarButton;
class QMouseEvent;
class QPaintEvent;
class QPushButton;
class QHBoxLayout;
class QSpacerItem;
class QColor;
class QPoint;
class MyTitleBar : public QWidget
{
Q_OBJECT
public:
MyTitleBar(QWidget *parent = 0);
~MyTitleBar();
enum WindowState{Tray, Minimize, Close};
public slots:
void setTitleColor(const QColor &color);
//button clicked
void trayIconButtonClicked();
void minimizeButtonClicked();
void closeButtonClicked();
signals:
void windowStateChanged(MyTitleBar::WindowState state);
void dragWindow(const QPoint &point);
protected:
void mouseMoveEvent(QMouseEvent *event);
void mousePressEvent(QMouseEvent *event);
void mouseReleaseEvent(QMouseEvent *);
void paintEvent(QPaintEvent *);
MyTitleBarButton *trayIconButton;
MyTitleBarButton *minimizeButton;
MyTitleBarButton *closeButton;
QHBoxLayout *mainHLayout;
QSpacerItem *HLeftSpacerItem;
QSpacerItem *HRightSpacerItem;
QColor *titleColor;
bool mousePressed;
QPoint startPoint;
};
#endif // MYTITLEBAR_H