]>
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 license
7 /////////////////////////////////////////////////////////////////////////////
10 @class wxMultiChoiceDialog
12 This class represents a dialog that shows a list of strings, and allows the
13 user to select one or more.
18 @see @ref overview_cmndlg_multichoice, wxSingleChoiceDialog
20 class wxMultiChoiceDialog
: public wxDialog
25 Constructor taking an array of wxString choices.
30 Message to show on the dialog.
34 The number of choices.
36 An array of strings, or a string list, containing the choices.
38 A dialog style (bitlist) containing flags chosen from standard
39 dialog style and the ones listed below. The default value is
40 equivalent to wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER | wxOK |
43 Dialog position. Not Windows.
51 Centre the message. Not Windows.
54 @remarks Use ShowModal() to show the dialog.
58 For Python the two parameters @a n and @a choices are collapsed into a
59 multi parameter @a choices which is expected to be a Python list of
65 Not supported by wxPerl.
68 wxMultiChoiceDialog(wxWindow
* parent
, const wxString
& message
,
69 const wxString
& caption
,
70 int n
, const wxString
* choices
,
71 long style
= wxCHOICEDLG_STYLE
,
72 const wxPoint
& pos
= wxDefaultPosition
);
74 Constructor taking an array of wxString choices.
79 Message to show on the dialog.
83 An array of strings, or a string list, containing the choices.
85 A dialog style (bitlist) containing flags chosen from standard
86 dialog style and the ones listed below. The default value is
87 equivalent to wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER | wxOK |
90 Dialog position. Not Windows.
98 Centre the message. Not Windows.
101 @remarks Use ShowModal() to show the dialog.
105 For Python the two parameters @a n and @a choices are collapsed into a
106 multi parameter @a choices which is expected to be a Python list of
112 Use an array reference for the @a choices parameter.
115 wxMultiChoiceDialog(wxWindow
* parent
,
116 const wxString
& message
,
117 const wxString
& caption
,
118 const wxArrayString
& choices
,
119 long style
= wxCHOICEDLG_STYLE
,
120 const wxPoint
& pos
= wxDefaultPosition
);
124 Returns array with indexes of selected items.
126 wxArrayInt
GetSelection() const;
129 Sets selected items from the array of selected items' indexes.
131 void SetSelections(const wxArrayInt
& selections
);
134 Shows the dialog, returning either wxID_OK or wxID_CANCEL.
142 @class wxSingleChoiceDialog
144 This class represents a dialog that shows a list of strings, and allows the
145 user to select one. Double-clicking on a list item is equivalent to
146 single-clicking and then pressing OK.
151 @see @ref overview_cmndlg_singlechoice, wxMultiChoiceDialog
153 class wxSingleChoiceDialog
: public wxDialog
158 Constructor, taking an array of wxString choices and optional client
164 Message to show on the dialog.
168 The number of choices.
170 An array of strings, or a string list, containing the choices.
172 An array of client data to be associated with the items. See
173 GetSelectionClientData().
175 A dialog style (bitlist) containing flags chosen from standard
176 dialog styles and the ones listed below. The default value is
177 equivalent to wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER | wxOK |
180 Dialog position. Not Windows.
186 Show a Cancel button.
188 Centre the message. Not Windows.
191 @remarks Use ShowModal() to show the dialog.
195 For Python the two parameters @a n and @a choices are collapsed into a
196 multi parameter @a choices which is expected to be a Python list of
202 Not supported by wxPerl.
205 wxSingleChoiceDialog(wxWindow
* parent
, const wxString
& message
,
206 const wxString
& caption
,
207 int n
, const wxString
* choices
,
208 void** clientData
= NULL
,
209 long style
= wxCHOICEDLG_STYLE
,
210 const wxPoint
& pos
= wxDefaultPosition
);
212 Constructor, taking an array of wxString choices and optional client
218 Message to show on the dialog.
222 An array of strings, or a string list, containing the choices.
224 An array of client data to be associated with the items. See
225 GetSelectionClientData().
227 A dialog style (bitlist) containing flags chosen from standard
228 dialog styles and the ones listed below. The default value is
229 equivalent to wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER | wxOK |
232 Dialog position. Not Windows.
238 Show a Cancel button.
240 Centre the message. Not Windows.
243 @remarks Use ShowModal() to show the dialog.
247 For Python the two parameters @a n and @a choices are collapsed into a
248 multi parameter @a choices which is expected to be a Python list of
254 Use an array reference for the @a choices parameter.
257 wxSingleChoiceDialog(wxWindow
* parent
,
258 const wxString
& message
,
259 const wxString
& caption
,
260 const wxArrayString
& choices
,
261 void** clientData
= NULL
,
262 long style
= wxCHOICEDLG_STYLE
,
263 const wxPoint
& pos
= wxDefaultPosition
);
267 Returns the index of selected item.
269 int GetSelection() const;
272 Returns the client data associated with the selection.
274 char* GetSelectionClientData() const;
277 Returns the selected string.
279 wxString
GetStringSelection() const;
282 Sets the index of the initially selected item.
284 void SetSelection(int selection
);
287 Shows the dialog, returning either wxID_OK or wxID_CANCEL.
294 // ============================================================================
295 // Global functions/macros
296 // ============================================================================
298 /** @addtogroup group_funcmacro_dialog */
302 Same as wxGetSingleChoice() but returns the index representing the
303 selected string. If the user pressed cancel, -1 is returned.
305 @header{wx/choicdlg.h}
308 Use an array reference for the @a aChoices parameter.
311 int wxGetSingleChoiceIndex(const wxString
& message
,
312 const wxString
& caption
,
313 const wxArrayString
& aChoices
,
314 wxWindow
* parent
= NULL
,
320 int wxGetSingleChoiceIndex(const wxString
& message
,
321 const wxString
& caption
,
323 const wxString
& choices
[],
324 wxWindow
* parent
= NULL
,
333 /** @addtogroup group_funcmacro_dialog */
337 Pops up a dialog box containing a message, OK/Cancel buttons and a
338 single-selection listbox. The user may choose an item and press OK to
339 return a string or Cancel to return the empty string. Use
340 wxGetSingleChoiceIndex() if empty string is a valid choice and if you want
341 to be able to detect pressing Cancel reliably.
343 You may pass the list of strings to choose from either using @c choices
344 which is an array of @a n strings for the listbox or by using a single
345 @c aChoices parameter of type wxArrayString.
347 If @c centre is @true, the message text (which may include new line
348 characters) is centred; if @false, the message is left-justified.
350 @header{wx/choicdlg.h}
353 Use an array reference for the @a choices parameter.
356 wxString
wxGetSingleChoice(const wxString
& message
,
357 const wxString
& caption
,
358 const wxArrayString
& aChoices
,
359 wxWindow
* parent
= NULL
,
365 wxString
wxGetSingleChoice(const wxString
& message
,
366 const wxString
& caption
,
368 const wxString
& choices
[],
369 wxWindow
* parent
= NULL
,
378 /** @addtogroup group_funcmacro_dialog */
382 Same as wxGetSingleChoice but takes an array of client data pointers
383 corresponding to the strings, and returns one of these pointers or @NULL
384 if Cancel was pressed. The @c client_data array must have the same number
385 of elements as @c choices or @c aChoices!
387 @header{wx/choicdlg.h}
390 Use an array reference for the @a aChoices and @a client_data parameters.
393 wxString
wxGetSingleChoiceData(const wxString
& message
,
394 const wxString
& caption
,
395 const wxArrayString
& aChoices
,
396 const wxString
& client_data
[],
397 wxWindow
* parent
= NULL
,
403 wxString
wxGetSingleChoiceData(const wxString
& message
,
404 const wxString
& caption
,
406 const wxString
& choices
[],
407 const wxString
& client_data
[],
408 wxWindow
* parent
= NULL
,
417 /** @addtogroup group_funcmacro_dialog */
421 Pops up a dialog box containing a message, OK/Cancel buttons and a
422 multiple-selection listbox. The user may choose an arbitrary (including 0)
423 number of items in the listbox whose indices will be returned in
424 @c selections array. The initial contents of this array will be used to
425 select the items when the dialog is shown. If the user cancels the dialog,
426 the function returns -1 and @c selections array is left unchanged.
428 You may pass the list of strings to choose from either using @c choices
429 which is an array of @a n strings for the listbox or by using a single
430 @c aChoices parameter of type wxArrayString.
432 If @c centre is @true, the message text (which may include new line
433 characters) is centred; if @false, the message is left-justified.
435 @header{wx/choicdlg.h}
438 Use an array reference for the @a choices parameter.
439 In wxPerl there is no @a selections parameter; the function
440 returns an array containing the user selections.
443 int wxGetSelectedChoices(wxArrayInt
& selections
,
444 const wxString
& message
,
445 const wxString
& caption
,
446 const wxArrayString
& aChoices
,
447 wxWindow
* parent
= NULL
,
453 int wxGetSelectedChoices(wxArrayInt
& selections
,
454 const wxString
& message
,
455 const wxString
& caption
,
457 const wxString
& choices
[],
458 wxWindow
* parent
= NULL
,