]>
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
64 wxMultiChoiceDialog(wxWindow
* parent
, const wxString
& message
,
65 const wxString
& caption
,
66 int n
, const wxString
* choices
,
67 long style
= wxCHOICEDLG_STYLE
,
68 const wxPoint
& pos
= wxDefaultPosition
);
70 Constructor taking an array of wxString choices.
75 Message to show on the dialog.
79 An array of strings, or a string list, containing the choices.
81 A dialog style (bitlist) containing flags chosen from standard
82 dialog style and the ones listed below. The default value is
83 equivalent to wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER | wxOK |
86 Dialog position. Not Windows.
94 Centre the message. Not Windows.
97 @remarks Use ShowModal() to show the dialog.
101 For Python the two parameters @a n and @a choices are collapsed into a
102 multi parameter @a choices which is expected to be a Python list of
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
);
116 Returns array with indexes of selected items.
118 wxArrayInt
GetSelection() const;
121 Sets selected items from the array of selected items' indexes.
123 void SetSelections(const wxArrayInt
& selections
);
126 Shows the dialog, returning either wxID_OK or wxID_CANCEL.
134 @class wxSingleChoiceDialog
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
138 single-clicking and then pressing OK.
143 @see @ref overview_cmndlg_singlechoice, wxMultiChoiceDialog
145 class wxSingleChoiceDialog
: public wxDialog
150 Constructor, taking an array of wxString choices and optional client
156 Message to show on the dialog.
160 The number of choices.
162 An array of strings, or a string list, containing the choices.
164 An array of client data to be associated with the items. See
165 GetSelectionClientData().
167 A dialog style (bitlist) containing flags chosen from standard
168 dialog styles and the ones listed below. The default value is
169 equivalent to wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER | wxOK |
172 Dialog position. Not Windows.
178 Show a Cancel button.
180 Centre the message. Not Windows.
183 @remarks Use ShowModal() to show the dialog.
187 For Python the two parameters @a n and @a choices are collapsed into a
188 multi parameter @a choices which is expected to be a Python list of
193 wxSingleChoiceDialog(wxWindow
* parent
, const wxString
& message
,
194 const wxString
& caption
,
195 int n
, const wxString
* choices
,
196 void** clientData
= NULL
,
197 long style
= wxCHOICEDLG_STYLE
,
198 const wxPoint
& pos
= wxDefaultPosition
);
200 Constructor, taking an array of wxString choices and optional client
206 Message to show on the dialog.
210 An array of strings, or a string list, containing the choices.
212 An array of client data to be associated with the items. See
213 GetSelectionClientData().
215 A dialog style (bitlist) containing flags chosen from standard
216 dialog styles and the ones listed below. The default value is
217 equivalent to wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER | wxOK |
220 Dialog position. Not Windows.
226 Show a Cancel button.
228 Centre the message. Not Windows.
231 @remarks Use ShowModal() to show the dialog.
235 For Python the two parameters @a n and @a choices are collapsed into a
236 multi parameter @a choices which is expected to be a Python list of
241 wxSingleChoiceDialog(wxWindow
* parent
,
242 const wxString
& message
,
243 const wxString
& caption
,
244 const wxArrayString
& choices
,
245 void** clientData
= NULL
,
246 long style
= wxCHOICEDLG_STYLE
,
247 const wxPoint
& pos
= wxDefaultPosition
);
251 Returns the index of selected item.
253 int GetSelection() const;
256 Returns the client data associated with the selection.
258 char* GetSelectionClientData() const;
261 Returns the selected string.
263 wxString
GetStringSelection() const;
266 Sets the index of the initially selected item.
268 void SetSelection(int selection
);
271 Shows the dialog, returning either wxID_OK or wxID_CANCEL.
278 // ============================================================================
279 // Global functions/macros
280 // ============================================================================
282 /** @addtogroup group_funcmacro_dialog */
286 Same as wxGetSingleChoice() but returns the index representing the
287 selected string. If the user pressed cancel, -1 is returned.
289 @header{wx/choicdlg.h}
291 int wxGetSingleChoiceIndex(const wxString
& message
,
292 const wxString
& caption
,
293 const wxArrayString
& aChoices
,
294 wxWindow
* parent
= NULL
,
300 int wxGetSingleChoiceIndex(const wxString
& message
,
301 const wxString
& caption
,
303 const wxString
& choices
[],
304 wxWindow
* parent
= NULL
,
313 /** @addtogroup group_funcmacro_dialog */
317 Pops up a dialog box containing a message, OK/Cancel buttons and a
318 single-selection listbox. The user may choose an item and press OK to
319 return a string or Cancel to return the empty string. Use
320 wxGetSingleChoiceIndex() if empty string is a valid choice and if you want
321 to be able to detect pressing Cancel reliably.
323 You may pass the list of strings to choose from either using @c choices
324 which is an array of @a n strings for the listbox or by using a single
325 @c aChoices parameter of type wxArrayString.
327 If @c centre is @true, the message text (which may include new line
328 characters) is centred; if @false, the message is left-justified.
330 @header{wx/choicdlg.h}
332 wxString
wxGetSingleChoice(const wxString
& message
,
333 const wxString
& caption
,
334 const wxArrayString
& aChoices
,
335 wxWindow
* parent
= NULL
,
341 wxString
wxGetSingleChoice(const wxString
& message
,
342 const wxString
& caption
,
344 const wxString
& choices
[],
345 wxWindow
* parent
= NULL
,
354 /** @addtogroup group_funcmacro_dialog */
358 Same as wxGetSingleChoice but takes an array of client data pointers
359 corresponding to the strings, and returns one of these pointers or @NULL
360 if Cancel was pressed. The @c client_data array must have the same number
361 of elements as @c choices or @c aChoices!
363 @header{wx/choicdlg.h}
365 wxString
wxGetSingleChoiceData(const wxString
& message
,
366 const wxString
& caption
,
367 const wxArrayString
& aChoices
,
368 const wxString
& client_data
[],
369 wxWindow
* parent
= NULL
,
375 wxString
wxGetSingleChoiceData(const wxString
& message
,
376 const wxString
& caption
,
378 const wxString
& choices
[],
379 const wxString
& client_data
[],
380 wxWindow
* parent
= NULL
,
389 /** @addtogroup group_funcmacro_dialog */
393 Pops up a dialog box containing a message, OK/Cancel buttons and a
394 multiple-selection listbox. The user may choose an arbitrary (including 0)
395 number of items in the listbox whose indices will be returned in
396 @c selections array. The initial contents of this array will be used to
397 select the items when the dialog is shown. If the user cancels the dialog,
398 the function returns -1 and @c selections array is left unchanged.
400 You may pass the list of strings to choose from either using @c choices
401 which is an array of @a n strings for the listbox or by using a single
402 @c aChoices parameter of type wxArrayString.
404 If @c centre is @true, the message text (which may include new line
405 characters) is centred; if @false, the message is left-justified.
407 @header{wx/choicdlg.h}
409 int wxGetSelectedChoices(wxArrayInt
& selections
,
410 const wxString
& message
,
411 const wxString
& caption
,
412 const wxArrayString
& aChoices
,
413 wxWindow
* parent
= NULL
,
419 int wxGetSelectedChoices(wxArrayInt
& selections
,
420 const wxString
& message
,
421 const wxString
& caption
,
423 const wxString
& choices
[],
424 wxWindow
* parent
= NULL
,