VirtualBox

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

Last change on this file since 82781 was 76581, checked in by vboxsync, 5 years ago

Fe/QT: scm header guard alignment.

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

© 2023 Oracle
ContactPrivacy policyTerms of Use