]>
git.saurik.com Git - wxWidgets.git/blob - interface/wx/choicdlg.h
1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: interface of wx[Multi|Single]ChoiceDialog
4 // Author: wxWidgets team
5 // Licence: wxWindows licence
6 /////////////////////////////////////////////////////////////////////////////
9 Default width of the choice dialog.
11 #define wxCHOICE_WIDTH 150
14 Default height of the choice dialog.
16 #define wxCHOICE_HEIGHT 200
19 Default style of the choice dialog.
21 @remarks wxRESIZE_BORDER is not used under WinCE.
23 #define wxCHOICEDLG_STYLE (wxDEFAULT_DIALOG_STYLE | wxOK | wxCANCEL | wxCENTRE | wxRESIZE_BORDER)
27 @class wxMultiChoiceDialog
29 This class represents a dialog that shows a list of strings, and allows the
30 user to select one or more.
38 Centre the message. Not Windows.
44 @see @ref overview_cmndlg_multichoice, wxSingleChoiceDialog
46 class wxMultiChoiceDialog
: public wxDialog
51 Constructor taking an array of wxString choices.
56 Message to show on the dialog.
60 The number of choices.
62 An array of strings, or a string list, containing the choices.
64 A dialog style (bitlist) containing flags chosen from standard
65 dialog styles and the ones listed in the class documentation. The
66 default value is equivalent to wxDEFAULT_DIALOG_STYLE |
67 wxRESIZE_BORDER | wxOK | wxCANCEL | wxCENTRE.
69 Dialog position. Not Windows.
71 @remarks Use ShowModal() to show the dialog.
74 Not supported by wxPerl.
77 wxMultiChoiceDialog(wxWindow
* parent
, const wxString
& message
,
78 const wxString
& caption
,
79 int n
, const wxString
* choices
,
80 long style
= wxCHOICEDLG_STYLE
,
81 const wxPoint
& pos
= wxDefaultPosition
);
83 Constructor taking an array of wxString choices.
88 Message to show on the dialog.
92 An array of strings, or a string list, containing the choices.
94 A dialog style (bitlist) containing flags chosen from standard
95 dialog styles and the ones listed in the class documentation. The
96 default value is equivalent to wxDEFAULT_DIALOG_STYLE |
97 wxRESIZE_BORDER | wxOK | wxCANCEL | wxCENTRE.
99 Dialog position. Not Windows.
101 @remarks Use ShowModal() to show the dialog.
104 Use an array reference for the @a choices parameter.
107 wxMultiChoiceDialog(wxWindow
* parent
,
108 const wxString
& message
,
109 const wxString
& caption
,
110 const wxArrayString
& choices
,
111 long style
= wxCHOICEDLG_STYLE
,
112 const wxPoint
& pos
= wxDefaultPosition
);
116 Returns array with indexes of selected items.
118 wxArrayInt
GetSelections() const;
121 Sets selected items from the array of selected items' indexes.
123 void SetSelections(const wxArrayInt
& selections
);
126 Shows the dialog, returning either wxID_OK or wxID_CANCEL.
134 @class wxSingleChoiceDialog
136 This class represents a dialog that shows a list of strings, and allows the
137 user to select one. Double-clicking on a list item is equivalent to
138 single-clicking and then pressing OK.
144 Show a Cancel button.
146 Centre the message. Not Windows.
152 @see @ref overview_cmndlg_singlechoice, wxMultiChoiceDialog
154 class wxSingleChoiceDialog
: public wxDialog
159 Constructor, taking an array of wxString choices and optional client
165 Message to show on the dialog.
169 The number of choices.
171 An array of strings, or a string list, containing the choices.
173 An array of client data to be associated with the items. See
176 A dialog style (bitlist) containing flags chosen from standard
177 dialog styles and the ones listed in the class documentation. The
178 default value is equivalent to wxDEFAULT_DIALOG_STYLE |
179 wxRESIZE_BORDER | wxOK | wxCANCEL | wxCENTRE.
181 Dialog position. Not Windows.
183 @remarks Use ShowModal() to show the dialog.
186 Not supported by wxPerl.
189 wxSingleChoiceDialog(wxWindow
* parent
, const wxString
& message
,
190 const wxString
& caption
,
191 int n
, const wxString
* choices
,
192 void** clientData
= NULL
,
193 long style
= wxCHOICEDLG_STYLE
,
194 const wxPoint
& pos
= wxDefaultPosition
);
196 Constructor, taking an array of wxString choices and optional client
202 Message to show on the dialog.
206 An array of strings, or a string list, containing the choices.
208 An array of client data to be associated with the items. See
211 A dialog style (bitlist) containing flags chosen from standard
212 dialog styles and the ones listed in the class documentation. The
213 default value is equivalent to wxDEFAULT_DIALOG_STYLE |
214 wxRESIZE_BORDER | wxOK | wxCANCEL | wxCENTRE.
216 Dialog position. Not Windows.
218 @remarks Use ShowModal() to show the dialog.
221 Use an array reference for the @a choices parameter.
224 wxSingleChoiceDialog(wxWindow
* parent
,
225 const wxString
& message
,
226 const wxString
& caption
,
227 const wxArrayString
& choices
,
228 void** clientData
= NULL
,
229 long style
= wxCHOICEDLG_STYLE
,
230 const wxPoint
& pos
= wxDefaultPosition
);
234 Returns the index of selected item.
236 int GetSelection() const;
239 Returns the client data associated with the selection.
243 void* GetSelectionData() const;
246 Returns the selected string.
248 wxString
GetStringSelection() const;
251 Sets the index of the initially selected item.
253 void SetSelection(int selection
);
256 Shows the dialog, returning either wxID_OK or wxID_CANCEL.
263 // ============================================================================
264 // Global functions/macros
265 // ============================================================================
267 /** @addtogroup group_funcmacro_dialog */
271 Same as wxGetSingleChoice() but returns the index representing the
272 selected string. If the user pressed cancel, -1 is returned.
274 @header{wx/choicdlg.h}
277 Use an array reference for the @a aChoices parameter.
280 int wxGetSingleChoiceIndex(const wxString
& message
,
281 const wxString
& caption
,
282 const wxArrayString
& aChoices
,
283 wxWindow
* parent
= NULL
,
284 int x
= wxDefaultCoord
,
285 int y
= wxDefaultCoord
,
287 int width
= wxCHOICE_WIDTH
,
288 int height
= wxCHOICE_HEIGHT
,
289 int initialSelection
= 0);
291 int wxGetSingleChoiceIndex(const wxString
& message
,
292 const wxString
& caption
,
294 const wxString
& choices
[],
295 wxWindow
* parent
= NULL
,
296 int x
= wxDefaultCoord
,
297 int y
= wxDefaultCoord
,
299 int width
= wxCHOICE_WIDTH
,
300 int height
= wxCHOICE_HEIGHT
,
301 int initialSelection
= 0);
304 int wxGetSingleChoiceIndex(const wxString
& message
,
305 const wxString
& caption
,
306 const wxArrayString
& choices
,
307 int initialSelection
,
308 wxWindow
*parent
= NULL
);
310 int wxGetSingleChoiceIndex(const wxString
& message
,
311 const wxString
& caption
,
312 int n
, const wxString
*choices
,
313 int initialSelection
,
314 wxWindow
*parent
= NULL
);
317 /** @addtogroup group_funcmacro_dialog */
321 Pops up a dialog box containing a message, OK/Cancel buttons and a
322 single-selection listbox. The user may choose an item and press OK to
323 return a string or Cancel to return the empty string. Use
324 wxGetSingleChoiceIndex() if empty string is a valid choice and if you want
325 to be able to detect pressing Cancel reliably.
327 You may pass the list of strings to choose from either using @c choices
328 which is an array of @a n strings for the listbox or by using a single
329 @c aChoices parameter of type wxArrayString.
331 If @c centre is @true, the message text (which may include new line
332 characters) is centred; if @false, the message is left-justified.
334 @header{wx/choicdlg.h}
337 Use an array reference for the @a choices parameter.
340 wxString
wxGetSingleChoice(const wxString
& message
,
341 const wxString
& caption
,
342 const wxArrayString
& aChoices
,
343 wxWindow
* parent
= NULL
,
344 int x
= wxDefaultCoord
,
345 int y
= wxDefaultCoord
,
347 int width
= wxCHOICE_WIDTH
,
348 int height
= wxCHOICE_HEIGHT
,
349 int initialSelection
= 0);
350 wxString
wxGetSingleChoice(const wxString
& message
,
351 const wxString
& caption
,
353 const wxString
& choices
[],
354 wxWindow
* parent
= NULL
,
355 int x
= wxDefaultCoord
,
356 int y
= wxDefaultCoord
,
358 int width
= wxCHOICE_WIDTH
,
359 int height
= wxCHOICE_HEIGHT
,
360 int initialSelection
= 0);
363 wxString
wxGetSingleChoice(const wxString
& message
,
364 const wxString
& caption
,
365 const wxArrayString
& choices
,
366 int initialSelection
,
367 wxWindow
*parent
= NULL
);
369 wxString
wxGetSingleChoice(const wxString
& message
,
370 const wxString
& caption
,
371 int n
, const wxString
*choices
,
372 int initialSelection
,
373 wxWindow
*parent
= NULL
);
377 /** @addtogroup group_funcmacro_dialog */
381 Same as wxGetSingleChoice but takes an array of client data pointers
382 corresponding to the strings, and returns one of these pointers or @NULL
383 if Cancel was pressed. The @c client_data array must have the same number
384 of elements as @c choices or @c aChoices!
386 @header{wx/choicdlg.h}
389 Use an array reference for the @a aChoices and @a client_data parameters.
392 wxString
wxGetSingleChoiceData(const wxString
& message
,
393 const wxString
& caption
,
394 const wxArrayString
& aChoices
,
395 const wxString
& client_data
[],
396 wxWindow
* parent
= NULL
,
397 int x
= wxDefaultCoord
,
398 int y
= wxDefaultCoord
,
400 int width
= wxCHOICE_WIDTH
,
401 int height
= wxCHOICE_HEIGHT
,
402 int initialSelection
= 0);
404 wxString
wxGetSingleChoiceData(const wxString
& message
,
405 const wxString
& caption
,
407 const wxString
& choices
[],
408 const wxString
& client_data
[],
409 wxWindow
* parent
= NULL
,
410 int x
= wxDefaultCoord
,
411 int y
= wxDefaultCoord
,
413 int width
= wxCHOICE_WIDTH
,
414 int height
= wxCHOICE_HEIGHT
,
415 int initialSelection
= 0);
417 void* wxGetSingleChoiceData(const wxString
& message
,
418 const wxString
& caption
,
419 const wxArrayString
& choices
,
421 int initialSelection
,
422 wxWindow
*parent
= NULL
);
424 void* wxGetSingleChoiceData(const wxString
& message
,
425 const wxString
& caption
,
426 int n
, const wxString
*choices
,
428 int initialSelection
,
429 wxWindow
*parent
= NULL
);
433 /** @addtogroup group_funcmacro_dialog */
437 Pops up a dialog box containing a message, OK/Cancel buttons and a
438 multiple-selection listbox. The user may choose an arbitrary (including 0)
439 number of items in the listbox whose indices will be returned in
440 @c selections array. The initial contents of this array will be used to
441 select the items when the dialog is shown. If the user cancels the dialog,
442 the function returns -1 and @c selections array is left unchanged.
444 You may pass the list of strings to choose from either using @c choices
445 which is an array of @a n strings for the listbox or by using a single
446 @c aChoices parameter of type wxArrayString.
448 If @c centre is @true, the message text (which may include new line
449 characters) is centred; if @false, the message is left-justified.
451 @header{wx/choicdlg.h}
454 Use an array reference for the @a choices parameter.
455 In wxPerl there is no @a selections parameter; the function
456 returns an array containing the user selections.
459 int wxGetSelectedChoices(wxArrayInt
& selections
,
460 const wxString
& message
,
461 const wxString
& caption
,
462 const wxArrayString
& aChoices
,
463 wxWindow
* parent
= NULL
,
464 int x
= wxDefaultCoord
,
465 int y
= wxDefaultCoord
,
467 int width
= wxCHOICE_WIDTH
,
468 int height
= wxCHOICE_HEIGHT
);
470 int wxGetSelectedChoices(wxArrayInt
& selections
,
471 const wxString
& message
,
472 const wxString
& caption
,
474 const wxString
& choices
[],
475 wxWindow
* parent
= NULL
,
476 int x
= wxDefaultCoord
,
477 int y
= wxDefaultCoord
,
479 int width
= wxCHOICE_WIDTH
,
480 int height
= wxCHOICE_HEIGHT
);