VirtualBox

source: vbox/trunk/src/VBox/Frontends/VirtualBox/src/widgets/UIPopupStack.h@ 104158

Last change on this file since 104158 was 98103, checked in by vboxsync, 23 months ago

Copyright year updates by scm.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 4.4 KB
Line 
1/* $Id: UIPopupStack.h 98103 2023-01-17 14:15:46Z vboxsync $ */
2/** @file
3 * VBox Qt GUI - UIPopupStack 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_UIPopupStack_h
29#define FEQT_INCLUDED_SRC_widgets_UIPopupStack_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#include "UIPopupCenter.h"
41
42/* Forward declaration: */
43class QEvent;
44class QObject;
45class QScrollArea;
46class QShowEvent;
47class QSize;
48class QString;
49class QVBoxLayout;
50class UIPopupStackViewport;
51
52/** QWidget extension providing GUI with popup-stack prototype class. */
53class SHARED_LIBRARY_STUFF UIPopupStack : public QWidget
54{
55 Q_OBJECT;
56
57signals:
58
59 /** Notifies about popup-stack viewport size change. */
60 void sigProposeStackViewportSize(QSize newSize);
61
62 /** Asks to close popup-pane with @a strID and @a iResultCode. */
63 void sigPopupPaneDone(QString strID, int iResultCode);
64
65 /** Asks to close popup-stack with @a strID. */
66 void sigRemove(QString strID);
67
68public:
69
70 /** Constructs popup-stack with passed @a strID and @a enmOrientation. */
71 UIPopupStack(const QString &strID, UIPopupStackOrientation enmOrientation);
72
73 /** Returns whether pane with passed @a strID exists. */
74 bool exists(const QString &strID) const;
75 /** Creates pane with passed @a strID, @a strMessage, @a strDetails and @a buttonDescriptions. */
76 void createPopupPane(const QString &strID,
77 const QString &strMessage, const QString &strDetails,
78 const QMap<int, QString> &buttonDescriptions);
79 /** Updates pane with passed @a strID, @a strMessage and @a strDetails. */
80 void updatePopupPane(const QString &strID,
81 const QString &strMessage, const QString &strDetails);
82 /** Recalls pane with passed @a strID. */
83 void recallPopupPane(const QString &strID);
84 /** Defines stack @a enmOrientation. */
85 void setOrientation(UIPopupStackOrientation enmOrientation);
86
87 /** Defines stack @a pParent*/
88 void setParent(QWidget *pParent);
89 /** Defines stack @a pParent and @a enmFlags. */
90 void setParent(QWidget *pParent, Qt::WindowFlags enmFlags);
91
92protected:
93
94 /** Pre-handles standard Qt @a pEvent for passed @a pObject. */
95 virtual bool eventFilter(QObject *pObject, QEvent *pEvent) RT_OVERRIDE;
96
97 /** Handles show @a pEvent. */
98 virtual void showEvent(QShowEvent *pEvent) RT_OVERRIDE;
99
100private slots:
101
102 /** Adjusts geometry. */
103 void sltAdjustGeometry();
104
105 /** Handles removal of the popup-pane with @a strID. */
106 void sltPopupPaneRemoved(QString strID);
107 /** Handles removal of all the popup-panes. */
108 void sltPopupPanesRemoved();
109
110private:
111
112 /** Prepares all. */
113 void prepare();
114 /** Prepares contents. */
115 void prepareContent();
116
117 /** Propagates size. */
118 void propagateSize();
119
120 /** Returns @a pParent menu-bar height. */
121 static int parentMenuBarHeight(QWidget *pParent);
122 /** Returns @a pParent status-bar height. */
123 static int parentStatusBarHeight(QWidget *pParent);
124
125 /** Holds the stack ID. */
126 QString m_strID;
127 /** Holds the stack orientation. */
128 UIPopupStackOrientation m_enmOrientation;
129
130 /** Holds the main-layout instance. */
131 QVBoxLayout *m_pMainLayout;
132 /** Holds the scroll-area instance. */
133 QScrollArea *m_pScrollArea;
134 /** Holds the scroll-viewport instance. */
135 UIPopupStackViewport *m_pScrollViewport;
136
137 /** Holds the parent menu-bar height. */
138 int m_iParentMenuBarHeight;
139 /** Holds the parent status-bar height. */
140 int m_iParentStatusBarHeight;
141};
142
143#endif /* !FEQT_INCLUDED_SRC_widgets_UIPopupStack_h */
144
Note: See TracBrowser for help on using the repository browser.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette