]> git.saurik.com Git - wxWidgets.git/blame - wxPython/src/_cmndlgs.i
Fixed typo causing multiple file selections to always return the same single name.
[wxWidgets.git] / wxPython / src / _cmndlgs.i
CommitLineData
7bf85405 1/////////////////////////////////////////////////////////////////////////////
d14a1e28
RD
2// Name: _cmndlgs.i
3// Purpose: SWIG interface for the "Common Dialog" classes
7bf85405
RD
4//
5// Author: Robin Dunn
6//
d14a1e28 7// Created: 25-July-1998
7bf85405 8// RCS-ID: $Id$
d14a1e28 9// Copyright: (c) 2003 by Total Control Software
7bf85405
RD
10// Licence: wxWindows license
11/////////////////////////////////////////////////////////////////////////////
12
d14a1e28 13// Not a %module
7bf85405 14
7bf85405 15
d14a1e28
RD
16//---------------------------------------------------------------------------
17%newgroup
7bf85405 18
b2dc1044
RD
19MAKE_CONST_WXSTRING(FileSelectorPromptStr);
20MAKE_CONST_WXSTRING(DirSelectorPromptStr);
21MAKE_CONST_WXSTRING(DirDialogNameStr);
22MAKE_CONST_WXSTRING(FileSelectorDefaultWildcardStr);
23MAKE_CONST_WXSTRING(GetTextFromUserPromptStr);
24MAKE_CONST_WXSTRING(MessageBoxCaptionStr);
137b5242 25
d14a1e28
RD
26//---------------------------------------------------------------------------
27
137b5242 28
9416aa89 29class wxColourData : public wxObject {
7bf85405
RD
30public:
31 wxColourData();
32 ~wxColourData();
33
34 bool GetChooseFull();
25832b3f 35 wxColour GetColour();
fb5e0af0 36 wxColour GetCustomColour(int i);
7bf85405
RD
37 void SetChooseFull(int flag);
38 void SetColour(const wxColour& colour);
39 void SetCustomColour(int i, const wxColour& colour);
40};
41
42
43class wxColourDialog : public wxDialog {
44public:
2b9048c5 45 %pythonAppend wxColourDialog "self._setOORInfo(self)"
7bf85405 46
d14a1e28 47 wxColourDialog(wxWindow* parent, wxColourData* data = NULL);
0122b7e3 48
7bf85405
RD
49 wxColourData& GetColourData();
50 int ShowModal();
51};
52
53
d14a1e28 54//--------------------------------------------------------------------------------
7bf85405
RD
55
56class wxDirDialog : public wxDialog {
57public:
2b9048c5 58 %pythonAppend wxDirDialog "self._setOORInfo(self)"
d14a1e28 59
7bf85405 60 wxDirDialog(wxWindow* parent,
daa3eac9 61 const wxString& message = wxPyDirSelectorPromptStr,
137b5242 62 const wxString& defaultPath = wxPyEmptyString,
7bf85405 63 long style = 0,
daa3eac9
RD
64 const wxPoint& pos = wxDefaultPosition,
65 const wxSize& size = wxDefaultSize,
66 const wxString& name = wxPyDirDialogNameStr);
7bf85405 67
0122b7e3 68
7bf85405
RD
69 wxString GetPath();
70 wxString GetMessage();
71 long GetStyle();
72 void SetMessage(const wxString& message);
73 void SetPath(const wxString& path);
74 int ShowModal();
75};
76
68320e40 77
d14a1e28 78//---------------------------------------------------------------------------
7bf85405
RD
79
80class wxFileDialog : public wxDialog {
81public:
2b9048c5 82 %pythonAppend wxFileDialog "self._setOORInfo(self)"
d14a1e28 83
7bf85405 84 wxFileDialog(wxWindow* parent,
137b5242
RD
85 const wxString& message = wxPyFileSelectorPromptStr,
86 const wxString& defaultDir = wxPyEmptyString,
87 const wxString& defaultFile = wxPyEmptyString,
88 const wxString& wildcard = wxPyFileSelectorDefaultWildcardStr,
7bf85405 89 long style = 0,
b68dc582 90 const wxPoint& pos = wxDefaultPosition);
7bf85405 91
0122b7e3 92
7bf85405
RD
93 void SetMessage(const wxString& message);
94 void SetPath(const wxString& path);
3ef86e32
RD
95 void SetDirectory(const wxString& dir);
96 void SetFilename(const wxString& name);
7bf85405 97 void SetWildcard(const wxString& wildCard);
3ef86e32
RD
98 void SetStyle(long style);
99 void SetFilterIndex(int filterIndex);
100
101 wxString GetMessage() const;
102 wxString GetPath() const;
103 wxString GetDirectory() const;
104 wxString GetFilename() const;
105 wxString GetWildcard() const;
106 long GetStyle() const;
107 int GetFilterIndex() const;
f6bcfd97 108
d14a1e28 109 %extend {
f6bcfd97
BP
110 PyObject* GetFilenames() {
111 wxArrayString arr;
112 self->GetFilenames(arr);
b37c7e1d 113 return wxArrayString2PyList_helper(arr);
f6bcfd97
BP
114 }
115
116 PyObject* GetPaths() {
117 wxArrayString arr;
118 self->GetPaths(arr);
b37c7e1d 119 return wxArrayString2PyList_helper(arr);
f6bcfd97
BP
120 }
121 }
3ef86e32
RD
122
123// TODO
124// // Utility functions
125
126// // Parses the wildCard, returning the number of filters.
127// // Returns 0 if none or if there's a problem,
128// // The arrays will contain an equal number of items found before the error.
129// // wildCard is in the form:
130// // "All files (*)|*|Image Files (*.jpeg *.png)|*.jpg;*.png"
131// static int ParseWildcard(const wxString& wildCard,
132// wxArrayString& descriptions,
133// wxArrayString& filters);
134
135// // Append first extension to filePath from a ';' separated extensionList
136// // if filePath = "path/foo.bar" just return it as is
137// // if filePath = "foo[.]" and extensionList = "*.jpg;*.png" return "foo.jpg"
138// // if the extension is "*.j?g" (has wildcards) or "jpg" then return filePath
139// static wxString AppendExtension(const wxString &filePath,
140// const wxString &extensionList);
141
142
7bf85405
RD
143};
144
145
d14a1e28 146//---------------------------------------------------------------------------
7bf85405 147
293a0a86
RD
148enum { wxCHOICEDLG_STYLE };
149
150class wxMultiChoiceDialog : public wxDialog
151{
152public:
2b9048c5 153 %pythonAppend wxMultiChoiceDialog "self._setOORInfo(self)"
d14a1e28 154
293a0a86
RD
155 wxMultiChoiceDialog(wxWindow *parent,
156 const wxString& message,
157 const wxString& caption,
699e192b 158 int choices=0, wxString* choices_array,
293a0a86
RD
159 long style = wxCHOICEDLG_STYLE,
160 const wxPoint& pos = wxDefaultPosition);
161
293a0a86
RD
162 void SetSelections(const wxArrayInt& selections);
163
164 // wxArrayInt GetSelections() const;
d14a1e28 165 %extend {
293a0a86
RD
166 PyObject* GetSelections() {
167 return wxArrayInt2PyList_helper(self->GetSelections());
168 }
169 }
170};
171
7bf85405 172
d14a1e28 173//---------------------------------------------------------------------------
7bf85405
RD
174
175class wxSingleChoiceDialog : public wxDialog {
176public:
2b9048c5 177 %pythonAppend wxSingleChoiceDialog "self._setOORInfo(self)"
d14a1e28
RD
178
179 %extend {
180 // TODO: ignoring clientData for now... FIX THIS
7bf85405
RD
181 // SWIG is messing up the &/*'s for some reason.
182 wxSingleChoiceDialog(wxWindow* parent,
d14a1e28
RD
183 const wxString& message,
184 const wxString& caption,
185 int choices, wxString* choices_array,
7bf85405 186 //char** clientData = NULL,
293a0a86 187 long style = wxCHOICEDLG_STYLE,
d14a1e28
RD
188 const wxPoint& pos = wxDefaultPosition) {
189 return new wxSingleChoiceDialog(parent, message, caption,
190 choices, choices_array, NULL, style, pos);
7bf85405 191 }
09f3d4e6 192 }
9c039d08 193
7bf85405
RD
194 int GetSelection();
195 wxString GetStringSelection();
196 void SetSelection(int sel);
197 int ShowModal();
198};
199
200
d14a1e28 201//---------------------------------------------------------------------------
7bf85405
RD
202
203class wxTextEntryDialog : public wxDialog {
204public:
2b9048c5 205 %pythonAppend wxTextEntryDialog "self._setOORInfo(self)"
d14a1e28 206
7bf85405 207 wxTextEntryDialog(wxWindow* parent,
137b5242
RD
208 const wxString& message,
209 const wxString& caption = wxPyGetTextFromUserPromptStr,
210 const wxString& defaultValue = wxPyEmptyString,
7bf85405 211 long style = wxOK | wxCANCEL | wxCENTRE,
b68dc582 212 const wxPoint& pos = wxDefaultPosition);
7bf85405
RD
213
214 wxString GetValue();
215 void SetValue(const wxString& value);
216 int ShowModal();
217};
218
d14a1e28 219//---------------------------------------------------------------------------
7bf85405 220
9416aa89 221class wxFontData : public wxObject {
7bf85405
RD
222public:
223 wxFontData();
224 ~wxFontData();
225
226 void EnableEffects(bool enable);
227 bool GetAllowSymbols();
25832b3f 228 wxColour GetColour();
7bf85405
RD
229 wxFont GetChosenFont();
230 bool GetEnableEffects();
231 wxFont GetInitialFont();
232 bool GetShowHelp();
233 void SetAllowSymbols(bool allowSymbols);
234 void SetChosenFont(const wxFont& font);
235 void SetColour(const wxColour& colour);
236 void SetInitialFont(const wxFont& font);
237 void SetRange(int min, int max);
238 void SetShowHelp(bool showHelp);
239};
240
241
242class wxFontDialog : public wxDialog {
243public:
2b9048c5 244 %pythonAppend wxFontDialog "self._setOORInfo(self)"
d14a1e28 245
557a93b9 246 wxFontDialog(wxWindow* parent, const wxFontData& data);
7bf85405
RD
247
248 wxFontData& GetFontData();
249 int ShowModal();
250};
251
252
d14a1e28 253//---------------------------------------------------------------------------
7bf85405
RD
254
255class wxMessageDialog : public wxDialog {
256public:
2b9048c5 257 %pythonAppend wxMessageDialog "self._setOORInfo(self)"
d14a1e28 258
7bf85405 259 wxMessageDialog(wxWindow* parent,
137b5242
RD
260 const wxString& message,
261 const wxString& caption = wxPyMessageBoxCaptionStr,
7bf85405 262 long style = wxOK | wxCANCEL | wxCENTRE,
b68dc582 263 const wxPoint& pos = wxDefaultPosition);
7bf85405
RD
264
265 int ShowModal();
266};
267
d14a1e28 268//---------------------------------------------------------------------------
7bf85405 269
bb0054cd
RD
270class wxProgressDialog : public wxFrame {
271public:
2b9048c5 272 %pythonAppend wxProgressDialog "self._setOORInfo(self)"
d14a1e28 273
bb0054cd
RD
274 wxProgressDialog(const wxString& title,
275 const wxString& message,
276 int maximum = 100,
277 wxWindow* parent = NULL,
278 int style = wxPD_AUTO_HIDE | wxPD_APP_MODAL );
7bf85405 279
137b5242 280 bool Update(int value, const wxString& newmsg = wxPyEmptyString);
bb0054cd 281 void Resume();
d14a1e28 282};
bb0054cd 283
d14a1e28 284//---------------------------------------------------------------------------
0122b7e3
RD
285
286enum wxFindReplaceFlags
287{
288 // downward search/replace selected (otherwise - upwards)
289 wxFR_DOWN = 1,
290
291 // whole word search/replace selected
292 wxFR_WHOLEWORD = 2,
293
294 // case sensitive search/replace selected (otherwise - case insensitive)
295 wxFR_MATCHCASE = 4
296};
297
298
299enum wxFindReplaceDialogStyles
300{
301 // replace dialog (otherwise find dialog)
302 wxFR_REPLACEDIALOG = 1,
303
304 // don't allow changing the search direction
305 wxFR_NOUPDOWN = 2,
306
307 // don't allow case sensitive searching
308 wxFR_NOMATCHCASE = 4,
309
310 // don't allow whole word searching
311 wxFR_NOWHOLEWORD = 8
312};
313
0122b7e3 314
0122b7e3 315
d14a1e28
RD
316%constant wxEventType wxEVT_COMMAND_FIND;
317%constant wxEventType wxEVT_COMMAND_FIND_NEXT;
318%constant wxEventType wxEVT_COMMAND_FIND_REPLACE;
319%constant wxEventType wxEVT_COMMAND_FIND_REPLACE_ALL;
320%constant wxEventType wxEVT_COMMAND_FIND_CLOSE;
0122b7e3 321
0122b7e3 322
d14a1e28
RD
323%pythoncode {
324EVT_FIND = wx.PyEventBinder( wxEVT_COMMAND_FIND, 1 )
325EVT_FIND_NEXT = wx.PyEventBinder( wxEVT_COMMAND_FIND_NEXT, 1 )
326EVT_FIND_REPLACE = wx.PyEventBinder( wxEVT_COMMAND_FIND_REPLACE, 1 )
327EVT_FIND_REPLACE_ALL = wx.PyEventBinder( wxEVT_COMMAND_FIND_REPLACE_ALL, 1 )
328EVT_FIND_CLOSE = wx.PyEventBinder( wxEVT_COMMAND_FIND_CLOSE, 1 )
0122b7e3 329
d14a1e28
RD
330%# For backwards compatibility. Should they be removed?
331EVT_COMMAND_FIND = EVT_FIND
332EVT_COMMAND_FIND_NEXT = EVT_FIND_NEXT
333EVT_COMMAND_FIND_REPLACE = EVT_FIND_REPLACE
334EVT_COMMAND_FIND_REPLACE_ALL = EVT_FIND_REPLACE_ALL
335EVT_COMMAND_FIND_CLOSE = EVT_FIND_CLOSE
336}
0122b7e3 337
0122b7e3
RD
338
339class wxFindDialogEvent : public wxCommandEvent
340{
341public:
342 wxFindDialogEvent(wxEventType commandType = wxEVT_NULL, int id = 0);
343 int GetFlags();
87c2245b 344 const wxString& GetFindString();
0122b7e3
RD
345 const wxString& GetReplaceString();
346 wxFindReplaceDialog *GetDialog();
347 void SetFlags(int flags);
348 void SetFindString(const wxString& str);
349 void SetReplaceString(const wxString& str);
350};
351
352
353
354class wxFindReplaceData : public wxObject
355{
356public:
357 wxFindReplaceData(int flags=0);
358 ~wxFindReplaceData();
359
360 const wxString& GetFindString();
361 const wxString& GetReplaceString();
362 int GetFlags();
363 void SetFlags(int flags);
364 void SetFindString(const wxString& str);
365 void SetReplaceString(const wxString& str);
366};
367
368
369class wxFindReplaceDialog : public wxDialog {
370public:
2b9048c5
RD
371 %pythonAppend wxFindReplaceDialog "self._setOORInfo(self)"
372 %pythonAppend wxFindReplaceDialog() ""
d14a1e28 373
0122b7e3
RD
374 wxFindReplaceDialog(wxWindow *parent,
375 wxFindReplaceData *data,
376 const wxString &title,
377 int style = 0);
d14a1e28 378 %name(PreFindReplaceDialog)wxFindReplaceDialog();
0122b7e3
RD
379
380 bool Create(wxWindow *parent,
381 wxFindReplaceData *data,
382 const wxString &title,
383 int style = 0);
384
0122b7e3
RD
385 const wxFindReplaceData *GetData();
386 void SetData(wxFindReplaceData *data);
387};
388
d14a1e28
RD
389//---------------------------------------------------------------------------
390//---------------------------------------------------------------------------