1 | /* $Id: UIPopupStackViewport.h 103988 2024-03-21 13:49:47Z vboxsync $ */
|
---|
2 | /** @file
|
---|
3 | * VBox Qt GUI - UIPopupStackViewport 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_UIPopupStackViewport_h
|
---|
29 | #define FEQT_INCLUDED_SRC_widgets_UIPopupStackViewport_h
|
---|
30 | #ifndef RT_WITHOUT_PRAGMA_ONCE
|
---|
31 | # pragma once
|
---|
32 | #endif
|
---|
33 |
|
---|
34 | /* Qt includes: */
|
---|
35 | #include <QWidget>
|
---|
36 | #include <QMap>
|
---|
37 |
|
---|
38 | /* GUI includes: */
|
---|
39 | #include "UILibraryDefs.h"
|
---|
40 |
|
---|
41 | /* Forward declaration: */
|
---|
42 | class QSize;
|
---|
43 | class QString;
|
---|
44 | class UIPopupPane;
|
---|
45 |
|
---|
46 | /** QWidget extension providing GUI with popup-stack viewport prototype class. */
|
---|
47 | class SHARED_LIBRARY_STUFF UIPopupStackViewport : public QWidget
|
---|
48 | {
|
---|
49 | Q_OBJECT;
|
---|
50 |
|
---|
51 | signals:
|
---|
52 |
|
---|
53 | /** Notifies about popup-pane size change. */
|
---|
54 | void sigProposePopupPaneSize(QSize newSize);
|
---|
55 |
|
---|
56 | /** Notifies about size-hint change. */
|
---|
57 | void sigSizeHintChanged();
|
---|
58 |
|
---|
59 | /** Asks to close popup-pane with @a strID and @a iResultCode. */
|
---|
60 | void sigPopupPaneDone(QString strID, int iResultCode);
|
---|
61 | /** Notifies about popup-pane with @a strID was removed. */
|
---|
62 | void sigPopupPaneRemoved(QString strID);
|
---|
63 | /** Notifies about popup-panes were removed. */
|
---|
64 | void sigPopupPanesRemoved();
|
---|
65 |
|
---|
66 | public:
|
---|
67 |
|
---|
68 | /** Constructs popup-stack viewport. */
|
---|
69 | UIPopupStackViewport();
|
---|
70 |
|
---|
71 | /** Returns whether pane with passed @a strID exists. */
|
---|
72 | bool exists(const QString &strID) const;
|
---|
73 | /** Creates pane with passed @a strID, @a strMessage, @a strDetails and @a buttonDescriptions. */
|
---|
74 | void createPopupPane(const QString &strID,
|
---|
75 | const QString &strMessage, const QString &strDetails,
|
---|
76 | const QMap<int, QString> &buttonDescriptions);
|
---|
77 | /** Updates pane with passed @a strID, @a strMessage and @a strDetails. */
|
---|
78 | void updatePopupPane(const QString &strID,
|
---|
79 | const QString &strMessage, const QString &strDetails);
|
---|
80 | /** Recalls pane with passed @a strID. */
|
---|
81 | void recallPopupPane(const QString &strID);
|
---|
82 |
|
---|
83 | /** Returns minimum size-hint. */
|
---|
84 | QSize minimumSizeHint() const RT_OVERRIDE RT_FINAL { return m_minimumSizeHint; }
|
---|
85 |
|
---|
86 | public slots:
|
---|
87 |
|
---|
88 | /** Handle proposal for @a newSize. */
|
---|
89 | void sltHandleProposalForSize(QSize newSize);
|
---|
90 |
|
---|
91 | private slots:
|
---|
92 |
|
---|
93 | /** Adjusts geometry. */
|
---|
94 | void sltAdjustGeometry();
|
---|
95 |
|
---|
96 | /** Handles reuqest to dismiss popup-pane with @a iButtonCode. */
|
---|
97 | void sltPopupPaneDone(int iButtonCode);
|
---|
98 |
|
---|
99 | private:
|
---|
100 |
|
---|
101 | /** Updates size-hint. */
|
---|
102 | void updateSizeHint();
|
---|
103 | /** Lays the content out. */
|
---|
104 | void layoutContent();
|
---|
105 |
|
---|
106 | /** Holds the layout margin. */
|
---|
107 | const int m_iLayoutMargin;
|
---|
108 | /** Holds the layout spacing. */
|
---|
109 | const int m_iLayoutSpacing;
|
---|
110 |
|
---|
111 | /** Holds the minimum size-hint. */
|
---|
112 | QSize m_minimumSizeHint;
|
---|
113 |
|
---|
114 | /** Holds the popup-pane instances. */
|
---|
115 | QMap<QString, UIPopupPane*> m_panes;
|
---|
116 | };
|
---|
117 |
|
---|
118 | #endif /* !FEQT_INCLUDED_SRC_widgets_UIPopupStackViewport_h */
|
---|