]>
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
14 the 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.
57 wxMultiChoiceDialog(wxWindow
* parent
, const wxString
& message
,
58 const wxString
& caption
,
60 const wxString
* choices
,
61 long style
= wxCHOICEDLG_STYLE
,
62 const wxPoint
& pos
= wxDefaultPosition
);
63 wxMultiChoiceDialog(wxWindow
* parent
,
64 const wxString
& message
,
65 const wxString
& caption
,
66 const wxArrayString
& choices
,
67 long style
= wxCHOICEDLG_STYLE
,
68 const wxPoint
& pos
= wxDefaultPosition
);
72 Returns array with indexes of selected items.
74 wxArrayInt
GetSelection() const;
77 Sets selected items from the array of selected items' indexes.
79 void SetSelections(const wxArrayInt
& selections
) const;
82 Shows the dialog, returning either wxID_OK or wxID_CANCEL.
90 @class wxSingleChoiceDialog
93 This class represents a dialog that shows a list of strings, and allows
94 the user to select one. Double-clicking on a list item is equivalent to
95 single-clicking and then pressing OK.
100 @see @ref overview_cmndlg_singlechoice, wxMultiChoiceDialog
102 class wxSingleChoiceDialog
: public wxDialog
107 Constructor, taking an array of wxString choices and optional client
113 Message to show on the dialog.
117 The number of choices.
119 An array of strings, or a string list, containing the choices.
121 An array of client data to be associated with the items.
122 See GetSelectionClientData.
124 A dialog style (bitlist) containing flags chosen from standard
125 dialog styles and the ones listed below. The default value is
126 equivalent to wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER | wxOK |
129 Dialog position. Not Windows.
135 Show a Cancel button.
137 Centre the message. Not Windows.
140 @remarks Use ShowModal() to show the dialog.
142 wxSingleChoiceDialog(wxWindow
* parent
, const wxString
& message
,
143 const wxString
& caption
,
145 const wxString
* choices
,
146 void** clientData
= NULL
,
147 long style
= wxCHOICEDLG_STYLE
,
148 const wxPoint
& pos
= wxDefaultPosition
);
149 wxSingleChoiceDialog(wxWindow
* parent
,
150 const wxString
& message
,
151 const wxString
& caption
,
152 const wxArrayString
& choices
,
153 void** clientData
= NULL
,
154 long style
= wxCHOICEDLG_STYLE
,
155 const wxPoint
& pos
= wxDefaultPosition
);
159 Returns the index of selected item.
161 int GetSelection() const;
164 Returns the client data associated with the selection.
166 char* GetSelectionClientData() const;
169 Returns the selected string.
171 wxString
GetStringSelection() const;
174 Sets the index of the initially selected item.
176 void SetSelection(int selection
) const;
179 Shows the dialog, returning either wxID_OK or wxID_CANCEL.
186 // ============================================================================
187 // Global functions/macros
188 // ============================================================================
190 /** @ingroup group_funcmacro_dialog */
194 Same as wxGetSingleChoice() but returns the index representing the
195 selected string. If the user pressed cancel, -1 is returned.
197 @header{wx/choicdlg.h}
199 int wxGetSingleChoiceIndex(const wxString
& message
,
200 const wxString
& caption
,
201 const wxArrayString
& aChoices
,
202 wxWindow
* parent
= NULL
,
208 int wxGetSingleChoiceIndex(const wxString
& message
,
209 const wxString
& caption
,
211 const wxString
& choices
[],
212 wxWindow
* parent
= NULL
,
221 /** @ingroup group_funcmacro_dialog */
225 Pops up a dialog box containing a message, OK/Cancel buttons and a
226 single-selection listbox. The user may choose an item and press OK to
227 return a string or Cancel to return the empty string. Use
228 wxGetSingleChoiceIndex() if empty string is a valid choice and if you want
229 to be able to detect pressing Cancel reliably.
231 You may pass the list of strings to choose from either using @c choices
232 which is an array of @a n strings for the listbox or by using a single
233 @c aChoices parameter of type wxArrayString.
235 If @c centre is @true, the message text (which may include new line
236 characters) is centred; if @false, the message is left-justified.
238 @header{wx/choicdlg.h}
240 wxString
wxGetSingleChoice(const wxString
& message
,
241 const wxString
& caption
,
242 const wxArrayString
& aChoices
,
243 wxWindow
* parent
= NULL
,
249 wxString
wxGetSingleChoice(const wxString
& message
,
250 const wxString
& caption
,
252 const wxString
& choices
[],
253 wxWindow
* parent
= NULL
,
262 /** @ingroup group_funcmacro_dialog */
266 Same as wxGetSingleChoice but takes an array of client data pointers
267 corresponding to the strings, and returns one of these pointers or @NULL
268 if Cancel was pressed. The @c client_data array must have the same number
269 of elements as @c choices or @c aChoices!
271 @header{wx/choicdlg.h}
273 wxString
wxGetSingleChoiceData(const wxString
& message
,
274 const wxString
& caption
,
275 const wxArrayString
& aChoices
,
276 const wxString
& client_data
[],
277 wxWindow
* parent
= NULL
,
283 wxString
wxGetSingleChoiceData(const wxString
& message
,
284 const wxString
& caption
,
286 const wxString
& choices
[],
287 const wxString
& client_data
[],
288 wxWindow
* parent
= NULL
,
297 /** @ingroup group_funcmacro_dialog */
301 Pops up a dialog box containing a message, OK/Cancel buttons and a
302 multiple-selection listbox. The user may choose an arbitrary (including 0)
303 number of items in the listbox whose indices will be returned in
304 @c selections array. The initial contents of this array will be used to
305 select the items when the dialog is shown.
307 You may pass the list of strings to choose from either using @c choices
308 which is an array of @a n strings for the listbox or by using a single
309 @c aChoices parameter of type wxArrayString.
311 If @c centre is @true, the message text (which may include new line
312 characters) is centred; if @false, the message is left-justified.
314 @header{wx/choicdlg.h}
316 size_t wxGetMultipleChoices(wxArrayInt
& selections
,
317 const wxString
& message
,
318 const wxString
& caption
,
319 const wxArrayString
& aChoices
,
320 wxWindow
* parent
= NULL
,
326 size_t wxGetMultipleChoices(wxArrayInt
& selections
,
327 const wxString
& message
,
328 const wxString
& caption
,
330 const wxString
& choices
[],
331 wxWindow
* parent
= NULL
,