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