]> git.saurik.com Git - wxWidgets.git/blame - interface/choicdlg.h
remove daily build of docs
[wxWidgets.git] / interface / choicdlg.h
CommitLineData
23324ae1
FM
1/////////////////////////////////////////////////////////////////////////////
2// Name: choicdlg.h
e54c96f1 3// Purpose: interface of wxMultiChoiceDialog
23324ae1
FM
4// Author: wxWidgets team
5// RCS-ID: $Id$
6// Licence: wxWindows license
7/////////////////////////////////////////////////////////////////////////////
8
9/**
10 @class wxMultiChoiceDialog
11 @wxheader{choicdlg.h}
7c913512 12
23324ae1
FM
13 This class represents a dialog that shows a list of strings, and allows
14 the user to select one or more.
7c913512 15
23324ae1
FM
16 @library{wxbase}
17 @category{cmndlg}
7c913512 18
e54c96f1 19 @see @ref overview_wxmultichoicedialogoverview "wxMultiChoiceDialog overview",
23324ae1
FM
20 wxSingleChoiceDialog
21*/
22class wxMultiChoiceDialog : public wxDialog
23{
24public:
25 //@{
26 /**
27 Constructor taking an array of wxString choices.
28
7c913512 29 @param parent
4cc4bfaf 30 Parent window.
7c913512 31 @param message
4cc4bfaf 32 Message to show on the dialog.
7c913512 33 @param caption
4cc4bfaf 34 The dialog caption.
7c913512 35 @param n
4cc4bfaf 36 The number of choices.
7c913512 37 @param choices
4cc4bfaf 38 An array of strings, or a string list, containing the choices.
7c913512 39 @param style
4cc4bfaf
FM
40 A dialog style (bitlist) containing flags chosen from standard
41 dialog styles and the following:
42
43
44
45
46
47
48
49 wxOK
50
51
52
23324ae1 53
4cc4bfaf 54 Show an OK button.
23324ae1 55
23324ae1
FM
56
57
23324ae1 58
23324ae1 59
4cc4bfaf 60 wxCANCEL
23324ae1 61
23324ae1 62
23324ae1
FM
63
64
4cc4bfaf 65 Show a Cancel button.
23324ae1 66
23324ae1 67
4cc4bfaf
FM
68
69
70
71 wxCENTRE
72
73
74
75
76 Centre the message. Not Windows.
77
78
79
80
81
82 The default value is equivalent to wxDEFAULT_DIALOG_STYLE |
83 wxRESIZE_BORDER | wxOK | wxCANCEL | wxCENTRE.
7c913512 84 @param pos
4cc4bfaf 85 Dialog position. Not Windows.
23324ae1
FM
86
87 @remarks Use ShowModal() to show the dialog.
88 */
89 wxMultiChoiceDialog(wxWindow* parent, const wxString& message,
90 const wxString& caption,
91 int n,
92 const wxString* choices,
93 long style = wxCHOICEDLG_STYLE,
94 const wxPoint& pos = wxDefaultPosition);
7c913512
FM
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);
23324ae1
FM
101 //@}
102
103 /**
104 Returns array with indexes of selected items.
105 */
328f5751 106 wxArrayInt GetSelection() const;
23324ae1
FM
107
108 /**
109 Sets selected items from the array of selected items' indexes.
110 */
328f5751 111 void SetSelections(const wxArrayInt& selections) const;
23324ae1
FM
112
113 /**
114 Shows the dialog, returning either wxID_OK or wxID_CANCEL.
115 */
116 int ShowModal();
117};
118
119
e54c96f1 120
23324ae1
FM
121/**
122 @class wxSingleChoiceDialog
123 @wxheader{choicdlg.h}
7c913512 124
23324ae1
FM
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.
7c913512 128
23324ae1
FM
129 @library{wxbase}
130 @category{cmndlg}
7c913512 131
e54c96f1
FM
132 @see @ref overview_wxsinglechoicedialogoverview "wxSingleChoiceDialog
133 overview", wxMultiChoiceDialog
23324ae1
FM
134*/
135class wxSingleChoiceDialog : public wxDialog
136{
137public:
138 //@{
139 /**
140 Constructor, taking an array of wxString choices and optional client data.
141
7c913512 142 @param parent
4cc4bfaf 143 Parent window.
7c913512 144 @param message
4cc4bfaf 145 Message to show on the dialog.
7c913512 146 @param caption
4cc4bfaf 147 The dialog caption.
7c913512 148 @param n
4cc4bfaf 149 The number of choices.
7c913512 150 @param choices
4cc4bfaf 151 An array of strings, or a string list, containing the choices.
7c913512 152 @param clientData
4cc4bfaf
FM
153 An array of client data to be associated with the items.
154 See GetSelectionClientData.
7c913512 155 @param style
4cc4bfaf
FM
156 A dialog style (bitlist) containing flags chosen from standard
157 dialog styles and the following:
158
159
160
161
162
163
164
165 wxOK
166
167
168
169
170 Show an OK button.
171
23324ae1
FM
172
173
23324ae1
FM
174
175
4cc4bfaf 176 wxCANCEL
23324ae1 177
23324ae1
FM
178
179
23324ae1 180
4cc4bfaf 181 Show a Cancel button.
23324ae1
FM
182
183
23324ae1 184
23324ae1 185
4cc4bfaf
FM
186
187 wxCENTRE
188
189
190
191
192 Centre the message. Not Windows.
193
194
195
196
197
198 The default value is equivalent to wxDEFAULT_DIALOG_STYLE |
199 wxRESIZE_BORDER | wxOK | wxCANCEL | wxCENTRE.
7c913512 200 @param pos
4cc4bfaf 201 Dialog position. Not Windows.
23324ae1
FM
202
203 @remarks Use ShowModal() to show the dialog.
204 */
205 wxSingleChoiceDialog(wxWindow* parent, const wxString& message,
206 const wxString& caption,
207 int n,
208 const wxString* choices,
4cc4bfaf 209 void** clientData = NULL,
23324ae1
FM
210 long style = wxCHOICEDLG_STYLE,
211 const wxPoint& pos = wxDefaultPosition);
7c913512
FM
212 wxSingleChoiceDialog(wxWindow* parent,
213 const wxString& message,
214 const wxString& caption,
215 const wxArrayString& choices,
4cc4bfaf 216 void** clientData = NULL,
7c913512
FM
217 long style = wxCHOICEDLG_STYLE,
218 const wxPoint& pos = wxDefaultPosition);
23324ae1
FM
219 //@}
220
221 /**
222 Returns the index of selected item.
223 */
328f5751 224 int GetSelection() const;
23324ae1
FM
225
226 /**
227 Returns the client data associated with the selection.
228 */
328f5751 229 char* GetSelectionClientData() const;
23324ae1
FM
230
231 /**
232 Returns the selected string.
233 */
328f5751 234 wxString GetStringSelection() const;
23324ae1
FM
235
236 /**
237 Sets the index of the initially selected item.
238 */
328f5751 239 void SetSelection(int selection) const;
23324ae1
FM
240
241 /**
242 Shows the dialog, returning either wxID_OK or wxID_CANCEL.
243 */
244 int ShowModal();
245};
246
247
e54c96f1 248
23324ae1
FM
249// ============================================================================
250// Global functions/macros
251// ============================================================================
252
253//@{
254/**
255 As @b wxGetSingleChoice but returns the index representing the selected
256 string. If the user pressed cancel, -1 is returned.
257*/
258int wxGetSingleChoiceIndex(const wxString& message,
259 const wxString& caption,
260 const wxArrayString& aChoices,
4cc4bfaf 261 wxWindow* parent = NULL,
23324ae1
FM
262 int x = -1,
263 int y = -1,
4cc4bfaf
FM
264 bool centre = true,
265 int width = 150,
266 int height = 200);
7c913512
FM
267int wxGetSingleChoiceIndex(const wxString& message,
268 const wxString& caption,
269 int n,
270 const wxString& choices[],
4cc4bfaf 271 wxWindow* parent = NULL,
7c913512
FM
272 int x = -1,
273 int y = -1,
4cc4bfaf
FM
274 bool centre = true,
275 int width = 150,
276 int height = 200);
23324ae1
FM
277//@}
278
279//@{
280/**
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
e54c96f1 284 wxGetSingleChoiceIndex() if empty string is a
23324ae1 285 valid choice and if you want to be able to detect pressing Cancel reliably.
23324ae1 286 You may pass the list of strings to choose from either using @e choices
4cc4bfaf
FM
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
23324ae1
FM
290 characters) is centred; if @false, the message is left-justified.
291*/
292wxString wxGetSingleChoice(const wxString& message,
293 const wxString& caption,
294 const wxArrayString& aChoices,
4cc4bfaf 295 wxWindow* parent = NULL,
23324ae1
FM
296 int x = -1,
297 int y = -1,
4cc4bfaf
FM
298 bool centre = true,
299 int width = 150,
300 int height = 200);
7c913512
FM
301wxString wxGetSingleChoice(const wxString& message,
302 const wxString& caption,
303 int n,
304 const wxString& choices[],
4cc4bfaf 305 wxWindow* parent = NULL,
7c913512
FM
306 int x = -1,
307 int y = -1,
4cc4bfaf
FM
308 bool centre = true,
309 int width = 150,
310 int height = 200);
23324ae1
FM
311//@}
312
313//@{
314/**
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!
319*/
320wxString wxGetSingleChoiceData(const wxString& message,
321 const wxString& caption,
322 const wxArrayString& aChoices,
323 const wxString& client_data[],
4cc4bfaf 324 wxWindow* parent = NULL,
23324ae1
FM
325 int x = -1,
326 int y = -1,
4cc4bfaf
FM
327 bool centre = true,
328 int width = 150,
329 int height = 200);
7c913512
FM
330wxString wxGetSingleChoiceData(const wxString& message,
331 const wxString& caption,
332 int n,
333 const wxString& choices[],
334 const wxString& client_data[],
4cc4bfaf 335 wxWindow* parent = NULL,
7c913512
FM
336 int x = -1,
337 int y = -1,
4cc4bfaf
FM
338 bool centre = true,
339 int width = 150,
340 int height = 200);
23324ae1
FM
341//@}
342
343//@{
344/**
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.
23324ae1 350 You may pass the list of strings to choose from either using @e choices
4cc4bfaf
FM
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
23324ae1
FM
354 characters) is centred; if @false, the message is left-justified.
355*/
356size_t wxGetMultipleChoices(wxArrayInt& selections,
357 const wxString& message,
358 const wxString& caption,
359 const wxArrayString& aChoices,
4cc4bfaf 360 wxWindow* parent = NULL,
23324ae1
FM
361 int x = -1,
362 int y = -1,
4cc4bfaf
FM
363 bool centre = true,
364 int width = 150,
365 int height = 200);
7c913512
FM
366size_t wxGetMultipleChoices(wxArrayInt& selections,
367 const wxString& message,
368 const wxString& caption,
369 int n,
370 const wxString& choices[],
4cc4bfaf 371 wxWindow* parent = NULL,
7c913512
FM
372 int x = -1,
373 int y = -1,
4cc4bfaf
FM
374 bool centre = true,
375 int width = 150,
376 int height = 200);
23324ae1
FM
377//@}
378