]> git.saurik.com Git - wxWidgets.git/blame - interface/wx/choicdlg.h
Move code removing "-psn_xxx" command line arguments to common code.
[wxWidgets.git] / interface / wx / choicdlg.h
CommitLineData
23324ae1
FM
1/////////////////////////////////////////////////////////////////////////////
2// Name: choicdlg.h
ba2874ff 3// Purpose: interface of wx[Multi|Single]ChoiceDialog
23324ae1 4// Author: wxWidgets team
526954c5 5// Licence: wxWindows licence
23324ae1
FM
6/////////////////////////////////////////////////////////////////////////////
7
0b59366f
VZ
8/**
9 Default width of the choice dialog.
10*/
11#define wxCHOICE_WIDTH 150
12
13/**
14 Default height of the choice dialog.
15*/
16#define wxCHOICE_HEIGHT 200
17
18/**
19 Default style of the choice dialog.
20
21 @remarks wxRESIZE_BORDER is not used under WinCE.
22*/
23#define wxCHOICEDLG_STYLE (wxDEFAULT_DIALOG_STYLE | wxOK | wxCANCEL | wxCENTRE | wxRESIZE_BORDER)
24
25
23324ae1
FM
26/**
27 @class wxMultiChoiceDialog
7c913512 28
bfac6166
BP
29 This class represents a dialog that shows a list of strings, and allows the
30 user to select one or more.
7c913512 31
634034d5
VZ
32 @beginStyleTable
33 @style{wxOK}
34 Show an OK button.
35 @style{wxCANCEL}
36 Show a Cancel button.
37 @style{wxCENTRE}
38 Centre the message. Not Windows.
39 @endStyleTable
40
23324ae1
FM
41 @library{wxbase}
42 @category{cmndlg}
7c913512 43
ba2874ff 44 @see @ref overview_cmndlg_multichoice, wxSingleChoiceDialog
23324ae1
FM
45*/
46class wxMultiChoiceDialog : public wxDialog
47{
48public:
49 //@{
50 /**
51 Constructor taking an array of wxString choices.
ba2874ff 52
7c913512 53 @param parent
4cc4bfaf 54 Parent window.
7c913512 55 @param message
4cc4bfaf 56 Message to show on the dialog.
7c913512 57 @param caption
4cc4bfaf 58 The dialog caption.
7c913512 59 @param n
4cc4bfaf 60 The number of choices.
7c913512 61 @param choices
4cc4bfaf 62 An array of strings, or a string list, containing the choices.
7c913512 63 @param style
4cc4bfaf 64 A dialog style (bitlist) containing flags chosen from standard
634034d5
VZ
65 dialog styles and the ones listed in the class documentation. The
66 default value is equivalent to wxDEFAULT_DIALOG_STYLE |
67 wxRESIZE_BORDER | wxOK | wxCANCEL | wxCENTRE.
ba2874ff
BP
68 @param pos
69 Dialog position. Not Windows.
70
23324ae1 71 @remarks Use ShowModal() to show the dialog.
bfac6166 72
1058f652
MB
73 @beginWxPerlOnly
74 Not supported by wxPerl.
75 @endWxPerlOnly
23324ae1
FM
76 */
77 wxMultiChoiceDialog(wxWindow* parent, const wxString& message,
78 const wxString& caption,
bfac6166 79 int n, const wxString* choices,
23324ae1
FM
80 long style = wxCHOICEDLG_STYLE,
81 const wxPoint& pos = wxDefaultPosition);
792255cc
VZ
82 /**
83 Constructor taking an array of wxString choices.
84
85 @param parent
86 Parent window.
87 @param message
88 Message to show on the dialog.
89 @param caption
90 The dialog caption.
91 @param choices
92 An array of strings, or a string list, containing the choices.
93 @param style
94 A dialog style (bitlist) containing flags chosen from standard
634034d5
VZ
95 dialog styles and the ones listed in the class documentation. The
96 default value is equivalent to wxDEFAULT_DIALOG_STYLE |
97 wxRESIZE_BORDER | wxOK | wxCANCEL | wxCENTRE.
792255cc
VZ
98 @param pos
99 Dialog position. Not Windows.
100
792255cc
VZ
101 @remarks Use ShowModal() to show the dialog.
102
1058f652
MB
103 @beginWxPerlOnly
104 Use an array reference for the @a choices parameter.
105 @endWxPerlOnly
792255cc 106 */
7c913512
FM
107 wxMultiChoiceDialog(wxWindow* parent,
108 const wxString& message,
109 const wxString& caption,
110 const wxArrayString& choices,
111 long style = wxCHOICEDLG_STYLE,
112 const wxPoint& pos = wxDefaultPosition);
23324ae1
FM
113 //@}
114
115 /**
116 Returns array with indexes of selected items.
117 */
c68b8967 118 wxArrayInt GetSelections() const;
23324ae1
FM
119
120 /**
121 Sets selected items from the array of selected items' indexes.
122 */
b7e94bd7 123 void SetSelections(const wxArrayInt& selections);
23324ae1
FM
124
125 /**
126 Shows the dialog, returning either wxID_OK or wxID_CANCEL.
127 */
128 int ShowModal();
129};
130
131
e54c96f1 132
23324ae1
FM
133/**
134 @class wxSingleChoiceDialog
7c913512 135
bfac6166
BP
136 This class represents a dialog that shows a list of strings, and allows the
137 user to select one. Double-clicking on a list item is equivalent to
23324ae1 138 single-clicking and then pressing OK.
7c913512 139
634034d5
VZ
140 @beginStyleTable
141 @style{wxOK}
142 Show an OK button.
143 @style{wxCANCEL}
144 Show a Cancel button.
145 @style{wxCENTRE}
146 Centre the message. Not Windows.
147 @endStyleTable
148
23324ae1
FM
149 @library{wxbase}
150 @category{cmndlg}
7c913512 151
ba2874ff 152 @see @ref overview_cmndlg_singlechoice, wxMultiChoiceDialog
23324ae1
FM
153*/
154class wxSingleChoiceDialog : public wxDialog
155{
156public:
157 //@{
158 /**
ba2874ff
BP
159 Constructor, taking an array of wxString choices and optional client
160 data.
161
7c913512 162 @param parent
4cc4bfaf 163 Parent window.
7c913512 164 @param message
4cc4bfaf 165 Message to show on the dialog.
7c913512 166 @param caption
4cc4bfaf 167 The dialog caption.
7c913512 168 @param n
4cc4bfaf 169 The number of choices.
7c913512 170 @param choices
4cc4bfaf 171 An array of strings, or a string list, containing the choices.
7c913512 172 @param clientData
bfac6166 173 An array of client data to be associated with the items. See
fc12b1f1 174 GetSelectionData().
7c913512 175 @param style
4cc4bfaf 176 A dialog style (bitlist) containing flags chosen from standard
634034d5
VZ
177 dialog styles and the ones listed in the class documentation. The
178 default value is equivalent to wxDEFAULT_DIALOG_STYLE |
179 wxRESIZE_BORDER | wxOK | wxCANCEL | wxCENTRE.
ba2874ff
BP
180 @param pos
181 Dialog position. Not Windows.
182
23324ae1 183 @remarks Use ShowModal() to show the dialog.
bfac6166 184
1058f652
MB
185 @beginWxPerlOnly
186 Not supported by wxPerl.
187 @endWxPerlOnly
23324ae1
FM
188 */
189 wxSingleChoiceDialog(wxWindow* parent, const wxString& message,
190 const wxString& caption,
bfac6166 191 int n, const wxString* choices,
4cc4bfaf 192 void** clientData = NULL,
23324ae1
FM
193 long style = wxCHOICEDLG_STYLE,
194 const wxPoint& pos = wxDefaultPosition);
792255cc
VZ
195 /**
196 Constructor, taking an array of wxString choices and optional client
197 data.
198
199 @param parent
200 Parent window.
201 @param message
202 Message to show on the dialog.
203 @param caption
204 The dialog caption.
205 @param choices
206 An array of strings, or a string list, containing the choices.
207 @param clientData
208 An array of client data to be associated with the items. See
fc12b1f1 209 GetSelectionData().
792255cc
VZ
210 @param style
211 A dialog style (bitlist) containing flags chosen from standard
634034d5
VZ
212 dialog styles and the ones listed in the class documentation. The
213 default value is equivalent to wxDEFAULT_DIALOG_STYLE |
214 wxRESIZE_BORDER | wxOK | wxCANCEL | wxCENTRE.
792255cc
VZ
215 @param pos
216 Dialog position. Not Windows.
217
792255cc
VZ
218 @remarks Use ShowModal() to show the dialog.
219
1058f652
MB
220 @beginWxPerlOnly
221 Use an array reference for the @a choices parameter.
222 @endWxPerlOnly
792255cc 223 */
7c913512
FM
224 wxSingleChoiceDialog(wxWindow* parent,
225 const wxString& message,
226 const wxString& caption,
227 const wxArrayString& choices,
4cc4bfaf 228 void** clientData = NULL,
7c913512
FM
229 long style = wxCHOICEDLG_STYLE,
230 const wxPoint& pos = wxDefaultPosition);
23324ae1
FM
231 //@}
232
233 /**
234 Returns the index of selected item.
235 */
328f5751 236 int GetSelection() const;
23324ae1
FM
237
238 /**
239 Returns the client data associated with the selection.
fc12b1f1
VZ
240
241 @since 2.9.4
23324ae1 242 */
fc12b1f1 243 void* GetSelectionData() const;
23324ae1
FM
244
245 /**
246 Returns the selected string.
247 */
328f5751 248 wxString GetStringSelection() const;
23324ae1
FM
249
250 /**
251 Sets the index of the initially selected item.
252 */
b7e94bd7 253 void SetSelection(int selection);
23324ae1
FM
254
255 /**
256 Shows the dialog, returning either wxID_OK or wxID_CANCEL.
257 */
258 int ShowModal();
259};
260
261
e54c96f1 262
23324ae1
FM
263// ============================================================================
264// Global functions/macros
265// ============================================================================
266
b21126db 267/** @addtogroup group_funcmacro_dialog */
23324ae1 268//@{
ba2874ff 269
23324ae1 270/**
ba2874ff
BP
271 Same as wxGetSingleChoice() but returns the index representing the
272 selected string. If the user pressed cancel, -1 is returned.
273
274 @header{wx/choicdlg.h}
1058f652
MB
275
276 @beginWxPerlOnly
277 Use an array reference for the @a aChoices parameter.
278 @endWxPerlOnly
23324ae1
FM
279*/
280int wxGetSingleChoiceIndex(const wxString& message,
281 const wxString& caption,
282 const wxArrayString& aChoices,
4cc4bfaf 283 wxWindow* parent = NULL,
0b59366f
VZ
284 int x = wxDefaultCoord,
285 int y = wxDefaultCoord,
4cc4bfaf 286 bool centre = true,
0b59366f
VZ
287 int width = wxCHOICE_WIDTH,
288 int height = wxCHOICE_HEIGHT,
697f4a96
VZ
289 int initialSelection = 0);
290
7c913512
FM
291int wxGetSingleChoiceIndex(const wxString& message,
292 const wxString& caption,
293 int n,
294 const wxString& choices[],
4cc4bfaf 295 wxWindow* parent = NULL,
0b59366f
VZ
296 int x = wxDefaultCoord,
297 int y = wxDefaultCoord,
4cc4bfaf 298 bool centre = true,
0b59366f
VZ
299 int width = wxCHOICE_WIDTH,
300 int height = wxCHOICE_HEIGHT,
697f4a96
VZ
301 int initialSelection = 0);
302
303
304int wxGetSingleChoiceIndex(const wxString& message,
305 const wxString& caption,
306 const wxArrayString& choices,
307 int initialSelection,
308 wxWindow *parent = NULL);
ba2874ff 309
697f4a96
VZ
310int wxGetSingleChoiceIndex(const wxString& message,
311 const wxString& caption,
312 int n, const wxString *choices,
313 int initialSelection,
314 wxWindow *parent = NULL);
23324ae1
FM
315//@}
316
b21126db 317/** @addtogroup group_funcmacro_dialog */
23324ae1 318//@{
ba2874ff 319
23324ae1
FM
320/**
321 Pops up a dialog box containing a message, OK/Cancel buttons and a
ba2874ff
BP
322 single-selection listbox. The user may choose an item and press OK to
323 return a string or Cancel to return the empty string. Use
324 wxGetSingleChoiceIndex() if empty string is a valid choice and if you want
325 to be able to detect pressing Cancel reliably.
326
327 You may pass the list of strings to choose from either using @c choices
4cc4bfaf 328 which is an array of @a n strings for the listbox or by using a single
ba2874ff
BP
329 @c aChoices parameter of type wxArrayString.
330
331 If @c centre is @true, the message text (which may include new line
23324ae1 332 characters) is centred; if @false, the message is left-justified.
ba2874ff
BP
333
334 @header{wx/choicdlg.h}
1058f652
MB
335
336 @beginWxPerlOnly
337 Use an array reference for the @a choices parameter.
338 @endWxPerlOnly
23324ae1
FM
339*/
340wxString wxGetSingleChoice(const wxString& message,
341 const wxString& caption,
342 const wxArrayString& aChoices,
4cc4bfaf 343 wxWindow* parent = NULL,
0b59366f
VZ
344 int x = wxDefaultCoord,
345 int y = wxDefaultCoord,
4cc4bfaf 346 bool centre = true,
0b59366f
VZ
347 int width = wxCHOICE_WIDTH,
348 int height = wxCHOICE_HEIGHT,
697f4a96 349 int initialSelection = 0);
7c913512
FM
350wxString wxGetSingleChoice(const wxString& message,
351 const wxString& caption,
352 int n,
353 const wxString& choices[],
4cc4bfaf 354 wxWindow* parent = NULL,
0b59366f
VZ
355 int x = wxDefaultCoord,
356 int y = wxDefaultCoord,
4cc4bfaf 357 bool centre = true,
0b59366f
VZ
358 int width = wxCHOICE_WIDTH,
359 int height = wxCHOICE_HEIGHT,
697f4a96
VZ
360 int initialSelection = 0);
361
362
363wxString wxGetSingleChoice(const wxString& message,
364 const wxString& caption,
365 const wxArrayString& choices,
366 int initialSelection,
367 wxWindow *parent = NULL);
368
369wxString wxGetSingleChoice(const wxString& message,
370 const wxString& caption,
371 int n, const wxString *choices,
372 int initialSelection,
373 wxWindow *parent = NULL);
ba2874ff 374
23324ae1
FM
375//@}
376
b21126db 377/** @addtogroup group_funcmacro_dialog */
23324ae1 378//@{
ba2874ff 379
23324ae1 380/**
ba2874ff
BP
381 Same as wxGetSingleChoice but takes an array of client data pointers
382 corresponding to the strings, and returns one of these pointers or @NULL
383 if Cancel was pressed. The @c client_data array must have the same number
384 of elements as @c choices or @c aChoices!
385
386 @header{wx/choicdlg.h}
1058f652
MB
387
388 @beginWxPerlOnly
389 Use an array reference for the @a aChoices and @a client_data parameters.
390 @endWxPerlOnly
23324ae1
FM
391*/
392wxString wxGetSingleChoiceData(const wxString& message,
393 const wxString& caption,
394 const wxArrayString& aChoices,
395 const wxString& client_data[],
4cc4bfaf 396 wxWindow* parent = NULL,
0b59366f
VZ
397 int x = wxDefaultCoord,
398 int y = wxDefaultCoord,
4cc4bfaf 399 bool centre = true,
0b59366f
VZ
400 int width = wxCHOICE_WIDTH,
401 int height = wxCHOICE_HEIGHT,
697f4a96
VZ
402 int initialSelection = 0);
403
7c913512
FM
404wxString wxGetSingleChoiceData(const wxString& message,
405 const wxString& caption,
406 int n,
407 const wxString& choices[],
408 const wxString& client_data[],
4cc4bfaf 409 wxWindow* parent = NULL,
0b59366f
VZ
410 int x = wxDefaultCoord,
411 int y = wxDefaultCoord,
4cc4bfaf 412 bool centre = true,
0b59366f
VZ
413 int width = wxCHOICE_WIDTH,
414 int height = wxCHOICE_HEIGHT,
697f4a96
VZ
415 int initialSelection = 0);
416
417void* wxGetSingleChoiceData(const wxString& message,
418 const wxString& caption,
419 const wxArrayString& choices,
420 void **client_data,
421 int initialSelection,
422 wxWindow *parent = NULL);
423
424void* wxGetSingleChoiceData(const wxString& message,
425 const wxString& caption,
426 int n, const wxString *choices,
427 void **client_data,
428 int initialSelection,
429 wxWindow *parent = NULL);
ba2874ff 430
23324ae1
FM
431//@}
432
b21126db 433/** @addtogroup group_funcmacro_dialog */
23324ae1 434//@{
ba2874ff 435
23324ae1
FM
436/**
437 Pops up a dialog box containing a message, OK/Cancel buttons and a
438 multiple-selection listbox. The user may choose an arbitrary (including 0)
439 number of items in the listbox whose indices will be returned in
ba2874ff 440 @c selections array. The initial contents of this array will be used to
e5cfb314
VZ
441 select the items when the dialog is shown. If the user cancels the dialog,
442 the function returns -1 and @c selections array is left unchanged.
ba2874ff
BP
443
444 You may pass the list of strings to choose from either using @c choices
4cc4bfaf 445 which is an array of @a n strings for the listbox or by using a single
ba2874ff
BP
446 @c aChoices parameter of type wxArrayString.
447
448 If @c centre is @true, the message text (which may include new line
23324ae1 449 characters) is centred; if @false, the message is left-justified.
ba2874ff
BP
450
451 @header{wx/choicdlg.h}
1058f652
MB
452
453 @beginWxPerlOnly
454 Use an array reference for the @a choices parameter.
455 In wxPerl there is no @a selections parameter; the function
456 returns an array containing the user selections.
457 @endWxPerlOnly
23324ae1 458*/
e5cfb314 459int wxGetSelectedChoices(wxArrayInt& selections,
23324ae1
FM
460 const wxString& message,
461 const wxString& caption,
462 const wxArrayString& aChoices,
4cc4bfaf 463 wxWindow* parent = NULL,
0b59366f
VZ
464 int x = wxDefaultCoord,
465 int y = wxDefaultCoord,
4cc4bfaf 466 bool centre = true,
0b59366f
VZ
467 int width = wxCHOICE_WIDTH,
468 int height = wxCHOICE_HEIGHT);
697f4a96 469
e5cfb314 470int wxGetSelectedChoices(wxArrayInt& selections,
7c913512
FM
471 const wxString& message,
472 const wxString& caption,
473 int n,
474 const wxString& choices[],
4cc4bfaf 475 wxWindow* parent = NULL,
0b59366f
VZ
476 int x = wxDefaultCoord,
477 int y = wxDefaultCoord,
4cc4bfaf 478 bool centre = true,
0b59366f
VZ
479 int width = wxCHOICE_WIDTH,
480 int height = wxCHOICE_HEIGHT);
ba2874ff 481
23324ae1
FM
482//@}
483