[55401] | 1 | /* $Id: UIPopupStackViewport.h 103988 2024-03-21 13:49:47Z vboxsync $ */
|
---|
[25177] | 2 | /** @file
|
---|
[52727] | 3 | * VBox Qt GUI - UIPopupStackViewport class declaration.
|
---|
[25177] | 4 | */
|
---|
| 5 |
|
---|
| 6 | /*
|
---|
[98103] | 7 | * Copyright (C) 2013-2023 Oracle and/or its affiliates.
|
---|
[25177] | 8 | *
|
---|
[96407] | 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
|
---|
[25177] | 26 | */
|
---|
| 27 |
|
---|
[76581] | 28 | #ifndef FEQT_INCLUDED_SRC_widgets_UIPopupStackViewport_h
|
---|
| 29 | #define FEQT_INCLUDED_SRC_widgets_UIPopupStackViewport_h
|
---|
[76532] | 30 | #ifndef RT_WITHOUT_PRAGMA_ONCE
|
---|
| 31 | # pragma once
|
---|
| 32 | #endif
|
---|
[25177] | 33 |
|
---|
[41587] | 34 | /* Qt includes: */
|
---|
[45659] | 35 | #include <QWidget>
|
---|
[45431] | 36 | #include <QMap>
|
---|
[34736] | 37 |
|
---|
[71630] | 38 | /* GUI includes: */
|
---|
| 39 | #include "UILibraryDefs.h"
|
---|
| 40 |
|
---|
[45468] | 41 | /* Forward declaration: */
|
---|
[71521] | 42 | class QSize;
|
---|
| 43 | class QString;
|
---|
[45515] | 44 | class UIPopupPane;
|
---|
[45468] | 45 |
|
---|
[71521] | 46 | /** QWidget extension providing GUI with popup-stack viewport prototype class. */
|
---|
[71630] | 47 | class SHARED_LIBRARY_STUFF UIPopupStackViewport : public QWidget
|
---|
[47455] | 48 | {
|
---|
| 49 | Q_OBJECT;
|
---|
| 50 |
|
---|
| 51 | signals:
|
---|
| 52 |
|
---|
[71521] | 53 | /** Notifies about popup-pane size change. */
|
---|
[68540] | 54 | void sigProposePopupPaneSize(QSize newSize);
|
---|
[71521] | 55 |
|
---|
| 56 | /** Notifies about size-hint change. */
|
---|
[47455] | 57 | void sigSizeHintChanged();
|
---|
| 58 |
|
---|
[71521] | 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. */
|
---|
[47523] | 64 | void sigPopupPanesRemoved();
|
---|
[47455] | 65 |
|
---|
| 66 | public:
|
---|
| 67 |
|
---|
[71521] | 68 | /** Constructs popup-stack viewport. */
|
---|
[47455] | 69 | UIPopupStackViewport();
|
---|
| 70 |
|
---|
[71521] | 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,
|
---|
[47455] | 75 | const QString &strMessage, const QString &strDetails,
|
---|
[50138] | 76 | const QMap<int, QString> &buttonDescriptions);
|
---|
[71521] | 77 | /** Updates pane with passed @a strID, @a strMessage and @a strDetails. */
|
---|
| 78 | void updatePopupPane(const QString &strID,
|
---|
[47455] | 79 | const QString &strMessage, const QString &strDetails);
|
---|
[71521] | 80 | /** Recalls pane with passed @a strID. */
|
---|
| 81 | void recallPopupPane(const QString &strID);
|
---|
[47455] | 82 |
|
---|
[71521] | 83 | /** Returns minimum size-hint. */
|
---|
[103988] | 84 | QSize minimumSizeHint() const RT_OVERRIDE RT_FINAL { return m_minimumSizeHint; }
|
---|
[47455] | 85 |
|
---|
[68540] | 86 | public slots:
|
---|
| 87 |
|
---|
[71521] | 88 | /** Handle proposal for @a newSize. */
|
---|
[68540] | 89 | void sltHandleProposalForSize(QSize newSize);
|
---|
| 90 |
|
---|
[47455] | 91 | private slots:
|
---|
| 92 |
|
---|
[71521] | 93 | /** Adjusts geometry. */
|
---|
[47455] | 94 | void sltAdjustGeometry();
|
---|
| 95 |
|
---|
[71521] | 96 | /** Handles reuqest to dismiss popup-pane with @a iButtonCode. */
|
---|
[47455] | 97 | void sltPopupPaneDone(int iButtonCode);
|
---|
| 98 |
|
---|
| 99 | private:
|
---|
| 100 |
|
---|
[71521] | 101 | /** Updates size-hint. */
|
---|
[47455] | 102 | void updateSizeHint();
|
---|
[71521] | 103 | /** Lays the content out. */
|
---|
[47455] | 104 | void layoutContent();
|
---|
| 105 |
|
---|
[71521] | 106 | /** Holds the layout margin. */
|
---|
[45662] | 107 | const int m_iLayoutMargin;
|
---|
[71521] | 108 | /** Holds the layout spacing. */
|
---|
[45662] | 109 | const int m_iLayoutSpacing;
|
---|
[71521] | 110 |
|
---|
| 111 | /** Holds the minimum size-hint. */
|
---|
[47014] | 112 | QSize m_minimumSizeHint;
|
---|
[47455] | 113 |
|
---|
[71521] | 114 | /** Holds the popup-pane instances. */
|
---|
[45658] | 115 | QMap<QString, UIPopupPane*> m_panes;
|
---|
| 116 | };
|
---|
| 117 |
|
---|
[76581] | 118 | #endif /* !FEQT_INCLUDED_SRC_widgets_UIPopupStackViewport_h */
|
---|