VirtualBox

source: vbox/trunk/src/VBox/Frontends/VirtualBox/src/widgets/UIPopupPaneButtonPane.h

Last change on this file was 98103, checked in by vboxsync, 16 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: 3.1 KB
Line 
1/* $Id: UIPopupPaneButtonPane.h 98103 2023-01-17 14:15:46Z vboxsync $ */
2/** @file
3 * VBox Qt GUI - UIPopupPaneButtonPane 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_UIPopupPaneButtonPane_h
29#define FEQT_INCLUDED_SRC_widgets_UIPopupPaneButtonPane_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 declarations: */
42class QHBoxLayout;
43class QIcon;
44class QKeyEvent;
45class QString;
46class QIToolButton;
47
48/** QWidget extension providing GUI with popup-pane button-pane prototype class. */
49class SHARED_LIBRARY_STUFF UIPopupPaneButtonPane : public QWidget
50{
51 Q_OBJECT;
52
53signals:
54
55 /** Notifies about button with @a iButtonID being clicked. */
56 void sigButtonClicked(int iButtonID);
57
58public:
59
60 /** Constructs popup-button pane passing @a pParent to the base-class. */
61 UIPopupPaneButtonPane(QWidget *pParent = 0);
62
63 /** Defines @a buttonDescriptions. */
64 void setButtons(const QMap<int, QString> &buttonDescriptions);
65 /** Returns default button. */
66 int defaultButton() const { return m_iDefaultButton; }
67 /** Returns escape button. */
68 int escapeButton() const { return m_iEscapeButton; }
69
70private slots:
71
72 /** Handles button click. */
73 void sltButtonClicked();
74
75private:
76
77 /** Prepares all. */
78 void prepare();
79 /** Prepares layouts. */
80 void prepareLayouts();
81 /** Prepares buttons. */
82 void prepareButtons();
83 /** Cleanups buttons. */
84 void cleanupButtons();
85
86 /** Handles key-press @a pEvent. */
87 virtual void keyPressEvent(QKeyEvent *pEvent) RT_OVERRIDE;
88
89 /** Adds button with @a iButtonID and @a strToolTip. */
90 static QIToolButton *addButton(int iButtonID, const QString &strToolTip);
91 /** Returns default tool-tip for button @a iButtonID. */
92 static QString defaultToolTip(int iButtonID);
93 /** Returns default icon for button @a iButtonID. */
94 static QIcon defaultIcon(int iButtonID);
95
96 /** Holds the button layout. */
97 QHBoxLayout *m_pButtonLayout;
98
99 /** Holds the button descriptions. */
100 QMap<int, QString> m_buttonDescriptions;
101 /** Holds the button instances. */
102 QMap<int, QIToolButton*> m_buttons;
103
104 /** Holds default button. */
105 int m_iDefaultButton;
106 /** Holds escape button. */
107 int m_iEscapeButton;
108};
109
110#endif /* !FEQT_INCLUDED_SRC_widgets_UIPopupPaneButtonPane_h */
111
Note: See TracBrowser for help on using the repository browser.

© 2023 Oracle
ContactPrivacy policyTerms of Use