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