]> git.saurik.com Git - wxWidgets.git/blobdiff - wxPython/src/misc2.i
Regenerated file lists so features.h would be installed
[wxWidgets.git] / wxPython / src / misc2.i
index 91c74c6d801b2664c446fb520fe148ae715670f8..74c55bd82f00d36666c18b4b9fed9d1f33d7ffef 100644 (file)
@@ -16,6 +16,7 @@
 
 %{
 #include "helpers.h"
+#include "pyistream.h"
 #include <wx/resource.h>
 #include <wx/tooltip.h>
 #include <wx/caret.h>
 %import streams.i
 %import utils.i
 
-%{
-    static wxString wxPyEmptyStr("");
-%}
 
 //---------------------------------------------------------------------------
 // Dialog Functions
 
-wxString wxFileSelector(char* message,
-                        char* default_path = NULL,
-                        char* default_filename = NULL,
-                        char* default_extension = NULL,
-                        char* wildcard = "*.*",
+wxString wxFileSelector(const wxChar* message = wxFileSelectorPromptStr,
+                        const wxChar* default_path = NULL,
+                        const wxChar* default_filename = NULL,
+                        const wxChar* default_extension = NULL,
+                        const wxChar* wildcard = wxFileSelectorDefaultWildcardStr,
                         int flags = 0,
                         wxWindow *parent = NULL,
                         int x = -1, int y = -1);
 
+// Ask for filename to load
+wxString wxLoadFileSelector(const wxChar *what,
+                            const wxChar *extension,
+                            const wxChar *default_name = NULL,
+                            wxWindow *parent = NULL);
+
+// Ask for filename to save
+wxString wxSaveFileSelector(const wxChar *what,
+                            const wxChar *extension,
+                            const wxChar *default_name = NULL,
+                            wxWindow *parent = NULL);
+
 wxString wxGetTextFromUser(const wxString& message,
-                           const wxString& caption = wxPyEmptyStr,
-                           const wxString& default_value = wxPyEmptyStr,
+                           const wxString& caption = wxEmptyString,
+                           const wxString& default_value = wxEmptyString,
                            wxWindow *parent = NULL,
                            int x = -1, int y = -1,
                            bool centre = TRUE);
 
 wxString wxGetPasswordFromUser(const wxString& message,
-                               const wxString& caption = wxPyEmptyStr,
-                               const wxString& default_value = wxPyEmptyStr,
+                               const wxString& caption = wxEmptyString,
+                               const wxString& default_value = wxEmptyString,
                                wxWindow *parent = NULL);
 
 
@@ -101,7 +111,7 @@ int wxGetSingleChoiceIndex(const wxString& message, const wxString& caption,
 
 
 int wxMessageBox(const wxString& message,
-                 const wxString& caption = wxPyEmptyStr,
+                 const wxString& caption = wxEmptyString,
                  int style = wxOK | wxCENTRE,
                  wxWindow *parent = NULL,
                  int x = -1, int y = -1);
@@ -576,7 +586,7 @@ public:
 
     static bool IsEnabled();
     static bool EnableLogging(bool doIt = TRUE);
-    static void OnLog(wxLogLevel level, const char *szString, int t=0);
+    static void OnLog(wxLogLevel level, const wxString& szString, int t=0);
 
     virtual void Flush();
     bool HasPendingMessages() const;
@@ -602,7 +612,7 @@ public:
     bool GetVerbose() const { return m_bVerbose; }
 
     static wxTraceMask GetTraceMask();
-    static bool IsAllowedTraceMask(const char *mask);
+    static bool IsAllowedTraceMask(const wxString& mask);
 
     // static void TimeStamp(wxString *str);
     %addmethods {
@@ -639,7 +649,7 @@ class wxLogWindow : public wxLog
 {
 public:
     wxLogWindow(wxFrame *pParent,         // the parent frame (can be NULL)
-            const char *szTitle,          // the title of the frame
+            const wxString& szTitle,      // the title of the frame
             bool bShow = TRUE,            // show window immediately?
             bool bPassToOld = TRUE);      // pass log messages to the old target?
 
@@ -647,7 +657,7 @@ public:
     wxFrame *GetFrame() const;
     wxLog *GetOldLog() const;
     bool IsPassingMessages() const;
-    void PassMessages(bool bDoPass) { m_bPassMessages = bDoPass; }
+    void PassMessages(bool bDoPass);
 };
 
 
@@ -671,16 +681,16 @@ public:
 
 
 unsigned long wxSysErrorCode();
-const char* wxSysErrorMsg(unsigned long nErrCode = 0);
-void wxLogFatalError(const char *szFormat);
-void wxLogError(const char *szFormat);
-void wxLogWarning(const char *szFormat);
-void wxLogMessage(const char *szFormat);
-void wxLogInfo(const char *szFormat);
-void wxLogVerbose(const char *szFormat);
-void wxLogStatus(const char *szFormat);
-%name(wxLogStatusFrame)void wxLogStatus(wxFrame *pFrame, const char *szFormat);
-void wxLogSysError(const char *szFormat);
+const wxString wxSysErrorMsg(unsigned long nErrCode = 0);
+void wxLogFatalError(const wxString& szFormat);
+void wxLogError(const wxString& szFormat);
+void wxLogWarning(const wxString& szFormat);
+void wxLogMessage(const wxString& szFormat);
+void wxLogInfo(const wxString& szFormat);
+void wxLogVerbose(const wxString& szFormat);
+void wxLogStatus(const wxString& szFormat);
+%name(wxLogStatusFrame)void wxLogStatus(wxFrame *pFrame, const wxString& szFormat);
+void wxLogSysError(const wxString& szFormat);
 
 
 %{
@@ -693,7 +703,8 @@ public:
         bool found;
         wxPyBeginBlockThreads();
         if ((found = wxPyCBH_findCallback(m_myInst, "DoLog")))
-            wxPyCBH_callCallback(m_myInst, Py_BuildValue("(isi)", level, szString, t));
+            wxPyCBH_callCallback(m_myInst, Py_BuildValue("(iOi)", level,
+                                                         wx2PyString(szString), t));
         wxPyEndBlockThreads();
         if (! found)
             wxLog::DoLog(level, szString, t);
@@ -703,7 +714,8 @@ public:
         bool found;
         wxPyBeginBlockThreads();
         if ((found = wxPyCBH_findCallback(m_myInst, "DoLogString")))
-            wxPyCBH_callCallback(m_myInst, Py_BuildValue("(si)", szString, t));
+            wxPyCBH_callCallback(m_myInst, Py_BuildValue("(Oi)",
+                                                         wx2PyString(szString), t));
         wxPyEndBlockThreads();
         if (! found)
             wxLog::DoLogString(szString, t);
@@ -1039,8 +1051,8 @@ public:
     {
     public:
         // ctors
-        MessageParameters(const wxString& filename=wxPyEmptyStr,
-                          const wxString& mimetype=wxPyEmptyStr);
+        MessageParameters(const wxString& filename=wxEmptyString,
+                          const wxString& mimetype=wxEmptyString);
 
         // accessors (called by GetOpenCommand)
             // filename
@@ -1063,8 +1075,13 @@ public:
     %addmethods {
         PyObject* GetMimeType() {
             wxString str;
-            if (self->GetMimeType(&str))
-                return PyString_FromString(str.c_str());
+            if (self->GetMimeType(&str)) {
+#if wxUSE_UNICODE
+             return PyUnicode_FromUnicode(str.c_str(), str.Len());
+#else
+             return PyString_FromStringAndSize(str.c_str(), str.Len());
+#endif
+           }
             else
                 RETURN_NONE();
         }
@@ -1111,7 +1128,11 @@ public:
                 PyObject* tuple = PyTuple_New(3);
                 PyTuple_SetItem(tuple, 0, wxPyConstructObject(new wxIcon(icon),
                                                               "wxIcon", TRUE));
-                PyTuple_SetItem(tuple, 1, PyString_FromString(iconFile.c_str()));
+#if wxUSE_UNICODE
+                PyTuple_SetItem(tuple, 1, PyUnicode_FromUnicode(iconFile.c_str(), iconFile.Len()));
+#else
+                PyTuple_SetItem(tuple, 1, PyString_FromStringAndSize(iconFile.c_str(), iconFile.Len()));
+#endif
                 PyTuple_SetItem(tuple, 2, PyInt_FromLong(iconIndex));
                 wxPyEndBlockThreads();
                 return tuple;
@@ -1125,9 +1146,13 @@ public:
         // get a brief file type description ("*.txt" => "text document")
         PyObject* GetDescription() {
             wxString str;
-            if (self->GetDescription(&str))
-                return PyString_FromString(str.c_str());
-            else
+            if (self->GetDescription(&str)) {
+#if  wxUSE_UNICODE
+             return PyUnicode_FromUnicode(str.c_str(), str.Len());
+#else
+             return PyString_FromStringAndSize(str.c_str(), str.Len());
+#endif
+            } else
                 RETURN_NONE();
         }
     }
@@ -1136,11 +1161,15 @@ public:
     // get the command to open/execute the file of given type
     %addmethods {
         PyObject* GetOpenCommand(const wxString& filename,
-                                 const wxString& mimetype=wxPyEmptyStr) {
+                                 const wxString& mimetype=wxEmptyString) {
             wxString str;
-            if (self->GetOpenCommand(&str, wxFileType::MessageParameters(filename, mimetype)))
-                return PyString_FromString(str.c_str());
-            else
+            if (self->GetOpenCommand(&str, wxFileType::MessageParameters(filename, mimetype))) {
+#if  wxUSE_UNICODE
+                return PyUnicode_FromUnicode(str.c_str(), str.Len());
+#else
+                return PyString_FromStringAndSize(str.c_str(), str.Len());
+#endif
+            } else
                 RETURN_NONE();
         }
     }
@@ -1149,11 +1178,15 @@ public:
     // get the command to print the file of given type
     %addmethods {
         PyObject* GetPrintCommand(const wxString& filename,
-                                  const wxString& mimetype=wxPyEmptyStr) {
+                                  const wxString& mimetype=wxEmptyString) {
             wxString str;
-            if (self->GetPrintCommand(&str, wxFileType::MessageParameters(filename, mimetype)))
-                return PyString_FromString(str.c_str());
-            else
+            if (self->GetPrintCommand(&str, wxFileType::MessageParameters(filename, mimetype))) {
+#if wxUSE_UNICODE
+                return PyUnicode_FromUnicode(str.c_str(), str.Len());
+#else
+                return PyString_FromStringAndSize(str.c_str(), str.Len());
+#endif
+            } else
                 RETURN_NONE();
         }
     }
@@ -1162,7 +1195,7 @@ public:
     // Get all commands defined for this file type
     %addmethods {
         PyObject* GetAllCommands(const wxString& filename,
-                                 const wxString& mimetype=wxPyEmptyStr) {
+                                 const wxString& mimetype=wxEmptyString) {
             wxArrayString verbs;
             wxArrayString commands;
             if (self->GetAllCommands(&verbs, &commands,