VirtualBox

source: vbox/trunk/src/VBox/Frontends/VirtualBox/include/QIMessageBox.h@ 16694

Last change on this file since 16694 was 14440, checked in by vboxsync, 16 years ago

FE/Qt4: QIMessageBox: Don't accept dialog closure when no Escape button is set (bad practice but necessary for spotting itself).

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 3.3 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-2008 Sun Microsystems, Inc.
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 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
19 * Clara, CA 95054 USA or visit http://www.sun.com if you need
20 * additional information or have any questions.
21 */
22
23#ifndef __QIMessageBox_h__
24#define __QIMessageBox_h__
25
26#include "QIDialog.h"
27
28/* Qt includes */
29#include <QMessageBox>
30#include <QCheckBox>
31#include <QTextEdit>
32
33class QILabel;
34class QLabel;
35class QPushButton;
36class QSpacerItem;
37class QCloseEvent;
38
39class QIDialogButtonBox;
40
41class QIMessageBox : public QIDialog
42{
43 Q_OBJECT
44
45public:
46
47 // for compatibility with QMessageBox
48 enum Icon
49 {
50 NoIcon = QMessageBox::NoIcon,
51 Information = QMessageBox::Information,
52 Warning = QMessageBox::Warning,
53 Critical = QMessageBox::Critical,
54 Question = QMessageBox::Question,
55 GuruMeditation,
56 };
57
58 enum
59 {
60 NoButton = 0, Ok = 1, Cancel = 2, Yes = 3, No = 4, Abort = 5,
61 Retry = 6, Ignore = 7, YesAll = 8, NoAll = 9,
62 ButtonMask = 0xFF,
63
64 Default = 0x100, Escape = 0x200,
65 FlagMask = 0x300
66 };
67
68 QIMessageBox (const QString &aCaption, const QString &aText,
69 Icon aIcon, int aButton0, int aButton1 = 0, int aButton2 = 0,
70 QWidget *aParent = 0, const char *aName = 0, bool aModal = TRUE);
71
72 QString buttonText (int aButton) const;
73 void setButtonText (int aButton, const QString &aText);
74
75 QString flagText() const { return mFlagCB->isVisible() ? mFlagCB->text() : QString::null; }
76 void setFlagText (const QString &aText);
77
78 bool isFlagChecked() const { return mFlagCB->isChecked(); }
79 void setFlagChecked (bool aChecked) { mFlagCB->setChecked (aChecked); }
80
81 QString detailsText () const { return mDetailsText->toHtml(); }
82 void setDetailsText (const QString &aText);
83
84 bool isDetailsShown() const { return mDetailsVBox->isVisible(); }
85 void setDetailsShown (bool aShown);
86
87 QPixmap standardPixmap (QIMessageBox::Icon aIcon);
88
89private:
90
91 QPushButton *createButton (int aButton);
92
93 void closeEvent (QCloseEvent *e);
94
95private slots:
96
97 void done0() { mWasDone = true; done (mButton0 & ButtonMask); }
98 void done1() { mWasDone = true; done (mButton1 & ButtonMask); }
99 void done2() { mWasDone = true; done (mButton2 & ButtonMask); }
100
101 void reject();
102
103private:
104
105 int mButton0, mButton1, mButton2, mButtonEsc;
106 QLabel *mIconLabel;
107 QILabel *mTextLabel;
108 QPushButton *mButton0PB, *mButton1PB, *mButton2PB;
109 QCheckBox *mFlagCB, *mFlagCB_Main, *mFlagCB_Details;
110 QWidget *mDetailsVBox;
111 QTextEdit *mDetailsText;
112 QSpacerItem *mSpacer;
113 QIDialogButtonBox *mButtonBox;
114 bool mWasDone : 1;
115};
116
117#endif
118
Note: See TracBrowser for help on using the repository browser.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette