]> git.saurik.com Git - wxWidgets.git/blobdiff - wxPython/src/my_typemaps.i
wxUniversal fixes:
[wxWidgets.git] / wxPython / src / my_typemaps.i
index 1c712edc4f308bbe2e13db9655151ded15b069cd..d32602247b1747aef39bc6485a286880cd848817 100644 (file)
@@ -188,6 +188,32 @@ $function
 
 
 
+//---------------------------------------------------------------------------
+
+
+%typemap(python, in) wxMemoryBuffer& {
+    if (!PyString_Check($source)) {
+        PyErr_SetString(PyExc_TypeError, "String buffer expected");
+        return NULL;
+    }
+    char* str = PyString_AS_STRING($source);
+    int   len = PyString_GET_SIZE($source);
+    $target = new wxMemoryBuffer(len);
+    memcpy($target->GetData(), str, len);
+}
+
+%typemap(python, freearg) wxMemoryBuffer& {
+    if ($target)
+        delete $source;
+}
+
+%typemap(python, out) wxMemoryBuffer {
+    $target = PyString_FromStringAndSize((char*)$source->GetData(), $source->GetDataLen());
+}
+
+%typemap(python, ret) wxMemoryBuffer {
+    delete $source;
+}
 
 
 //---------------------------------------------------------------------------
@@ -370,6 +396,7 @@ $function
 %typemap(python, out) wxTextCtrl*               { $target = wxPyMake_wxObject($source); }
 %typemap(python, out) wxToolBar*                { $target = wxPyMake_wxObject($source); }
 %typemap(python, out) wxToolBarBase*            { $target = wxPyMake_wxObject($source); }
+%typemap(python, out) wxTreeCtrl*               { $target = wxPyMake_wxObject($source); }
 %typemap(python, out) wxWindow*                 { $target = wxPyMake_wxObject($source); }
 %typemap(python, out) wxHtmlWindow*             { $target = wxPyMake_wxObject($source); }