]>
git.saurik.com Git - wxWidgets.git/blob - interface/wx/choicdlg.h
80262fbda6ca7b075c4e37609c4820edaae193ad
1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: interface of wx[Multi|Single]ChoiceDialog
4 // Author: wxWidgets team
6 // Licence: wxWindows licence
7 /////////////////////////////////////////////////////////////////////////////
10 Default width of the choice dialog.
12 #define wxCHOICE_WIDTH 150
15 Default height of the choice dialog.
17 #define wxCHOICE_HEIGHT 200
20 Default style of the choice dialog.
22 @remarks wxRESIZE_BORDER is not used under WinCE.
24 #define wxCHOICEDLG_STYLE (wxDEFAULT_DIALOG_STYLE | wxOK | wxCANCEL | wxCENTRE | wxRESIZE_BORDER)
28 @class wxMultiChoiceDialog
30 This class represents a dialog that shows a list of strings, and allows the
31 user to select one or more.
39 Centre the message. Not Windows.
45 @see @ref overview_cmndlg_multichoice, wxSingleChoiceDialog
47 class wxMultiChoiceDialog
: public wxDialog
52 Constructor taking an array of wxString choices.
57 Message to show on the dialog.
61 The number of choices.
63 An array of strings, or a string list, containing the choices.
65 A dialog style (bitlist) containing flags chosen from standard
66 dialog styles and the ones listed in the class documentation. The
67 default value is equivalent to wxDEFAULT_DIALOG_STYLE |
68 wxRESIZE_BORDER | wxOK | wxCANCEL | wxCENTRE.
70 Dialog position. Not Windows.
72 @remarks Use ShowModal() to show the dialog.
75 Not supported by wxPerl.
78 wxMultiChoiceDialog(wxWindow
* parent
, const wxString
& message
,
79 const wxString
& caption
,
80 int n
, const wxString
* choices
,
81 long style
= wxCHOICEDLG_STYLE
,
82 const wxPoint
& pos
= wxDefaultPosition
);
84 Constructor taking an array of wxString choices.
89 Message to show on the dialog.
93 An array of strings, or a string list, containing the choices.
95 A dialog style (bitlist) containing flags chosen from standard
96 dialog styles and the ones listed in the class documentation. The
97 default value is equivalent to wxDEFAULT_DIALOG_STYLE |
98 wxRESIZE_BORDER | wxOK | wxCANCEL | wxCENTRE.
100 Dialog position. Not Windows.
102 @remarks Use ShowModal() to show the dialog.
105 Use an array reference for the @a choices parameter.
108 wxMultiChoiceDialog(wxWindow
* parent
,
109 const wxString
& message
,
110 const wxString
& caption
,
111 const wxArrayString
& choices
,
112 long style
= wxCHOICEDLG_STYLE
,
113 const wxPoint
& pos
= wxDefaultPosition
);
117 Returns array with indexes of selected items.
119 wxArrayInt
GetSelections() const;
122 Sets selected items from the array of selected items' indexes.
124 void SetSelections(const wxArrayInt
& selections
);
127 Shows the dialog, returning either wxID_OK or wxID_CANCEL.
135 @class wxSingleChoiceDialog
137 This class represents a dialog that shows a list of strings, and allows the
138 user to select one. Double-clicking on a list item is equivalent to
139 single-clicking and then pressing OK.
145 Show a Cancel button.
147 Centre the message. Not Windows.
153 @see @ref overview_cmndlg_singlechoice, wxMultiChoiceDialog
155 class wxSingleChoiceDialog
: public wxDialog
160 Constructor, taking an array of wxString choices and optional client
166 Message to show on the dialog.
170 The number of choices.
172 An array of strings, or a string list, containing the choices.
174 An array of client data to be associated with the items. See
177 A dialog style (bitlist) containing flags chosen from standard
178 dialog styles and the ones listed in the class documentation. The
179 default value is equivalent to wxDEFAULT_DIALOG_STYLE |
180 wxRESIZE_BORDER | wxOK | wxCANCEL | wxCENTRE.
182 Dialog position. Not Windows.
184 @remarks Use ShowModal() to show the dialog.
187 Not supported by wxPerl.
190 wxSingleChoiceDialog(wxWindow
* parent
, const wxString
& message
,
191 const wxString
& caption
,
192 int n
, const wxString
* choices
,
193 void** clientData
= NULL
,
194 long style
= wxCHOICEDLG_STYLE
,
195 const wxPoint
& pos
= wxDefaultPosition
);
197 Constructor, taking an array of wxString choices and optional client
203 Message to show on the dialog.
207 An array of strings, or a string list, containing the choices.
209 An array of client data to be associated with the items. See
212 A dialog style (bitlist) containing flags chosen from standard
213 dialog styles and the ones listed in the class documentation. The
214 default value is equivalent to wxDEFAULT_DIALOG_STYLE |
215 wxRESIZE_BORDER | wxOK | wxCANCEL | wxCENTRE.
217 Dialog position. Not Windows.
219 @remarks Use ShowModal() to show the dialog.
222 Use an array reference for the @a choices parameter.
225 wxSingleChoiceDialog(wxWindow
* parent
,
226 const wxString
& message
,
227 const wxString
& caption
,
228 const wxArrayString
& choices
,
229 void** clientData
= NULL
,
230 long style
= wxCHOICEDLG_STYLE
,
231 const wxPoint
& pos
= wxDefaultPosition
);
235 Returns the index of selected item.
237 int GetSelection() const;
240 Returns the client data associated with the selection.
244 void* GetSelectionData() const;
247 Returns the selected string.
249 wxString
GetStringSelection() const;
252 Sets the index of the initially selected item.
254 void SetSelection(int selection
);
257 Shows the dialog, returning either wxID_OK or wxID_CANCEL.
264 // ============================================================================
265 // Global functions/macros
266 // ============================================================================
268 /** @addtogroup group_funcmacro_dialog */
272 Same as wxGetSingleChoice() but returns the index representing the
273 selected string. If the user pressed cancel, -1 is returned.
275 @header{wx/choicdlg.h}
278 Use an array reference for the @a aChoices parameter.
281 int wxGetSingleChoiceIndex(const wxString
& message
,
282 const wxString
& caption
,
283 const wxArrayString
& aChoices
,
284 wxWindow
* parent
= NULL
,
285 int x
= wxDefaultCoord
,
286 int y
= wxDefaultCoord
,
288 int width
= wxCHOICE_WIDTH
,
289 int height
= wxCHOICE_HEIGHT
,
290 int initialSelection
= 0);
292 int wxGetSingleChoiceIndex(const wxString
& message
,
293 const wxString
& caption
,
295 const wxString
& choices
[],
296 wxWindow
* parent
= NULL
,
297 int x
= wxDefaultCoord
,
298 int y
= wxDefaultCoord
,
300 int width
= wxCHOICE_WIDTH
,
301 int height
= wxCHOICE_HEIGHT
,
302 int initialSelection
= 0);
305 int wxGetSingleChoiceIndex(const wxString
& message
,
306 const wxString
& caption
,
307 const wxArrayString
& choices
,
308 int initialSelection
,
309 wxWindow
*parent
= NULL
);
311 int wxGetSingleChoiceIndex(const wxString
& message
,
312 const wxString
& caption
,
313 int n
, const wxString
*choices
,
314 int initialSelection
,
315 wxWindow
*parent
= NULL
);
318 /** @addtogroup group_funcmacro_dialog */
322 Pops up a dialog box containing a message, OK/Cancel buttons and a
323 single-selection listbox. The user may choose an item and press OK to
324 return a string or Cancel to return the empty string. Use
325 wxGetSingleChoiceIndex() if empty string is a valid choice and if you want
326 to be able to detect pressing Cancel reliably.
328 You may pass the list of strings to choose from either using @c choices
329 which is an array of @a n strings for the listbox or by using a single
330 @c aChoices parameter of type wxArrayString.
332 If @c centre is @true, the message text (which may include new line
333 characters) is centred; if @false, the message is left-justified.
335 @header{wx/choicdlg.h}
338 Use an array reference for the @a choices parameter.
341 wxString
wxGetSingleChoice(const wxString
& message
,
342 const wxString
& caption
,
343 const wxArrayString
& aChoices
,
344 wxWindow
* parent
= NULL
,
345 int x
= wxDefaultCoord
,
346 int y
= wxDefaultCoord
,
348 int width
= wxCHOICE_WIDTH
,
349 int height
= wxCHOICE_HEIGHT
,
350 int initialSelection
= 0);
351 wxString
wxGetSingleChoice(const wxString
& message
,
352 const wxString
& caption
,
354 const wxString
& choices
[],
355 wxWindow
* parent
= NULL
,
356 int x
= wxDefaultCoord
,
357 int y
= wxDefaultCoord
,
359 int width
= wxCHOICE_WIDTH
,
360 int height
= wxCHOICE_HEIGHT
,
361 int initialSelection
= 0);
364 wxString
wxGetSingleChoice(const wxString
& message
,
365 const wxString
& caption
,
366 const wxArrayString
& choices
,
367 int initialSelection
,
368 wxWindow
*parent
= NULL
);
370 wxString
wxGetSingleChoice(const wxString
& message
,
371 const wxString
& caption
,
372 int n
, const wxString
*choices
,
373 int initialSelection
,
374 wxWindow
*parent
= NULL
);
378 /** @addtogroup group_funcmacro_dialog */
382 Same as wxGetSingleChoice but takes an array of client data pointers
383 corresponding to the strings, and returns one of these pointers or @NULL
384 if Cancel was pressed. The @c client_data array must have the same number
385 of elements as @c choices or @c aChoices!
387 @header{wx/choicdlg.h}
390 Use an array reference for the @a aChoices and @a client_data parameters.
393 wxString
wxGetSingleChoiceData(const wxString
& message
,
394 const wxString
& caption
,
395 const wxArrayString
& aChoices
,
396 const wxString
& client_data
[],
397 wxWindow
* parent
= NULL
,
398 int x
= wxDefaultCoord
,
399 int y
= wxDefaultCoord
,
401 int width
= wxCHOICE_WIDTH
,
402 int height
= wxCHOICE_HEIGHT
,
403 int initialSelection
= 0);
405 wxString
wxGetSingleChoiceData(const wxString
& message
,
406 const wxString
& caption
,
408 const wxString
& choices
[],
409 const wxString
& client_data
[],
410 wxWindow
* parent
= NULL
,
411 int x
= wxDefaultCoord
,
412 int y
= wxDefaultCoord
,
414 int width
= wxCHOICE_WIDTH
,
415 int height
= wxCHOICE_HEIGHT
,
416 int initialSelection
= 0);
418 void* wxGetSingleChoiceData(const wxString
& message
,
419 const wxString
& caption
,
420 const wxArrayString
& choices
,
422 int initialSelection
,
423 wxWindow
*parent
= NULL
);
425 void* wxGetSingleChoiceData(const wxString
& message
,
426 const wxString
& caption
,
427 int n
, const wxString
*choices
,
429 int initialSelection
,
430 wxWindow
*parent
= NULL
);
434 /** @addtogroup group_funcmacro_dialog */
438 Pops up a dialog box containing a message, OK/Cancel buttons and a
439 multiple-selection listbox. The user may choose an arbitrary (including 0)
440 number of items in the listbox whose indices will be returned in
441 @c selections array. The initial contents of this array will be used to
442 select the items when the dialog is shown. If the user cancels the dialog,
443 the function returns -1 and @c selections array is left unchanged.
445 You may pass the list of strings to choose from either using @c choices
446 which is an array of @a n strings for the listbox or by using a single
447 @c aChoices parameter of type wxArrayString.
449 If @c centre is @true, the message text (which may include new line
450 characters) is centred; if @false, the message is left-justified.
452 @header{wx/choicdlg.h}
455 Use an array reference for the @a choices parameter.
456 In wxPerl there is no @a selections parameter; the function
457 returns an array containing the user selections.
460 int wxGetSelectedChoices(wxArrayInt
& selections
,
461 const wxString
& message
,
462 const wxString
& caption
,
463 const wxArrayString
& aChoices
,
464 wxWindow
* parent
= NULL
,
465 int x
= wxDefaultCoord
,
466 int y
= wxDefaultCoord
,
468 int width
= wxCHOICE_WIDTH
,
469 int height
= wxCHOICE_HEIGHT
);
471 int wxGetSelectedChoices(wxArrayInt
& selections
,
472 const wxString
& message
,
473 const wxString
& caption
,
475 const wxString
& choices
[],
476 wxWindow
* parent
= NULL
,
477 int x
= wxDefaultCoord
,
478 int y
= wxDefaultCoord
,
480 int width
= wxCHOICE_WIDTH
,
481 int height
= wxCHOICE_HEIGHT
);