1 // Copyright (C) 2005 OPEN CASCADE, CEA/DEN, EDF R&D, PRINCIPIA R&D
3 // This library is free software; you can redistribute it and/or
4 // modify it under the terms of the GNU Lesser General Public
5 // License as published by the Free Software Foundation; either
6 // version 2.1 of the License.
8 // This library is distributed in the hope that it will be useful
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 // Lesser General Public License for more details.
13 // You should have received a copy of the GNU Lesser General Public
14 // License along with this library; if not, write to the Free Software
15 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 // See http://www.salome-platform.org/
21 \class: SUIT_MessageBox
22 Message dialog box for SUIT-based application
24 Created: UI team, 02.10.00
27 #include "SUIT_MessageBox.h"
28 #include "SUIT_OverrideCursor.h"
30 #include <qmessagebox.h>
31 #include <qapplication.h>
34 Shows info message box with one button [ static ]
36 int SUIT_MessageBox::info1( QWidget* parent,
37 const QString& caption,
39 const QString& textButton0 )
41 SUIT_OverrideCursor cw( parent ? parent->cursor() : Qt::arrowCursor );
42 int ret = QMessageBox::information( parent, caption, text, textButton0,
43 QString::null, QString::null, 0, 0 );
44 qApp->processEvents();
49 Shows warning message box with one button [ static ]
51 int SUIT_MessageBox::warn1( QWidget* parent,
52 const QString& caption,
54 const QString& textButton0 )
56 SUIT_OverrideCursor cw( parent ? parent->cursor() : Qt::arrowCursor );
57 int ret = QMessageBox::warning( parent, caption, text, textButton0,
58 QString::null, QString::null, 0, 0 );
59 qApp->processEvents();
64 Shows error message box with one button [ static ]
66 int SUIT_MessageBox::error1( QWidget* parent,
67 const QString& caption,
69 const QString& textButton0 )
71 SUIT_OverrideCursor cw( parent ? parent->cursor() : Qt::arrowCursor );
72 int ret = QMessageBox::critical( parent, caption, text, textButton0,
73 QString::null, QString::null, 0, 0 );
74 qApp->processEvents();
79 Shows question message box with one button [ static ]
81 int SUIT_MessageBox::question1( QWidget* parent,
82 const QString& caption,
84 const QString& textButton0 )
86 SUIT_OverrideCursor cw( parent ? parent->cursor() : Qt::arrowCursor );
87 int ret = QMessageBox::question( parent, caption, text, textButton0,
88 QString::null, QString::null, 0, 0 );
89 qApp->processEvents();
94 Shows info message box with two buttons.
95 Returns id of the pressed button or -1 if escaped [ static ]
97 int SUIT_MessageBox::info2( QWidget* parent,
98 const QString& caption,
100 const QString& textButton0,
101 const QString& textButton1,
102 int idButton0, int idButton1, int idDefault )
104 SUIT_OverrideCursor cw( parent ? parent->cursor() : Qt::arrowCursor );
105 if ( idDefault == idButton0 )
107 else if ( idDefault == idButton1 )
112 int ret = QMessageBox::information( parent, caption, text, textButton0,
113 textButton1, QString::null, idDefault );
114 qApp->processEvents();
115 return ( ret == 0 ? idButton0 : idButton1 );
119 Shows warning message box with two buttons.
120 Returns id of the pressed button or -1 if escaped [ static ]
122 int SUIT_MessageBox::warn2( QWidget* parent,
123 const QString& caption,
125 const QString& textButton0,
126 const QString& textButton1,
127 int idButton0, int idButton1, int idDefault )
129 SUIT_OverrideCursor cw( parent ? parent->cursor() : Qt::arrowCursor );
131 if ( idDefault == idButton0 )
133 else if ( idDefault == idButton1 )
138 int ret = QMessageBox::warning( parent, caption, text, textButton0,
139 textButton1, QString::null, idDefault );
140 qApp->processEvents();
141 return ( ret == 0 ? idButton0 : idButton1 );
145 Shows error message box with two buttons
146 Returns id of the pressed button or -1 if escaped [ static ]
148 int SUIT_MessageBox::error2( QWidget* parent,
149 const QString& caption,
151 const QString& textButton0,
152 const QString& textButton1,
153 int idButton0, int idButton1, int idDefault )
155 SUIT_OverrideCursor cw( parent ? parent->cursor() : Qt::arrowCursor );
157 if ( idDefault == idButton0 )
159 else if ( idDefault == idButton1 )
164 int ret = QMessageBox::critical( parent, caption, text, textButton0,
165 textButton1, QString::null, idDefault );
166 qApp->processEvents();
167 return ( ret == 0 ? idButton0 : idButton1 );
171 Shows question message box with two buttons
172 Returns id of the pressed button or -1 if escaped [ static ]
174 int SUIT_MessageBox::question2( QWidget* parent,
175 const QString& caption,
177 const QString& textButton0,
178 const QString& textButton1,
179 int idButton0, int idButton1, int idDefault )
181 SUIT_OverrideCursor cw( parent ? parent->cursor() : Qt::arrowCursor );
183 if ( idDefault == idButton0 )
185 else if ( idDefault == idButton1 )
190 int ret = QMessageBox::question( parent, caption, text, textButton0,
191 textButton1, QString::null, idDefault );
192 qApp->processEvents();
193 return ( ret == 0 ? idButton0 : idButton1 );
197 Shows info message box with three buttons.
198 Returns id of the pressed button or -1 if escaped [ static ]
200 int SUIT_MessageBox::info3( QWidget* parent,
201 const QString& caption,
203 const QString& textButton0,
204 const QString& textButton1,
205 const QString& textButton2,
206 int idButton0, int idButton1,
207 int idButton2, int idDefault )
209 SUIT_OverrideCursor cw( parent ? parent->cursor() : Qt::arrowCursor );
211 if ( idDefault == idButton0 )
213 else if ( idDefault == idButton1 )
215 else if ( idDefault == idButton2 )
220 int ret = QMessageBox::information( parent, caption, text, textButton0,
221 textButton1, textButton2, idDefault );
222 qApp->processEvents();
236 Shows warning message box with three buttons.
237 Returns id of the pressed button or -1 if escaped [ static ]
239 int SUIT_MessageBox::warn3( QWidget* parent,
240 const QString& caption,
242 const QString& textButton0,
243 const QString& textButton1,
244 const QString& textButton2,
245 int idButton0, int idButton1,
246 int idButton2, int idDefault )
248 SUIT_OverrideCursor cw( parent ? parent->cursor() : Qt::arrowCursor );
250 if ( idDefault == idButton0 )
252 else if ( idDefault == idButton1 )
254 else if ( idDefault == idButton2 )
259 int ret = QMessageBox::warning( parent, caption, text, textButton0,
260 textButton1, textButton2, idDefault );
261 qApp->processEvents();
275 Shows error message box with three buttons.
276 Returns id of the pressed button or -1 if escaped [ static ]
278 int SUIT_MessageBox::error3( QWidget* parent,
279 const QString& caption,
281 const QString& textButton0,
282 const QString& textButton1,
283 const QString& textButton2,
284 int idButton0, int idButton1,
285 int idButton2, int idDefault )
287 SUIT_OverrideCursor cw( parent ? parent->cursor() : Qt::arrowCursor );
289 if ( idDefault == idButton0 )
291 else if ( idDefault == idButton1 )
293 else if ( idDefault == idButton2 )
298 int ret = QMessageBox::critical( parent, caption, text, textButton0,
299 textButton1, textButton2, idDefault );
300 qApp->processEvents();
314 Shows question message box with three buttons.
315 Returns id of the pressed button or -1 if escaped [ static ]
317 int SUIT_MessageBox::question3( QWidget* parent,
318 const QString& caption,
320 const QString& textButton0,
321 const QString& textButton1,
322 const QString& textButton2,
323 int idButton0, int idButton1,
324 int idButton2, int idDefault )
326 SUIT_OverrideCursor cw( parent ? parent->cursor() : Qt::arrowCursor );
328 if ( idDefault == idButton0 )
330 else if ( idDefault == idButton1 )
332 else if ( idDefault == idButton2 )
337 int ret = QMessageBox::question( parent, caption, text, textButton0,
338 textButton1, textButton2, idDefault );
339 qApp->processEvents();