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