]> git.saurik.com Git - wxWidgets.git/blobdiff - wxPython/src/helpers.cpp
Apply parts of patch #1719888 to fix compilation on Mac and with
[wxWidgets.git] / wxPython / src / helpers.cpp
index af74e074f37f822eaa51b690a3da1792069e32ce..3e7a8e9c9cb939981be37ea1f1f2bafa7d16f04e 100644 (file)
@@ -297,6 +297,17 @@ void wxPyApp::MacOpenFile(const wxString &fileName)
     wxPyEndBlockThreads(blocked);
 }
 
+void wxPyApp::MacOpenURL(const wxString &url)
+{
+    wxPyBlock_t blocked = wxPyBeginBlockThreads();
+    if (wxPyCBH_findCallback(m_myInst, "MacOpenURL")) {
+        PyObject* s = wx2PyString(url);
+        wxPyCBH_callCallback(m_myInst, Py_BuildValue("(O)", s));
+        Py_DECREF(s);
+    }
+    wxPyEndBlockThreads(blocked);
+}
+
 void wxPyApp::MacPrintFile(const wxString &fileName)
 {
     wxPyBlock_t blocked = wxPyBeginBlockThreads();
@@ -1873,8 +1884,7 @@ wxString* wxString_in_helper(PyObject* source) {
     target = new wxString();
     size_t len = PyUnicode_GET_SIZE(uni);
     if (len) {
-        PyUnicode_AsWideChar((PyUnicodeObject*)uni, target->GetWriteBuf(len), len);
-        target->UngetWriteBuf(len);
+        PyUnicode_AsWideChar((PyUnicodeObject*)uni, wxStringBuffer(*target, len), len);
     }
 
     if (PyString_Check(source))
@@ -1916,8 +1926,7 @@ wxString Py2wxString(PyObject* source)
     }
     size_t len = PyUnicode_GET_SIZE(uni);
     if (len) {
-        PyUnicode_AsWideChar((PyUnicodeObject*)uni, target.GetWriteBuf(len), len);
-        target.UngetWriteBuf();
+        PyUnicode_AsWideChar((PyUnicodeObject*)uni, wxStringBuffer(target, len), len);
     }
 
     if (!PyUnicode_Check(source))
@@ -2526,6 +2535,17 @@ bool wxPoint_helper(PyObject* source, wxPoint** obj)
 
 
 
+bool wxPosition_helper(PyObject* source, wxPosition** obj)
+{
+    if (source == Py_None) {
+        **obj = wxPosition(-1,-1);
+        return true;
+    }
+    return wxPyTwoIntItem_helper(source, obj, wxT("wxPosition"));
+}
+
+
+
 bool wxRealPoint_helper(PyObject* source, wxRealPoint** obj) {
 
     if (source == Py_None) {