1 // SALOME SALOMEGUI : implementation of desktop and GUI kernel
3 // Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
6 // This library is free software; you can redistribute it and/or
7 // modify it under the terms of the GNU Lesser General Public
8 // License as published by the Free Software Foundation; either
9 // version 2.1 of the License.
11 // This library is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 // Lesser General Public License for more details.
16 // You should have received a copy of the GNU Lesser General Public
17 // License along with this library; if not, write to the Free Software
18 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 // See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
24 // File : QAD_MessageBox.cxx
31 \class QAD_MessageBox QAD_MessageBox.h
32 \brief Message dialog box for QAD-based application.
35 #include "QAD_MessageBox.h"
38 #include <qmessagebox.h>
39 #include <qapplication.h>
42 Shows info message box with one button [ static ]
44 int QAD_MessageBox::info1 ( QWidget* parent, const QString& caption, const QString& text,
45 const QString& textButton0 )
47 int ret = QMessageBox::information ( parent, caption, text, textButton0,
48 QString::null, QString::null, 0, 0);
49 qApp->processEvents(); /* update desktop */
54 Shows warning message box with one button [ static ]
56 int QAD_MessageBox::warn1 ( QWidget* parent, const QString& caption, const QString& text,
57 const QString& textButton0 )
59 int ret = QMessageBox::warning ( parent, caption, text, textButton0,
60 QString::null, QString::null, 0, 0);
61 qApp->processEvents(); /* update desktop */
66 Shows error message box with one button [ static ]
68 int QAD_MessageBox::error1 ( QWidget* parent, const QString& caption, const QString& text,
69 const QString& textButton0 )
71 int ret = QMessageBox::critical ( parent, caption, text, textButton0,
72 QString::null, QString::null, 0, 0);
73 qApp->processEvents(); /* update desktop */
78 Shows info message box with two buttons.
79 Returns id of the pressed button or -1 if escaped [ static ]
81 int QAD_MessageBox::info2 ( QWidget* parent, const QString& caption, const QString& text,
82 const QString& textButton0, const QString& textButton1,
83 int idButton0, int idButton1, int idDefault )
85 if ( idDefault == idButton0 ) idDefault = 0;
86 else if ( idDefault == idButton1 ) idDefault = 1;
89 int ret = QMessageBox::information ( parent, caption, text, textButton0,
90 textButton1, QString::null, idDefault );
91 qApp->processEvents(); /* update desktop */
92 return ( ret == 0 ? idButton0 : idButton1 );
96 Shows warning message box with two buttons.
97 Returns id of the pressed button or -1 if escaped [ static ]
99 int QAD_MessageBox::warn2 ( QWidget* parent, const QString& caption, const QString& text,
100 const QString& textButton0, const QString& textButton1,
101 int idButton0, int idButton1, int idDefault )
103 if ( idDefault == idButton0 ) idDefault = 0;
104 else if ( idDefault == idButton1 ) idDefault = 1;
107 int ret = QMessageBox::warning ( parent, caption, text, textButton0,
108 textButton1, QString::null, idDefault );
109 qApp->processEvents(); /* update desktop */
110 return ( ret == 0 ? idButton0 : idButton1 );
114 Shows error message box with two buttons
115 Returns id of the pressed button or -1 if escaped [ static ]
117 int QAD_MessageBox::error2 ( QWidget* parent, const QString& caption, const QString& text,
118 const QString& textButton0, const QString& textButton1,
119 int idButton0, int idButton1, int idDefault )
121 if ( idDefault == idButton0 ) idDefault = 0;
122 else if ( idDefault == idButton1 ) idDefault = 1;
125 int ret = QMessageBox::critical ( parent, caption, text, textButton0,
126 textButton1, QString::null, idDefault );
127 qApp->processEvents(); /* update desktop */
128 return ( ret == 0 ? idButton0 : idButton1 );
132 Shows info message box with three buttons.
133 Returns id of the pressed button or -1 if escaped [ static ]
135 int QAD_MessageBox::info3 ( QWidget* parent, const QString& caption, const QString& text,
136 const QString& textButton0, const QString& textButton1,
137 const QString& textButton2, int idButton0, int idButton1,
138 int idButton2, int idDefault )
140 if ( idDefault == idButton0 ) idDefault = 0;
141 else if ( idDefault == idButton1 ) idDefault = 1;
142 else if ( idDefault == idButton2 ) idDefault = 2;
145 int ret = QMessageBox::information ( parent, caption, text, textButton0,
146 textButton1, textButton2, idDefault );
147 qApp->processEvents(); /* update desktop */
150 case 0: return idButton0;
151 case 1: return idButton1;
152 case 2: return idButton2;
158 Shows warning message box with three buttons.
159 Returns id of the pressed button or -1 if escaped [ static ]
161 int QAD_MessageBox::warn3 ( QWidget* parent, const QString& caption, const QString& text,
162 const QString& textButton0, const QString& textButton1,
163 const QString& textButton2, int idButton0, int idButton1,
164 int idButton2, int idDefault )
166 if ( idDefault == idButton0 ) idDefault = 0;
167 else if ( idDefault == idButton1 ) idDefault = 1;
168 else if ( idDefault == idButton2 ) idDefault = 2;
171 int ret = QMessageBox::warning ( parent, caption, text, textButton0,
172 textButton1, textButton2, idDefault );
173 qApp->processEvents(); /* update desktop */
176 case 0: return idButton0;
177 case 1: return idButton1;
178 case 2: return idButton2;
184 Shows error message box with three buttons.
185 Returns id of the pressed button or -1 if escaped [ static ]
187 int QAD_MessageBox::error3 ( QWidget* parent, const QString& caption, const QString& text,
188 const QString& textButton0, const QString& textButton1,
189 const QString& textButton2, int idButton0, int idButton1,
190 int idButton2, int idDefault )
192 if ( idDefault == idButton0 ) idDefault = 0;
193 else if ( idDefault == idButton1 ) idDefault = 1;
194 else if ( idDefault == idButton2 ) idDefault = 2;
197 int ret = QMessageBox::critical ( parent, caption, text, textButton0,
198 textButton1, textButton2, idDefault );
199 qApp->processEvents(); /* update desktop */
202 case 0: return idButton0;
203 case 1: return idButton1;
204 case 2: return idButton2;