]>
Commit | Line | Data |
---|---|---|
23324ae1 FM |
1 | ///////////////////////////////////////////////////////////////////////////// |
2 | // Name: msgdlg.h | |
e54c96f1 | 3 | // Purpose: interface of wxMessageDialog |
23324ae1 FM |
4 | // Author: wxWidgets team |
5 | // RCS-ID: $Id$ | |
6 | // Licence: wxWindows license | |
7 | ///////////////////////////////////////////////////////////////////////////// | |
8 | ||
9 | /** | |
10 | @class wxMessageDialog | |
11 | @wxheader{msgdlg.h} | |
7c913512 | 12 | |
23324ae1 FM |
13 | This class represents a dialog that shows a single or multi-line message, |
14 | with a choice of OK, Yes, No and Cancel buttons. | |
7c913512 | 15 | |
23324ae1 FM |
16 | @library{wxcore} |
17 | @category{cmndlg} | |
7c913512 | 18 | |
e54c96f1 | 19 | @see @ref overview_wxmessagedialogoverview "wxMessageDialog overview" |
23324ae1 FM |
20 | */ |
21 | class wxMessageDialog : public wxDialog | |
22 | { | |
23 | public: | |
24 | /** | |
25 | Constructor. Use ShowModal() to show the dialog. | |
26 | ||
7c913512 | 27 | @param parent |
4cc4bfaf | 28 | Parent window. |
7c913512 | 29 | @param message |
4cc4bfaf | 30 | Message to show on the dialog. |
7c913512 | 31 | @param caption |
4cc4bfaf | 32 | The dialog caption. |
7c913512 | 33 | @param style |
4cc4bfaf FM |
34 | A dialog style (bitlist) containing flags chosen from the following: |
35 | ||
36 | ||
37 | ||
38 | ||
39 | ||
40 | ||
41 | ||
42 | wxOK | |
43 | ||
44 | ||
45 | ||
46 | ||
47 | Show an OK button. | |
48 | ||
49 | ||
50 | ||
51 | ||
52 | ||
53 | wxCANCEL | |
54 | ||
55 | ||
56 | ||
23324ae1 | 57 | |
4cc4bfaf | 58 | Show a Cancel button. |
23324ae1 | 59 | |
23324ae1 FM |
60 | |
61 | ||
23324ae1 | 62 | |
23324ae1 | 63 | |
4cc4bfaf | 64 | wxYES_NO |
23324ae1 | 65 | |
23324ae1 | 66 | |
23324ae1 FM |
67 | |
68 | ||
4cc4bfaf | 69 | Show Yes and No buttons. |
23324ae1 | 70 | |
23324ae1 FM |
71 | |
72 | ||
4cc4bfaf FM |
73 | |
74 | ||
75 | wxYES_DEFAULT | |
76 | ||
77 | ||
78 | ||
79 | ||
80 | Used with wxYES_NO, makes Yes button the default - which is the default | |
23324ae1 FM |
81 | behaviour. |
82 | ||
23324ae1 FM |
83 | |
84 | ||
23324ae1 | 85 | |
23324ae1 | 86 | |
4cc4bfaf | 87 | wxNO_DEFAULT |
23324ae1 | 88 | |
23324ae1 | 89 | |
23324ae1 FM |
90 | |
91 | ||
4cc4bfaf | 92 | Used with wxYES_NO, makes No button the default. |
23324ae1 | 93 | |
23324ae1 FM |
94 | |
95 | ||
23324ae1 | 96 | |
23324ae1 | 97 | |
4cc4bfaf | 98 | wxICON_EXCLAMATION |
23324ae1 | 99 | |
23324ae1 | 100 | |
23324ae1 FM |
101 | |
102 | ||
4cc4bfaf FM |
103 | Shows an exclamation mark icon. |
104 | ||
105 | ||
106 | ||
107 | ||
108 | ||
109 | wxICON_HAND | |
110 | ||
111 | ||
112 | ||
113 | ||
114 | Shows an error icon. | |
115 | ||
116 | ||
117 | ||
118 | ||
119 | ||
120 | wxICON_ERROR | |
23324ae1 | 121 | |
23324ae1 FM |
122 | |
123 | ||
23324ae1 | 124 | |
4cc4bfaf FM |
125 | Shows an error icon - the same as wxICON_HAND. |
126 | ||
127 | ||
128 | ||
129 | ||
130 | ||
131 | wxICON_QUESTION | |
132 | ||
133 | ||
134 | ||
135 | ||
136 | Shows a question mark icon. | |
137 | ||
138 | ||
139 | ||
140 | ||
141 | ||
142 | wxICON_INFORMATION | |
143 | ||
144 | ||
145 | ||
146 | ||
147 | Shows an information (i) icon. | |
148 | ||
149 | ||
150 | ||
151 | ||
152 | ||
153 | wxSTAY_ON_TOP | |
154 | ||
155 | ||
156 | ||
157 | ||
158 | The message box stays on top of all other window, even those of the other | |
159 | applications (Windows only). | |
7c913512 | 160 | @param pos |
4cc4bfaf | 161 | Dialog position. Not Windows. |
23324ae1 FM |
162 | */ |
163 | wxMessageDialog(wxWindow* parent, const wxString& message, | |
164 | const wxString& caption = "Message box", | |
4cc4bfaf | 165 | long style = wxOK | wxCANCEL, |
23324ae1 FM |
166 | const wxPoint& pos = wxDefaultPosition); |
167 | ||
168 | /** | |
169 | Destructor. | |
170 | */ | |
171 | ~wxMessageDialog(); | |
172 | ||
173 | /** | |
174 | Sets the extended message for the dialog: this message is usually an extension | |
7c913512 | 175 | of the short message specified in the constructor or set with |
23324ae1 FM |
176 | SetMessage(). If it is set, the main message |
177 | appears highlighted -- if supported -- and this message appears beneath it in | |
178 | normal font. On the platforms which don't support extended messages, it is | |
179 | simply appended to the normal message with a new line separating them. | |
180 | */ | |
181 | void SetExtendedMessage(const wxString exMsg); | |
182 | ||
183 | /** | |
184 | Sets the message shown by the dialog. | |
185 | */ | |
186 | void SetMessage(const wxString msg); | |
187 | ||
188 | /** | |
189 | Overrides the default labels of the OK and Cancel buttons. | |
7c913512 | 190 | Please see the remarks in |
23324ae1 FM |
191 | SetYesNoLabels() documentation. |
192 | */ | |
193 | bool SetOKCancelLabels(const wxString ok, const wxString cancel); | |
194 | ||
195 | /** | |
196 | Overrides the default label of the OK button. | |
7c913512 | 197 | Please see the remarks in |
23324ae1 FM |
198 | SetYesNoLabels() documentation. |
199 | */ | |
200 | bool SetOKLabel(const wxString ok); | |
201 | ||
202 | /** | |
203 | Overrides the default labels of the Yes, No and Cancel buttons. | |
7c913512 | 204 | Please see the remarks in |
23324ae1 FM |
205 | SetYesNoLabels() documentation. |
206 | */ | |
207 | bool SetYesNoCancelLabels(const wxString yes, const wxString no, | |
208 | const wxString cancel); | |
209 | ||
210 | /** | |
211 | Overrides the default labels of the Yes and No buttons. | |
23324ae1 FM |
212 | Notice that this function is not currently available on all platforms, so it |
213 | may return @false to indicate that the labels couldn't be changed. If it | |
214 | returns @true (currently only under wxMac), the labels were set successfully. | |
215 | Typically, if the function was used successfully, the main dialog message may | |
216 | need to be changed, e.g.: | |
217 | */ | |
218 | bool SetYesNoLabels(const wxString yes, const wxString no); | |
219 | ||
220 | /** | |
221 | Shows the dialog, returning one of wxID_OK, wxID_CANCEL, wxID_YES, wxID_NO. | |
222 | */ | |
223 | int ShowModal(); | |
224 | }; | |
225 | ||
226 | ||
e54c96f1 | 227 | |
23324ae1 FM |
228 | // ============================================================================ |
229 | // Global functions/macros | |
230 | // ============================================================================ | |
231 | ||
232 | /** | |
4cc4bfaf | 233 | General purpose message dialog. @a style may be a bit list of the |
23324ae1 | 234 | following identifiers: |
7c913512 | 235 | |
23324ae1 | 236 | wxYES_NO |
7c913512 | 237 | |
23324ae1 FM |
238 | Puts Yes and No buttons on the message box. May be combined with |
239 | wxCANCEL. | |
7c913512 | 240 | |
23324ae1 | 241 | wxCANCEL |
7c913512 | 242 | |
23324ae1 FM |
243 | Puts a Cancel button on the message box. May only be combined with |
244 | wxYES_NO or wxOK. | |
7c913512 | 245 | |
23324ae1 | 246 | wxOK |
7c913512 | 247 | |
23324ae1 | 248 | Puts an Ok button on the message box. May be combined with wxCANCEL. |
7c913512 | 249 | |
23324ae1 | 250 | wxICON_EXCLAMATION |
7c913512 | 251 | |
23324ae1 | 252 | Displays an exclamation mark symbol. |
7c913512 | 253 | |
23324ae1 | 254 | wxICON_HAND |
7c913512 | 255 | |
23324ae1 | 256 | Displays an error symbol. |
7c913512 | 257 | |
23324ae1 | 258 | wxICON_ERROR |
7c913512 | 259 | |
23324ae1 | 260 | Displays an error symbol - the same as wxICON_HAND. |
7c913512 | 261 | |
23324ae1 | 262 | wxICON_QUESTION |
7c913512 | 263 | |
23324ae1 | 264 | Displays a question mark symbol. |
7c913512 | 265 | |
23324ae1 | 266 | wxICON_INFORMATION |
7c913512 | 267 | |
23324ae1 | 268 | Displays an information symbol. |
7c913512 | 269 | |
23324ae1 | 270 | The return value is one of: wxYES, wxNO, wxCANCEL, wxOK. |
23324ae1 | 271 | For example: |
4cc4bfaf | 272 | |
23324ae1 FM |
273 | @code |
274 | ... | |
275 | int answer = wxMessageBox("Quit program?", "Confirm", | |
276 | wxYES_NO | wxCANCEL, main_frame); | |
277 | if (answer == wxYES) | |
278 | main_frame-Close(); | |
279 | ... | |
280 | @endcode | |
7c913512 | 281 | |
4cc4bfaf | 282 | @a message may contain newline characters, in which case the |
23324ae1 FM |
283 | message will be split into separate lines, to cater for large messages. |
284 | */ | |
285 | int wxMessageBox(const wxString& message, | |
286 | const wxString& caption = "Message", | |
287 | int style = wxOK, | |
4cc4bfaf | 288 | wxWindow* parent = NULL, |
23324ae1 FM |
289 | int x = -1, int y = -1); |
290 |