2 // File : QAD_MessageBox.cxx
5 // Descr : Message dialog box for QAD-based application
8 // Copyright : Open CASCADE
12 \class QAD_MessageBox QAD_MessageBox.h
13 \brief Message dialog box for QAD-based application.
16 #include "QAD_MessageBox.h"
19 #include <qmessagebox.h>
20 #include <qapplication.h>
23 Shows info message box with one button [ static ]
25 int QAD_MessageBox::info1 ( QWidget* parent, const QString& caption, const QString& text,
26 const QString& textButton0 )
28 int ret = QMessageBox::information ( parent, caption, text, textButton0,
29 QString::null, QString::null, 0, 0);
30 qApp->processEvents(); /* update desktop */
35 Shows warning message box with one button [ static ]
37 int QAD_MessageBox::warn1 ( QWidget* parent, const QString& caption, const QString& text,
38 const QString& textButton0 )
40 int ret = QMessageBox::warning ( parent, caption, text, textButton0,
41 QString::null, QString::null, 0, 0);
42 qApp->processEvents(); /* update desktop */
47 Shows error message box with one button [ static ]
49 int QAD_MessageBox::error1 ( QWidget* parent, const QString& caption, const QString& text,
50 const QString& textButton0 )
52 int ret = QMessageBox::critical ( parent, caption, text, textButton0,
53 QString::null, QString::null, 0, 0);
54 qApp->processEvents(); /* update desktop */
59 Shows info message box with two buttons.
60 Returns id of the pressed button or -1 if escaped [ static ]
62 int QAD_MessageBox::info2 ( QWidget* parent, const QString& caption, const QString& text,
63 const QString& textButton0, const QString& textButton1,
64 int idButton0, int idButton1, int idDefault )
66 if ( idDefault == idButton0 ) idDefault = 0;
67 else if ( idDefault == idButton1 ) idDefault = 1;
70 int ret = QMessageBox::information ( parent, caption, text, textButton0,
71 textButton1, QString::null, idDefault );
72 qApp->processEvents(); /* update desktop */
73 return ( ret == 0 ? idButton0 : idButton1 );
77 Shows warning message box with two buttons.
78 Returns id of the pressed button or -1 if escaped [ static ]
80 int QAD_MessageBox::warn2 ( QWidget* parent, const QString& caption, const QString& text,
81 const QString& textButton0, const QString& textButton1,
82 int idButton0, int idButton1, int idDefault )
84 if ( idDefault == idButton0 ) idDefault = 0;
85 else if ( idDefault == idButton1 ) idDefault = 1;
88 int ret = QMessageBox::warning ( parent, caption, text, textButton0,
89 textButton1, QString::null, idDefault );
90 qApp->processEvents(); /* update desktop */
91 return ( ret == 0 ? idButton0 : idButton1 );
95 Shows error message box with two buttons
96 Returns id of the pressed button or -1 if escaped [ static ]
98 int QAD_MessageBox::error2 ( QWidget* parent, const QString& caption, const QString& text,
99 const QString& textButton0, const QString& textButton1,
100 int idButton0, int idButton1, int idDefault )
102 if ( idDefault == idButton0 ) idDefault = 0;
103 else if ( idDefault == idButton1 ) idDefault = 1;
106 int ret = QMessageBox::critical ( parent, caption, text, textButton0,
107 textButton1, QString::null, idDefault );
108 qApp->processEvents(); /* update desktop */
109 return ( ret == 0 ? idButton0 : idButton1 );
113 Shows info message box with three buttons.
114 Returns id of the pressed button or -1 if escaped [ static ]
116 int QAD_MessageBox::info3 ( QWidget* parent, const QString& caption, const QString& text,
117 const QString& textButton0, const QString& textButton1,
118 const QString& textButton2, int idButton0, int idButton1,
119 int idButton2, int idDefault )
121 if ( idDefault == idButton0 ) idDefault = 0;
122 else if ( idDefault == idButton1 ) idDefault = 1;
123 else if ( idDefault == idButton2 ) idDefault = 2;
126 int ret = QMessageBox::information ( parent, caption, text, textButton0,
127 textButton1, textButton2, idDefault );
128 qApp->processEvents(); /* update desktop */
131 case 0: return idButton0;
132 case 1: return idButton1;
133 case 2: return idButton2;
139 Shows warning message box with three buttons.
140 Returns id of the pressed button or -1 if escaped [ static ]
142 int QAD_MessageBox::warn3 ( QWidget* parent, const QString& caption, const QString& text,
143 const QString& textButton0, const QString& textButton1,
144 const QString& textButton2, int idButton0, int idButton1,
145 int idButton2, int idDefault )
147 if ( idDefault == idButton0 ) idDefault = 0;
148 else if ( idDefault == idButton1 ) idDefault = 1;
149 else if ( idDefault == idButton2 ) idDefault = 2;
152 int ret = QMessageBox::warning ( parent, caption, text, textButton0,
153 textButton1, textButton2, idDefault );
154 qApp->processEvents(); /* update desktop */
157 case 0: return idButton0;
158 case 1: return idButton1;
159 case 2: return idButton2;
165 Shows error message box with three buttons.
166 Returns id of the pressed button or -1 if escaped [ static ]
168 int QAD_MessageBox::error3 ( QWidget* parent, const QString& caption, const QString& text,
169 const QString& textButton0, const QString& textButton1,
170 const QString& textButton2, int idButton0, int idButton1,
171 int idButton2, int idDefault )
173 if ( idDefault == idButton0 ) idDefault = 0;
174 else if ( idDefault == idButton1 ) idDefault = 1;
175 else if ( idDefault == idButton2 ) idDefault = 2;
178 int ret = QMessageBox::critical ( parent, caption, text, textButton0,
179 textButton1, textButton2, idDefault );
180 qApp->processEvents(); /* update desktop */
183 case 0: return idButton0;
184 case 1: return idButton1;
185 case 2: return idButton2;