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