]>
git.saurik.com Git - wxWidgets.git/blob - interface/wx/choicdlg.h
1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: interface of wx[Multi|Single]ChoiceDialog
4 // Author: wxWidgets team
6 // Licence: wxWindows licence
7 /////////////////////////////////////////////////////////////////////////////
10 Default width of the choice dialog.
12 #define wxCHOICE_WIDTH 150
15 Default height of the choice dialog.
17 #define wxCHOICE_HEIGHT 200
20 Default style of the choice dialog.
22 @remarks wxRESIZE_BORDER is not used under WinCE.
24 #define wxCHOICEDLG_STYLE (wxDEFAULT_DIALOG_STYLE | wxOK | wxCANCEL | wxCENTRE | wxRESIZE_BORDER)
28 @class wxMultiChoiceDialog
30 This class represents a dialog that shows a list of strings, and allows the
31 user to select one or more.
36 @see @ref overview_cmndlg_multichoice, wxSingleChoiceDialog
38 class wxMultiChoiceDialog
: public wxDialog
43 Constructor taking an array of wxString choices.
48 Message to show on the dialog.
52 The number of choices.
54 An array of strings, or a string list, containing the choices.
56 A dialog style (bitlist) containing flags chosen from standard
57 dialog style and the ones listed below. The default value is
58 equivalent to wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER | wxOK |
61 Dialog position. Not Windows.
69 Centre the message. Not Windows.
72 @remarks Use ShowModal() to show the dialog.
76 For Python the two parameters @a n and @a choices are collapsed into a
77 multi parameter @a choices which is expected to be a Python list of
83 Not supported by wxPerl.
86 wxMultiChoiceDialog(wxWindow
* parent
, const wxString
& message
,
87 const wxString
& caption
,
88 int n
, const wxString
* choices
,
89 long style
= wxCHOICEDLG_STYLE
,
90 const wxPoint
& pos
= wxDefaultPosition
);
92 Constructor taking an array of wxString choices.
97 Message to show on the dialog.
101 An array of strings, or a string list, containing the choices.
103 A dialog style (bitlist) containing flags chosen from standard
104 dialog style and the ones listed below. The default value is
105 equivalent to wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER | wxOK |
108 Dialog position. Not Windows.
114 Show a Cancel button.
116 Centre the message. Not Windows.
119 @remarks Use ShowModal() to show the dialog.
123 For Python the two parameters @a n and @a choices are collapsed into a
124 multi parameter @a choices which is expected to be a Python list of
130 Use an array reference for the @a choices parameter.
133 wxMultiChoiceDialog(wxWindow
* parent
,
134 const wxString
& message
,
135 const wxString
& caption
,
136 const wxArrayString
& choices
,
137 long style
= wxCHOICEDLG_STYLE
,
138 const wxPoint
& pos
= wxDefaultPosition
);
142 Returns array with indexes of selected items.
144 wxArrayInt
GetSelections() const;
147 Sets selected items from the array of selected items' indexes.
149 void SetSelections(const wxArrayInt
& selections
);
152 Shows the dialog, returning either wxID_OK or wxID_CANCEL.
160 @class wxSingleChoiceDialog
162 This class represents a dialog that shows a list of strings, and allows the
163 user to select one. Double-clicking on a list item is equivalent to
164 single-clicking and then pressing OK.
169 @see @ref overview_cmndlg_singlechoice, wxMultiChoiceDialog
171 class wxSingleChoiceDialog
: public wxDialog
176 Constructor, taking an array of wxString choices and optional client
182 Message to show on the dialog.
186 The number of choices.
188 An array of strings, or a string list, containing the choices.
190 An array of client data to be associated with the items. See
193 A dialog style (bitlist) containing flags chosen from standard
194 dialog styles and the ones listed below. The default value is
195 equivalent to wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER | wxOK |
198 Dialog position. Not Windows.
204 Show a Cancel button.
206 Centre the message. Not Windows.
209 @remarks Use ShowModal() to show the dialog.
213 For Python the two parameters @a n and @a choices are collapsed into a
214 multi parameter @a choices which is expected to be a Python list of
220 Not supported by wxPerl.
223 wxSingleChoiceDialog(wxWindow
* parent
, const wxString
& message
,
224 const wxString
& caption
,
225 int n
, const wxString
* choices
,
226 void** clientData
= NULL
,
227 long style
= wxCHOICEDLG_STYLE
,
228 const wxPoint
& pos
= wxDefaultPosition
);
230 Constructor, taking an array of wxString choices and optional client
236 Message to show on the dialog.
240 An array of strings, or a string list, containing the choices.
242 An array of client data to be associated with the items. See
245 A dialog style (bitlist) containing flags chosen from standard
246 dialog styles and the ones listed below. The default value is
247 equivalent to wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER | wxOK |
250 Dialog position. Not Windows.
256 Show a Cancel button.
258 Centre the message. Not Windows.
261 @remarks Use ShowModal() to show the dialog.
265 For Python the two parameters @a n and @a choices are collapsed into a
266 multi parameter @a choices which is expected to be a Python list of
272 Use an array reference for the @a choices parameter.
275 wxSingleChoiceDialog(wxWindow
* parent
,
276 const wxString
& message
,
277 const wxString
& caption
,
278 const wxArrayString
& choices
,
279 void** clientData
= NULL
,
280 long style
= wxCHOICEDLG_STYLE
,
281 const wxPoint
& pos
= wxDefaultPosition
);
285 Returns the index of selected item.
287 int GetSelection() const;
290 Returns the client data associated with the selection.
294 void* GetSelectionData() const;
297 Returns the selected string.
299 wxString
GetStringSelection() const;
302 Sets the index of the initially selected item.
304 void SetSelection(int selection
);
307 Shows the dialog, returning either wxID_OK or wxID_CANCEL.
314 // ============================================================================
315 // Global functions/macros
316 // ============================================================================
318 /** @addtogroup group_funcmacro_dialog */
322 Same as wxGetSingleChoice() but returns the index representing the
323 selected string. If the user pressed cancel, -1 is returned.
325 @header{wx/choicdlg.h}
328 Use an array reference for the @a aChoices parameter.
331 int wxGetSingleChoiceIndex(const wxString
& message
,
332 const wxString
& caption
,
333 const wxArrayString
& aChoices
,
334 wxWindow
* parent
= NULL
,
335 int x
= wxDefaultCoord
,
336 int y
= wxDefaultCoord
,
338 int width
= wxCHOICE_WIDTH
,
339 int height
= wxCHOICE_HEIGHT
,
340 int initialSelection
= 0);
342 int wxGetSingleChoiceIndex(const wxString
& message
,
343 const wxString
& caption
,
345 const wxString
& choices
[],
346 wxWindow
* parent
= NULL
,
347 int x
= wxDefaultCoord
,
348 int y
= wxDefaultCoord
,
350 int width
= wxCHOICE_WIDTH
,
351 int height
= wxCHOICE_HEIGHT
,
352 int initialSelection
= 0);
355 int wxGetSingleChoiceIndex(const wxString
& message
,
356 const wxString
& caption
,
357 const wxArrayString
& choices
,
358 int initialSelection
,
359 wxWindow
*parent
= NULL
);
361 int wxGetSingleChoiceIndex(const wxString
& message
,
362 const wxString
& caption
,
363 int n
, const wxString
*choices
,
364 int initialSelection
,
365 wxWindow
*parent
= NULL
);
368 /** @addtogroup group_funcmacro_dialog */
372 Pops up a dialog box containing a message, OK/Cancel buttons and a
373 single-selection listbox. The user may choose an item and press OK to
374 return a string or Cancel to return the empty string. Use
375 wxGetSingleChoiceIndex() if empty string is a valid choice and if you want
376 to be able to detect pressing Cancel reliably.
378 You may pass the list of strings to choose from either using @c choices
379 which is an array of @a n strings for the listbox or by using a single
380 @c aChoices parameter of type wxArrayString.
382 If @c centre is @true, the message text (which may include new line
383 characters) is centred; if @false, the message is left-justified.
385 @header{wx/choicdlg.h}
388 Use an array reference for the @a choices parameter.
391 wxString
wxGetSingleChoice(const wxString
& message
,
392 const wxString
& caption
,
393 const wxArrayString
& aChoices
,
394 wxWindow
* parent
= NULL
,
395 int x
= wxDefaultCoord
,
396 int y
= wxDefaultCoord
,
398 int width
= wxCHOICE_WIDTH
,
399 int height
= wxCHOICE_HEIGHT
,
400 int initialSelection
= 0);
401 wxString
wxGetSingleChoice(const wxString
& message
,
402 const wxString
& caption
,
404 const wxString
& choices
[],
405 wxWindow
* parent
= NULL
,
406 int x
= wxDefaultCoord
,
407 int y
= wxDefaultCoord
,
409 int width
= wxCHOICE_WIDTH
,
410 int height
= wxCHOICE_HEIGHT
,
411 int initialSelection
= 0);
414 wxString
wxGetSingleChoice(const wxString
& message
,
415 const wxString
& caption
,
416 const wxArrayString
& choices
,
417 int initialSelection
,
418 wxWindow
*parent
= NULL
);
420 wxString
wxGetSingleChoice(const wxString
& message
,
421 const wxString
& caption
,
422 int n
, const wxString
*choices
,
423 int initialSelection
,
424 wxWindow
*parent
= NULL
);
428 /** @addtogroup group_funcmacro_dialog */
432 Same as wxGetSingleChoice but takes an array of client data pointers
433 corresponding to the strings, and returns one of these pointers or @NULL
434 if Cancel was pressed. The @c client_data array must have the same number
435 of elements as @c choices or @c aChoices!
437 @header{wx/choicdlg.h}
440 Use an array reference for the @a aChoices and @a client_data parameters.
443 wxString
wxGetSingleChoiceData(const wxString
& message
,
444 const wxString
& caption
,
445 const wxArrayString
& aChoices
,
446 const wxString
& client_data
[],
447 wxWindow
* parent
= NULL
,
448 int x
= wxDefaultCoord
,
449 int y
= wxDefaultCoord
,
451 int width
= wxCHOICE_WIDTH
,
452 int height
= wxCHOICE_HEIGHT
,
453 int initialSelection
= 0);
455 wxString
wxGetSingleChoiceData(const wxString
& message
,
456 const wxString
& caption
,
458 const wxString
& choices
[],
459 const wxString
& client_data
[],
460 wxWindow
* parent
= NULL
,
461 int x
= wxDefaultCoord
,
462 int y
= wxDefaultCoord
,
464 int width
= wxCHOICE_WIDTH
,
465 int height
= wxCHOICE_HEIGHT
,
466 int initialSelection
= 0);
468 void* wxGetSingleChoiceData(const wxString
& message
,
469 const wxString
& caption
,
470 const wxArrayString
& choices
,
472 int initialSelection
,
473 wxWindow
*parent
= NULL
);
475 void* wxGetSingleChoiceData(const wxString
& message
,
476 const wxString
& caption
,
477 int n
, const wxString
*choices
,
479 int initialSelection
,
480 wxWindow
*parent
= NULL
);
484 /** @addtogroup group_funcmacro_dialog */
488 Pops up a dialog box containing a message, OK/Cancel buttons and a
489 multiple-selection listbox. The user may choose an arbitrary (including 0)
490 number of items in the listbox whose indices will be returned in
491 @c selections array. The initial contents of this array will be used to
492 select the items when the dialog is shown. If the user cancels the dialog,
493 the function returns -1 and @c selections array is left unchanged.
495 You may pass the list of strings to choose from either using @c choices
496 which is an array of @a n strings for the listbox or by using a single
497 @c aChoices parameter of type wxArrayString.
499 If @c centre is @true, the message text (which may include new line
500 characters) is centred; if @false, the message is left-justified.
502 @header{wx/choicdlg.h}
505 Use an array reference for the @a choices parameter.
506 In wxPerl there is no @a selections parameter; the function
507 returns an array containing the user selections.
510 int wxGetSelectedChoices(wxArrayInt
& selections
,
511 const wxString
& message
,
512 const wxString
& caption
,
513 const wxArrayString
& aChoices
,
514 wxWindow
* parent
= NULL
,
515 int x
= wxDefaultCoord
,
516 int y
= wxDefaultCoord
,
518 int width
= wxCHOICE_WIDTH
,
519 int height
= wxCHOICE_HEIGHT
);
521 int wxGetSelectedChoices(wxArrayInt
& selections
,
522 const wxString
& message
,
523 const wxString
& caption
,
525 const wxString
& choices
[],
526 wxWindow
* parent
= NULL
,
527 int x
= wxDefaultCoord
,
528 int y
= wxDefaultCoord
,
530 int width
= wxCHOICE_WIDTH
,
531 int height
= wxCHOICE_HEIGHT
);