]> git.saurik.com Git - wxWidgets.git/blob - wxPython/src/_cmndlgs.i
Some ifdef's to correct compile problems on wxMac
[wxWidgets.git] / wxPython / src / _cmndlgs.i
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: _cmndlgs.i
3 // Purpose: SWIG interface for the "Common Dialog" classes
4 //
5 // Author: Robin Dunn
6 //
7 // Created: 25-July-1998
8 // RCS-ID: $Id$
9 // Copyright: (c) 2003 by Total Control Software
10 // Licence: wxWindows license
11 /////////////////////////////////////////////////////////////////////////////
12
13 // Not a %module
14
15
16 //---------------------------------------------------------------------------
17 %newgroup
18
19 MAKE_CONST_WXSTRING(FileSelectorPromptStr);
20 MAKE_CONST_WXSTRING(DirSelectorPromptStr);
21 MAKE_CONST_WXSTRING(DirDialogNameStr);
22 MAKE_CONST_WXSTRING(FileSelectorDefaultWildcardStr);
23 MAKE_CONST_WXSTRING(GetTextFromUserPromptStr);
24 MAKE_CONST_WXSTRING(MessageBoxCaptionStr);
25
26 //---------------------------------------------------------------------------
27
28
29 class wxColourData : public wxObject {
30 public:
31 wxColourData();
32 ~wxColourData();
33
34 bool GetChooseFull();
35 wxColour GetColour();
36 wxColour GetCustomColour(int i);
37 void SetChooseFull(int flag);
38 void SetColour(const wxColour& colour);
39 void SetCustomColour(int i, const wxColour& colour);
40 };
41
42
43 class wxColourDialog : public wxDialog {
44 public:
45 %pythonAppend wxColourDialog "self._setOORInfo(self)"
46
47 wxColourDialog(wxWindow* parent, wxColourData* data = NULL);
48
49 wxColourData& GetColourData();
50 int ShowModal();
51 };
52
53
54 //--------------------------------------------------------------------------------
55
56 class wxDirDialog : public wxDialog {
57 public:
58 %pythonAppend wxDirDialog "self._setOORInfo(self)"
59
60 wxDirDialog(wxWindow* parent,
61 const wxString& message = wxPyDirSelectorPromptStr,
62 const wxString& defaultPath = wxPyEmptyString,
63 long style = 0,
64 const wxPoint& pos = wxDefaultPosition,
65 const wxSize& size = wxDefaultSize,
66 const wxString& name = wxPyDirDialogNameStr);
67
68
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
77
78 //---------------------------------------------------------------------------
79
80 class wxFileDialog : public wxDialog {
81 public:
82 %pythonAppend wxFileDialog "self._setOORInfo(self)"
83
84 wxFileDialog(wxWindow* parent,
85 const wxString& message = wxPyFileSelectorPromptStr,
86 const wxString& defaultDir = wxPyEmptyString,
87 const wxString& defaultFile = wxPyEmptyString,
88 const wxString& wildcard = wxPyFileSelectorDefaultWildcardStr,
89 long style = 0,
90 const wxPoint& pos = wxDefaultPosition);
91
92
93 void SetMessage(const wxString& message);
94 void SetPath(const wxString& path);
95 void SetDirectory(const wxString& dir);
96 void SetFilename(const wxString& name);
97 void SetWildcard(const wxString& wildCard);
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;
108
109 %extend {
110 PyObject* GetFilenames() {
111 wxArrayString arr;
112 self->GetFilenames(arr);
113 return wxArrayString2PyList_helper(arr);
114 }
115
116 PyObject* GetPaths() {
117 wxArrayString arr;
118 self->GetPaths(arr);
119 return wxArrayString2PyList_helper(arr);
120 }
121 }
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
143 };
144
145
146 //---------------------------------------------------------------------------
147
148 enum { wxCHOICEDLG_STYLE };
149
150 class wxMultiChoiceDialog : public wxDialog
151 {
152 public:
153 %pythonAppend wxMultiChoiceDialog "self._setOORInfo(self)"
154
155 wxMultiChoiceDialog(wxWindow *parent,
156 const wxString& message,
157 const wxString& caption,
158 int choices=0, wxString* choices_array,
159 long style = wxCHOICEDLG_STYLE,
160 const wxPoint& pos = wxDefaultPosition);
161
162 void SetSelections(const wxArrayInt& selections);
163
164 // wxArrayInt GetSelections() const;
165 %extend {
166 PyObject* GetSelections() {
167 return wxArrayInt2PyList_helper(self->GetSelections());
168 }
169 }
170 };
171
172
173 //---------------------------------------------------------------------------
174
175 class wxSingleChoiceDialog : public wxDialog {
176 public:
177 %pythonAppend wxSingleChoiceDialog "self._setOORInfo(self)"
178
179 %extend {
180 // TODO: ignoring clientData for now... FIX THIS
181 // SWIG is messing up the &/*'s for some reason.
182 wxSingleChoiceDialog(wxWindow* parent,
183 const wxString& message,
184 const wxString& caption,
185 int choices, wxString* choices_array,
186 //char** clientData = NULL,
187 long style = wxCHOICEDLG_STYLE,
188 const wxPoint& pos = wxDefaultPosition) {
189 return new wxSingleChoiceDialog(parent, message, caption,
190 choices, choices_array, NULL, style, pos);
191 }
192 }
193
194 int GetSelection();
195 wxString GetStringSelection();
196 void SetSelection(int sel);
197 int ShowModal();
198 };
199
200
201 //---------------------------------------------------------------------------
202
203 class wxTextEntryDialog : public wxDialog {
204 public:
205 %pythonAppend wxTextEntryDialog "self._setOORInfo(self)"
206
207 wxTextEntryDialog(wxWindow* parent,
208 const wxString& message,
209 const wxString& caption = wxPyGetTextFromUserPromptStr,
210 const wxString& defaultValue = wxPyEmptyString,
211 long style = wxOK | wxCANCEL | wxCENTRE,
212 const wxPoint& pos = wxDefaultPosition);
213
214 wxString GetValue();
215 void SetValue(const wxString& value);
216 int ShowModal();
217 };
218
219 //---------------------------------------------------------------------------
220
221 class wxFontData : public wxObject {
222 public:
223 wxFontData();
224 ~wxFontData();
225
226 void EnableEffects(bool enable);
227 bool GetAllowSymbols();
228 wxColour GetColour();
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
242 class wxFontDialog : public wxDialog {
243 public:
244 %pythonAppend wxFontDialog "self._setOORInfo(self)"
245
246 wxFontDialog(wxWindow* parent, const wxFontData& data);
247
248 wxFontData& GetFontData();
249 int ShowModal();
250 };
251
252
253 //---------------------------------------------------------------------------
254
255 class wxMessageDialog : public wxDialog {
256 public:
257 %pythonAppend wxMessageDialog "self._setOORInfo(self)"
258
259 wxMessageDialog(wxWindow* parent,
260 const wxString& message,
261 const wxString& caption = wxPyMessageBoxCaptionStr,
262 long style = wxOK | wxCANCEL | wxCENTRE,
263 const wxPoint& pos = wxDefaultPosition);
264
265 int ShowModal();
266 };
267
268 //---------------------------------------------------------------------------
269
270 class wxProgressDialog : public wxFrame {
271 public:
272 %pythonAppend wxProgressDialog "self._setOORInfo(self)"
273
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 );
279
280 bool Update(int value, const wxString& newmsg = wxPyEmptyString);
281 void Resume();
282 };
283
284 //---------------------------------------------------------------------------
285
286 enum 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
299 enum 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
314
315
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;
321
322
323 %pythoncode {
324 EVT_FIND = wx.PyEventBinder( wxEVT_COMMAND_FIND, 1 )
325 EVT_FIND_NEXT = wx.PyEventBinder( wxEVT_COMMAND_FIND_NEXT, 1 )
326 EVT_FIND_REPLACE = wx.PyEventBinder( wxEVT_COMMAND_FIND_REPLACE, 1 )
327 EVT_FIND_REPLACE_ALL = wx.PyEventBinder( wxEVT_COMMAND_FIND_REPLACE_ALL, 1 )
328 EVT_FIND_CLOSE = wx.PyEventBinder( wxEVT_COMMAND_FIND_CLOSE, 1 )
329
330 %# For backwards compatibility. Should they be removed?
331 EVT_COMMAND_FIND = EVT_FIND
332 EVT_COMMAND_FIND_NEXT = EVT_FIND_NEXT
333 EVT_COMMAND_FIND_REPLACE = EVT_FIND_REPLACE
334 EVT_COMMAND_FIND_REPLACE_ALL = EVT_FIND_REPLACE_ALL
335 EVT_COMMAND_FIND_CLOSE = EVT_FIND_CLOSE
336 }
337
338
339 class wxFindDialogEvent : public wxCommandEvent
340 {
341 public:
342 wxFindDialogEvent(wxEventType commandType = wxEVT_NULL, int id = 0);
343 int GetFlags();
344 const wxString& GetFindString();
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
354 class wxFindReplaceData : public wxObject
355 {
356 public:
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
369 class wxFindReplaceDialog : public wxDialog {
370 public:
371 %pythonAppend wxFindReplaceDialog "self._setOORInfo(self)"
372 %pythonAppend wxFindReplaceDialog() ""
373
374 wxFindReplaceDialog(wxWindow *parent,
375 wxFindReplaceData *data,
376 const wxString &title,
377 int style = 0);
378 %name(PreFindReplaceDialog)wxFindReplaceDialog();
379
380 bool Create(wxWindow *parent,
381 wxFindReplaceData *data,
382 const wxString &title,
383 int style = 0);
384
385 const wxFindReplaceData *GetData();
386 void SetData(wxFindReplaceData *data);
387 };
388
389 //---------------------------------------------------------------------------
390 //---------------------------------------------------------------------------