VirtualBox

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

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

scm --update-copyright-year

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 2.8 KB
Line 
1/* $Id: UIPopupPaneButtonPane.h 76553 2019-01-01 01:45:53Z vboxsync $ */
2/** @file
3 * VBox Qt GUI - UIPopupPaneButtonPane 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 ___UIPopupPaneButtonPane_h___
19#define ___UIPopupPaneButtonPane_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 declarations: */
32class QHBoxLayout;
33class QIcon;
34class QKeyEvent;
35class QString;
36class QIToolButton;
37
38/** QWidget extension providing GUI with popup-pane button-pane prototype class. */
39class SHARED_LIBRARY_STUFF UIPopupPaneButtonPane : public QWidget
40{
41 Q_OBJECT;
42
43signals:
44
45 /** Notifies about button with @a iButtonID being clicked. */
46 void sigButtonClicked(int iButtonID);
47
48public:
49
50 /** Constructs popup-button pane passing @a pParent to the base-class. */
51 UIPopupPaneButtonPane(QWidget *pParent = 0);
52
53 /** Defines @a buttonDescriptions. */
54 void setButtons(const QMap<int, QString> &buttonDescriptions);
55 /** Returns default button. */
56 int defaultButton() const { return m_iDefaultButton; }
57 /** Returns escape button. */
58 int escapeButton() const { return m_iEscapeButton; }
59
60private slots:
61
62 /** Handles button click. */
63 void sltButtonClicked();
64
65private:
66
67 /** Prepares all. */
68 void prepare();
69 /** Prepares layouts. */
70 void prepareLayouts();
71 /** Prepares buttons. */
72 void prepareButtons();
73 /** Cleanups buttons. */
74 void cleanupButtons();
75
76 /** Handles key-press @a pEvent. */
77 virtual void keyPressEvent(QKeyEvent *pEvent) /* override */;
78
79 /** Adds button with @a iButtonID and @a strToolTip. */
80 static QIToolButton *addButton(int iButtonID, const QString &strToolTip);
81 /** Returns default tool-tip for button @a iButtonID. */
82 static QString defaultToolTip(int iButtonID);
83 /** Returns default icon for button @a iButtonID. */
84 static QIcon defaultIcon(int iButtonID);
85
86 /** Holds the button layout. */
87 QHBoxLayout *m_pButtonLayout;
88
89 /** Holds the button descriptions. */
90 QMap<int, QString> m_buttonDescriptions;
91 /** Holds the button instances. */
92 QMap<int, QIToolButton*> m_buttons;
93
94 /** Holds default button. */
95 int m_iDefaultButton;
96 /** Holds escape button. */
97 int m_iEscapeButton;
98};
99
100#endif /* !___UIPopupPaneButtonPane_h___ */
101
Note: See TracBrowser for help on using the repository browser.

© 2023 Oracle
ContactPrivacy policyTerms of Use