]> git.saurik.com Git - wxWidgets.git/blame - interface/choicdlg.h
remove unused wxAppTraits-related files
[wxWidgets.git] / interface / choicdlg.h
CommitLineData
23324ae1
FM
1/////////////////////////////////////////////////////////////////////////////
2// Name: choicdlg.h
ba2874ff 3// Purpose: interface of wx[Multi|Single]ChoiceDialog
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
bfac6166
BP
13 This class represents a dialog that shows a list of strings, and allows the
14 user to select one or more.
7c913512 15
23324ae1
FM
16 @library{wxbase}
17 @category{cmndlg}
7c913512 18
ba2874ff 19 @see @ref overview_cmndlg_multichoice, wxSingleChoiceDialog
23324ae1
FM
20*/
21class wxMultiChoiceDialog : public wxDialog
22{
23public:
24 //@{
25 /**
26 Constructor taking an array of wxString choices.
ba2874ff 27
7c913512 28 @param parent
4cc4bfaf 29 Parent window.
7c913512 30 @param message
4cc4bfaf 31 Message to show on the dialog.
7c913512 32 @param caption
4cc4bfaf 33 The dialog caption.
7c913512 34 @param n
4cc4bfaf 35 The number of choices.
7c913512 36 @param choices
4cc4bfaf 37 An array of strings, or a string list, containing the choices.
7c913512 38 @param style
4cc4bfaf 39 A dialog style (bitlist) containing flags chosen from standard
ba2874ff
BP
40 dialog style and the ones listed below. The default value is
41 equivalent to wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER | wxOK |
42 wxCANCEL | wxCENTRE.
43 @param pos
44 Dialog position. Not Windows.
45
46 @beginStyleTable
8c6791e4 47 @style{wxOK}
4cc4bfaf 48 Show an OK button.
8c6791e4 49 @style{wxCANCEL}
4cc4bfaf 50 Show a Cancel button.
8c6791e4 51 @style{wxCENTRE}
4cc4bfaf 52 Centre the message. Not Windows.
ba2874ff
BP
53 @endStyleTable
54
23324ae1 55 @remarks Use ShowModal() to show the dialog.
bfac6166
BP
56
57 @beginWxPythonOnly
58
59 For Python the two parameters @a n and @a choices are collapsed into a
60 multi parameter @a choices which is expected to be a Python list of
61 strings.
62
63 @endWxPythonOnly
23324ae1
FM
64 */
65 wxMultiChoiceDialog(wxWindow* parent, const wxString& message,
66 const wxString& caption,
bfac6166 67 int n, const wxString* choices,
23324ae1
FM
68 long style = wxCHOICEDLG_STYLE,
69 const wxPoint& pos = wxDefaultPosition);
7c913512
FM
70 wxMultiChoiceDialog(wxWindow* parent,
71 const wxString& message,
72 const wxString& caption,
73 const wxArrayString& choices,
74 long style = wxCHOICEDLG_STYLE,
75 const wxPoint& pos = wxDefaultPosition);
23324ae1
FM
76 //@}
77
78 /**
79 Returns array with indexes of selected items.
80 */
328f5751 81 wxArrayInt GetSelection() const;
23324ae1
FM
82
83 /**
84 Sets selected items from the array of selected items' indexes.
85 */
328f5751 86 void SetSelections(const wxArrayInt& selections) const;
23324ae1
FM
87
88 /**
89 Shows the dialog, returning either wxID_OK or wxID_CANCEL.
90 */
91 int ShowModal();
92};
93
94
e54c96f1 95
23324ae1
FM
96/**
97 @class wxSingleChoiceDialog
98 @wxheader{choicdlg.h}
7c913512 99
bfac6166
BP
100 This class represents a dialog that shows a list of strings, and allows the
101 user to select one. Double-clicking on a list item is equivalent to
23324ae1 102 single-clicking and then pressing OK.
7c913512 103
23324ae1
FM
104 @library{wxbase}
105 @category{cmndlg}
7c913512 106
ba2874ff 107 @see @ref overview_cmndlg_singlechoice, wxMultiChoiceDialog
23324ae1
FM
108*/
109class wxSingleChoiceDialog : public wxDialog
110{
111public:
112 //@{
113 /**
ba2874ff
BP
114 Constructor, taking an array of wxString choices and optional client
115 data.
116
7c913512 117 @param parent
4cc4bfaf 118 Parent window.
7c913512 119 @param message
4cc4bfaf 120 Message to show on the dialog.
7c913512 121 @param caption
4cc4bfaf 122 The dialog caption.
7c913512 123 @param n
4cc4bfaf 124 The number of choices.
7c913512 125 @param choices
4cc4bfaf 126 An array of strings, or a string list, containing the choices.
7c913512 127 @param clientData
bfac6166
BP
128 An array of client data to be associated with the items. See
129 GetSelectionClientData().
7c913512 130 @param style
4cc4bfaf 131 A dialog style (bitlist) containing flags chosen from standard
ba2874ff
BP
132 dialog styles and the ones listed below. The default value is
133 equivalent to wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER | wxOK |
134 wxCANCEL | wxCENTRE.
135 @param pos
136 Dialog position. Not Windows.
137
138 @beginStyleTable
8c6791e4 139 @style{wxOK}
4cc4bfaf 140 Show an OK button.
8c6791e4 141 @style{wxCANCEL}
4cc4bfaf 142 Show a Cancel button.
8c6791e4 143 @style{wxCENTRE}
4cc4bfaf 144 Centre the message. Not Windows.
ba2874ff
BP
145 @endStyleTable
146
23324ae1 147 @remarks Use ShowModal() to show the dialog.
bfac6166
BP
148
149 @beginWxPythonOnly
150
151 For Python the two parameters @a n and @a choices are collapsed into a
152 multi parameter @a choices which is expected to be a Python list of
153 strings.
154
155 @endWxPythonOnly
23324ae1
FM
156 */
157 wxSingleChoiceDialog(wxWindow* parent, const wxString& message,
158 const wxString& caption,
bfac6166 159 int n, const wxString* choices,
4cc4bfaf 160 void** clientData = NULL,
23324ae1
FM
161 long style = wxCHOICEDLG_STYLE,
162 const wxPoint& pos = wxDefaultPosition);
7c913512
FM
163 wxSingleChoiceDialog(wxWindow* parent,
164 const wxString& message,
165 const wxString& caption,
166 const wxArrayString& choices,
4cc4bfaf 167 void** clientData = NULL,
7c913512
FM
168 long style = wxCHOICEDLG_STYLE,
169 const wxPoint& pos = wxDefaultPosition);
23324ae1
FM
170 //@}
171
172 /**
173 Returns the index of selected item.
174 */
328f5751 175 int GetSelection() const;
23324ae1
FM
176
177 /**
178 Returns the client data associated with the selection.
179 */
328f5751 180 char* GetSelectionClientData() const;
23324ae1
FM
181
182 /**
183 Returns the selected string.
184 */
328f5751 185 wxString GetStringSelection() const;
23324ae1
FM
186
187 /**
188 Sets the index of the initially selected item.
189 */
328f5751 190 void SetSelection(int selection) const;
23324ae1
FM
191
192 /**
193 Shows the dialog, returning either wxID_OK or wxID_CANCEL.
194 */
195 int ShowModal();
196};
197
198
e54c96f1 199
23324ae1
FM
200// ============================================================================
201// Global functions/macros
202// ============================================================================
203
ba2874ff 204/** @ingroup group_funcmacro_dialog */
23324ae1 205//@{
ba2874ff 206
23324ae1 207/**
ba2874ff
BP
208 Same as wxGetSingleChoice() but returns the index representing the
209 selected string. If the user pressed cancel, -1 is returned.
210
211 @header{wx/choicdlg.h}
23324ae1
FM
212*/
213int wxGetSingleChoiceIndex(const wxString& message,
214 const wxString& caption,
215 const wxArrayString& aChoices,
4cc4bfaf 216 wxWindow* parent = NULL,
23324ae1
FM
217 int x = -1,
218 int y = -1,
4cc4bfaf
FM
219 bool centre = true,
220 int width = 150,
221 int height = 200);
7c913512
FM
222int wxGetSingleChoiceIndex(const wxString& message,
223 const wxString& caption,
224 int n,
225 const wxString& choices[],
4cc4bfaf 226 wxWindow* parent = NULL,
7c913512
FM
227 int x = -1,
228 int y = -1,
4cc4bfaf
FM
229 bool centre = true,
230 int width = 150,
231 int height = 200);
ba2874ff 232
23324ae1
FM
233//@}
234
ba2874ff 235/** @ingroup group_funcmacro_dialog */
23324ae1 236//@{
ba2874ff 237
23324ae1
FM
238/**
239 Pops up a dialog box containing a message, OK/Cancel buttons and a
ba2874ff
BP
240 single-selection listbox. The user may choose an item and press OK to
241 return a string or Cancel to return the empty string. Use
242 wxGetSingleChoiceIndex() if empty string is a valid choice and if you want
243 to be able to detect pressing Cancel reliably.
244
245 You may pass the list of strings to choose from either using @c choices
4cc4bfaf 246 which is an array of @a n strings for the listbox or by using a single
ba2874ff
BP
247 @c aChoices parameter of type wxArrayString.
248
249 If @c centre is @true, the message text (which may include new line
23324ae1 250 characters) is centred; if @false, the message is left-justified.
ba2874ff
BP
251
252 @header{wx/choicdlg.h}
23324ae1
FM
253*/
254wxString wxGetSingleChoice(const wxString& message,
255 const wxString& caption,
256 const wxArrayString& aChoices,
4cc4bfaf 257 wxWindow* parent = NULL,
23324ae1
FM
258 int x = -1,
259 int y = -1,
4cc4bfaf
FM
260 bool centre = true,
261 int width = 150,
262 int height = 200);
7c913512
FM
263wxString wxGetSingleChoice(const wxString& message,
264 const wxString& caption,
265 int n,
266 const wxString& choices[],
4cc4bfaf 267 wxWindow* parent = NULL,
7c913512
FM
268 int x = -1,
269 int y = -1,
4cc4bfaf
FM
270 bool centre = true,
271 int width = 150,
272 int height = 200);
ba2874ff 273
23324ae1
FM
274//@}
275
ba2874ff 276/** @ingroup group_funcmacro_dialog */
23324ae1 277//@{
ba2874ff 278
23324ae1 279/**
ba2874ff
BP
280 Same as wxGetSingleChoice but takes an array of client data pointers
281 corresponding to the strings, and returns one of these pointers or @NULL
282 if Cancel was pressed. The @c client_data array must have the same number
283 of elements as @c choices or @c aChoices!
284
285 @header{wx/choicdlg.h}
23324ae1
FM
286*/
287wxString wxGetSingleChoiceData(const wxString& message,
288 const wxString& caption,
289 const wxArrayString& aChoices,
290 const wxString& client_data[],
4cc4bfaf 291 wxWindow* parent = NULL,
23324ae1
FM
292 int x = -1,
293 int y = -1,
4cc4bfaf
FM
294 bool centre = true,
295 int width = 150,
296 int height = 200);
7c913512
FM
297wxString wxGetSingleChoiceData(const wxString& message,
298 const wxString& caption,
299 int n,
300 const wxString& choices[],
301 const wxString& client_data[],
4cc4bfaf 302 wxWindow* parent = NULL,
7c913512
FM
303 int x = -1,
304 int y = -1,
4cc4bfaf
FM
305 bool centre = true,
306 int width = 150,
307 int height = 200);
ba2874ff 308
23324ae1
FM
309//@}
310
ba2874ff 311/** @ingroup group_funcmacro_dialog */
23324ae1 312//@{
ba2874ff 313
23324ae1
FM
314/**
315 Pops up a dialog box containing a message, OK/Cancel buttons and a
316 multiple-selection listbox. The user may choose an arbitrary (including 0)
317 number of items in the listbox whose indices will be returned in
ba2874ff 318 @c selections array. The initial contents of this array will be used to
23324ae1 319 select the items when the dialog is shown.
ba2874ff
BP
320
321 You may pass the list of strings to choose from either using @c choices
4cc4bfaf 322 which is an array of @a n strings for the listbox or by using a single
ba2874ff
BP
323 @c aChoices parameter of type wxArrayString.
324
325 If @c centre is @true, the message text (which may include new line
23324ae1 326 characters) is centred; if @false, the message is left-justified.
ba2874ff
BP
327
328 @header{wx/choicdlg.h}
23324ae1
FM
329*/
330size_t wxGetMultipleChoices(wxArrayInt& selections,
331 const wxString& message,
332 const wxString& caption,
333 const wxArrayString& aChoices,
4cc4bfaf 334 wxWindow* parent = NULL,
23324ae1
FM
335 int x = -1,
336 int y = -1,
4cc4bfaf
FM
337 bool centre = true,
338 int width = 150,
339 int height = 200);
7c913512
FM
340size_t wxGetMultipleChoices(wxArrayInt& selections,
341 const wxString& message,
342 const wxString& caption,
343 int n,
344 const wxString& choices[],
4cc4bfaf 345 wxWindow* parent = NULL,
7c913512
FM
346 int x = -1,
347 int y = -1,
4cc4bfaf
FM
348 bool centre = true,
349 int width = 150,
350 int height = 200);
ba2874ff 351
23324ae1
FM
352//@}
353