VirtualBox

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

Last change on this file since 3894 was 3894, checked in by vboxsync, 18 years ago

FE/Qt: Fixed focus order in QIMessageBox (try 2).

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 3.0 KB
Line 
1/** @file
2 *
3 * VBox frontends: Qt GUI ("VirtualBox"):
4 * innotek Qt extensions: QIMessageBox class declaration
5 */
6
7/*
8 * Copyright (C) 2006-2007 innotek 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
32class QLabel;
33class QPushButton;
34class QSpacerItem;
35
36class QIMessageBox : public QDialog
37{
38 Q_OBJECT
39
40public:
41
42 // for compatibility with QMessageBox
43 enum Icon
44 {
45 NoIcon = QMessageBox::NoIcon,
46 Information = QMessageBox::Information,
47 Warning = QMessageBox::Warning,
48 Critical = QMessageBox::Critical,
49 Question = QMessageBox::Question
50 };
51
52 enum
53 {
54 NoButton = 0, Ok = 1, Cancel = 2, Yes = 3, No = 4, Abort = 5,
55 Retry = 6, Ignore = 7, YesAll = 8, NoAll = 9, ButtonMask = 0xff,
56 Default = 0x100, Escape = 0x200, FlagMask = 0x300
57 };
58
59 QIMessageBox (const QString &aCaption, const QString &aText,
60 Icon aIcon, int aButton0, int aButton1 = 0, int aButton2 = 0,
61 QWidget *aParent = 0, const char *aName = 0, bool aModal = TRUE,
62 WFlags aFlags = WStyle_DialogBorder);
63
64 QString flagText() const { return mFlagCB->isShown() ? mFlagCB->text() : QString::null; }
65 void setFlagText (const QString &aText);
66
67 bool isFlagChecked() const { return mFlagCB->isChecked(); }
68 void setFlagChecked (bool aChecked) { mFlagCB->setChecked (aChecked); }
69
70 QString detailsText () const { return mDetailsText->text(); }
71 void setDetailsText (const QString &aText);
72
73 bool isDetailsShown() const { return mDetailsVBox->isShown(); }
74 void setDetailsShown (bool aShown);
75
76private:
77
78 QPushButton *createButton (QWidget *aParent, int aButton);
79
80private slots:
81
82 void done0() { done (mButton0 & ButtonMask); }
83 void done1() { done (mButton1 & ButtonMask); }
84 void done2() { done (mButton2 & ButtonMask); }
85
86 void reject() {
87 QDialog::reject();
88 if (mButtonEsc)
89 setResult (mButtonEsc & ButtonMask);
90 }
91
92private:
93
94 int mButton0, mButton1, mButton2, mButtonEsc;
95 QLabel *mIconLabel, *mTextLabel;
96 QPushButton *mButton0PB, *mButton1PB, *mButton2PB;
97 QVBox *mMessageVBox;
98 QCheckBox *mFlagCB, *mFlagCB_Main, *mFlagCB_Details;
99 QVBox *mDetailsVBox;
100 QTextEdit *mDetailsText;
101 QSpacerItem *mSpacer;
102};
103
104#endif
Note: See TracBrowser for help on using the repository browser.

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