]> git.saurik.com Git - wxWidgets.git/blobdiff - wxPython/src/cmndlgs.i
Various changes needed to get up to date with current CVS
[wxWidgets.git] / wxPython / src / cmndlgs.i
index 321c4e7ddd3f3043ad529d088dafabcb3d21567c..432ba32ac99b62e0d85c3544c62a04f9b101a1cb 100644 (file)
@@ -18,6 +18,7 @@
 #include <wx/dirdlg.h>
 #include <wx/fontdlg.h>
 #include <wx/progdlg.h>
 #include <wx/dirdlg.h>
 #include <wx/fontdlg.h>
 #include <wx/progdlg.h>
+#include <wx/fdrepdlg.h>
 %}
 
 //----------------------------------------------------------------------
 %}
 
 //----------------------------------------------------------------------
 %import misc.i
 %import gdi.i
 %import windows.i
 %import misc.i
 %import gdi.i
 %import windows.i
+%import events.i
 %import frames.i
 
 %pragma(python) code = "import wx"
 
 //----------------------------------------------------------------------
 
 %import frames.i
 
 %pragma(python) code = "import wx"
 
 //----------------------------------------------------------------------
 
+%{
+    // Put some wx default wxChar* values into wxStrings.
+    DECLARE_DEF_STRING(FileSelectorPromptStr);
+    DECLARE_DEF_STRING(DirSelectorPromptStr);
+    DECLARE_DEF_STRING(DirDialogNameStr);
+    DECLARE_DEF_STRING(FileSelectorDefaultWildcardStr);
+    DECLARE_DEF_STRING(GetTextFromUserPromptStr);
+    DECLARE_DEF_STRING(MessageBoxCaptionStr);
+    static const wxString wxPyEmptyString(wxT(""));
+
+%}
+
+//----------------------------------------------------------------------
+
 class wxColourData : public wxObject {
 public:
     wxColourData();
 class wxColourData : public wxObject {
 public:
     wxColourData();
@@ -54,7 +70,7 @@ class wxColourDialog : public wxDialog {
 public:
     wxColourDialog(wxWindow* parent, wxColourData* data = NULL);
 
 public:
     wxColourDialog(wxWindow* parent, wxColourData* data = NULL);
 
-    %pragma(python) addtomethod = "__init__:#wx._StdDialogCallbacks(self)"
+    %pragma(python) addtomethod = "__init__:self._setOORInfo(self)"
 
     wxColourData& GetColourData();
     int ShowModal();
 
     wxColourData& GetColourData();
     int ShowModal();
@@ -66,12 +82,14 @@ public:
 class wxDirDialog : public wxDialog {
 public:
     wxDirDialog(wxWindow* parent,
 class wxDirDialog : public wxDialog {
 public:
     wxDirDialog(wxWindow* parent,
-                char* message = "Choose a directory",
-                char* defaultPath = "",
+                const wxString& message = wxPyDirSelectorPromptStr,
+                const wxString& defaultPath = wxPyEmptyString,
                 long style = 0,
                 long style = 0,
-                const wxPoint& pos = wxDefaultPosition);
+                const wxPoint& pos = wxDefaultPosition,
+                const wxSize& size = wxDefaultSize,
+                const wxString& name = wxPyDirDialogNameStr);
 
 
-    %pragma(python) addtomethod = "__init__:#wx._StdDialogCallbacks(self)"
+    %pragma(python) addtomethod = "__init__:self._setOORInfo(self)"
 
     wxString GetPath();
     wxString GetMessage();
 
     wxString GetPath();
     wxString GetMessage();
@@ -81,67 +99,100 @@ public:
     int ShowModal();
 };
 
     int ShowModal();
 };
 
+
 //----------------------------------------------------------------------
 
 class wxFileDialog : public wxDialog {
 public:
     wxFileDialog(wxWindow* parent,
 //----------------------------------------------------------------------
 
 class wxFileDialog : public wxDialog {
 public:
     wxFileDialog(wxWindow* parent,
-                 char* message = "Choose a file",
-                 char* defaultDir = "",
-                 char* defaultFile = "",
-                 char* wildcard = "*.*",
+                 const wxString& message = wxPyFileSelectorPromptStr,
+                 const wxString& defaultDir = wxPyEmptyString,
+                 const wxString& defaultFile = wxPyEmptyString,
+                 const wxString& wildcard = wxPyFileSelectorDefaultWildcardStr,
                  long style = 0,
                  const wxPoint& pos = wxDefaultPosition);
 
                  long style = 0,
                  const wxPoint& pos = wxDefaultPosition);
 
-    %pragma(python) addtomethod = "__init__:#wx._StdDialogCallbacks(self)"
+    %pragma(python) addtomethod = "__init__:self._setOORInfo(self)"
 
 
-    wxString GetDirectory();
-    wxString GetFilename();
-    int GetFilterIndex();
-    wxString GetMessage();
-    wxString GetPath();
-    long GetStyle();
-    wxString GetWildcard();
-    void SetDirectory(const wxString& directory);
-    void SetFilename(const wxString& setfilename);
-    void SetFilterIndex(int filterIndex);
     void SetMessage(const wxString& message);
     void SetPath(const wxString& path);
     void SetMessage(const wxString& message);
     void SetPath(const wxString& path);
-    void SetStyle(long style);
+    void SetDirectory(const wxString& dir);
+    void SetFilename(const wxString& name);
     void SetWildcard(const wxString& wildCard);
     void SetWildcard(const wxString& wildCard);
-    int ShowModal();
+    void SetStyle(long style);
+    void SetFilterIndex(int filterIndex);
+
+    wxString GetMessage() const;
+    wxString GetPath() const;
+    wxString GetDirectory() const;
+    wxString GetFilename() const;
+    wxString GetWildcard() const;
+    long GetStyle() const;
+    int GetFilterIndex() const;
 
     %addmethods {
         PyObject* GetFilenames() {
             wxArrayString arr;
             self->GetFilenames(arr);
 
     %addmethods {
         PyObject* GetFilenames() {
             wxArrayString arr;
             self->GetFilenames(arr);
-            size_t count = arr.GetCount();
-            PyObject* listObj = PyList_New(0);
-            for(size_t x=0; x<count; x++) {
-                PyObject* name = PyString_FromString(arr[x]);
-                PyList_Append(listObj, name);
-            }
-            return listObj;
+            return wxArrayString2PyList_helper(arr);
         }
 
         PyObject* GetPaths() {
             wxArrayString arr;
             self->GetPaths(arr);
         }
 
         PyObject* GetPaths() {
             wxArrayString arr;
             self->GetPaths(arr);
-            size_t count = arr.GetCount();
-            PyObject* listObj = PyList_New(0);
-            for(size_t x=0; x<count; x++) {
-                PyObject* name = PyString_FromString(arr[x]);
-                PyList_Append(listObj, name);
-            }
-            return listObj;
+            return wxArrayString2PyList_helper(arr);
         }
     }
         }
     }
+
+// TODO
+//     // Utility functions
+
+//     // Parses the wildCard, returning the number of filters.
+//     // Returns 0 if none or if there's a problem,
+//     // The arrays will contain an equal number of items found before the error.
+//     // wildCard is in the form:
+//     // "All files (*)|*|Image Files (*.jpeg *.png)|*.jpg;*.png"
+//     static int ParseWildcard(const wxString& wildCard,
+//                              wxArrayString& descriptions,
+//                              wxArrayString& filters);
+
+//     // Append first extension to filePath from a ';' separated extensionList
+//     // if filePath = "path/foo.bar" just return it as is
+//     // if filePath = "foo[.]" and extensionList = "*.jpg;*.png" return "foo.jpg"
+//     // if the extension is "*.j?g" (has wildcards) or "jpg" then return filePath
+//     static wxString AppendExtension(const wxString &filePath,
+//                                     const wxString &extensionList);
+
+
 };
 
 
 //----------------------------------------------------------------------
 
 };
 
 
 //----------------------------------------------------------------------
 
-//TODO: wxMultipleChoiceDialog
+enum { wxCHOICEDLG_STYLE };
+
+class wxMultiChoiceDialog : public wxDialog
+{
+public:
+    wxMultiChoiceDialog(wxWindow *parent,
+                        const wxString& message,
+                        const wxString& caption,
+                        int LCOUNT, wxString *choices,
+                        long style = wxCHOICEDLG_STYLE,
+                        const wxPoint& pos = wxDefaultPosition);
+
+    %pragma(python) addtomethod = "__init__:self._setOORInfo(self)"
+
+    void SetSelections(const wxArrayInt& selections);
+
+    // wxArrayInt GetSelections() const;
+    %addmethods {
+        PyObject* GetSelections() {
+            return wxArrayInt2PyList_helper(self->GetSelections());
+        }
+    }
+};
+
 
 //----------------------------------------------------------------------
 
 
 //----------------------------------------------------------------------
 
@@ -155,14 +206,14 @@ public:
                              wxString* caption,
                              int LCOUNT, wxString* choices,
                              //char** clientData = NULL,
                              wxString* caption,
                              int LCOUNT, wxString* choices,
                              //char** clientData = NULL,
-                             long style = wxOK | wxCANCEL | wxCENTRE,
+                             long style = wxCHOICEDLG_STYLE,
                              wxPoint* pos = &wxDefaultPosition) {
             return new wxSingleChoiceDialog(parent, *message, *caption,
                                             LCOUNT, choices, NULL, style, *pos);
         }
                              wxPoint* pos = &wxDefaultPosition) {
             return new wxSingleChoiceDialog(parent, *message, *caption,
                                             LCOUNT, choices, NULL, style, *pos);
         }
-    }
+    %pragma(python) addtomethod = "__init__:self._setOORInfo(self)"
 
 
-    %pragma(python) addtomethod = "__init__:#wx._StdDialogCallbacks(self)"
+    }
 
     int GetSelection();
     wxString GetStringSelection();
 
     int GetSelection();
     wxString GetStringSelection();
@@ -176,13 +227,13 @@ public:
 class wxTextEntryDialog : public wxDialog {
 public:
     wxTextEntryDialog(wxWindow* parent,
 class wxTextEntryDialog : public wxDialog {
 public:
     wxTextEntryDialog(wxWindow* parent,
-                      char* message,
-                      char* caption = "Input Text",
-                      char* defaultValue = "",
+                      const wxString& message,
+                      const wxString& caption = wxPyGetTextFromUserPromptStr,
+                      const wxString& defaultValue = wxPyEmptyString,
                       long style = wxOK | wxCANCEL | wxCENTRE,
                       const wxPoint& pos = wxDefaultPosition);
 
                       long style = wxOK | wxCANCEL | wxCENTRE,
                       const wxPoint& pos = wxDefaultPosition);
 
-    %pragma(python) addtomethod = "__init__:#wx._StdDialogCallbacks(self)"
+    %pragma(python) addtomethod = "__init__:self._setOORInfo(self)"
 
     wxString GetValue();
     void SetValue(const wxString& value);
 
     wxString GetValue();
     void SetValue(const wxString& value);
@@ -214,9 +265,8 @@ public:
 
 class wxFontDialog : public wxDialog {
 public:
 
 class wxFontDialog : public wxDialog {
 public:
-    wxFontDialog(wxWindow* parent, wxFontData* data);
-
-    %pragma(python) addtomethod = "__init__:#wx._StdDialogCallbacks(self)"
+    wxFontDialog(wxWindow* parent, const wxFontData& data);
+    %pragma(python) addtomethod = "__init__:self._setOORInfo(self)"
 
     wxFontData& GetFontData();
     int ShowModal();
 
     wxFontData& GetFontData();
     int ShowModal();
@@ -228,12 +278,11 @@ public:
 class wxMessageDialog : public wxDialog {
 public:
     wxMessageDialog(wxWindow* parent,
 class wxMessageDialog : public wxDialog {
 public:
     wxMessageDialog(wxWindow* parent,
-                    char* message,
-                    char* caption = "Message box",
+                    const wxString& message,
+                    const wxString& caption = wxPyMessageBoxCaptionStr,
                     long style = wxOK | wxCANCEL | wxCENTRE,
                     const wxPoint& pos = wxDefaultPosition);
                     long style = wxOK | wxCANCEL | wxCENTRE,
                     const wxPoint& pos = wxDefaultPosition);
-
-    %pragma(python) addtomethod = "__init__:#wx._StdDialogCallbacks(self)"
+    %pragma(python) addtomethod = "__init__:self._setOORInfo(self)"
 
     int ShowModal();
 };
 
     int ShowModal();
 };
@@ -247,10 +296,117 @@ public:
                      int maximum = 100,
                      wxWindow* parent = NULL,
                      int style = wxPD_AUTO_HIDE | wxPD_APP_MODAL );
                      int maximum = 100,
                      wxWindow* parent = NULL,
                      int style = wxPD_AUTO_HIDE | wxPD_APP_MODAL );
+    %pragma(python) addtomethod = "__init__:self._setOORInfo(self)"
 
 
-
-    bool Update(int value = -1, const char* newmsg = NULL);
+    bool Update(int value, const wxString& newmsg = wxPyEmptyString);
     void Resume();
 }
 
 //----------------------------------------------------------------------
     void Resume();
 }
 
 //----------------------------------------------------------------------
+
+enum wxFindReplaceFlags
+{
+    // downward search/replace selected (otherwise - upwards)
+    wxFR_DOWN       = 1,
+
+    // whole word search/replace selected
+    wxFR_WHOLEWORD  = 2,
+
+    // case sensitive search/replace selected (otherwise - case insensitive)
+    wxFR_MATCHCASE  = 4
+};
+
+
+enum wxFindReplaceDialogStyles
+{
+    // replace dialog (otherwise find dialog)
+    wxFR_REPLACEDIALOG = 1,
+
+    // don't allow changing the search direction
+    wxFR_NOUPDOWN      = 2,
+
+    // don't allow case sensitive searching
+    wxFR_NOMATCHCASE   = 4,
+
+    // don't allow whole word searching
+    wxFR_NOWHOLEWORD   = 8
+};
+
+enum {
+    wxEVT_COMMAND_FIND,
+    wxEVT_COMMAND_FIND_NEXT,
+    wxEVT_COMMAND_FIND_REPLACE,
+    wxEVT_COMMAND_FIND_REPLACE_ALL,
+    wxEVT_COMMAND_FIND_CLOSE,
+};
+
+%pragma(python) code = "
+
+def EVT_COMMAND_FIND(win, id, func):
+    win.Connect(id, -1, wxEVT_COMMAND_FIND, func)
+
+def EVT_COMMAND_FIND_NEXT(win, id, func):
+    win.Connect(id, -1, wxEVT_COMMAND_FIND_NEXT, func)
+
+def EVT_COMMAND_FIND_REPLACE(win, id, func):
+    win.Connect(id, -1, wxEVT_COMMAND_FIND_REPLACE, func)
+
+def EVT_COMMAND_FIND_REPLACE_ALL(win, id, func):
+    win.Connect(id, -1, wxEVT_COMMAND_FIND_REPLACE_ALL, func)
+
+def EVT_COMMAND_FIND_CLOSE(win, id, func):
+    win.Connect(id, -1, wxEVT_COMMAND_FIND_CLOSE, func)
+
+"
+
+class wxFindDialogEvent : public wxCommandEvent
+{
+public:
+    wxFindDialogEvent(wxEventType commandType = wxEVT_NULL, int id = 0);
+    int GetFlags();
+    wxString GetFindString();
+    const wxString& GetReplaceString();
+    wxFindReplaceDialog *GetDialog();
+    void SetFlags(int flags);
+    void SetFindString(const wxString& str);
+    void SetReplaceString(const wxString& str);
+};
+
+
+
+class wxFindReplaceData : public wxObject
+{
+public:
+    wxFindReplaceData(int flags=0);
+    ~wxFindReplaceData();
+
+    const wxString& GetFindString();
+    const wxString& GetReplaceString();
+    int GetFlags();
+    void SetFlags(int flags);
+    void SetFindString(const wxString& str);
+    void SetReplaceString(const wxString& str);
+};
+
+
+class wxFindReplaceDialog : public wxDialog {
+public:
+    wxFindReplaceDialog(wxWindow *parent,
+                        wxFindReplaceData *data,
+                        const wxString &title,
+                        int style = 0);
+    %name(wxPreFindReplaceDialog)wxFindReplaceDialog();
+
+     bool Create(wxWindow *parent,
+                 wxFindReplaceData *data,
+                 const wxString &title,
+                 int style = 0);
+
+    %pragma(python) addtomethod = "__init__:self._setOORInfo(self)"
+    %pragma(python) addtomethod = "wxPreFindReplaceDialog:val._setOORInfo(val)"
+
+    const wxFindReplaceData *GetData();
+    void SetData(wxFindReplaceData *data);
+};
+
+//----------------------------------------------------------------------