]>
git.saurik.com Git - wxWidgets.git/blob - interface/choicdlg.h
138c60c88f42ed88d0c16a7a94672f730040e17c
1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: documentation for wxMultiChoiceDialog class
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.
20 @ref overview_wxmultichoicedialogoverview "wxMultiChoiceDialog overview",
23 class wxMultiChoiceDialog
: public wxDialog
28 Constructor taking an array of wxString choices.
33 Message to show on the dialog.
37 The number of choices.
39 An array of strings, or a string list, containing the choices.
41 A dialog style (bitlist) containing flags chosen from standard
42 dialog styles and the following:
77 Centre the message. Not Windows.
83 The default value is equivalent to wxDEFAULT_DIALOG_STYLE |
84 wxRESIZE_BORDER | wxOK | wxCANCEL | wxCENTRE.
86 Dialog position. Not Windows.
88 @remarks Use ShowModal() to show the dialog.
90 wxMultiChoiceDialog(wxWindow
* parent
, const wxString
& message
,
91 const wxString
& caption
,
93 const wxString
* choices
,
94 long style
= wxCHOICEDLG_STYLE
,
95 const wxPoint
& pos
= wxDefaultPosition
);
96 wxMultiChoiceDialog(wxWindow
* parent
,
97 const wxString
& message
,
98 const wxString
& caption
,
99 const wxArrayString
& choices
,
100 long style
= wxCHOICEDLG_STYLE
,
101 const wxPoint
& pos
= wxDefaultPosition
);
105 Returns array with indexes of selected items.
107 wxArrayInt
GetSelection() const;
110 Sets selected items from the array of selected items' indexes.
112 void SetSelections(const wxArrayInt
& selections
) const;
115 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.
133 @ref overview_wxsinglechoicedialogoverview "wxSingleChoiceDialog overview",
136 class wxSingleChoiceDialog
: public wxDialog
141 Constructor, taking an array of wxString choices and optional client data.
146 Message to show on the dialog.
150 The number of choices.
152 An array of strings, or a string list, containing the choices.
154 An array of client data to be associated with the items.
155 See GetSelectionClientData.
157 A dialog style (bitlist) containing flags chosen from standard
158 dialog styles and the following:
182 Show a Cancel button.
193 Centre the message. Not Windows.
199 The default value is equivalent to wxDEFAULT_DIALOG_STYLE |
200 wxRESIZE_BORDER | wxOK | wxCANCEL | wxCENTRE.
202 Dialog position. Not Windows.
204 @remarks Use ShowModal() to show the dialog.
206 wxSingleChoiceDialog(wxWindow
* parent
, const wxString
& message
,
207 const wxString
& caption
,
209 const wxString
* choices
,
210 void** clientData
= NULL
,
211 long style
= wxCHOICEDLG_STYLE
,
212 const wxPoint
& pos
= wxDefaultPosition
);
213 wxSingleChoiceDialog(wxWindow
* parent
,
214 const wxString
& message
,
215 const wxString
& caption
,
216 const wxArrayString
& choices
,
217 void** clientData
= NULL
,
218 long style
= wxCHOICEDLG_STYLE
,
219 const wxPoint
& pos
= wxDefaultPosition
);
223 Returns the index of selected item.
225 int GetSelection() const;
228 Returns the client data associated with the selection.
230 char* GetSelectionClientData() const;
233 Returns the selected string.
235 wxString
GetStringSelection() const;
238 Sets the index of the initially selected item.
240 void SetSelection(int selection
) const;
243 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
,