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 //----------------------------------------------------------------------
 
  41 class wxColourData : public wxObject {
 
  48     wxColour GetCustomColour(int i);
 
  49     void SetChooseFull(int flag);
 
  50     void SetColour(const wxColour& colour);
 
  51     void SetCustomColour(int i, const wxColour& colour);
 
  55 class wxColourDialog : public wxDialog {
 
  57     wxColourDialog(wxWindow* parent, wxColourData* data = NULL);
 
  59     %pragma(python) addtomethod = "__init__:self._setOORInfo(self)"
 
  61     wxColourData& GetColourData();
 
  66 //----------------------------------------------------------------------
 
  68 class wxDirDialog : public wxDialog {
 
  70     wxDirDialog(wxWindow* parent,
 
  71                 char* message = "Choose a directory",
 
  72                 char* defaultPath = "",
 
  74                 const wxPoint& pos = wxDefaultPosition);
 
  76     %pragma(python) addtomethod = "__init__:self._setOORInfo(self)"
 
  79     wxString GetMessage();
 
  81     void SetMessage(const wxString& message);
 
  82     void SetPath(const wxString& path);
 
  86 //----------------------------------------------------------------------
 
  88 class wxFileDialog : public wxDialog {
 
  90     wxFileDialog(wxWindow* parent,
 
  91                  char* message = "Choose a file",
 
  92                  char* defaultDir = "",
 
  93                  char* defaultFile = "",
 
  94                  char* wildcard = "*.*",
 
  96                  const wxPoint& pos = wxDefaultPosition);
 
  98     %pragma(python) addtomethod = "__init__:self._setOORInfo(self)"
 
 100     wxString GetDirectory();
 
 101     wxString GetFilename();
 
 102     int GetFilterIndex();
 
 103     wxString GetMessage();
 
 106     wxString GetWildcard();
 
 107     void SetDirectory(const wxString& directory);
 
 108     void SetFilename(const wxString& setfilename);
 
 109     void SetFilterIndex(int filterIndex);
 
 110     void SetMessage(const wxString& message);
 
 111     void SetPath(const wxString& path);
 
 112     void SetStyle(long style);
 
 113     void SetWildcard(const wxString& wildCard);
 
 117         PyObject* GetFilenames() {
 
 119             self->GetFilenames(arr);
 
 120             size_t count = arr.GetCount();
 
 121             PyObject* listObj = PyList_New(0);
 
 122             for(size_t x=0; x<count; x++) {
 
 123                 PyObject* name = PyString_FromString(arr[x]);
 
 124                 PyList_Append(listObj, name);
 
 129         PyObject* GetPaths() {
 
 132             size_t count = arr.GetCount();
 
 133             PyObject* listObj = PyList_New(0);
 
 134             for(size_t x=0; x<count; x++) {
 
 135                 PyObject* name = PyString_FromString(arr[x]);
 
 136                 PyList_Append(listObj, name);
 
 144 //----------------------------------------------------------------------
 
 146 //TODO: wxMultipleChoiceDialog
 
 148 //----------------------------------------------------------------------
 
 150 class wxSingleChoiceDialog : public wxDialog {
 
 153         // TODO: ignoring clientData for now...
 
 154         //       SWIG is messing up the &/*'s for some reason.
 
 155         wxSingleChoiceDialog(wxWindow* parent,
 
 158                              int LCOUNT, wxString* choices,
 
 159                              //char** clientData = NULL,
 
 160                              long style = wxOK | wxCANCEL | wxCENTRE,
 
 161                              wxPoint* pos = &wxDefaultPosition) {
 
 162             return new wxSingleChoiceDialog(parent, *message, *caption,
 
 163                                             LCOUNT, choices, NULL, style, *pos);
 
 165     %pragma(python) addtomethod = "__init__:self._setOORInfo(self)"
 
 170     wxString GetStringSelection();
 
 171     void SetSelection(int sel);
 
 176 //----------------------------------------------------------------------
 
 178 class wxTextEntryDialog : public wxDialog {
 
 180     wxTextEntryDialog(wxWindow* parent,
 
 182                       char* caption = "Input Text",
 
 183                       char* defaultValue = "",
 
 184                       long style = wxOK | wxCANCEL | wxCENTRE,
 
 185                       const wxPoint& pos = wxDefaultPosition);
 
 187     %pragma(python) addtomethod = "__init__:self._setOORInfo(self)"
 
 190     void SetValue(const wxString& value);
 
 194 //----------------------------------------------------------------------
 
 196 class wxFontData : public wxObject {
 
 201     void EnableEffects(bool enable);
 
 202     bool GetAllowSymbols();
 
 203     wxColour GetColour();
 
 204     wxFont GetChosenFont();
 
 205     bool GetEnableEffects();
 
 206     wxFont GetInitialFont();
 
 208     void SetAllowSymbols(bool allowSymbols);
 
 209     void SetChosenFont(const wxFont& font);
 
 210     void SetColour(const wxColour& colour);
 
 211     void SetInitialFont(const wxFont& font);
 
 212     void SetRange(int min, int max);
 
 213     void SetShowHelp(bool showHelp);
 
 217 class wxFontDialog : public wxDialog {
 
 219     wxFontDialog(wxWindow* parent, wxFontData* data);
 
 220     %pragma(python) addtomethod = "__init__:self._setOORInfo(self)"
 
 222     wxFontData& GetFontData();
 
 227 //----------------------------------------------------------------------
 
 229 class wxMessageDialog : public wxDialog {
 
 231     wxMessageDialog(wxWindow* parent,
 
 233                     char* caption = "Message box",
 
 234                     long style = wxOK | wxCANCEL | wxCENTRE,
 
 235                     const wxPoint& pos = wxDefaultPosition);
 
 236     %pragma(python) addtomethod = "__init__:self._setOORInfo(self)"
 
 241 //----------------------------------------------------------------------
 
 243 class wxProgressDialog : public wxFrame {
 
 245     wxProgressDialog(const wxString& title,
 
 246                      const wxString& message,
 
 248                      wxWindow* parent = NULL,
 
 249                      int style = wxPD_AUTO_HIDE | wxPD_APP_MODAL );
 
 250     %pragma(python) addtomethod = "__init__:self._setOORInfo(self)"
 
 252     bool Update(int value = -1, const char* newmsg = NULL);
 
 256 //----------------------------------------------------------------------
 
 258 enum wxFindReplaceFlags
 
 260     // downward search/replace selected (otherwise - upwards)
 
 263     // whole word search/replace selected
 
 266     // case sensitive search/replace selected (otherwise - case insensitive)
 
 271 enum wxFindReplaceDialogStyles
 
 273     // replace dialog (otherwise find dialog)
 
 274     wxFR_REPLACEDIALOG = 1,
 
 276     // don't allow changing the search direction
 
 279     // don't allow case sensitive searching
 
 280     wxFR_NOMATCHCASE   = 4,
 
 282     // don't allow whole word searching
 
 288     wxEVT_COMMAND_FIND_NEXT,
 
 289     wxEVT_COMMAND_FIND_REPLACE,
 
 290     wxEVT_COMMAND_FIND_REPLACE_ALL,
 
 291     wxEVT_COMMAND_FIND_CLOSE,
 
 294 %pragma(python) code = "
 
 296 def EVT_COMMAND_FIND(win, id, func):
 
 297     win.Connect(id, -1, wxEVT_COMMAND_FIND, func)
 
 299 def EVT_COMMAND_FIND_NEXT(win, id, func):
 
 300     win.Connect(id, -1, wxEVT_COMMAND_FIND_NEXT, func)
 
 302 def EVT_COMMAND_FIND_REPLACE(win, id, func):
 
 303     win.Connect(id, -1, wxEVT_COMMAND_FIND_REPLACE, func)
 
 305 def EVT_COMMAND_FIND_REPLACE_ALL(win, id, func):
 
 306     win.Connect(id, -1, wxEVT_COMMAND_FIND_REPLACE_ALL, func)
 
 308 def EVT_COMMAND_FIND_CLOSE(win, id, func):
 
 309     win.Connect(id, -1, wxEVT_COMMAND_FIND_CLOSE, func)
 
 313 class wxFindDialogEvent : public wxCommandEvent
 
 316     wxFindDialogEvent(wxEventType commandType = wxEVT_NULL, int id = 0);
 
 318     wxString GetFindString();
 
 319     const wxString& GetReplaceString();
 
 320     wxFindReplaceDialog *GetDialog();
 
 321     void SetFlags(int flags);
 
 322     void SetFindString(const wxString& str);
 
 323     void SetReplaceString(const wxString& str);
 
 328 class wxFindReplaceData : public wxObject
 
 331     wxFindReplaceData(int flags=0);
 
 332     ~wxFindReplaceData();
 
 334     const wxString& GetFindString();
 
 335     const wxString& GetReplaceString();
 
 337     void SetFlags(int flags);
 
 338     void SetFindString(const wxString& str);
 
 339     void SetReplaceString(const wxString& str);
 
 343 class wxFindReplaceDialog : public wxDialog {
 
 345     wxFindReplaceDialog(wxWindow *parent,
 
 346                         wxFindReplaceData *data,
 
 347                         const wxString &title,
 
 349     %name(wxPreFindReplaceDialog)wxFindReplaceDialog();
 
 351      bool Create(wxWindow *parent,
 
 352                  wxFindReplaceData *data,
 
 353                  const wxString &title,
 
 356     %pragma(python) addtomethod = "__init__:self._setOORInfo(self)"
 
 357     %pragma(python) addtomethod = "wxPreFindReplaceDialog:val._setOORInfo(self)"
 
 359     const wxFindReplaceData *GetData();
 
 360     void SetData(wxFindReplaceData *data);
 
 363 //----------------------------------------------------------------------