1 | /** @file
|
---|
2 | *
|
---|
3 | * VBox frontends: Qt GUI ("VirtualBox"):
|
---|
4 | * UIPopupBox class declaration
|
---|
5 | */
|
---|
6 |
|
---|
7 | /*
|
---|
8 | * Copyright (C) 2010 Oracle Corporation
|
---|
9 | *
|
---|
10 | * This file is part of VirtualBox Open Source Edition (OSE), as
|
---|
11 | * available from http://www.virtualbox.org. This file is free software;
|
---|
12 | * you can redistribute it and/or modify it under the terms of the GNU
|
---|
13 | * General Public License (GPL) as published by the Free Software
|
---|
14 | * Foundation, in version 2 as it comes in the "COPYING" file of the
|
---|
15 | * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
|
---|
16 | * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
|
---|
17 | */
|
---|
18 |
|
---|
19 | #ifndef __UIPopupBox_h__
|
---|
20 | #define __UIPopupBox_h__
|
---|
21 |
|
---|
22 | /* Global includes */
|
---|
23 | #include <QIcon>
|
---|
24 | #include <QWidget>
|
---|
25 |
|
---|
26 | /* Global forward declarations */
|
---|
27 | class QLabel;
|
---|
28 |
|
---|
29 | class UIPopupBox : public QWidget
|
---|
30 | {
|
---|
31 | Q_OBJECT;
|
---|
32 |
|
---|
33 | public:
|
---|
34 |
|
---|
35 | UIPopupBox(QWidget *pParent);
|
---|
36 | ~UIPopupBox();
|
---|
37 |
|
---|
38 | void setTitle(const QString& strTitle);
|
---|
39 | QString title() const;
|
---|
40 |
|
---|
41 | void setTitleIcon(const QIcon& icon);
|
---|
42 | QIcon titleIcon() const;
|
---|
43 |
|
---|
44 | void setTitleLink(const QString& strLink);
|
---|
45 | QString titleLink() const;
|
---|
46 |
|
---|
47 | void setTitleLinkEnabled(bool fEnabled);
|
---|
48 | bool isTitleLinkEnabled() const;
|
---|
49 |
|
---|
50 | void setContentWidget(QWidget *pWidget);
|
---|
51 | QWidget* contentWidget() const;
|
---|
52 |
|
---|
53 | void setOpen(bool fOpen);
|
---|
54 | void toggleOpen();
|
---|
55 | bool isOpen() const;
|
---|
56 |
|
---|
57 | signals:
|
---|
58 | void titleClicked(const QString);
|
---|
59 |
|
---|
60 | protected:
|
---|
61 |
|
---|
62 | bool eventFilter(QObject *pWatched, QEvent *pEvent);
|
---|
63 |
|
---|
64 | void resizeEvent(QResizeEvent *pEvent);
|
---|
65 | void mouseDoubleClickEvent(QMouseEvent *pEvent);
|
---|
66 | void mouseMoveEvent(QMouseEvent *pEvent);
|
---|
67 | void wheelEvent(QWheelEvent *pEvent);
|
---|
68 | void enterEvent(QEvent *pEvent);
|
---|
69 | void leaveEvent(QEvent *pEvent);
|
---|
70 | void paintEvent(QPaintEvent *pEvent);
|
---|
71 |
|
---|
72 | private:
|
---|
73 |
|
---|
74 | void updateHover(bool fForce = false);
|
---|
75 | void recalc();
|
---|
76 |
|
---|
77 | /* Private member vars */
|
---|
78 | QLabel *m_pTitleLabel;
|
---|
79 | QString m_strTitle;
|
---|
80 | QLabel *m_pTitleIcon;
|
---|
81 | QIcon m_icon;
|
---|
82 | QString m_strLink;
|
---|
83 | bool m_fLinkEnabled;
|
---|
84 | QWidget *m_pContentWidget;
|
---|
85 | bool m_fOpen;
|
---|
86 |
|
---|
87 | QPainterPath *m_pLabelPath;
|
---|
88 | const int m_aw;
|
---|
89 | QPainterPath m_arrowPath;
|
---|
90 | bool m_fHeaderHover;
|
---|
91 | };
|
---|
92 |
|
---|
93 | #endif /* !__UIPopupBox_h__ */
|
---|
94 |
|
---|