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     wxString GetDirectory();
 
 118     wxString GetFilename();
 
 119     int GetFilterIndex();
 
 120     wxString GetMessage();
 
 123     wxString GetWildcard();
 
 124     void SetDirectory(const wxString& directory);
 
 125     void SetFilename(const wxString& setfilename);
 
 126     void SetFilterIndex(int filterIndex);
 
 127     void SetMessage(const wxString& message);
 
 128     void SetPath(const wxString& path);
 
 129     void SetStyle(long style);
 
 130     void SetWildcard(const wxString& wildCard);
 
 134         PyObject* GetFilenames() {
 
 136             self->GetFilenames(arr);
 
 137             return wxArrayString2PyList_helper(arr);
 
 140         PyObject* GetPaths() {
 
 143             return wxArrayString2PyList_helper(arr);
 
 149 //----------------------------------------------------------------------
 
 151 enum { wxCHOICEDLG_STYLE };
 
 153 class wxMultiChoiceDialog : public wxDialog
 
 156     wxMultiChoiceDialog(wxWindow *parent,
 
 157                         const wxString& message,
 
 158                         const wxString& caption,
 
 159                         int LCOUNT, wxString *choices,
 
 160                         long style = wxCHOICEDLG_STYLE,
 
 161                         const wxPoint& pos = wxDefaultPosition);
 
 163     %pragma(python) addtomethod = "__init__:self._setOORInfo(self)"
 
 165     void SetSelections(const wxArrayInt& selections);
 
 167     // wxArrayInt GetSelections() const;
 
 169         PyObject* GetSelections() {
 
 170             return wxArrayInt2PyList_helper(self->GetSelections());
 
 176 //----------------------------------------------------------------------
 
 178 class wxSingleChoiceDialog : public wxDialog {
 
 181         // TODO: ignoring clientData for now...
 
 182         //       SWIG is messing up the &/*'s for some reason.
 
 183         wxSingleChoiceDialog(wxWindow* parent,
 
 186                              int LCOUNT, wxString* choices,
 
 187                              //char** clientData = NULL,
 
 188                              long style = wxCHOICEDLG_STYLE,
 
 189                              wxPoint* pos = &wxDefaultPosition) {
 
 190             return new wxSingleChoiceDialog(parent, *message, *caption,
 
 191                                             LCOUNT, choices, NULL, style, *pos);
 
 193     %pragma(python) addtomethod = "__init__:self._setOORInfo(self)"
 
 198     wxString GetStringSelection();
 
 199     void SetSelection(int sel);
 
 204 //----------------------------------------------------------------------
 
 206 class wxTextEntryDialog : public wxDialog {
 
 208     wxTextEntryDialog(wxWindow* parent,
 
 209                       const wxString& message,
 
 210                       const wxString& caption = wxPyGetTextFromUserPromptStr,
 
 211                       const wxString& defaultValue = wxPyEmptyString,
 
 212                       long style = wxOK | wxCANCEL | wxCENTRE,
 
 213                       const wxPoint& pos = wxDefaultPosition);
 
 215     %pragma(python) addtomethod = "__init__:self._setOORInfo(self)"
 
 218     void SetValue(const wxString& value);
 
 222 //----------------------------------------------------------------------
 
 224 class wxFontData : public wxObject {
 
 229     void EnableEffects(bool enable);
 
 230     bool GetAllowSymbols();
 
 231     wxColour GetColour();
 
 232     wxFont GetChosenFont();
 
 233     bool GetEnableEffects();
 
 234     wxFont GetInitialFont();
 
 236     void SetAllowSymbols(bool allowSymbols);
 
 237     void SetChosenFont(const wxFont& font);
 
 238     void SetColour(const wxColour& colour);
 
 239     void SetInitialFont(const wxFont& font);
 
 240     void SetRange(int min, int max);
 
 241     void SetShowHelp(bool showHelp);
 
 245 class wxFontDialog : public wxDialog {
 
 247     wxFontDialog(wxWindow* parent, const wxFontData& data);
 
 248     %pragma(python) addtomethod = "__init__:self._setOORInfo(self)"
 
 250     wxFontData& GetFontData();
 
 255 //----------------------------------------------------------------------
 
 257 class wxMessageDialog : public wxDialog {
 
 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     %pragma(python) addtomethod = "__init__:self._setOORInfo(self)"
 
 269 //----------------------------------------------------------------------
 
 271 class wxProgressDialog : public wxFrame {
 
 273     wxProgressDialog(const wxString& title,
 
 274                      const wxString& message,
 
 276                      wxWindow* parent = NULL,
 
 277                      int style = wxPD_AUTO_HIDE | wxPD_APP_MODAL );
 
 278     %pragma(python) addtomethod = "__init__:self._setOORInfo(self)"
 
 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     wxEVT_COMMAND_FIND_NEXT,
 
 317     wxEVT_COMMAND_FIND_REPLACE,
 
 318     wxEVT_COMMAND_FIND_REPLACE_ALL,
 
 319     wxEVT_COMMAND_FIND_CLOSE,
 
 322 %pragma(python) code = "
 
 324 def EVT_COMMAND_FIND(win, id, func):
 
 325     win.Connect(id, -1, wxEVT_COMMAND_FIND, func)
 
 327 def EVT_COMMAND_FIND_NEXT(win, id, func):
 
 328     win.Connect(id, -1, wxEVT_COMMAND_FIND_NEXT, func)
 
 330 def EVT_COMMAND_FIND_REPLACE(win, id, func):
 
 331     win.Connect(id, -1, wxEVT_COMMAND_FIND_REPLACE, func)
 
 333 def EVT_COMMAND_FIND_REPLACE_ALL(win, id, func):
 
 334     win.Connect(id, -1, wxEVT_COMMAND_FIND_REPLACE_ALL, func)
 
 336 def EVT_COMMAND_FIND_CLOSE(win, id, func):
 
 337     win.Connect(id, -1, wxEVT_COMMAND_FIND_CLOSE, func)
 
 341 class wxFindDialogEvent : public wxCommandEvent
 
 344     wxFindDialogEvent(wxEventType commandType = wxEVT_NULL, int id = 0);
 
 346     wxString GetFindString();
 
 347     const wxString& GetReplaceString();
 
 348     wxFindReplaceDialog *GetDialog();
 
 349     void SetFlags(int flags);
 
 350     void SetFindString(const wxString& str);
 
 351     void SetReplaceString(const wxString& str);
 
 356 class wxFindReplaceData : public wxObject
 
 359     wxFindReplaceData(int flags=0);
 
 360     ~wxFindReplaceData();
 
 362     const wxString& GetFindString();
 
 363     const wxString& GetReplaceString();
 
 365     void SetFlags(int flags);
 
 366     void SetFindString(const wxString& str);
 
 367     void SetReplaceString(const wxString& str);
 
 371 class wxFindReplaceDialog : public wxDialog {
 
 373     wxFindReplaceDialog(wxWindow *parent,
 
 374                         wxFindReplaceData *data,
 
 375                         const wxString &title,
 
 377     %name(wxPreFindReplaceDialog)wxFindReplaceDialog();
 
 379      bool Create(wxWindow *parent,
 
 380                  wxFindReplaceData *data,
 
 381                  const wxString &title,
 
 384     %pragma(python) addtomethod = "__init__:self._setOORInfo(self)"
 
 385     %pragma(python) addtomethod = "wxPreFindReplaceDialog:val._setOORInfo(val)"
 
 387     const wxFindReplaceData *GetData();
 
 388     void SetData(wxFindReplaceData *data);
 
 391 //----------------------------------------------------------------------