]>
git.saurik.com Git - wxWidgets.git/blob - interface/choicdlg.h
1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: interface of wx[Multi|Single]ChoiceDialog
4 // Author: wxWidgets team
6 // Licence: wxWindows license
7 /////////////////////////////////////////////////////////////////////////////
10 @class wxMultiChoiceDialog
13 This class represents a dialog that shows a list of strings, and allows the
14 user to select one or more.
19 @see @ref overview_cmndlg_multichoice, wxSingleChoiceDialog
21 class wxMultiChoiceDialog
: public wxDialog
26 Constructor taking an array of wxString choices.
31 Message to show on the dialog.
35 The number of choices.
37 An array of strings, or a string list, containing the choices.
39 A dialog style (bitlist) containing flags chosen from standard
40 dialog style and the ones listed below. The default value is
41 equivalent to wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER | wxOK |
44 Dialog position. Not Windows.
52 Centre the message. Not Windows.
55 @remarks Use ShowModal() to show the dialog.
59 For Python the two parameters @a n and @a choices are collapsed into a
60 multi parameter @a choices which is expected to be a Python list of
65 wxMultiChoiceDialog(wxWindow
* parent
, const wxString
& message
,
66 const wxString
& caption
,
67 int n
, const wxString
* choices
,
68 long style
= wxCHOICEDLG_STYLE
,
69 const wxPoint
& pos
= wxDefaultPosition
);
70 wxMultiChoiceDialog(wxWindow
* parent
,
71 const wxString
& message
,
72 const wxString
& caption
,
73 const wxArrayString
& choices
,
74 long style
= wxCHOICEDLG_STYLE
,
75 const wxPoint
& pos
= wxDefaultPosition
);
79 Returns array with indexes of selected items.
81 wxArrayInt
GetSelection() const;
84 Sets selected items from the array of selected items' indexes.
86 void SetSelections(const wxArrayInt
& selections
) const;
89 Shows the dialog, returning either wxID_OK or wxID_CANCEL.
97 @class wxSingleChoiceDialog
100 This class represents a dialog that shows a list of strings, and allows the
101 user to select one. Double-clicking on a list item is equivalent to
102 single-clicking and then pressing OK.
107 @see @ref overview_cmndlg_singlechoice, wxMultiChoiceDialog
109 class wxSingleChoiceDialog
: public wxDialog
114 Constructor, taking an array of wxString choices and optional client
120 Message to show on the dialog.
124 The number of choices.
126 An array of strings, or a string list, containing the choices.
128 An array of client data to be associated with the items. See
129 GetSelectionClientData().
131 A dialog style (bitlist) containing flags chosen from standard
132 dialog styles and the ones listed below. The default value is
133 equivalent to wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER | wxOK |
136 Dialog position. Not Windows.
142 Show a Cancel button.
144 Centre the message. Not Windows.
147 @remarks Use ShowModal() to show the dialog.
151 For Python the two parameters @a n and @a choices are collapsed into a
152 multi parameter @a choices which is expected to be a Python list of
157 wxSingleChoiceDialog(wxWindow
* parent
, const wxString
& message
,
158 const wxString
& caption
,
159 int n
, const wxString
* choices
,
160 void** clientData
= NULL
,
161 long style
= wxCHOICEDLG_STYLE
,
162 const wxPoint
& pos
= wxDefaultPosition
);
163 wxSingleChoiceDialog(wxWindow
* parent
,
164 const wxString
& message
,
165 const wxString
& caption
,
166 const wxArrayString
& choices
,
167 void** clientData
= NULL
,
168 long style
= wxCHOICEDLG_STYLE
,
169 const wxPoint
& pos
= wxDefaultPosition
);
173 Returns the index of selected item.
175 int GetSelection() const;
178 Returns the client data associated with the selection.
180 char* GetSelectionClientData() const;
183 Returns the selected string.
185 wxString
GetStringSelection() const;
188 Sets the index of the initially selected item.
190 void SetSelection(int selection
) const;
193 Shows the dialog, returning either wxID_OK or wxID_CANCEL.
200 // ============================================================================
201 // Global functions/macros
202 // ============================================================================
204 /** @ingroup group_funcmacro_dialog */
208 Same as wxGetSingleChoice() but returns the index representing the
209 selected string. If the user pressed cancel, -1 is returned.
211 @header{wx/choicdlg.h}
213 int wxGetSingleChoiceIndex(const wxString
& message
,
214 const wxString
& caption
,
215 const wxArrayString
& aChoices
,
216 wxWindow
* parent
= NULL
,
222 int wxGetSingleChoiceIndex(const wxString
& message
,
223 const wxString
& caption
,
225 const wxString
& choices
[],
226 wxWindow
* parent
= NULL
,
235 /** @ingroup group_funcmacro_dialog */
239 Pops up a dialog box containing a message, OK/Cancel buttons and a
240 single-selection listbox. The user may choose an item and press OK to
241 return a string or Cancel to return the empty string. Use
242 wxGetSingleChoiceIndex() if empty string is a valid choice and if you want
243 to be able to detect pressing Cancel reliably.
245 You may pass the list of strings to choose from either using @c choices
246 which is an array of @a n strings for the listbox or by using a single
247 @c aChoices parameter of type wxArrayString.
249 If @c centre is @true, the message text (which may include new line
250 characters) is centred; if @false, the message is left-justified.
252 @header{wx/choicdlg.h}
254 wxString
wxGetSingleChoice(const wxString
& message
,
255 const wxString
& caption
,
256 const wxArrayString
& aChoices
,
257 wxWindow
* parent
= NULL
,
263 wxString
wxGetSingleChoice(const wxString
& message
,
264 const wxString
& caption
,
266 const wxString
& choices
[],
267 wxWindow
* parent
= NULL
,
276 /** @ingroup group_funcmacro_dialog */
280 Same as wxGetSingleChoice but takes an array of client data pointers
281 corresponding to the strings, and returns one of these pointers or @NULL
282 if Cancel was pressed. The @c client_data array must have the same number
283 of elements as @c choices or @c aChoices!
285 @header{wx/choicdlg.h}
287 wxString
wxGetSingleChoiceData(const wxString
& message
,
288 const wxString
& caption
,
289 const wxArrayString
& aChoices
,
290 const wxString
& client_data
[],
291 wxWindow
* parent
= NULL
,
297 wxString
wxGetSingleChoiceData(const wxString
& message
,
298 const wxString
& caption
,
300 const wxString
& choices
[],
301 const wxString
& client_data
[],
302 wxWindow
* parent
= NULL
,
311 /** @ingroup group_funcmacro_dialog */
315 Pops up a dialog box containing a message, OK/Cancel buttons and a
316 multiple-selection listbox. The user may choose an arbitrary (including 0)
317 number of items in the listbox whose indices will be returned in
318 @c selections array. The initial contents of this array will be used to
319 select the items when the dialog is shown.
321 You may pass the list of strings to choose from either using @c choices
322 which is an array of @a n strings for the listbox or by using a single
323 @c aChoices parameter of type wxArrayString.
325 If @c centre is @true, the message text (which may include new line
326 characters) is centred; if @false, the message is left-justified.
328 @header{wx/choicdlg.h}
330 size_t wxGetMultipleChoices(wxArrayInt
& selections
,
331 const wxString
& message
,
332 const wxString
& caption
,
333 const wxArrayString
& aChoices
,
334 wxWindow
* parent
= NULL
,
340 size_t wxGetMultipleChoices(wxArrayInt
& selections
,
341 const wxString
& message
,
342 const wxString
& caption
,
344 const wxString
& choices
[],
345 wxWindow
* parent
= NULL
,