1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: SWIG interface for the "Common Dialog" classes
7 // Created: 25-July-1998
9 // Copyright: (c) 2003 by Total Control Software
10 // Licence: wxWindows license
11 /////////////////////////////////////////////////////////////////////////////
16 //---------------------------------------------------------------------------
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);
26 //---------------------------------------------------------------------------
29 class wxColourData : public wxObject {
36 wxColour GetCustomColour(int i);
37 void SetChooseFull(int flag);
38 void SetColour(const wxColour& colour);
39 void SetCustomColour(int i, const wxColour& colour);
43 class wxColourDialog : public wxDialog {
45 %pythonAppend wxColourDialog "self._setOORInfo(self)"
47 wxColourDialog(wxWindow* parent, wxColourData* data = NULL);
49 wxColourData& GetColourData();
54 //--------------------------------------------------------------------------------
56 class wxDirDialog : public wxDialog {
58 %pythonAppend wxDirDialog "self._setOORInfo(self)"
60 wxDirDialog(wxWindow* parent,
61 const wxString& message = wxPyDirSelectorPromptStr,
62 const wxString& defaultPath = wxPyEmptyString,
64 const wxPoint& pos = wxDefaultPosition,
65 const wxSize& size = wxDefaultSize,
66 const wxString& name = wxPyDirDialogNameStr);
70 wxString GetMessage();
72 void SetMessage(const wxString& message);
73 void SetPath(const wxString& path);
78 //---------------------------------------------------------------------------
80 class wxFileDialog : public wxDialog {
82 %pythonAppend wxFileDialog "self._setOORInfo(self)"
84 wxFileDialog(wxWindow* parent,
85 const wxString& message = wxPyFileSelectorPromptStr,
86 const wxString& defaultDir = wxPyEmptyString,
87 const wxString& defaultFile = wxPyEmptyString,
88 const wxString& wildcard = wxPyFileSelectorDefaultWildcardStr,
90 const wxPoint& pos = wxDefaultPosition);
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);
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;
110 PyObject* GetFilenames() {
112 self->GetFilenames(arr);
113 return wxArrayString2PyList_helper(arr);
116 PyObject* GetPaths() {
119 return wxArrayString2PyList_helper(arr);
124 // // Utility functions
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);
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);
146 //---------------------------------------------------------------------------
148 enum { wxCHOICEDLG_STYLE };
150 class wxMultiChoiceDialog : public wxDialog
153 %pythonAppend wxMultiChoiceDialog "self._setOORInfo(self)"
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);
162 void SetSelections(const wxArrayInt& selections);
164 // wxArrayInt GetSelections() const;
166 PyObject* GetSelections() {
167 return wxArrayInt2PyList_helper(self->GetSelections());
173 //---------------------------------------------------------------------------
175 class wxSingleChoiceDialog : public wxDialog {
177 %pythonAppend wxSingleChoiceDialog "self._setOORInfo(self)"
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);
195 wxString GetStringSelection();
196 void SetSelection(int sel);
201 //---------------------------------------------------------------------------
203 class wxTextEntryDialog : public wxDialog {
205 %pythonAppend wxTextEntryDialog "self._setOORInfo(self)"
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);
215 void SetValue(const wxString& value);
219 //---------------------------------------------------------------------------
221 class wxFontData : public wxObject {
226 void EnableEffects(bool enable);
227 bool GetAllowSymbols();
228 wxColour GetColour();
229 wxFont GetChosenFont();
230 bool GetEnableEffects();
231 wxFont GetInitialFont();
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);
242 class wxFontDialog : public wxDialog {
244 %pythonAppend wxFontDialog "self._setOORInfo(self)"
246 wxFontDialog(wxWindow* parent, const wxFontData& data);
248 wxFontData& GetFontData();
253 //---------------------------------------------------------------------------
255 class wxMessageDialog : public wxDialog {
257 %pythonAppend wxMessageDialog "self._setOORInfo(self)"
259 wxMessageDialog(wxWindow* parent,
260 const wxString& message,
261 const wxString& caption = wxPyMessageBoxCaptionStr,
262 long style = wxOK | wxCANCEL | wxCENTRE,
263 const wxPoint& pos = wxDefaultPosition);
268 //---------------------------------------------------------------------------
270 class wxProgressDialog : public wxFrame {
272 %pythonAppend wxProgressDialog "self._setOORInfo(self)"
274 wxProgressDialog(const wxString& title,
275 const wxString& message,
277 wxWindow* parent = NULL,
278 int style = wxPD_AUTO_HIDE | wxPD_APP_MODAL );
280 bool Update(int value, const wxString& newmsg = wxPyEmptyString);
284 //---------------------------------------------------------------------------
286 enum wxFindReplaceFlags
288 // downward search/replace selected (otherwise - upwards)
291 // whole word search/replace selected
294 // case sensitive search/replace selected (otherwise - case insensitive)
299 enum wxFindReplaceDialogStyles
301 // replace dialog (otherwise find dialog)
302 wxFR_REPLACEDIALOG = 1,
304 // don't allow changing the search direction
307 // don't allow case sensitive searching
308 wxFR_NOMATCHCASE = 4,
310 // don't allow whole word searching
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;
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 )
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
339 class wxFindDialogEvent : public wxCommandEvent
342 wxFindDialogEvent(wxEventType commandType = wxEVT_NULL, int id = 0);
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);
354 class wxFindReplaceData : public wxObject
357 wxFindReplaceData(int flags=0);
358 ~wxFindReplaceData();
360 const wxString& GetFindString();
361 const wxString& GetReplaceString();
363 void SetFlags(int flags);
364 void SetFindString(const wxString& str);
365 void SetReplaceString(const wxString& str);
369 class wxFindReplaceDialog : public wxDialog {
371 %pythonAppend wxFindReplaceDialog "self._setOORInfo(self)"
372 %pythonAppend wxFindReplaceDialog() ""
374 wxFindReplaceDialog(wxWindow *parent,
375 wxFindReplaceData *data,
376 const wxString &title,
378 %name(PreFindReplaceDialog)wxFindReplaceDialog();
380 bool Create(wxWindow *parent,
381 wxFindReplaceData *data,
382 const wxString &title,
385 const wxFindReplaceData *GetData();
386 void SetData(wxFindReplaceData *data);
389 //---------------------------------------------------------------------------
390 //---------------------------------------------------------------------------