1 | /* $Id: UIPopupPaneMessage.h 76553 2019-01-01 01:45:53Z vboxsync $ */
|
---|
2 | /** @file
|
---|
3 | * VBox Qt GUI - UIPopupPaneMessage class declaration.
|
---|
4 | */
|
---|
5 |
|
---|
6 | /*
|
---|
7 | * Copyright (C) 2013-2019 Oracle Corporation
|
---|
8 | *
|
---|
9 | * This file is part of VirtualBox Open Source Edition (OSE), as
|
---|
10 | * available from http://www.virtualbox.org. This file is free software;
|
---|
11 | * you can redistribute it and/or modify it under the terms of the GNU
|
---|
12 | * General Public License (GPL) as published by the Free Software
|
---|
13 | * Foundation, in version 2 as it comes in the "COPYING" file of the
|
---|
14 | * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
|
---|
15 | * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
|
---|
16 | */
|
---|
17 |
|
---|
18 | #ifndef ___UIPopupPaneMessage_h___
|
---|
19 | #define ___UIPopupPaneMessage_h___
|
---|
20 | #ifndef RT_WITHOUT_PRAGMA_ONCE
|
---|
21 | # pragma once
|
---|
22 | #endif
|
---|
23 |
|
---|
24 | /* Qt includes: */
|
---|
25 | #include <QWidget>
|
---|
26 |
|
---|
27 | /* GUI includes: */
|
---|
28 | #include "UILibraryDefs.h"
|
---|
29 |
|
---|
30 | /* Forward declarations: */
|
---|
31 | class QLabel;
|
---|
32 | class UIAnimation;
|
---|
33 |
|
---|
34 | /** QWidget extension providing GUI with popup-pane message-pane prototype class. */
|
---|
35 | class SHARED_LIBRARY_STUFF UIPopupPaneMessage : public QWidget
|
---|
36 | {
|
---|
37 | Q_OBJECT;
|
---|
38 | Q_PROPERTY(QSize collapsedSizeHint READ collapsedSizeHint);
|
---|
39 | Q_PROPERTY(QSize expandedSizeHint READ expandedSizeHint);
|
---|
40 | Q_PROPERTY(QSize minimumSizeHint READ minimumSizeHint WRITE setMinimumSizeHint);
|
---|
41 |
|
---|
42 | signals:
|
---|
43 |
|
---|
44 | /** Notifies about focus enter. */
|
---|
45 | void sigFocusEnter();
|
---|
46 | /** Notifies about focus enter. */
|
---|
47 | void sigFocusLeave();
|
---|
48 |
|
---|
49 | /** Notifies about size-hint change. */
|
---|
50 | void sigSizeHintChanged();
|
---|
51 |
|
---|
52 | public:
|
---|
53 |
|
---|
54 | /** Constructs message-pane passing @a pParent to the base-class.
|
---|
55 | * @param strText Brings the message text.
|
---|
56 | * @param fFcoused Brings whether the pane is focused. */
|
---|
57 | UIPopupPaneMessage(QWidget *pParent, const QString &strText, bool fFocused);
|
---|
58 |
|
---|
59 | /** Defines the message @a strText. */
|
---|
60 | void setText(const QString &strText);
|
---|
61 |
|
---|
62 | /** Returns the message minimum size-hint. */
|
---|
63 | QSize minimumSizeHint() const;
|
---|
64 | /** Defines the message @a minimumSizeHint. */
|
---|
65 | void setMinimumSizeHint(const QSize &minimumSizeHint);
|
---|
66 | /** Lays the content out. */
|
---|
67 | void layoutContent();
|
---|
68 |
|
---|
69 | /** Returns the collapsed size-hint. */
|
---|
70 | QSize collapsedSizeHint() const { return m_collapsedSizeHint; }
|
---|
71 | /** Returns the expanded size-hint. */
|
---|
72 | QSize expandedSizeHint() const { return m_expandedSizeHint; }
|
---|
73 |
|
---|
74 | private slots:
|
---|
75 |
|
---|
76 | /** Handles proposal for @a iWidth. */
|
---|
77 | void sltHandleProposalForWidth(int iWidth);
|
---|
78 |
|
---|
79 | /** Handles focus enter. */
|
---|
80 | void sltFocusEnter();
|
---|
81 | /** Handles focus leave. */
|
---|
82 | void sltFocusLeave();
|
---|
83 |
|
---|
84 | private:
|
---|
85 |
|
---|
86 | /** Prepares all. */
|
---|
87 | void prepare();
|
---|
88 | /** Prepares content. */
|
---|
89 | void prepareContent();
|
---|
90 | /** Prepares animations. */
|
---|
91 | void prepareAnimation();
|
---|
92 |
|
---|
93 | /** Updates size-hint. */
|
---|
94 | void updateSizeHint();
|
---|
95 |
|
---|
96 | /** Adjusts @a font. */
|
---|
97 | static QFont tuneFont(QFont font);
|
---|
98 |
|
---|
99 | /** Holds the layout margin. */
|
---|
100 | const int m_iLayoutMargin;
|
---|
101 | /** Holds the layout spacing. */
|
---|
102 | const int m_iLayoutSpacing;
|
---|
103 |
|
---|
104 | /** Holds the label size-hint. */
|
---|
105 | QSize m_labelSizeHint;
|
---|
106 | /** Holds the collapsed size-hint. */
|
---|
107 | QSize m_collapsedSizeHint;
|
---|
108 | /** Holds the expanded size-hint. */
|
---|
109 | QSize m_expandedSizeHint;
|
---|
110 | /** Holds the minimum size-hint. */
|
---|
111 | QSize m_minimumSizeHint;
|
---|
112 |
|
---|
113 | /** Holds the text. */
|
---|
114 | QString m_strText;
|
---|
115 |
|
---|
116 | /** Holds the label instance. */
|
---|
117 | QLabel *m_pLabel;
|
---|
118 |
|
---|
119 | /** Holds the desired label width. */
|
---|
120 | int m_iDesiredLabelWidth;
|
---|
121 |
|
---|
122 | /** Holds whether message-pane is focused. */
|
---|
123 | bool m_fFocused;
|
---|
124 |
|
---|
125 | /** Holds the animation instance. */
|
---|
126 | UIAnimation *m_pAnimation;
|
---|
127 | };
|
---|
128 |
|
---|
129 | #endif /* !___UIPopupPaneMessage_h___ */
|
---|
130 |
|
---|