]> git.saurik.com Git - wxWidgets.git/blobdiff - wxPython/src/filesys.i
Added a few new flags, etc.
[wxWidgets.git] / wxPython / src / filesys.i
index 7fc6c420c60a2eb01455e534606967c0d72a2966..0f3b1371bd4d5d27e4b27e5400507bf28c2d51b8 100644 (file)
@@ -2,7 +2,7 @@
 // Name:        filesys.i
 // Purpose:     SWIG definitions of the wxFileSystem family of classes
 //
 // Name:        filesys.i
 // Purpose:     SWIG definitions of the wxFileSystem family of classes
 //
-// Author:      Joerg Baumann
+// Author:      Joerg Baumann and Robin Dunn
 //
 // Created:     25-Sept-2000
 // RCS-ID:      $Id$
 //
 // Created:     25-Sept-2000
 // RCS-ID:      $Id$
@@ -14,6 +14,7 @@
 
 %{
 #include "helpers.h"
 
 %{
 #include "helpers.h"
+#include "pyistream.h"
 #include <wx/filesys.h>
 #include <wx/fs_inet.h>
 #include <wx/fs_mem.h>
 #include <wx/filesys.h>
 #include <wx/fs_inet.h>
 #include <wx/fs_mem.h>
 
 //---------------------------------------------------------------------------
 
 
 //---------------------------------------------------------------------------
 
-//  // typemaps for wxInputStream: Note wxFSFile object has to do the delete
-//  // of wxInputStream *
-//  %typemap(python,in) wxInputStream *stream {
-//      if (PyInstance_Check($source)) {
-//          wxPyInputStream* ptr;
-//          if (SWIG_GetPtrObj($source, (void **) &ptr,"_wxPyInputStream_p")) {
-//              PyErr_SetString(PyExc_TypeError,"Expected _wxInputStream_p.");
-//              return NULL;
-//          }
-//          $target = ptr->wxi;
-//      } else {
-//          PyErr_SetString(PyExc_TypeError,"Expected _wxInputStream_p.");
-//          return NULL;
-//      }
-//  }
-
-
-//  // typemaps for wxInputStream: Note wxFSFile object has to do the delete
-//  // of wxInputStream *
-//  %typemap(python,out) wxInputStream* {
-//      wxPyInputStream * _ptr = NULL;
-
-//      if ($source) {
-//          _ptr = new wxPyInputStream($source);
-//      }
-//      if (_ptr) {
-//          char    swigptr[64];
-//          SWIG_MakePtr(swigptr, _ptr, "_wxPyInputStream_p");
-
-//          PyObject* classobj = PyDict_GetItemString(wxPython_dict, "wxInputStreamPtr");
-//          if (! classobj) {
-//              Py_INCREF(Py_None);
-//              $target = Py_None;
-//          } else {
-//              PyObject* arg = Py_BuildValue("(s)", swigptr);
-//              $target = PyInstance_New(classobj, arg, NULL);
-//              Py_DECREF(arg);
-
-//              // set ThisOwn
-//              PyObject_SetAttrString($target, "thisown", PyInt_FromLong(1));
-//          }
-//      } else {
-//          Py_INCREF(Py_None);
-//          $target = Py_None;
-//      }
-//  }
-
-
-
-class wxFSFile {
+
+class wxFSFile : public wxObject {
 public:
     wxFSFile(wxInputStream *stream, const wxString& loc,
              const wxString& mimetype, const wxString& anchor,
 public:
     wxFSFile(wxInputStream *stream, const wxString& loc,
              const wxString& mimetype, const wxString& anchor,
@@ -134,7 +87,7 @@ public:
         return wxFileSystemHandler::GetRightLocation(location);
     }
 
         return wxFileSystemHandler::GetRightLocation(location);
     }
 
-    wxString GetMimeTypeFromExt(const wxString& location){
+    wxString GetMimeTypeFromExt(const wxString& location) {
         return wxFileSystemHandler::GetMimeTypeFromExt(location);
     }
 
         return wxFileSystemHandler::GetMimeTypeFromExt(location);
     }
 
@@ -149,16 +102,16 @@ IMP_PYCALLBACK_STRING__pure(wxPyFileSystemHandler, wxFileSystemHandler, FindNext
 %}
 
 
 %}
 
 
-%name(wxCPPFileSystemHandler)class wxFileSystemHandler {
-      wxFileSystemHandler();
+%name(wxCPPFileSystemHandler)class wxFileSystemHandler : public wxObject {
+    wxFileSystemHandler();
 }
 
 %name(wxFileSystemHandler)class wxPyFileSystemHandler : public wxFileSystemHandler {
 public:
     wxPyFileSystemHandler();
 
 }
 
 %name(wxFileSystemHandler)class wxPyFileSystemHandler : public wxFileSystemHandler {
 public:
     wxPyFileSystemHandler();
 
-    void _setSelf(PyObject* self, PyObject* _class);
-    %pragma(python) addtomethod = "__init__:self._setSelf(self, wxFileSystemHandler)"
+    void _setCallbackInfo(PyObject* self, PyObject* _class);
+    %pragma(python) addtomethod = "__init__:self._setCallbackInfo(self, wxFileSystemHandler)"
 
     bool CanOpen(const wxString& location);
     wxFSFile* OpenFile(wxFileSystem& fs, const wxString& location);
 
     bool CanOpen(const wxString& location);
     wxFSFile* OpenFile(wxFileSystem& fs, const wxString& location);
@@ -174,7 +127,7 @@ public:
 
 //---------------------------------------------------------------------------
 
 
 //---------------------------------------------------------------------------
 
-class wxFileSystem {
+class wxFileSystem : public wxObject {
 public:
     wxFileSystem();
 
 public:
     wxFileSystem();
 
@@ -241,15 +194,11 @@ void __wxMemoryFSHandler_AddFile_wxBitmap(const wxString& filename,
     wxMemoryFSHandler::AddFile(filename, bitmap, type);
 }
 
     wxMemoryFSHandler::AddFile(filename, bitmap, type);
 }
 
-//  void __wxMemoryFSHandler_AddFile_wxString(const wxString& filename,
-//                                            const wxString& textdata) {
-//      wxMemoryFSHandler::AddFile(filename, textdata);
-//  }
-
 void __wxMemoryFSHandler_AddFile_Data(const wxString& filename,
                                       PyObject* data) {
 
     wxMemoryFSHandler::AddFile(filename,
 void __wxMemoryFSHandler_AddFile_Data(const wxString& filename,
                                       PyObject* data) {
 
     wxMemoryFSHandler::AddFile(filename,
+                               // TODO:  Verify data type
                                (void*)PyString_AsString(data),
                                (size_t)PyString_Size(data));
 }
                                (void*)PyString_AsString(data),
                                (size_t)PyString_Size(data));
 }
@@ -271,4 +220,10 @@ def wxMemoryFSHandler_AddFile(filename, a, b=''):
 "
 
 
 "
 
 
+//---------------------------------------------------------------------------
+
+%init %{
+    wxPyPtrTypeMap_Add("wxFileSystemHandler", "wxPyFileSystemHandler");
+%}
+
 //---------------------------------------------------------------------------
 //---------------------------------------------------------------------------