1 | /** @file
|
---|
2 | *
|
---|
3 | * VBox frontends: Qt GUI ("VirtualBox"):
|
---|
4 | * InnoTek Qt extensions: QIMessageBox class declaration
|
---|
5 | */
|
---|
6 |
|
---|
7 | /*
|
---|
8 | * Copyright (C) 2006 InnoTek Systemberatung GmbH
|
---|
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 as published by the Free Software Foundation,
|
---|
14 | * in version 2 as it comes in the "COPYING" file of the VirtualBox OSE
|
---|
15 | * distribution. VirtualBox OSE is distributed in the hope that it will
|
---|
16 | * be useful, but WITHOUT ANY WARRANTY of any kind.
|
---|
17 | *
|
---|
18 | * If you received this file as part of a commercial VirtualBox
|
---|
19 | * distribution, then only the terms of your commercial VirtualBox
|
---|
20 | * license agreement apply instead of the previous paragraph.
|
---|
21 | */
|
---|
22 |
|
---|
23 | #ifndef __QIMessageBox_h__
|
---|
24 | #define __QIMessageBox_h__
|
---|
25 |
|
---|
26 | #include <qdialog.h>
|
---|
27 | #include <qvbox.h>
|
---|
28 | #include <qmessagebox.h>
|
---|
29 | #include <qcheckbox.h>
|
---|
30 | #include <qtextedit.h>
|
---|
31 |
|
---|
32 | class QLabel;
|
---|
33 | class QPushButton;
|
---|
34 | class QSpacerItem;
|
---|
35 |
|
---|
36 | class QIMessageBox : public QDialog
|
---|
37 | {
|
---|
38 | Q_OBJECT
|
---|
39 |
|
---|
40 | public:
|
---|
41 |
|
---|
42 | // for compatibility with QMessageBox
|
---|
43 | enum Icon {
|
---|
44 | NoIcon = QMessageBox::NoIcon,
|
---|
45 | Information = QMessageBox::Information,
|
---|
46 | Warning = QMessageBox::Warning,
|
---|
47 | Critical = QMessageBox::Critical,
|
---|
48 | Question = QMessageBox::Question
|
---|
49 | };
|
---|
50 | enum {
|
---|
51 | NoButton = 0, Ok = 1, Cancel = 2, Yes = 3, No = 4, Abort = 5,
|
---|
52 | Retry = 6, Ignore = 7, YesAll = 8, NoAll = 9, ButtonMask = 0xff,
|
---|
53 | Default = 0x100, Escape = 0x200, FlagMask = 0x300
|
---|
54 | };
|
---|
55 |
|
---|
56 | QIMessageBox (
|
---|
57 | const QString &caption, const QString &text,
|
---|
58 | Icon icon, int button0, int button1 = 0, int button2 = 0,
|
---|
59 | QWidget *parent = 0, const char *name = 0, bool modal = TRUE,
|
---|
60 | WFlags f = WStyle_DialogBorder
|
---|
61 | );
|
---|
62 |
|
---|
63 | QString flagText() const { return cbflag->isShown() ? cbflag->text() : QString::null; }
|
---|
64 | void setFlagText (const QString &text);
|
---|
65 |
|
---|
66 | bool isFlagChecked() const { return cbflag->isChecked(); }
|
---|
67 | void setFlagChecked (bool checked) { cbflag->setChecked (checked); }
|
---|
68 |
|
---|
69 | QString detailsText () const { return dtext->text(); }
|
---|
70 | void setDetailsText (const QString &text);
|
---|
71 |
|
---|
72 | bool isDetailsShown() const { return dbox->isShown(); }
|
---|
73 | void setDetailsShown (bool shown);
|
---|
74 |
|
---|
75 | private:
|
---|
76 |
|
---|
77 | QPushButton *createButton (QWidget *parent, int button);
|
---|
78 |
|
---|
79 | private slots:
|
---|
80 |
|
---|
81 | void done0() { done (b0 & ButtonMask); }
|
---|
82 | void done1() { done (b1 & ButtonMask); }
|
---|
83 | void done2() { done (b2 & ButtonMask); }
|
---|
84 |
|
---|
85 | void reject() {
|
---|
86 | QDialog::reject();
|
---|
87 | if (bescape)
|
---|
88 | setResult (bescape & ButtonMask);
|
---|
89 | }
|
---|
90 |
|
---|
91 | private:
|
---|
92 |
|
---|
93 | int b0, b1, b2, bescape;
|
---|
94 | QLabel *licon, *ltext;
|
---|
95 | QPushButton *pb0, *pb1, *pb2;
|
---|
96 | QVBox *message;
|
---|
97 | QCheckBox *cbflag;
|
---|
98 | QVBox *dbox;
|
---|
99 | QTextEdit *dtext;
|
---|
100 | QSpacerItem *spacer;
|
---|
101 | };
|
---|
102 |
|
---|
103 | #endif
|
---|