VirtualBox

source: vbox/trunk/src/VBox/Frontends/VirtualBox4/include/QIMessageBox.h@ 10852

Last change on this file since 10852 was 9386, checked in by vboxsync, 17 years ago

FE/Qt4: Renamed QIRichLabel to QILabel. From now QAbstractWizard uses the new global QILabel.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 3.2 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;
37
38class QIDialogButtonBox;
39
40class QIMessageBox : public QIDialog
41{
42 Q_OBJECT
43
44public:
45
46 // for compatibility with QMessageBox
47 enum Icon
48 {
49 NoIcon = QMessageBox::NoIcon,
50 Information = QMessageBox::Information,
51 Warning = QMessageBox::Warning,
52 Critical = QMessageBox::Critical,
53 Question = QMessageBox::Question,
54 GuruMeditation,
55 };
56
57 enum
58 {
59 NoButton = 0, Ok = 1, Cancel = 2, Yes = 3, No = 4, Abort = 5,
60 Retry = 6, Ignore = 7, YesAll = 8, NoAll = 9,
61 ButtonMask = 0xFF,
62
63 Default = 0x100, Escape = 0x200,
64 FlagMask = 0x300
65 };
66
67 QIMessageBox (const QString &aCaption, const QString &aText,
68 Icon aIcon, int aButton0, int aButton1 = 0, int aButton2 = 0,
69 QWidget *aParent = 0, const char *aName = 0, bool aModal = TRUE);
70
71 QString buttonText (int aButton) const;
72 void setButtonText (int aButton, const QString &aText);
73
74 QString flagText() const { return mFlagCB->isVisible() ? mFlagCB->text() : QString::null; }
75 void setFlagText (const QString &aText);
76
77 bool isFlagChecked() const { return mFlagCB->isChecked(); }
78 void setFlagChecked (bool aChecked) { mFlagCB->setChecked (aChecked); }
79
80 QString detailsText () const { return mDetailsText->toHtml(); }
81 void setDetailsText (const QString &aText);
82
83 bool isDetailsShown() const { return mDetailsVBox->isVisible(); }
84 void setDetailsShown (bool aShown);
85
86 QPixmap standardPixmap (QIMessageBox::Icon aIcon);
87
88private:
89
90 QPushButton *createButton (int aButton);
91
92private slots:
93
94 void done0() { done (mButton0 & ButtonMask); }
95 void done1() { done (mButton1 & ButtonMask); }
96 void done2() { done (mButton2 & ButtonMask); }
97
98 void reject() {
99 QDialog::reject();
100 if (mButtonEsc)
101 setResult (mButtonEsc & ButtonMask);
102 }
103
104private:
105
106 int mButton0, mButton1, mButton2, mButtonEsc;
107 QLabel *mIconLabel;
108 QILabel *mTextLabel;
109 QPushButton *mButton0PB, *mButton1PB, *mButton2PB;
110 QCheckBox *mFlagCB, *mFlagCB_Main, *mFlagCB_Details;
111 QWidget *mDetailsVBox;
112 QTextEdit *mDetailsText;
113 QSpacerItem *mSpacer;
114 QIDialogButtonBox *mButtonBox;
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