1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: SWIG definitions for the Common Dialog Classes
9 // Copyright: (c) 1998 by Total Control Software
10 // Licence: wxWindows license
11 /////////////////////////////////////////////////////////////////////////////
17 #include <wx/colordlg.h>
18 #include <wx/dirdlg.h>
19 #include <wx/fontdlg.h>
20 #include <wx/progdlg.h>
21 #include <wx/fdrepdlg.h>
24 //----------------------------------------------------------------------
27 %include my_typemaps.i
29 // Import some definitions of other classes, etc.
37 %pragma(python) code = "import wx"
39 //----------------------------------------------------------------------
42 // Put some wx default wxChar* values into wxStrings.
43 DECLARE_DEF_STRING(FileSelectorPromptStr);
44 DECLARE_DEF_STRING(DirSelectorPromptStr);
45 DECLARE_DEF_STRING(DirDialogNameStr);
46 DECLARE_DEF_STRING(FileSelectorDefaultWildcardStr);
47 DECLARE_DEF_STRING(GetTextFromUserPromptStr);
48 DECLARE_DEF_STRING(MessageBoxCaptionStr);
49 static const wxString wxPyEmptyString(wxT(""));
53 //----------------------------------------------------------------------
55 class wxColourData : public wxObject {
62 wxColour GetCustomColour(int i);
63 void SetChooseFull(int flag);
64 void SetColour(const wxColour& colour);
65 void SetCustomColour(int i, const wxColour& colour);
69 class wxColourDialog : public wxDialog {
71 wxColourDialog(wxWindow* parent, wxColourData* data = NULL);
73 %pragma(python) addtomethod = "__init__:self._setOORInfo(self)"
75 wxColourData& GetColourData();
80 //----------------------------------------------------------------------
82 class wxDirDialog : public wxDialog {
84 wxDirDialog(wxWindow* parent,
85 const wxString& message = wxPyDirSelectorPromptStr,
86 const wxString& defaultPath = wxPyEmptyString,
88 const wxPoint& pos = wxDefaultPosition,
89 const wxSize& size = wxDefaultSize,
90 const wxString& name = wxPyDirDialogNameStr);
92 %pragma(python) addtomethod = "__init__:self._setOORInfo(self)"
95 wxString GetMessage();
97 void SetMessage(const wxString& message);
98 void SetPath(const wxString& path);
103 //----------------------------------------------------------------------
105 class wxFileDialog : public wxDialog {
107 wxFileDialog(wxWindow* parent,
108 const wxString& message = wxPyFileSelectorPromptStr,
109 const wxString& defaultDir = wxPyEmptyString,
110 const wxString& defaultFile = wxPyEmptyString,
111 const wxString& wildcard = wxPyFileSelectorDefaultWildcardStr,
113 const wxPoint& pos = wxDefaultPosition);
115 %pragma(python) addtomethod = "__init__:self._setOORInfo(self)"
117 void SetMessage(const wxString& message);
118 void SetPath(const wxString& path);
119 void SetDirectory(const wxString& dir);
120 void SetFilename(const wxString& name);
121 void SetWildcard(const wxString& wildCard);
122 void SetStyle(long style);
123 void SetFilterIndex(int filterIndex);
125 wxString GetMessage() const;
126 wxString GetPath() const;
127 wxString GetDirectory() const;
128 wxString GetFilename() const;
129 wxString GetWildcard() const;
130 long GetStyle() const;
131 int GetFilterIndex() const;
134 PyObject* GetFilenames() {
136 self->GetFilenames(arr);
137 return wxArrayString2PyList_helper(arr);
140 PyObject* GetPaths() {
143 return wxArrayString2PyList_helper(arr);
148 // // Utility functions
150 // // Parses the wildCard, returning the number of filters.
151 // // Returns 0 if none or if there's a problem,
152 // // The arrays will contain an equal number of items found before the error.
153 // // wildCard is in the form:
154 // // "All files (*)|*|Image Files (*.jpeg *.png)|*.jpg;*.png"
155 // static int ParseWildcard(const wxString& wildCard,
156 // wxArrayString& descriptions,
157 // wxArrayString& filters);
159 // // Append first extension to filePath from a ';' separated extensionList
160 // // if filePath = "path/foo.bar" just return it as is
161 // // if filePath = "foo[.]" and extensionList = "*.jpg;*.png" return "foo.jpg"
162 // // if the extension is "*.j?g" (has wildcards) or "jpg" then return filePath
163 // static wxString AppendExtension(const wxString &filePath,
164 // const wxString &extensionList);
170 //----------------------------------------------------------------------
172 enum { wxCHOICEDLG_STYLE };
174 class wxMultiChoiceDialog : public wxDialog
177 wxMultiChoiceDialog(wxWindow *parent,
178 const wxString& message,
179 const wxString& caption,
180 int LCOUNT, wxString *choices,
181 long style = wxCHOICEDLG_STYLE,
182 const wxPoint& pos = wxDefaultPosition);
184 %pragma(python) addtomethod = "__init__:self._setOORInfo(self)"
186 void SetSelections(const wxArrayInt& selections);
188 // wxArrayInt GetSelections() const;
190 PyObject* GetSelections() {
191 return wxArrayInt2PyList_helper(self->GetSelections());
197 //----------------------------------------------------------------------
199 class wxSingleChoiceDialog : public wxDialog {
202 // TODO: ignoring clientData for now...
203 // SWIG is messing up the &/*'s for some reason.
204 wxSingleChoiceDialog(wxWindow* parent,
207 int LCOUNT, wxString* choices,
208 //char** clientData = NULL,
209 long style = wxCHOICEDLG_STYLE,
210 wxPoint* pos = &wxDefaultPosition) {
211 return new wxSingleChoiceDialog(parent, *message, *caption,
212 LCOUNT, choices, NULL, style, *pos);
214 %pragma(python) addtomethod = "__init__:self._setOORInfo(self)"
219 wxString GetStringSelection();
220 void SetSelection(int sel);
225 //----------------------------------------------------------------------
227 class wxTextEntryDialog : public wxDialog {
229 wxTextEntryDialog(wxWindow* parent,
230 const wxString& message,
231 const wxString& caption = wxPyGetTextFromUserPromptStr,
232 const wxString& defaultValue = wxPyEmptyString,
233 long style = wxOK | wxCANCEL | wxCENTRE,
234 const wxPoint& pos = wxDefaultPosition);
236 %pragma(python) addtomethod = "__init__:self._setOORInfo(self)"
239 void SetValue(const wxString& value);
243 //----------------------------------------------------------------------
245 class wxFontData : public wxObject {
250 void EnableEffects(bool enable);
251 bool GetAllowSymbols();
252 wxColour GetColour();
253 wxFont GetChosenFont();
254 bool GetEnableEffects();
255 wxFont GetInitialFont();
257 void SetAllowSymbols(bool allowSymbols);
258 void SetChosenFont(const wxFont& font);
259 void SetColour(const wxColour& colour);
260 void SetInitialFont(const wxFont& font);
261 void SetRange(int min, int max);
262 void SetShowHelp(bool showHelp);
266 class wxFontDialog : public wxDialog {
268 wxFontDialog(wxWindow* parent, const wxFontData& data);
269 %pragma(python) addtomethod = "__init__:self._setOORInfo(self)"
271 wxFontData& GetFontData();
276 //----------------------------------------------------------------------
278 class wxMessageDialog : public wxDialog {
280 wxMessageDialog(wxWindow* parent,
281 const wxString& message,
282 const wxString& caption = wxPyMessageBoxCaptionStr,
283 long style = wxOK | wxCANCEL | wxCENTRE,
284 const wxPoint& pos = wxDefaultPosition);
285 %pragma(python) addtomethod = "__init__:self._setOORInfo(self)"
290 //----------------------------------------------------------------------
292 class wxProgressDialog : public wxFrame {
294 wxProgressDialog(const wxString& title,
295 const wxString& message,
297 wxWindow* parent = NULL,
298 int style = wxPD_AUTO_HIDE | wxPD_APP_MODAL );
299 %pragma(python) addtomethod = "__init__:self._setOORInfo(self)"
301 bool Update(int value, const wxString& newmsg = wxPyEmptyString);
305 //----------------------------------------------------------------------
307 enum wxFindReplaceFlags
309 // downward search/replace selected (otherwise - upwards)
312 // whole word search/replace selected
315 // case sensitive search/replace selected (otherwise - case insensitive)
320 enum wxFindReplaceDialogStyles
322 // replace dialog (otherwise find dialog)
323 wxFR_REPLACEDIALOG = 1,
325 // don't allow changing the search direction
328 // don't allow case sensitive searching
329 wxFR_NOMATCHCASE = 4,
331 // don't allow whole word searching
337 wxEVT_COMMAND_FIND_NEXT,
338 wxEVT_COMMAND_FIND_REPLACE,
339 wxEVT_COMMAND_FIND_REPLACE_ALL,
340 wxEVT_COMMAND_FIND_CLOSE,
343 %pragma(python) code = "
345 def EVT_COMMAND_FIND(win, id, func):
346 win.Connect(id, -1, wxEVT_COMMAND_FIND, func)
348 def EVT_COMMAND_FIND_NEXT(win, id, func):
349 win.Connect(id, -1, wxEVT_COMMAND_FIND_NEXT, func)
351 def EVT_COMMAND_FIND_REPLACE(win, id, func):
352 win.Connect(id, -1, wxEVT_COMMAND_FIND_REPLACE, func)
354 def EVT_COMMAND_FIND_REPLACE_ALL(win, id, func):
355 win.Connect(id, -1, wxEVT_COMMAND_FIND_REPLACE_ALL, func)
357 def EVT_COMMAND_FIND_CLOSE(win, id, func):
358 win.Connect(id, -1, wxEVT_COMMAND_FIND_CLOSE, func)
362 class wxFindDialogEvent : public wxCommandEvent
365 wxFindDialogEvent(wxEventType commandType = wxEVT_NULL, int id = 0);
367 wxString GetFindString();
368 const wxString& GetReplaceString();
369 wxFindReplaceDialog *GetDialog();
370 void SetFlags(int flags);
371 void SetFindString(const wxString& str);
372 void SetReplaceString(const wxString& str);
377 class wxFindReplaceData : public wxObject
380 wxFindReplaceData(int flags=0);
381 ~wxFindReplaceData();
383 const wxString& GetFindString();
384 const wxString& GetReplaceString();
386 void SetFlags(int flags);
387 void SetFindString(const wxString& str);
388 void SetReplaceString(const wxString& str);
392 class wxFindReplaceDialog : public wxDialog {
394 wxFindReplaceDialog(wxWindow *parent,
395 wxFindReplaceData *data,
396 const wxString &title,
398 %name(wxPreFindReplaceDialog)wxFindReplaceDialog();
400 bool Create(wxWindow *parent,
401 wxFindReplaceData *data,
402 const wxString &title,
405 %pragma(python) addtomethod = "__init__:self._setOORInfo(self)"
406 %pragma(python) addtomethod = "wxPreFindReplaceDialog:val._setOORInfo(val)"
408 const wxFindReplaceData *GetData();
409 void SetData(wxFindReplaceData *data);
412 //----------------------------------------------------------------------