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 //---------------------------------------------------------------------------
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);
30 //---------------------------------------------------------------------------
33 class wxColourData : public wxObject {
40 wxColour GetCustomColour(int i);
41 void SetChooseFull(int flag);
42 void SetColour(const wxColour& colour);
43 void SetCustomColour(int i, const wxColour& colour);
47 class wxColourDialog : public wxDialog {
49 %addtofunc wxColourDialog "self._setOORInfo(self)"
51 wxColourDialog(wxWindow* parent, wxColourData* data = NULL);
53 wxColourData& GetColourData();
58 //--------------------------------------------------------------------------------
60 class wxDirDialog : public wxDialog {
62 %addtofunc wxDirDialog "self._setOORInfo(self)"
64 wxDirDialog(wxWindow* parent,
65 const wxString& message = wxPyDirSelectorPromptStr,
66 const wxString& defaultPath = wxPyEmptyString,
68 const wxPoint& pos = wxDefaultPosition,
69 const wxSize& size = wxDefaultSize,
70 const wxString& name = wxPyDirDialogNameStr);
74 wxString GetMessage();
76 void SetMessage(const wxString& message);
77 void SetPath(const wxString& path);
82 //---------------------------------------------------------------------------
84 class wxFileDialog : public wxDialog {
86 %addtofunc wxFileDialog "self._setOORInfo(self)"
88 wxFileDialog(wxWindow* parent,
89 const wxString& message = wxPyFileSelectorPromptStr,
90 const wxString& defaultDir = wxPyEmptyString,
91 const wxString& defaultFile = wxPyEmptyString,
92 const wxString& wildcard = wxPyFileSelectorDefaultWildcardStr,
94 const wxPoint& pos = wxDefaultPosition);
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);
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;
114 PyObject* GetFilenames() {
116 self->GetFilenames(arr);
117 return wxArrayString2PyList_helper(arr);
120 PyObject* GetPaths() {
123 return wxArrayString2PyList_helper(arr);
128 // // Utility functions
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);
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);
150 //---------------------------------------------------------------------------
152 enum { wxCHOICEDLG_STYLE };
154 class wxMultiChoiceDialog : public wxDialog
157 %addtofunc wxMultiChoiceDialog "self._setOORInfo(self)"
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);
166 void SetSelections(const wxArrayInt& selections);
168 // wxArrayInt GetSelections() const;
170 PyObject* GetSelections() {
171 return wxArrayInt2PyList_helper(self->GetSelections());
177 //---------------------------------------------------------------------------
179 class wxSingleChoiceDialog : public wxDialog {
181 %addtofunc wxSingleChoiceDialog "self._setOORInfo(self)"
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);
199 wxString GetStringSelection();
200 void SetSelection(int sel);
205 //---------------------------------------------------------------------------
207 class wxTextEntryDialog : public wxDialog {
209 %addtofunc wxTextEntryDialog "self._setOORInfo(self)"
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);
219 void SetValue(const wxString& value);
223 //---------------------------------------------------------------------------
225 class wxFontData : public wxObject {
230 void EnableEffects(bool enable);
231 bool GetAllowSymbols();
232 wxColour GetColour();
233 wxFont GetChosenFont();
234 bool GetEnableEffects();
235 wxFont GetInitialFont();
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);
246 class wxFontDialog : public wxDialog {
248 %addtofunc wxFontDialog "self._setOORInfo(self)"
250 wxFontDialog(wxWindow* parent, const wxFontData& data);
252 wxFontData& GetFontData();
257 //---------------------------------------------------------------------------
259 class wxMessageDialog : public wxDialog {
261 %addtofunc wxMessageDialog "self._setOORInfo(self)"
263 wxMessageDialog(wxWindow* parent,
264 const wxString& message,
265 const wxString& caption = wxPyMessageBoxCaptionStr,
266 long style = wxOK | wxCANCEL | wxCENTRE,
267 const wxPoint& pos = wxDefaultPosition);
272 //---------------------------------------------------------------------------
274 class wxProgressDialog : public wxFrame {
276 %addtofunc wxProgressDialog "self._setOORInfo(self)"
278 wxProgressDialog(const wxString& title,
279 const wxString& message,
281 wxWindow* parent = NULL,
282 int style = wxPD_AUTO_HIDE | wxPD_APP_MODAL );
284 bool Update(int value, const wxString& newmsg = wxPyEmptyString);
288 //---------------------------------------------------------------------------
290 enum wxFindReplaceFlags
292 // downward search/replace selected (otherwise - upwards)
295 // whole word search/replace selected
298 // case sensitive search/replace selected (otherwise - case insensitive)
303 enum wxFindReplaceDialogStyles
305 // replace dialog (otherwise find dialog)
306 wxFR_REPLACEDIALOG = 1,
308 // don't allow changing the search direction
311 // don't allow case sensitive searching
312 wxFR_NOMATCHCASE = 4,
314 // don't allow whole word searching
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;
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 )
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
343 class wxFindDialogEvent : public wxCommandEvent
346 wxFindDialogEvent(wxEventType commandType = wxEVT_NULL, int id = 0);
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);
358 class wxFindReplaceData : public wxObject
361 wxFindReplaceData(int flags=0);
362 ~wxFindReplaceData();
364 const wxString& GetFindString();
365 const wxString& GetReplaceString();
367 void SetFlags(int flags);
368 void SetFindString(const wxString& str);
369 void SetReplaceString(const wxString& str);
373 class wxFindReplaceDialog : public wxDialog {
375 %addtofunc wxFindReplaceDialog "self._setOORInfo(self)"
376 %addtofunc wxFindReplaceDialog() ""
378 wxFindReplaceDialog(wxWindow *parent,
379 wxFindReplaceData *data,
380 const wxString &title,
382 %name(PreFindReplaceDialog)wxFindReplaceDialog();
384 bool Create(wxWindow *parent,
385 wxFindReplaceData *data,
386 const wxString &title,
389 const wxFindReplaceData *GetData();
390 void SetData(wxFindReplaceData *data);
393 //---------------------------------------------------------------------------
394 //---------------------------------------------------------------------------