[55401] | 1 | /* $Id: UIPopupPaneButtonPane.h 106061 2024-09-16 14:03:52Z vboxsync $ */
|
---|
[25177] | 2 | /** @file
|
---|
[52727] | 3 | * VBox Qt GUI - UIPopupPaneButtonPane class declaration.
|
---|
[25177] | 4 | */
|
---|
| 5 |
|
---|
| 6 | /*
|
---|
[106061] | 7 | * Copyright (C) 2013-2024 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_UIPopupPaneButtonPane_h
|
---|
| 29 | #define FEQT_INCLUDED_SRC_widgets_UIPopupPaneButtonPane_h
|
---|
[76532] | 30 | #ifndef RT_WITHOUT_PRAGMA_ONCE
|
---|
| 31 | # pragma once
|
---|
| 32 | #endif
|
---|
[47012] | 33 |
|
---|
[41587] | 34 | /* Qt includes: */
|
---|
[47012] | 35 | #include <QWidget>
|
---|
| 36 | #include <QMap>
|
---|
[34736] | 37 |
|
---|
[71630] | 38 | /* GUI includes: */
|
---|
| 39 | #include "UILibraryDefs.h"
|
---|
| 40 |
|
---|
[47012] | 41 | /* Forward declarations: */
|
---|
| 42 | class QHBoxLayout;
|
---|
[71513] | 43 | class QIcon;
|
---|
[47012] | 44 | class QKeyEvent;
|
---|
[71513] | 45 | class QString;
|
---|
[47012] | 46 | class QIToolButton;
|
---|
[25177] | 47 |
|
---|
[71513] | 48 | /** QWidget extension providing GUI with popup-pane button-pane prototype class. */
|
---|
[71630] | 49 | class SHARED_LIBRARY_STUFF UIPopupPaneButtonPane : public QWidget
|
---|
[45605] | 50 | {
|
---|
| 51 | Q_OBJECT;
|
---|
| 52 |
|
---|
| 53 | signals:
|
---|
| 54 |
|
---|
[71513] | 55 | /** Notifies about button with @a iButtonID being clicked. */
|
---|
[45605] | 56 | void sigButtonClicked(int iButtonID);
|
---|
| 57 |
|
---|
| 58 | public:
|
---|
| 59 |
|
---|
[71513] | 60 | /** Constructs popup-button pane passing @a pParent to the base-class. */
|
---|
[45605] | 61 | UIPopupPaneButtonPane(QWidget *pParent = 0);
|
---|
| 62 |
|
---|
[71513] | 63 | /** Defines @a buttonDescriptions. */
|
---|
[45605] | 64 | void setButtons(const QMap<int, QString> &buttonDescriptions);
|
---|
[71513] | 65 | /** Returns default button. */
|
---|
[47209] | 66 | int defaultButton() const { return m_iDefaultButton; }
|
---|
[71513] | 67 | /** Returns escape button. */
|
---|
[47209] | 68 | int escapeButton() const { return m_iEscapeButton; }
|
---|
[45605] | 69 |
|
---|
| 70 | private slots:
|
---|
| 71 |
|
---|
[71513] | 72 | /** Handles button click. */
|
---|
[45605] | 73 | void sltButtonClicked();
|
---|
| 74 |
|
---|
| 75 | private:
|
---|
| 76 |
|
---|
[71513] | 77 | /** Prepares all. */
|
---|
[45605] | 78 | void prepare();
|
---|
[71513] | 79 | /** Prepares layouts. */
|
---|
[45605] | 80 | void prepareLayouts();
|
---|
[71513] | 81 | /** Prepares buttons. */
|
---|
[45605] | 82 | void prepareButtons();
|
---|
[71513] | 83 | /** Cleanups buttons. */
|
---|
[45605] | 84 | void cleanupButtons();
|
---|
| 85 |
|
---|
[71513] | 86 | /** Handles key-press @a pEvent. */
|
---|
[93990] | 87 | virtual void keyPressEvent(QKeyEvent *pEvent) RT_OVERRIDE;
|
---|
[45605] | 88 |
|
---|
[71513] | 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. */
|
---|
[45605] | 92 | static QString defaultToolTip(int iButtonID);
|
---|
[71513] | 93 | /** Returns default icon for button @a iButtonID. */
|
---|
[45605] | 94 | static QIcon defaultIcon(int iButtonID);
|
---|
| 95 |
|
---|
[71513] | 96 | /** Holds the button layout. */
|
---|
[45605] | 97 | QHBoxLayout *m_pButtonLayout;
|
---|
[71513] | 98 |
|
---|
| 99 | /** Holds the button descriptions. */
|
---|
| 100 | QMap<int, QString> m_buttonDescriptions;
|
---|
| 101 | /** Holds the button instances. */
|
---|
[45605] | 102 | QMap<int, QIToolButton*> m_buttons;
|
---|
[71513] | 103 |
|
---|
| 104 | /** Holds default button. */
|
---|
[45605] | 105 | int m_iDefaultButton;
|
---|
[71513] | 106 | /** Holds escape button. */
|
---|
[45605] | 107 | int m_iEscapeButton;
|
---|
| 108 | };
|
---|
| 109 |
|
---|
[76581] | 110 | #endif /* !FEQT_INCLUDED_SRC_widgets_UIPopupPaneButtonPane_h */
|
---|
[71513] | 111 |
|
---|