VirtualBox

source: vbox/trunk/src/VBox/Frontends/VirtualBox/src/extensions/QIMessageBox.h@ 35740

Last change on this file since 35740 was 28800, checked in by vboxsync, 14 years ago

Automated rebranding to Oracle copyright/license strings via filemuncher

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 3.6 KB
Line 
1/** @file
2 *
3 * VBox frontends: Qt GUI ("VirtualBox"):
4 * VirtualBox Qt extensions: QIMessageBox class declaration
5 */
6
7/*
8 * Copyright (C) 2006-2009 Oracle Corporation
9 *
10 * This file is part of VirtualBox Open Source Edition (OSE), as
11 * available from http://www.virtualbox.org. This file is free software;
12 * you can redistribute it and/or modify it under the terms of the GNU
13 * General Public License (GPL) as published by the Free Software
14 * Foundation, in version 2 as it comes in the "COPYING" file of the
15 * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
16 * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
17 */
18
19#ifndef __QIMessageBox_h__
20#define __QIMessageBox_h__
21
22/* VBox includes */
23#include "QIDialog.h"
24#include "QIArrowSplitter.h"
25
26/* Qt includes */
27#include <QCheckBox>
28#include <QMessageBox>
29#include <QTextEdit>
30
31/* VBox forwards */
32class QIArrowSplitter;
33class QIDialogButtonBox;
34class QILabel;
35
36/* Qt forwards */
37class QCloseEvent;
38class QLabel;
39class QPushButton;
40class QSpacerItem;
41
42/** @class QIMessageBox
43 *
44 * The QIMessageBox class is a message box similar to QMessageBox.
45 * It partly implements the QMessageBox interface and adds some enhanced
46 * functionality.
47 */
48class QIMessageBox : public QIDialog
49{
50 Q_OBJECT;
51
52public:
53
54 // for compatibility with QMessageBox
55 enum Icon
56 {
57 NoIcon = QMessageBox::NoIcon,
58 Information = QMessageBox::Information,
59 Warning = QMessageBox::Warning,
60 Critical = QMessageBox::Critical,
61 Question = QMessageBox::Question,
62 GuruMeditation,
63 };
64
65 enum
66 {
67 NoButton = 0, Ok = 1, Cancel = 2, Yes = 3, No = 4, Abort = 5,
68 Retry = 6, Ignore = 7, YesAll = 8, NoAll = 9,
69 ButtonMask = 0xFF,
70
71 Default = 0x100, Escape = 0x200,
72 FlagMask = 0x300
73 };
74
75 QIMessageBox (const QString &aCaption, const QString &aText,
76 Icon aIcon, int aButton0, int aButton1 = 0, int aButton2 = 0,
77 QWidget *aParent = 0, const char *aName = 0, bool aModal = TRUE);
78
79 QString buttonText (int aButton) const;
80 void setButtonText (int aButton, const QString &aText);
81
82 QString flagText() const { return mFlagCB->isVisible() ? mFlagCB->text() : QString::null; }
83 void setFlagText (const QString &aText);
84
85 bool isFlagChecked() const { return mFlagCB->isChecked(); }
86 void setFlagChecked (bool aChecked) { mFlagCB->setChecked (aChecked); }
87
88 QString detailsText () const { return mDetailsText->toHtml(); }
89 void setDetailsText (const QString &aText);
90
91 QPixmap standardPixmap (QIMessageBox::Icon aIcon);
92
93private:
94
95 QPushButton *createButton (int aButton);
96
97 void closeEvent (QCloseEvent *e);
98 void showEvent (QShowEvent *e);
99
100 void refreshDetails();
101 void setDetailsShown (bool aShown);
102
103private slots:
104
105 void detailsBack();
106 void detailsNext();
107
108 void done0() { mWasDone = true; done (mButton0 & ButtonMask); }
109 void done1() { mWasDone = true; done (mButton1 & ButtonMask); }
110 void done2() { mWasDone = true; done (mButton2 & ButtonMask); }
111
112 void reject();
113
114private:
115
116 int mButton0, mButton1, mButton2, mButtonEsc;
117 QLabel *mIconLabel;
118 QILabel *mTextLabel;
119 QPushButton *mButton0PB, *mButton1PB, *mButton2PB;
120 QCheckBox *mFlagCB, *mFlagCB_Main, *mFlagCB_Details;
121 QWidget *mDetailsVBox;
122 QIArrowSplitter *mDetailsSplitter;
123 QTextEdit *mDetailsText;
124 QSpacerItem *mSpacer;
125 QIDialogButtonBox *mButtonBox;
126 QString mText;
127 QList < QPair <QString, QString> > mDetailsList;
128 int mDetailsIndex;
129 bool mWasDone : 1;
130 bool mWasPolished : 1;
131};
132
133#endif
134
Note: See TracBrowser for help on using the repository browser.

© 2023 Oracle
ContactPrivacy policyTerms of Use