]>
git.saurik.com Git - wxWidgets.git/blob - interface/choicdlg.h
1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: interface of wxMultiChoiceDialog
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_wxmultichoicedialogoverview "wxMultiChoiceDialog overview",
22 class wxMultiChoiceDialog
: public wxDialog
27 Constructor taking an array of wxString choices.
32 Message to show on the dialog.
36 The number of choices.
38 An array of strings, or a string list, containing the choices.
40 A dialog style (bitlist) containing flags chosen from standard
41 dialog styles and the following:
76 Centre the message. Not Windows.
82 The default value is equivalent to wxDEFAULT_DIALOG_STYLE |
83 wxRESIZE_BORDER | wxOK | wxCANCEL | wxCENTRE.
85 Dialog position. Not Windows.
87 @remarks Use ShowModal() to show the dialog.
89 wxMultiChoiceDialog(wxWindow
* parent
, const wxString
& message
,
90 const wxString
& caption
,
92 const wxString
* choices
,
93 long style
= wxCHOICEDLG_STYLE
,
94 const wxPoint
& pos
= wxDefaultPosition
);
95 wxMultiChoiceDialog(wxWindow
* parent
,
96 const wxString
& message
,
97 const wxString
& caption
,
98 const wxArrayString
& choices
,
99 long style
= wxCHOICEDLG_STYLE
,
100 const wxPoint
& pos
= wxDefaultPosition
);
104 Returns array with indexes of selected items.
106 wxArrayInt
GetSelection() const;
109 Sets selected items from the array of selected items' indexes.
111 void SetSelections(const wxArrayInt
& selections
) const;
114 Shows the dialog, returning either wxID_OK or wxID_CANCEL.
122 @class wxSingleChoiceDialog
123 @wxheader{choicdlg.h}
125 This class represents a dialog that shows a list of strings, and allows the
126 user to select one. Double-clicking on a list item is equivalent to
127 single-clicking and then pressing OK.
132 @see @ref overview_wxsinglechoicedialogoverview "wxSingleChoiceDialog
133 overview", wxMultiChoiceDialog
135 class wxSingleChoiceDialog
: public wxDialog
140 Constructor, taking an array of wxString choices and optional client data.
145 Message to show on the dialog.
149 The number of choices.
151 An array of strings, or a string list, containing the choices.
153 An array of client data to be associated with the items.
154 See GetSelectionClientData.
156 A dialog style (bitlist) containing flags chosen from standard
157 dialog styles and the following:
181 Show a Cancel button.
192 Centre the message. Not Windows.
198 The default value is equivalent to wxDEFAULT_DIALOG_STYLE |
199 wxRESIZE_BORDER | wxOK | wxCANCEL | wxCENTRE.
201 Dialog position. Not Windows.
203 @remarks Use ShowModal() to show the dialog.
205 wxSingleChoiceDialog(wxWindow
* parent
, const wxString
& message
,
206 const wxString
& caption
,
208 const wxString
* choices
,
209 void** clientData
= NULL
,
210 long style
= wxCHOICEDLG_STYLE
,
211 const wxPoint
& pos
= wxDefaultPosition
);
212 wxSingleChoiceDialog(wxWindow
* parent
,
213 const wxString
& message
,
214 const wxString
& caption
,
215 const wxArrayString
& choices
,
216 void** clientData
= NULL
,
217 long style
= wxCHOICEDLG_STYLE
,
218 const wxPoint
& pos
= wxDefaultPosition
);
222 Returns the index of selected item.
224 int GetSelection() const;
227 Returns the client data associated with the selection.
229 char* GetSelectionClientData() const;
232 Returns the selected string.
234 wxString
GetStringSelection() const;
237 Sets the index of the initially selected item.
239 void SetSelection(int selection
) const;
242 Shows the dialog, returning either wxID_OK or wxID_CANCEL.
249 // ============================================================================
250 // Global functions/macros
251 // ============================================================================
255 As @b wxGetSingleChoice but returns the index representing the selected
256 string. If the user pressed cancel, -1 is returned.
258 int wxGetSingleChoiceIndex(const wxString
& message
,
259 const wxString
& caption
,
260 const wxArrayString
& aChoices
,
261 wxWindow
* parent
= NULL
,
267 int wxGetSingleChoiceIndex(const wxString
& message
,
268 const wxString
& caption
,
270 const wxString
& choices
[],
271 wxWindow
* parent
= NULL
,
281 Pops up a dialog box containing a message, OK/Cancel buttons and a
282 single-selection listbox. The user may choose an item and press OK to return a
283 string or Cancel to return the empty string. Use
284 wxGetSingleChoiceIndex() if empty string is a
285 valid choice and if you want to be able to detect pressing Cancel reliably.
286 You may pass the list of strings to choose from either using @e choices
287 which is an array of @a n strings for the listbox or by using a single
288 @a aChoices parameter of type wxArrayString.
289 If @a centre is @true, the message text (which may include new line
290 characters) is centred; if @false, the message is left-justified.
292 wxString
wxGetSingleChoice(const wxString
& message
,
293 const wxString
& caption
,
294 const wxArrayString
& aChoices
,
295 wxWindow
* parent
= NULL
,
301 wxString
wxGetSingleChoice(const wxString
& message
,
302 const wxString
& caption
,
304 const wxString
& choices
[],
305 wxWindow
* parent
= NULL
,
315 As @b wxGetSingleChoice but takes an array of client data pointers
316 corresponding to the strings, and returns one of these pointers or @NULL if
317 Cancel was pressed. The @e client_data array must have the same number of
318 elements as @e choices or @e aChoices!
320 wxString
wxGetSingleChoiceData(const wxString
& message
,
321 const wxString
& caption
,
322 const wxArrayString
& aChoices
,
323 const wxString
& client_data
[],
324 wxWindow
* parent
= NULL
,
330 wxString
wxGetSingleChoiceData(const wxString
& message
,
331 const wxString
& caption
,
333 const wxString
& choices
[],
334 const wxString
& client_data
[],
335 wxWindow
* parent
= NULL
,
345 Pops up a dialog box containing a message, OK/Cancel buttons and a
346 multiple-selection listbox. The user may choose an arbitrary (including 0)
347 number of items in the listbox whose indices will be returned in
348 @e selection array. The initial contents of this array will be used to
349 select the items when the dialog is shown.
350 You may pass the list of strings to choose from either using @e choices
351 which is an array of @a n strings for the listbox or by using a single
352 @a aChoices parameter of type wxArrayString.
353 If @a centre is @true, the message text (which may include new line
354 characters) is centred; if @false, the message is left-justified.
356 size_t wxGetMultipleChoices(wxArrayInt
& selections
,
357 const wxString
& message
,
358 const wxString
& caption
,
359 const wxArrayString
& aChoices
,
360 wxWindow
* parent
= NULL
,
366 size_t wxGetMultipleChoices(wxArrayInt
& selections
,
367 const wxString
& message
,
368 const wxString
& caption
,
370 const wxString
& choices
[],
371 wxWindow
* parent
= NULL
,