]>
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
);
69 wxMultiChoiceDialog(wxWindow
* parent
,
70 const wxString
& message
,
71 const wxString
& caption
,
72 const wxArrayString
& choices
,
73 long style
= wxCHOICEDLG_STYLE
,
74 const wxPoint
& pos
= wxDefaultPosition
);
78 Returns array with indexes of selected items.
80 wxArrayInt
GetSelection() const;
83 Sets selected items from the array of selected items' indexes.
85 void SetSelections(const wxArrayInt
& selections
) const;
88 Shows the dialog, returning either wxID_OK or wxID_CANCEL.
96 @class wxSingleChoiceDialog
98 This class represents a dialog that shows a list of strings, and allows the
99 user to select one. Double-clicking on a list item is equivalent to
100 single-clicking and then pressing OK.
105 @see @ref overview_cmndlg_singlechoice, wxMultiChoiceDialog
107 class wxSingleChoiceDialog
: public wxDialog
112 Constructor, taking an array of wxString choices and optional client
118 Message to show on the dialog.
122 The number of choices.
124 An array of strings, or a string list, containing the choices.
126 An array of client data to be associated with the items. See
127 GetSelectionClientData().
129 A dialog style (bitlist) containing flags chosen from standard
130 dialog styles and the ones listed below. The default value is
131 equivalent to wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER | wxOK |
134 Dialog position. Not Windows.
140 Show a Cancel button.
142 Centre the message. Not Windows.
145 @remarks Use ShowModal() to show the dialog.
149 For Python the two parameters @a n and @a choices are collapsed into a
150 multi parameter @a choices which is expected to be a Python list of
155 wxSingleChoiceDialog(wxWindow
* parent
, const wxString
& message
,
156 const wxString
& caption
,
157 int n
, const wxString
* choices
,
158 void** clientData
= NULL
,
159 long style
= wxCHOICEDLG_STYLE
,
160 const wxPoint
& pos
= wxDefaultPosition
);
161 wxSingleChoiceDialog(wxWindow
* parent
,
162 const wxString
& message
,
163 const wxString
& caption
,
164 const wxArrayString
& choices
,
165 void** clientData
= NULL
,
166 long style
= wxCHOICEDLG_STYLE
,
167 const wxPoint
& pos
= wxDefaultPosition
);
171 Returns the index of selected item.
173 int GetSelection() const;
176 Returns the client data associated with the selection.
178 char* GetSelectionClientData() const;
181 Returns the selected string.
183 wxString
GetStringSelection() const;
186 Sets the index of the initially selected item.
188 void SetSelection(int selection
) const;
191 Shows the dialog, returning either wxID_OK or wxID_CANCEL.
198 // ============================================================================
199 // Global functions/macros
200 // ============================================================================
202 /** @ingroup group_funcmacro_dialog */
206 Same as wxGetSingleChoice() but returns the index representing the
207 selected string. If the user pressed cancel, -1 is returned.
209 @header{wx/choicdlg.h}
211 int wxGetSingleChoiceIndex(const wxString
& message
,
212 const wxString
& caption
,
213 const wxArrayString
& aChoices
,
214 wxWindow
* parent
= NULL
,
220 int wxGetSingleChoiceIndex(const wxString
& message
,
221 const wxString
& caption
,
223 const wxString
& choices
[],
224 wxWindow
* parent
= NULL
,
233 /** @ingroup group_funcmacro_dialog */
237 Pops up a dialog box containing a message, OK/Cancel buttons and a
238 single-selection listbox. The user may choose an item and press OK to
239 return a string or Cancel to return the empty string. Use
240 wxGetSingleChoiceIndex() if empty string is a valid choice and if you want
241 to be able to detect pressing Cancel reliably.
243 You may pass the list of strings to choose from either using @c choices
244 which is an array of @a n strings for the listbox or by using a single
245 @c aChoices parameter of type wxArrayString.
247 If @c centre is @true, the message text (which may include new line
248 characters) is centred; if @false, the message is left-justified.
250 @header{wx/choicdlg.h}
252 wxString
wxGetSingleChoice(const wxString
& message
,
253 const wxString
& caption
,
254 const wxArrayString
& aChoices
,
255 wxWindow
* parent
= NULL
,
261 wxString
wxGetSingleChoice(const wxString
& message
,
262 const wxString
& caption
,
264 const wxString
& choices
[],
265 wxWindow
* parent
= NULL
,
274 /** @ingroup group_funcmacro_dialog */
278 Same as wxGetSingleChoice but takes an array of client data pointers
279 corresponding to the strings, and returns one of these pointers or @NULL
280 if Cancel was pressed. The @c client_data array must have the same number
281 of elements as @c choices or @c aChoices!
283 @header{wx/choicdlg.h}
285 wxString
wxGetSingleChoiceData(const wxString
& message
,
286 const wxString
& caption
,
287 const wxArrayString
& aChoices
,
288 const wxString
& client_data
[],
289 wxWindow
* parent
= NULL
,
295 wxString
wxGetSingleChoiceData(const wxString
& message
,
296 const wxString
& caption
,
298 const wxString
& choices
[],
299 const wxString
& client_data
[],
300 wxWindow
* parent
= NULL
,
309 /** @ingroup group_funcmacro_dialog */
313 Pops up a dialog box containing a message, OK/Cancel buttons and a
314 multiple-selection listbox. The user may choose an arbitrary (including 0)
315 number of items in the listbox whose indices will be returned in
316 @c selections array. The initial contents of this array will be used to
317 select the items when the dialog is shown.
319 You may pass the list of strings to choose from either using @c choices
320 which is an array of @a n strings for the listbox or by using a single
321 @c aChoices parameter of type wxArrayString.
323 If @c centre is @true, the message text (which may include new line
324 characters) is centred; if @false, the message is left-justified.
326 @header{wx/choicdlg.h}
328 size_t wxGetMultipleChoices(wxArrayInt
& selections
,
329 const wxString
& message
,
330 const wxString
& caption
,
331 const wxArrayString
& aChoices
,
332 wxWindow
* parent
= NULL
,
338 size_t wxGetMultipleChoices(wxArrayInt
& selections
,
339 const wxString
& message
,
340 const wxString
& caption
,
342 const wxString
& choices
[],
343 wxWindow
* parent
= NULL
,