]> git.saurik.com Git - wxWidgets.git/blobdiff - wxPython/src/misc2.i
compilation fix for FALSE -> wxItemKind conversion
[wxWidgets.git] / wxPython / src / misc2.i
index 3c5fe21590a4b1410a63cc63931adaf2cbc06e25..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>
 //---------------------------------------------------------------------------
 // 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 = wxEmptyString,
                            const wxString& default_value = wxEmptyString,
@@ -573,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;
@@ -599,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 {
@@ -636,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?
 
@@ -644,7 +657,7 @@ public:
     wxFrame *GetFrame() const;
     wxLog *GetOldLog() const;
     bool IsPassingMessages() const;
-    void PassMessages(bool bDoPass) { m_bPassMessages = bDoPass; }
+    void PassMessages(bool bDoPass);
 };
 
 
@@ -668,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);
 
 
 %{
@@ -690,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);
@@ -700,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);
@@ -1060,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();
         }
@@ -1108,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;
@@ -1122,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();
         }
     }
@@ -1135,9 +1163,13 @@ public:
         PyObject* GetOpenCommand(const wxString& filename,
                                  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();
         }
     }
@@ -1148,9 +1180,13 @@ public:
         PyObject* GetPrintCommand(const wxString& filename,
                                   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();
         }
     }