]>
git.saurik.com Git - wxWidgets.git/blob - interface/wx/choicdlg.h
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.
76 For Python the two parameters @a n and @a choices are collapsed into a
77 multi parameter @a choices which is expected to be a Python list of
83 Not supported by wxPerl.
86 wxMultiChoiceDialog(wxWindow
* parent
, const wxString
& message
,
87 const wxString
& caption
,
88 int n
, const wxString
* choices
,
89 long style
= wxCHOICEDLG_STYLE
,
90 const wxPoint
& pos
= wxDefaultPosition
);
92 Constructor taking an array of wxString choices.
97 Message to show on the dialog.
101 An array of strings, or a string list, containing the choices.
103 A dialog style (bitlist) containing flags chosen from standard
104 dialog styles and the ones listed in the class documentation. The
105 default value is equivalent to wxDEFAULT_DIALOG_STYLE |
106 wxRESIZE_BORDER | wxOK | wxCANCEL | wxCENTRE.
108 Dialog position. Not Windows.
110 @remarks Use ShowModal() to show the dialog.
114 For Python the two parameters @a n and @a choices are collapsed into a
115 multi parameter @a choices which is expected to be a Python list of
121 Use an array reference for the @a choices parameter.
124 wxMultiChoiceDialog(wxWindow
* parent
,
125 const wxString
& message
,
126 const wxString
& caption
,
127 const wxArrayString
& choices
,
128 long style
= wxCHOICEDLG_STYLE
,
129 const wxPoint
& pos
= wxDefaultPosition
);
133 Returns array with indexes of selected items.
135 wxArrayInt
GetSelections() const;
138 Sets selected items from the array of selected items' indexes.
140 void SetSelections(const wxArrayInt
& selections
);
143 Shows the dialog, returning either wxID_OK or wxID_CANCEL.
151 @class wxSingleChoiceDialog
153 This class represents a dialog that shows a list of strings, and allows the
154 user to select one. Double-clicking on a list item is equivalent to
155 single-clicking and then pressing OK.
161 Show a Cancel button.
163 Centre the message. Not Windows.
169 @see @ref overview_cmndlg_singlechoice, wxMultiChoiceDialog
171 class wxSingleChoiceDialog
: public wxDialog
176 Constructor, taking an array of wxString choices and optional client
182 Message to show on the dialog.
186 The number of choices.
188 An array of strings, or a string list, containing the choices.
190 An array of client data to be associated with the items. See
193 A dialog style (bitlist) containing flags chosen from standard
194 dialog styles and the ones listed in the class documentation. The
195 default value is equivalent to wxDEFAULT_DIALOG_STYLE |
196 wxRESIZE_BORDER | wxOK | wxCANCEL | wxCENTRE.
198 Dialog position. Not Windows.
200 @remarks Use ShowModal() to show the dialog.
204 For Python the two parameters @a n and @a choices are collapsed into a
205 multi parameter @a choices which is expected to be a Python list of
211 Not supported by wxPerl.
214 wxSingleChoiceDialog(wxWindow
* parent
, const wxString
& message
,
215 const wxString
& caption
,
216 int n
, const wxString
* choices
,
217 void** clientData
= NULL
,
218 long style
= wxCHOICEDLG_STYLE
,
219 const wxPoint
& pos
= wxDefaultPosition
);
221 Constructor, taking an array of wxString choices and optional client
227 Message to show on the dialog.
231 An array of strings, or a string list, containing the choices.
233 An array of client data to be associated with the items. See
236 A dialog style (bitlist) containing flags chosen from standard
237 dialog styles and the ones listed in the class documentation. The
238 default value is equivalent to wxDEFAULT_DIALOG_STYLE |
239 wxRESIZE_BORDER | wxOK | wxCANCEL | wxCENTRE.
241 Dialog position. Not Windows.
243 @remarks Use ShowModal() to show the dialog.
247 For Python the two parameters @a n and @a choices are collapsed into a
248 multi parameter @a choices which is expected to be a Python list of
254 Use an array reference for the @a choices parameter.
257 wxSingleChoiceDialog(wxWindow
* parent
,
258 const wxString
& message
,
259 const wxString
& caption
,
260 const wxArrayString
& choices
,
261 void** clientData
= NULL
,
262 long style
= wxCHOICEDLG_STYLE
,
263 const wxPoint
& pos
= wxDefaultPosition
);
267 Returns the index of selected item.
269 int GetSelection() const;
272 Returns the client data associated with the selection.
276 void* GetSelectionData() const;
279 Returns the selected string.
281 wxString
GetStringSelection() const;
284 Sets the index of the initially selected item.
286 void SetSelection(int selection
);
289 Shows the dialog, returning either wxID_OK or wxID_CANCEL.
296 // ============================================================================
297 // Global functions/macros
298 // ============================================================================
300 /** @addtogroup group_funcmacro_dialog */
304 Same as wxGetSingleChoice() but returns the index representing the
305 selected string. If the user pressed cancel, -1 is returned.
307 @header{wx/choicdlg.h}
310 Use an array reference for the @a aChoices parameter.
313 int wxGetSingleChoiceIndex(const wxString
& message
,
314 const wxString
& caption
,
315 const wxArrayString
& aChoices
,
316 wxWindow
* parent
= NULL
,
317 int x
= wxDefaultCoord
,
318 int y
= wxDefaultCoord
,
320 int width
= wxCHOICE_WIDTH
,
321 int height
= wxCHOICE_HEIGHT
,
322 int initialSelection
= 0);
324 int wxGetSingleChoiceIndex(const wxString
& message
,
325 const wxString
& caption
,
327 const wxString
& choices
[],
328 wxWindow
* parent
= NULL
,
329 int x
= wxDefaultCoord
,
330 int y
= wxDefaultCoord
,
332 int width
= wxCHOICE_WIDTH
,
333 int height
= wxCHOICE_HEIGHT
,
334 int initialSelection
= 0);
337 int wxGetSingleChoiceIndex(const wxString
& message
,
338 const wxString
& caption
,
339 const wxArrayString
& choices
,
340 int initialSelection
,
341 wxWindow
*parent
= NULL
);
343 int wxGetSingleChoiceIndex(const wxString
& message
,
344 const wxString
& caption
,
345 int n
, const wxString
*choices
,
346 int initialSelection
,
347 wxWindow
*parent
= NULL
);
350 /** @addtogroup group_funcmacro_dialog */
354 Pops up a dialog box containing a message, OK/Cancel buttons and a
355 single-selection listbox. The user may choose an item and press OK to
356 return a string or Cancel to return the empty string. Use
357 wxGetSingleChoiceIndex() if empty string is a valid choice and if you want
358 to be able to detect pressing Cancel reliably.
360 You may pass the list of strings to choose from either using @c choices
361 which is an array of @a n strings for the listbox or by using a single
362 @c aChoices parameter of type wxArrayString.
364 If @c centre is @true, the message text (which may include new line
365 characters) is centred; if @false, the message is left-justified.
367 @header{wx/choicdlg.h}
370 Use an array reference for the @a choices parameter.
373 wxString
wxGetSingleChoice(const wxString
& message
,
374 const wxString
& caption
,
375 const wxArrayString
& aChoices
,
376 wxWindow
* parent
= NULL
,
377 int x
= wxDefaultCoord
,
378 int y
= wxDefaultCoord
,
380 int width
= wxCHOICE_WIDTH
,
381 int height
= wxCHOICE_HEIGHT
,
382 int initialSelection
= 0);
383 wxString
wxGetSingleChoice(const wxString
& message
,
384 const wxString
& caption
,
386 const wxString
& choices
[],
387 wxWindow
* parent
= NULL
,
388 int x
= wxDefaultCoord
,
389 int y
= wxDefaultCoord
,
391 int width
= wxCHOICE_WIDTH
,
392 int height
= wxCHOICE_HEIGHT
,
393 int initialSelection
= 0);
396 wxString
wxGetSingleChoice(const wxString
& message
,
397 const wxString
& caption
,
398 const wxArrayString
& choices
,
399 int initialSelection
,
400 wxWindow
*parent
= NULL
);
402 wxString
wxGetSingleChoice(const wxString
& message
,
403 const wxString
& caption
,
404 int n
, const wxString
*choices
,
405 int initialSelection
,
406 wxWindow
*parent
= NULL
);
410 /** @addtogroup group_funcmacro_dialog */
414 Same as wxGetSingleChoice but takes an array of client data pointers
415 corresponding to the strings, and returns one of these pointers or @NULL
416 if Cancel was pressed. The @c client_data array must have the same number
417 of elements as @c choices or @c aChoices!
419 @header{wx/choicdlg.h}
422 Use an array reference for the @a aChoices and @a client_data parameters.
425 wxString
wxGetSingleChoiceData(const wxString
& message
,
426 const wxString
& caption
,
427 const wxArrayString
& aChoices
,
428 const wxString
& client_data
[],
429 wxWindow
* parent
= NULL
,
430 int x
= wxDefaultCoord
,
431 int y
= wxDefaultCoord
,
433 int width
= wxCHOICE_WIDTH
,
434 int height
= wxCHOICE_HEIGHT
,
435 int initialSelection
= 0);
437 wxString
wxGetSingleChoiceData(const wxString
& message
,
438 const wxString
& caption
,
440 const wxString
& choices
[],
441 const wxString
& client_data
[],
442 wxWindow
* parent
= NULL
,
443 int x
= wxDefaultCoord
,
444 int y
= wxDefaultCoord
,
446 int width
= wxCHOICE_WIDTH
,
447 int height
= wxCHOICE_HEIGHT
,
448 int initialSelection
= 0);
450 void* wxGetSingleChoiceData(const wxString
& message
,
451 const wxString
& caption
,
452 const wxArrayString
& choices
,
454 int initialSelection
,
455 wxWindow
*parent
= NULL
);
457 void* wxGetSingleChoiceData(const wxString
& message
,
458 const wxString
& caption
,
459 int n
, const wxString
*choices
,
461 int initialSelection
,
462 wxWindow
*parent
= NULL
);
466 /** @addtogroup group_funcmacro_dialog */
470 Pops up a dialog box containing a message, OK/Cancel buttons and a
471 multiple-selection listbox. The user may choose an arbitrary (including 0)
472 number of items in the listbox whose indices will be returned in
473 @c selections array. The initial contents of this array will be used to
474 select the items when the dialog is shown. If the user cancels the dialog,
475 the function returns -1 and @c selections array is left unchanged.
477 You may pass the list of strings to choose from either using @c choices
478 which is an array of @a n strings for the listbox or by using a single
479 @c aChoices parameter of type wxArrayString.
481 If @c centre is @true, the message text (which may include new line
482 characters) is centred; if @false, the message is left-justified.
484 @header{wx/choicdlg.h}
487 Use an array reference for the @a choices parameter.
488 In wxPerl there is no @a selections parameter; the function
489 returns an array containing the user selections.
492 int wxGetSelectedChoices(wxArrayInt
& selections
,
493 const wxString
& message
,
494 const wxString
& caption
,
495 const wxArrayString
& aChoices
,
496 wxWindow
* parent
= NULL
,
497 int x
= wxDefaultCoord
,
498 int y
= wxDefaultCoord
,
500 int width
= wxCHOICE_WIDTH
,
501 int height
= wxCHOICE_HEIGHT
);
503 int wxGetSelectedChoices(wxArrayInt
& selections
,
504 const wxString
& message
,
505 const wxString
& caption
,
507 const wxString
& choices
[],
508 wxWindow
* parent
= NULL
,
509 int x
= wxDefaultCoord
,
510 int y
= wxDefaultCoord
,
512 int width
= wxCHOICE_WIDTH
,
513 int height
= wxCHOICE_HEIGHT
);