]> git.saurik.com Git - wxWidgets.git/commitdiff
Changes needed to be able to build with SWIG 1.3.24, 1.3.27 as well as
authorRobin Dunn <robin@alldunn.com>
Sun, 29 Jan 2006 02:09:45 +0000 (02:09 +0000)
committerRobin Dunn <robin@alldunn.com>
Sun, 29 Jan 2006 02:09:45 +0000 (02:09 +0000)
the upcoming 1.3.28, using #if statements on SWIG_VERSION.

Adjustments to ownership of SWIG objects, add some destructors and
explicitly disown non-window objects when their ownership is
transfered to a C++ object.

Since all window objects are owned by their parent, or by themselves,
always set their thisown attribute to False.

Explicitly set thisown to False after any Destroy() methods are
called, so SWIG doesn't try to destroy them again.

Etc.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@37203 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

32 files changed:
wxPython/b.win32
wxPython/config.py
wxPython/contrib/gizmos/gizmos.i
wxPython/src/_artprov.i
wxPython/src/_clipbrd.i
wxPython/src/_cmndlgs.i
wxPython/src/_config.i
wxPython/src/_core_api.i
wxPython/src/_cshelp.i
wxPython/src/_dataobj.i
wxPython/src/_defs.i
wxPython/src/_dnd.i
wxPython/src/_evthandler.i
wxPython/src/_gbsizer.i
wxPython/src/_listbox.i
wxPython/src/_listctrl.i
wxPython/src/_log.i
wxPython/src/_menu.i
wxPython/src/_misc.i
wxPython/src/_notebook.i
wxPython/src/_obj.i
wxPython/src/_process.i
wxPython/src/_sizers.i
wxPython/src/_stockobjs.i
wxPython/src/_taskbar.i
wxPython/src/_toplvl.i
wxPython/src/_treectrl.i
wxPython/src/_window.i
wxPython/src/grid.i
wxPython/src/html.i
wxPython/src/my_typemaps.i
wxPython/src/pyfragments.swg

index aac2d54f47fa71750f466c072f82b432faab2271..77ff58076597a15ccd797fe23eee40ae4a5a17fb 100644 (file)
@@ -6,7 +6,7 @@
 # if this breaks something at your end, let me know and we can
 # figure out some solution for both of us.
 if [ "$SWIGDIR" = "" ]; then
-  SWIGDIR=$PROJECTS\\SWIG-cvs
+  SWIGDIR=$PROJECTS\\SWIG-1.3.27
 fi
 
 FLAGS="USE_SWIG=1 SWIG=$SWIGDIR\\swig.exe"
index af616106ed581e2c6cf4d1d5c3b756f29a69d6f5..1f6d7242abdec833e2f033729c3511c72fcc8563 100644 (file)
@@ -700,6 +700,7 @@ if os.name == 'nt':
                 ('WXUSINGDLL', '1'),
 
                 ('SWIG_TYPE_TABLE', WXPYTHON_TYPE_TABLE),
+                ('SWIG_PYTHON_OUTPUT_TUPLE', None),
                 ('WXP_USE_THREAD', '1'),
                 ]
 
@@ -754,7 +755,7 @@ elif os.name == 'posix':
     WXDIR = '..'
     includes = ['include', 'src']
     defines = [('SWIG_TYPE_TABLE', WXPYTHON_TYPE_TABLE),
-               ('HAVE_CONFIG_H', None),
+               ('SWIG_PYTHON_OUTPUT_TUPLE', None),
                ('WXP_USE_THREAD', '1'),
                ]
     if UNDEF_NDEBUG:
@@ -873,7 +874,7 @@ i_files_includes = [ '-I' + opj(WXPY_SRC, 'src'),
 swig_cmd = SWIG
 swig_force = force
 swig_args = ['-c++',
-             '-Wall',
+             #'-Wall',
              '-python',
              '-new_repr',
              '-modern',
index 2a3821483aca7d580ceed9abea38c209491096ba..71dccd36c63239672e262756b5cb00d86e692e67 100644 (file)
@@ -582,11 +582,11 @@ public:
     void SetStateImageList(wxImageList *imageList);
     void SetButtonsImageList(wxImageList *imageList);
 
-    %apply SWIGTYPE *DISOWN { wxImageList *imageList };
+    %disownarg( wxImageList *imageList );
     void AssignImageList(wxImageList *imageList);
     void AssignStateImageList(wxImageList *imageList);
     void AssignButtonsImageList(wxImageList *imageList);
-    %clear wxImageList *imageList;
+    %cleardisown( wxImageList *imageList );
 
 
     // adds a column
index add7ff93d57ae3a9064bd8964be4b678e97bae81..4d02334a93f5b59c8e5a25863fb5aa12d5b94e95 100644 (file)
@@ -245,19 +245,22 @@ public:
 
     %pythonAppend wxPyArtProvider "self._setCallbackInfo(self, ArtProvider)"
     wxPyArtProvider();
+    ~wxPyArtProvider();
     
     void _setCallbackInfo(PyObject* self, PyObject* _class);
 
+    %disownarg( wxPyArtProvider *provider );
     DocDeclStr(
         static void , PushProvider(wxPyArtProvider *provider),
         "Add new provider to the top of providers stack.", "");
+    %cleardisown( wxPyArtProvider *provider );
     
 
     DocDeclStr(
         static bool , PopProvider(),
         "Remove latest added provider and delete it.", "");
     
-
+    %pythonAppend RemoveProvider "args[1].thisown = 1";
     DocDeclStr(
         static bool , RemoveProvider(wxPyArtProvider *provider),
         "Remove provider. The provider must have been added previously!  The
@@ -286,6 +289,7 @@ topmost provider if platform_dependent = false", "");
     
     
 
+    %pythonAppend Destroy "args[0].thisown = 0"
     %extend { void Destroy() { delete self; }}
 };
 
index 53a040abed3f82a2fe63b5a2adf63b9c7fb62a76..d3ca994dbc6ff12bf0243431b3f93a863f891d45 100644 (file)
@@ -65,7 +65,7 @@ True on success.", "");
     
 
 
-    %apply SWIGTYPE *DISOWN { wxDataObject *data };
+    %disownarg( wxDataObject *data );
     
     DocDeclStr(
         virtual bool , AddData( wxDataObject *data ),
@@ -84,8 +84,8 @@ do not delete the data explicitly.
 
 :see: `wx.DataObject`", "");
     
-
-    %clear wxDataObject *data;
+    %cleardisown( wxDataObject *data );
+    
     
     DocDeclStr(
         virtual bool , IsSupported( const wxDataFormat& format ),
index 901f41f1a25441bc562b3aea7ad23b0411161a74..c0050c56cc872e63d81ed9ec7ce91f7fd8de8c81 100644 (file)
@@ -289,23 +289,22 @@ which will be used when the dialog is first displayed. After the
 dialog is shown, this is the index selected by the user.", "");
 
 
-    DocStr(GetFilenames,
-        "Returns a list of filenames chosen in the dialog.  This function
+    %extend {
+        DocStr(GetFilenames,
+               "Returns a list of filenames chosen in the dialog.  This function
 should only be used with the dialogs which have wx.MULTIPLE style, use
 GetFilename for the others.", "");
-
-    DocStr(GetPaths,
-        "Fills the array paths with the full paths of the files chosen. This
-function should only be used with the dialogs which have wx.MULTIPLE
-style, use GetPath for the others.", "");   
-    
-    %extend {
         PyObject* GetFilenames() {
             wxArrayString arr;
             self->GetFilenames(arr);
             return wxArrayString2PyList_helper(arr);
         }
 
+        DocStr(GetPaths,
+               "Fills the array paths with the full paths of the files chosen. This
+function should only be used with the dialogs which have wx.MULTIPLE
+style, use GetPath for the others.", "");   
+    
         PyObject* GetPaths() {
             wxArrayString arr;
             self->GetPaths(arr);
index 4ee0060a0f60af788f600583b714a52b4aa4f8f2..434b42cdb11896eff52e9480b78cf9c42128929e 100644 (file)
@@ -85,12 +85,12 @@ public:
     };
 
 
-    %apply SWIGTYPE *DISOWN { wxConfigBase *config };
+    %disownarg( wxConfigBase *config );
     DocDeclStr(
         static wxConfigBase *, Set(wxConfigBase *config),
         "Sets the global config object (the one returned by Get) and returns a
 reference to the previous global config object.", "");
-    %clear wxConfigBase *config;
+    %cleardisown( wxConfigBase *config );
 
     DocDeclStr(
         static wxConfigBase *, Get(bool createOnDemand = true),
index 17f8b0efc56e6cfc4b92a2560849ed73bb97b063..153124b84217b8a18dec6a8830392e30326db7ad 100644 (file)
@@ -106,8 +106,9 @@ PyObject* wxPyMakeSwigPtr(void* ptr, const wxChar* className) {
     PyObject* robj = NULL;
 
     swig_type_info* swigType = wxPyFindSwigType(className);
-    wxCHECK_MSG(swigType != NULL, NULL, wxT("Unknown type in wxPyConvertSwigPtr"));
+    wxCHECK_MSG(swigType != NULL, NULL, wxT("Unknown type in wxPyMakeSwigPtr"));
 
+#if SWIG_VERSION < 0x010328
 #ifdef SWIG_COBJECT_TYPES
     robj = PySwigObject_FromVoidPtrAndDesc((void *) ptr, (char *)swigType->name);
 #else
@@ -117,7 +118,9 @@ PyObject* wxPyMakeSwigPtr(void* ptr, const wxChar* className) {
             PyString_FromString(result) : 0;
     }
 #endif
-
+#else // SWIG_VERSION >= 1.3.28
+    robj = PySwigObject_New(ptr, swigType, 0);
+#endif
     return robj;
 }
 
index ca04f0cae8b772c804bd17619983ba625b068cab..927fcea157ed7740bd23cabdf7d3dd9d22b0bfee 100644 (file)
@@ -208,11 +208,14 @@ application using wx.HelpProvider.Set().", "");
 class wxHelpProvider 
 {
 public:
+    %disownarg( wxHelpProvider *helpProvider );
+    %newobject Set;
     DocDeclStr(
         static wxHelpProvider *, Set(wxHelpProvider *helpProvider),
         "Sset the current, application-wide help provider. Returns the previous
 one.  Unlike some other classes, the help provider is not created on
 demand. This must be explicitly done by the application.", "");
+    %cleardisown( wxHelpProvider *helpProvider );
     
     DocDeclStr(
         static wxHelpProvider *, Get(),
@@ -250,6 +253,7 @@ table of help strings will fill up and when window pointers are
 reused, the wrong help string will be found.", "");
     
     
+    %pythonAppend Destroy "args[0].thisown = 0"
     %extend { void Destroy() { delete self; } }
 };
 
index c2e0c7f69339d4e29b4840ad60fdda86b46ecc24..fd6cd5c5b0a77f26505acb70ab703fb6edbcbac0 100644 (file)
@@ -230,14 +230,11 @@ data.", "");
     
 
 
-    // return all formats in the provided array (of size GetFormatCount())
-    //virtual void GetAllFormats(wxDataFormat *formats,
-    //                           Direction dir = Get) const;
-    DocAStr(GetAllFormats,
-            "GetAllFormats(self, int dir=Get) -> [formats]",
-            "Returns a list of all the wx.DataFormats that this dataobject supports
-in the given direction.", "");
     %extend {
+        DocAStr(GetAllFormats,
+                "GetAllFormats(self, int dir=Get) -> [formats]",
+                "Returns a list of all the wx.DataFormats that this dataobject supports
+in the given direction.", "");
         PyObject* GetAllFormats(Direction dir = Get) {
             size_t count = self->GetFormatCount(dir);
             wxDataFormat* formats = new wxDataFormat[count];
@@ -262,12 +259,11 @@ in the given direction.", "");
     // True if data copied successfully, False otherwise
     // virtual bool GetDataHere(const wxDataFormat& format, void *buf) const;
 
-    DocAStr(GetDataHere,
-            "GetDataHere(self, DataFormat format) -> String",
-            "Get the data bytes in the specified format, returns None on failure.
-", "
-:todo: This should use the python buffer interface isntead...");
     %extend {
+        DocAStr(GetDataHere,
+                "GetDataHere(self, DataFormat format) -> String",
+                "Get the data bytes in the specified format, returns None on failure.", "
+:todo: This should use the python buffer interface isntead...");
         PyObject* GetDataHere(const wxDataFormat& format) {
             PyObject* rval = NULL;
             size_t size = self->GetDataSize(format);            
@@ -353,12 +349,12 @@ assumed that the format is supported in both directions.", "");
 
 
     
-    DocAStr(GetDataHere,
-            "GetDataHere(self) -> String",
-            "Returns the data bytes from the data object as a string, returns None
+    %extend {
+        DocAStr(GetDataHere,
+                "GetDataHere(self) -> String",
+                "Returns the data bytes from the data object as a string, returns None
 on failure.  Must be implemented in the derived class if the object
 supports rendering its data.", "");
-    %extend {
         PyObject* GetDataHere() {
             PyObject* rval = NULL;
             size_t size = self->GetDataSize();            
@@ -379,12 +375,12 @@ supports rendering its data.", "");
     }
 
     
-    DocAStr(SetData,
-            "SetData(self, String data) -> bool",
-            "Copy the data value to the data object.  Must be implemented in the
+    %extend {
+        DocAStr(SetData,
+                "SetData(self, String data) -> bool",
+                "Copy the data value to the data object.  Must be implemented in the
 derived class if the object supports setting its data.
 ", "");
-    %extend {
         bool SetData(PyObject* data) {
             bool rval;
             wxPyBlock_t blocked = wxPyBeginBlockThreads();
@@ -520,14 +516,14 @@ class wxDataObjectComposite : public wxDataObject {
 public:
     wxDataObjectComposite();
 
-    %apply SWIGTYPE *DISOWN { wxDataObjectSimple *dataObject };
+    %disownarg( wxDataObjectSimple *dataObject );
     
     DocDeclStr(
         void , Add(wxDataObjectSimple *dataObject, bool preferred = false),
         "Adds the dataObject to the list of supported objects and it becomes
 the preferred object if preferred is True.", "");
     
-    %clear wxDataObjectSimple *dataObject;
+    %cleardisown( wxDataObjectSimple *dataObject );
 };
 
 //---------------------------------------------------------------------------
@@ -757,10 +753,10 @@ public:
     wxCustomDataObject();
     
     
-    DocAStr(SetData,
-            "SetData(self, String data) -> bool",
-            "Copy the data value to the data object.", "");
     %extend {
+        DocAStr(SetData,
+                "SetData(self, String data) -> bool",
+                "Copy the data value to the data object.", "");
         bool SetData(PyObject* data) {
             bool rval;
             wxPyBlock_t blocked = wxPyBeginBlockThreads();
@@ -783,10 +779,10 @@ public:
         "Get the size of the data.", "");
     
 
-    DocAStr(GetData,
-            "GetData(self) -> String",
-            "Returns the data bytes from the data object as a string.", "");
     %extend {
+        DocAStr(GetData,
+                "GetData(self) -> String",
+                "Returns the data bytes from the data object as a string.", "");
         PyObject* GetData() {
             PyObject* obj;
             wxPyBlock_t blocked = wxPyBeginBlockThreads();
index 014339c36b4d7c5228acdebef1e23bbb52a31af5..c07f2078b6da5680067842678587263517e4ec33 100644 (file)
@@ -12,8 +12,8 @@
 
 
 //---------------------------------------------------------------------------
-// Globally turn on the autodoc feature
 
+// Globally turn on the autodoc feature
 %feature("autodoc", "1");  // 0 == no param types, 1 == show param types
 
 // Turn on kwargs by default
 // Don't generate separate wrappers for each default args combination
 %feature("compactdefaultargs");
 
+#if SWIG_VERSION < 0x010328
 // Don't generate default ctors or dtors if the C++ doesn't have them
 %feature("nodefault");
-
+#else
 // This is the SWIG 1.3.28 way to do the above...
-// // Don't generate default ctors or dtors if the C++ doesn't have them
-// %feature("nodefaultctor");
-// %feature("nodefaultdtor");
+%feature("nodefaultctor");
+%feature("nodefaultdtor");
+#endif
+
+// For now, just supress the warning about using Python keywords as parameter
+// names.  Will need to come back later and correct these rather than just
+// hide them...
+#pragma SWIG nowarn=314
 
 //---------------------------------------------------------------------------
-// Tell SWIG to wrap all the wrappers with our thread protection by default
 
+// Tell SWIG to wrap all the wrappers with our thread protection
+%define %threadWrapperOn
 %exception {
     PyThreadState* __tstate = wxPyBeginAllowThreads();
     $action
     wxPyEndAllowThreads(__tstate);
     if (PyErr_Occurred()) SWIG_fail;
 }
+%enddef
+
+// This one will turn off the generation of the thread wrapper code
+%define %threadWrapperOff
+%exception 
+%enddef
 
+// Turn it on by default
+%threadWrapperOn
 
 // This one can be used to add a check for an existing wxApp before the real
 // work is done.  An exception is raised if there isn't one.
@@ -75,10 +90,19 @@ typedef unsigned long   wxUIntPtr;
 
 #define %pythonAppend   %feature("pythonappend")
 #define %pythonPrepend  %feature("pythonprepend")
-#define %kwargs         %feature("kwargs")
-#define %nokwargs       %feature("kwargs", "0")
 #define %noautodoc      %feature("noautodoc")
 
+#if SWIG_VERSION >= 0x010327
+#define %kwargs         %feature("kwargs", "1")
+#define %nokwargs       %feature("kwargs", "0")
+#else
+#define %kwargs         %feature("kwargs")
+#define %nokwargs       %feature("nokwargs")
+#endif
+
+#define %disownarg(typespec)   %typemap(in) typespec = SWIGTYPE* DISOWN
+#define %cleardisown(typespec) %typemap(in) typespec
+    
 
 
 #ifndef %pythoncode
index 29a4d2cc1954a5b37f36dc6d06d44b74bddeaf44..39702a198082ea445898a6075b59fe6dc52b0396 100644 (file)
@@ -137,7 +137,8 @@ class wxPyDropTarget // : public wxDropTarget
 public:
     %pythonAppend wxPyDropTarget
        "self._setCallbackInfo(self, DropTarget)"
-    %apply SWIGTYPE *DISOWN { wxDataObject *dataObject };
+
+    %disownarg( wxDataObject *dataObject );
 
     wxPyDropTarget(wxDataObject *dataObject = NULL);
     void _setCallbackInfo(PyObject* self, PyObject* _class);
@@ -148,7 +149,7 @@ public:
     wxDataObject *GetDataObject();
     void SetDataObject(wxDataObject *dataObject);
 
-    %clear wxDataObject *dataObject;
+    %cleardisown( wxDataObject *dataObject );
 
     wxDragResult base_OnEnter(wxCoord x, wxCoord y, wxDragResult def);
     wxDragResult base_OnDragOver(wxCoord x, wxCoord y, wxDragResult def);
index d54c5aa1eb71c90fa49c13022224b007aa94b4a0..5df2f19381cefa620a423cf7c81859d9d5b30f1b 100644 (file)
@@ -72,6 +72,7 @@ public:
         }
     }
 
+    %pythonAppend _setOORInfo   "args[0].thisown = 0";
     %extend {
         void _setOORInfo(PyObject* _self, bool incref=true) {
             if (_self && _self != Py_None) {
index 80f6429fe25d5f32c1d99ab52e737704c3b4ccea..8b79cc4c7d4c7356a882df53293fcd4c39c18512 100644 (file)
@@ -73,7 +73,8 @@ class wxGBPosition
 {
 public:
     wxGBPosition(int row=0, int col=0);
-
+    ~wxGBPosition();
+    
     int GetRow() const;
     int GetCol() const;
     void SetRow(int row);
@@ -143,6 +144,8 @@ public:
 colspan. The default is (1,1). (Meaning that the item occupies one
 cell in each direction.", "");
 
+    ~wxGBSpan();
+
     int GetRowspan() const;
     int GetColspan() const;
     void SetRowspan(int rowspan);
@@ -218,6 +221,9 @@ item can be used in a Sizer.
 You will probably never need to create a wx.GBSizerItem directly as they
 are created automatically when the sizer's Add method is called.", "");
 
+    ~wxGBSizerItem();
+
+    
     %extend {
         DocStr(wxGBSizerItem( wxWindow *window, const wxGBPosition& pos,const wxGBSpan& span,int flag,int border,PyObject* userData=NULL ),
                "Construct a `wx.GBSizerItem` for a window.", "");
@@ -241,6 +247,7 @@ are created automatically when the sizer's Add method is called.", "");
 
         DocStr(wxGBSizerItem( wxSizer *sizer,const wxGBPosition& pos,const wxGBSpan& span,int flag,int border,PyObject* userData=NULL ),
                "Construct a `wx.GBSizerItem` for a sizer", "");
+        %disownarg( wxSizer *sizer );
         %RenameCtor(GBSizerItemSizer, wxGBSizerItem( wxSizer *sizer,
                                                      const wxGBPosition& pos,
                                                      const wxGBSpan& span,
@@ -256,6 +263,7 @@ are created automatically when the sizer's Add method is called.", "");
                 }
                 return new wxGBSizerItem(sizer, pos, span, flag, border, data);
             }
+        %cleardisown( wxSizer *sizer );
 
              
         DocStr(wxGBSizerItem( int width,int height,const wxGBPosition& pos,const wxGBSpan& span,int flag,int border,PyObject* userData=NULL),
@@ -392,6 +400,8 @@ position, False if something was already there.
             wxPySizerItemInfo info = wxPySizerItemTypeHelper(item, true, false);
             if ( userData && (info.window || info.sizer || info.gotSize) )
                 data = new wxPyUserData(userData);
+            if ( info.sizer )
+                PyObject_SetAttrString(item,"thisown",Py_False);
             wxPyEndBlockThreads(blocked);
             
             // Now call the real Add method if a valid item type was found
@@ -405,7 +415,8 @@ position, False if something was already there.
             return NULL;
         }
     }
-    
+
+    %disownarg( wxGBSizerItem *item );
     DocDeclAStrName(
         wxGBSizerItem* , Add( wxGBSizerItem *item ),
         "Add(self, GBSizerItem item) -> wx.GBSizerItem",
@@ -413,6 +424,7 @@ position, False if something was already there.
 the item was successfully placed at its given cell position, False if
 something was already there.", "",
         AddItem);
+    %cleardisown( wxGBSizerItem *item );
 
     DocDeclStr(
         wxSize , GetCellSize(int row, int col) const,
index c3c01ea3e7e0d202731bb06134c608d80bae551e..565dea0bd12b8cc096c12738b911f9d4b0c3b173 100644 (file)
@@ -79,15 +79,15 @@ public:
     // GetSelection which only works for listboxes with single selection)
     //virtual int GetSelections(wxArrayInt& aSelections) const;
     %extend {
-      PyObject* GetSelections() {
-          wxArrayInt lst;
-          self->GetSelections(lst);
-          PyObject *tup = PyTuple_New(lst.GetCount());
-          for(size_t i=0; i<lst.GetCount(); i++) {
-              PyTuple_SetItem(tup, i, PyInt_FromLong(lst[i]));
-          }
-          return tup;
-      }
+        PyObject* GetSelections() {
+            wxArrayInt lst;
+            self->GetSelections(lst);
+            PyObject *tup = PyTuple_New(lst.GetCount());
+            for(size_t i=0; i<lst.GetCount(); i++) {
+                PyTuple_SetItem(tup, i, PyInt_FromLong(lst[i]));
+            }
+            return tup;
+        }
     }
 
     // set the specified item at the first visible item or scroll to max
index 836730ddacbf836cf26d05d1ebb0b853570d8ea3..22113546b467f9b1280b6fc91e141d1773dbc2cf 100644 (file)
@@ -153,7 +153,7 @@ public:
     wxListItemAttr(const wxColour& colText = wxNullColour,
                    const wxColour& colBack = wxNullColour,
                    const wxFont& font = wxNullFont);
-
+    ~wxListItemAttr();
 
     // setters
     void SetTextColour(const wxColour& colText);
@@ -169,6 +169,9 @@ public:
     wxColour GetBackgroundColour();
     wxFont GetFont();
 
+    void AssignFrom(const wxListItemAttr& source);
+
+    %pythonAppend Destroy "args[0].thisown = 0"
     %extend { void Destroy() { delete self; } }
 };
 
@@ -592,11 +595,9 @@ public:
     // Sets the image list
     void SetImageList(wxImageList *imageList, int which);
 
-    // is there a way to tell SWIG to disown this???
-
-    %apply SWIGTYPE *DISOWN { wxImageList *imageList };
+    %disownarg( wxImageList *imageList );
     void AssignImageList(wxImageList *imageList, int which);
-    %clear wxImageList *imageList;
+    %cleardisown( wxImageList *imageList );
 
     // are we in report mode?
     bool InReportView() const;
index 8084857b0aff8b611f3eece52e336ea992b510b2..4aa96d65bde7bfda0f92266ed51a282ead6bb092 100644 (file)
@@ -54,7 +54,7 @@ class wxLog
 {
 public:
     wxLog();
-
+    ~wxLog();
 
     // these functions allow to completely disable all log messages
     // is logging disabled now?
@@ -80,9 +80,12 @@ public:
     // create one if none exists
     static wxLog *GetActiveTarget();
 
+    %disownarg( wxLog* pLogger );
+    %newobject SetActiveTarget;
     // change log target, pLogger may be NULL
     static wxLog *SetActiveTarget(wxLog *pLogger);
-
+    %cleardisown( wxLog* pLogger );
+    
     // suspend the message flushing of the main target until the next call
     // to Resume() - this is mainly for internal use (to prevent wxYield()
     // from flashing the messages)
@@ -149,6 +152,7 @@ public:
         }
     }
 
+    %pythonAppend Destroy "args[0].thisown = 0";
     %extend { void Destroy() { delete self; } }
 };
 
@@ -222,7 +226,7 @@ public:
 unsigned long wxSysErrorCode();
 const wxString wxSysErrorMsg(unsigned long nErrCode = 0);
 
-%{// Make somce wrappers that double any % signs so they are 'escaped'
+%{// Make some wrappers that double any % signs so they are 'escaped'
     void wxPyLogFatalError(const wxString& msg)
     {
         wxString m(msg);
index 3ab240329107e56b92e94894995963d78bf5a1a4..b57f7bd6e72e08f2cf2c02ef117721f9b1c6d85c 100644 (file)
@@ -133,8 +133,10 @@ public:
     bool Delete(int id);
     %Rename(DeleteItem,  bool, Delete(wxMenuItem *item));
 
-    // delete the item from menu and destroy it (if it's a submenu)
+    %pythonAppend Destroy "args[0].thisown = 0"
     %extend { void Destroy() { delete self; } }
+    
+    // delete the item from menu and destroy it (if it's a submenu)
     %Rename(DestroyId,  bool, Destroy(int id));
     %Rename(DestroyItem,  bool, Destroy(wxMenuItem *item));
 
index 291fca6802986766b4fe6d66dcc6b6b86e399743..1b352d6ca250c9e605610ab331e25bcbe8f3a187 100644 (file)
@@ -24,8 +24,13 @@ MustHaveApp(wxToolTip);
 
 class wxToolTip : public wxObject {
 public:
+    %typemap(out) wxToolTip*;    // turn off this typemap
     wxToolTip(const wxString &tip);
+    // Turn it back on again
+    %typemap(out) wxToolTip* { $result = wxPyMake_wxObject($1, $owner); }
 
+    ~wxToolTip();
+    
     void SetTip(const wxString& tip);
     wxString GetTip();
     // *** Not in the "public" interface void SetWindow(wxWindow *win);
@@ -43,9 +48,10 @@ MustHaveApp(wxCaret);
 class wxCaret {
 public:
     wxCaret(wxWindow* window, const wxSize& size);
-//    ~wxCaret(); Window takes ownership
+    ~wxCaret(); 
 
     %extend {
+        %pythonAppend Destroy "args[0].thisown = 0"
         DocStr(Destroy,
                "Deletes the C++ object this Python object is a proxy for.", "");
         void Destroy() {
@@ -308,5 +314,55 @@ bool wxDrawWindowOnDC(wxWindow* window, const wxDC& dc
 %}
 
 
+
+#if 0
+%{
+    void t_output_tester1(int* a, int* b, int* c, int* d)
+    {
+        *a = 1234;
+        *b = 2345;
+        *c = 3456;
+        *d = 4567;
+    }
+    PyObject* t_output_tester2(int* a, int* b, int* c, int* d)
+    {
+        *a = 1234;
+        *b = 2345;
+        *c = 3456;
+        *d = 4567;
+        Py_INCREF(Py_None);
+        return Py_None;
+    }
+    PyObject* t_output_tester3(int* a, int* b, int* c, int* d)
+    {
+        *a = 1234;
+        *b = 2345;
+        *c = 3456;
+        *d = 4567;
+        PyObject* res = PyTuple_New(2);
+        PyTuple_SetItem(res, 0, PyInt_FromLong(1));
+        PyTuple_SetItem(res, 1, PyInt_FromLong(2));
+        return res;
+    }
+    PyObject* t_output_tester4()
+    {
+        PyObject* res = PyTuple_New(2);
+        PyTuple_SetItem(res, 0, PyInt_FromLong(132));
+        PyTuple_SetItem(res, 1, PyInt_FromLong(244));
+        return res;
+    }
+%}    
+
+%newobject t_output_tester2;
+%newobject t_output_tester3;
+%newobject t_output_tester4;
+
+void      t_output_tester1(int* OUTPUT, int* OUTPUT, int* OUTPUT, int* OUTPUT);
+PyObject* t_output_tester2(int* OUTPUT, int* OUTPUT, int* OUTPUT, int* OUTPUT);
+PyObject* t_output_tester3(int* OUTPUT, int* OUTPUT, int* OUTPUT, int* OUTPUT);
+PyObject* t_output_tester4();
+
+#endif
+
 //---------------------------------------------------------------------------
 //---------------------------------------------------------------------------
index 1d9565a5553994a85153574cea6ab36bee70ad6f..3f5e131b6fa48748b8f0dd88bd33128c48f43b28 100644 (file)
@@ -69,9 +69,9 @@ public:
     virtual void SetImageList(wxImageList *imageList);
 
     // as SetImageList() but we will delete the image list ourselves
-    %apply SWIGTYPE *DISOWN { wxImageList *imageList };
+    %disownarg( wxImageList *imageList );
     void AssignImageList(wxImageList *imageList);
-    %clear wxImageList *imageList;
+    %cleardisown( wxImageList *imageList );
 
     // get pointer (may be NULL) to the associated image list
     wxImageList* GetImageList() const;
index c0c72f124a40b2db63ea4a3ac5052261a51b884d..cb77d13273005a67c958361d5636cd950df96894 100644 (file)
@@ -30,6 +30,7 @@ public:
             return self->GetClassInfo()->GetClassName();
         }
 
+        %pythonAppend Destroy "args[0].thisown = 0"
         DocStr(Destroy,
                "Deletes the C++ object this Python object is a proxy for.", "");
         void Destroy() {
index bada7e7ac43dc7e7486e50174d51cac9038ae094..7c26a92e8bf8c594273430bf0d4ac090e1dac9d8 100644 (file)
@@ -187,7 +187,11 @@ long wxExecute(const wxString& command,
 {
     PyObject* o;
     o = PyInt_FromLong((long) (*$1));
+#if SWIG_VERSION < 0x010328
     $result = t_output_helper($result, o);
+#else
+    $result = SWIG_Python_AppendOutput($result, o);
+#endif
 }
 
 int wxKill(long pid, wxSignal sig = wxSIGTERM, wxKillError* rc, int flags = wxKILL_NOCHILDREN);
index 05d6af4e7ebc9668d5efa98d3bee2f578dd7f206..04fa9fed834ca470c3c1eb1c63c6b2e2e0cbb722 100644 (file)
@@ -43,6 +43,8 @@ methods are called.
 
 :see: `wx.SizerItemSpacer`, `wx.SizerItemWindow`, `wx.SizerItemSizer`", "");
 
+    
+    ~wxSizerItem();
 
 
     %extend {
@@ -86,6 +88,7 @@ methods are called.
                          int border, PyObject* userData=NULL ),
             "Constructs a `wx.SizerItem` for tracking a subsizer", "");
 
+        %disownarg( wxSizer *sizer );
         %RenameCtor(SizerItemSizer,  wxSizerItem( wxSizer *sizer, int proportion, int flag,
                                                   int border, PyObject* userData=NULL ))
         {
@@ -97,6 +100,7 @@ methods are called.
             }
             return new wxSizerItem(sizer, proportion, flag, border, data);
         }
+        %cleardisown( wxSizer *sizer );
     }
 
 
@@ -214,9 +218,11 @@ added, if needed.", "");
         wxSizer *, GetSizer(),
         "Get the subsizer (if any) that is managed by this sizer item.", "");
 
+    %disownarg( wxSizer *sizer );
     DocDeclStr(
         void , SetSizer( wxSizer *sizer ),
         "Set the subsizer to be managed by this sizer item.", "");
+    %cleardisown( wxSizer *sizer );
 
 
     DocDeclStr(
@@ -395,7 +401,8 @@ method to determine where the drawing operations should take place.
 class wxSizer : public wxObject {
 public:
     // wxSizer();      ****  abstract, can't instantiate
-    // ~wxSizer();
+
+    ~wxSizer();
 
     %extend {
         void _setOORInfo(PyObject* _self) {
@@ -512,6 +519,8 @@ public:
             wxPySizerItemInfo info = wxPySizerItemTypeHelper(item, true, false);
             if ( userData && (info.window || info.sizer || info.gotSize) )
                 data = new wxPyUserData(userData);
+            if ( info.sizer )
+                PyObject_SetAttrString(item,"thisown",Py_False);
             wxPyEndBlockThreads(blocked);
 
             // Now call the real Add method if a valid item type was found
@@ -543,6 +552,8 @@ the item at index *before*.  See `Add` for a description of the parameters.", ""
             wxPySizerItemInfo info = wxPySizerItemTypeHelper(item, true, false);
             if ( userData && (info.window || info.sizer || info.gotSize) )
                 data = new wxPyUserData(userData);
+            if ( info.sizer )
+                PyObject_SetAttrString(item,"thisown",Py_False);
             wxPyEndBlockThreads(blocked);
 
             // Now call the real Insert method if a valid item type was found
@@ -575,6 +586,8 @@ this sizer.  See `Add` for a description of the parameters.", "");
             wxPySizerItemInfo info = wxPySizerItemTypeHelper(item, true, false);
             if ( userData && (info.window || info.sizer || info.gotSize) )
                 data = new wxPyUserData(userData);
+            if ( info.sizer )
+                PyObject_SetAttrString(item,"thisown",Py_False);
             wxPyEndBlockThreads(blocked);
 
             // Now call the real Prepend method if a valid item type was found
@@ -693,6 +706,9 @@ the item to be found.", "");
             return self._SetItemMinSize(item, args[0])
     }
 
+
+    %disownarg( wxSizerItem *item ); 
+
     DocDeclAStrName(
         wxSizerItem* , Add( wxSizerItem *item ),
         "AddItem(self, SizerItem item)",
@@ -711,6 +727,7 @@ the item to be found.", "");
         "Prepends a `wx.SizerItem` to the sizer.", "",
         PrependItem);
 
+    %cleardisown( wxSizerItem *item );
 
 
     %pythoncode {
index 7ae7546af4a3a74cf7ce59cdf08e1f81b346f426..b3227af4636310b6733d15d6de26302688467f69 100644 (file)
@@ -19,6 +19,7 @@
 
 // See also wxPy_ReinitStockObjects in helpers.cpp
 %immutable;
+%threadWrapperOff;
 
 wxFont* const wxNORMAL_FONT;
 wxFont* const wxSMALL_FONT;
@@ -69,6 +70,7 @@ const wxPalette wxNullPalette;
 const wxFont   wxNullFont;
 const wxColour wxNullColour;
 
+%threadWrapperOn;
 %mutable;
 
 
index 1a5ea7b2285947b969d26f36a9b2d02989734f98..abdc2c65396c9240ccbd5b0ea6b11a525450d198 100644 (file)
@@ -104,9 +104,11 @@ public:
     %pythonAppend wxPyTaskBarIcon   "self._setCallbackInfo(self, TaskBarIcon, 0)"
 
     wxPyTaskBarIcon();
+    ~wxPyTaskBarIcon();
 
     void _setCallbackInfo(PyObject* self, PyObject* _class, int incref);
 
+    %pythonAppend Destroy "args[0].thisown = 0";
     %extend {
         void Destroy() {
             self->RemoveIcon();
index 7938545b179932d7c29210c23425af28efd0fd44..7b9786d46c104d46c038fc281b38bdba4213197d 100644 (file)
@@ -341,11 +341,6 @@ public:
 
     static wxVisualAttributes
     GetClassDefaultAttributes(wxWindowVariant variant = wxWINDOW_VARIANT_NORMAL);
-
-    %pythoncode {
-        def SendSizeEvent(self):
-            self.ProcessEvent(wx.SizeEvent((-1,-1)))
-    }
 };
 
 //---------------------------------------------------------------------------
index 8c86481e5d29de2e71df42b85480f8755b089ed3..841df1aa779cb735da5bd6ae3b88783c72c83d33 100644 (file)
@@ -121,13 +121,15 @@ public:
 class wxPyTreeItemData {
 public:
     wxPyTreeItemData(PyObject* obj = NULL);
-
+    ~wxPyTreeItemData();
+    
     PyObject* GetData();
     void      SetData(PyObject* obj);
 
     const wxTreeItemId& GetId();
     void                SetId(const wxTreeItemId& id);
 
+    %pythonAppend Destroy "args[0].thisown = 0"
     %extend { void Destroy() { delete self; } }
 };
 
@@ -144,7 +146,8 @@ public:
     wxTreeItemAttr(const wxColour& colText = wxNullColour,
                    const wxColour& colBack = wxNullColour,
                    const wxFont& font = wxNullFont);
-
+    ~wxTreeItemAttr();
+    
     // setters
     void SetTextColour(const wxColour& colText);
     void SetBackgroundColour(const wxColour& colBack);
@@ -159,6 +162,7 @@ public:
     wxColour GetBackgroundColour();
     wxFont GetFont();
 
+    %pythonAppend Destroy "args[0].thisown = 0"
     %extend { void Destroy() { delete self; } }
 };
 
@@ -372,10 +376,10 @@ public:
     void SetImageList(wxImageList *imageList);
     void SetStateImageList(wxImageList *imageList);
 
-    %apply SWIGTYPE *DISOWN { wxImageList *imageList };
+    %disownarg( wxImageList *imageList );
     void AssignImageList(wxImageList *imageList);
     void AssignStateImageList(wxImageList *imageList);
-    %clear wxImageList *imageList;
+    %cleardisown( wxImageList *imageList );
     
 
     // retrieve items label
@@ -430,10 +434,12 @@ public:
 
     %extend {
         // associate a wxPyTreeItemData with the tree item
+        %disownarg( wxPyTreeItemData* data );
         void SetItemData(const wxTreeItemId& item, wxPyTreeItemData* data) {
             data->SetId(item); // set the id
             self->SetItemData(item, data);
         }
+        %cleardisown( wxPyTreeItemData* data );
 
         // associate a Python object with the tree item
         void SetItemPyData(const wxTreeItemId& item, PyObject* obj) {
@@ -582,6 +588,7 @@ public:
     wxTreeItemId GetPrevVisible(const wxTreeItemId& item) const;
 
     
+    %disownarg( wxPyTreeItemData* data );
     
     // add the root node to the tree
     wxTreeItemId AddRoot(const wxString& text,
@@ -616,7 +623,8 @@ public:
                             wxPyTreeItemData *data = NULL);
 
 
-
+    %cleardisown( wxPyTreeItemData* data );
+    
     // delete this item and associated data if any
     void Delete(const wxTreeItemId& item);
 
index de89a749cf39a37a5091ccb82a504d27133f6ccb..44094342625c0c64a1f69aa6542bae96c26aeee4 100644 (file)
@@ -259,6 +259,7 @@ instead.");
     
 
 
+    %pythonAppend Destroy "args[0].thisown = 0"
     DocDeclStr(
         virtual bool , Destroy(),
         "Destroys the window safely.  Frames and dialogs are not destroyed
@@ -1454,9 +1455,11 @@ be reset back to default.", "");
 
     
 
+    %disownarg( wxCaret *caret );
     DocDeclStr(
         void , SetCaret(wxCaret *caret),
         "Sets the caret associated with the window.", "");
+    %cleardisown( wxCaret *caret );
     
     DocDeclStr(
         wxCaret *, GetCaret() const,
@@ -1767,7 +1770,10 @@ wxHelpProvider implementation, and not in the window object itself.", "");
     DocStr(SetToolTip,
            "Attach a tooltip to the window.", "");
     %Rename(SetToolTipString, void,  SetToolTip( const wxString &tip ));
+
+    %disownarg( wxToolTip *tip );
     void SetToolTip( wxToolTip *tip );
+    %cleardisown( wxToolTip *tip );
 
     DocDeclStr(
         wxToolTip* , GetToolTip() const,
@@ -1782,16 +1788,12 @@ wxHelpProvider implementation, and not in the window object itself.", "");
     // drag and drop
     // -------------
 
-    // set/retrieve the drop target associated with this window (may be
-    // NULL; it's owned by the window and will be deleted by it)
-    %apply SWIGTYPE *DISOWN { wxPyDropTarget *dropTarget };
-    
+    %disownarg( wxPyDropTarget *dropTarget );
     DocDeclStr(
         virtual void , SetDropTarget( wxPyDropTarget *dropTarget ),
         "Associates a drop target with this window.  If the window already has
 a drop target, it is deleted.", "");   
-
-    %clear wxPyDropTarget *dropTarget;
+    %cleardisown( wxPyDropTarget *dropTarget );
 
     
     DocDeclStr(
@@ -1855,6 +1857,7 @@ this function gets called automatically by the default EVT_SIZE
 handler when the window is resized.", "");
     
 
+    %disownarg( wxSizer *sizer );
     DocDeclStr(
         void , SetSizer(wxSizer *sizer, bool deleteOld = true ),
         "Sets the window to have the given layout sizer. The window will then
@@ -1868,7 +1871,8 @@ non-None, and False otherwise.", "");
         void , SetSizerAndFit( wxSizer *sizer, bool deleteOld = true ),
         "The same as SetSizer, except it also sets the size hints for the
 window based on the sizer's minimum size.", "");
-    
+    %cleardisown( wxSizer *sizer );
+
 
     DocDeclStr(
         wxSizer *, GetSizer() const,
@@ -1963,6 +1967,11 @@ wxControl where it returns true.", "");
         if hasattr(self, '_setCallbackInfo'):
             self._setCallbackInfo(self, self.__class__)
     }
+
+    %pythoncode {
+    def SendSizeEvent(self):
+        self.GetEventhandler().ProcessEvent(wx.SizeEvent((-1,-1)))
+    }
 };
 
 
index 48bfc14501878a5dc79d7b10f32d009b905ce078..fa42ac8fee70084047e9b1080a5cb461e00b1106 100644 (file)
@@ -44,11 +44,11 @@ MAKE_CONST_WXSTRING_NOSWIG(DefaultDateTimeFormat);
 //---------------------------------------------------------------------------
 // OOR related typemaps and helper functions
 
-%typemap(out) wxGridCellRenderer*     { $result = wxPyMake_wxGridCellRenderer($1, $owner); }
-%typemap(out) wxGridCellEditor*       { $result = wxPyMake_wxGridCellEditor($1, $owner); }
-%typemap(out) wxGridCellAttr*         { $result = wxPyMake_wxGridCellAttr($1, $owner); }
-%typemap(out) wxGridCellAttrProvider* { $result = wxPyMake_wxGridCellAttrProvider($1, $owner); }
-%typemap(out) wxGridTableBase*        { $result = wxPyMake_wxGridTableBase($1, $owner); }
+%typemap(out) wxGridCellRenderer*     { $result = wxPyMake_wxGridCellRenderer($1, (bool)$owner); }
+%typemap(out) wxGridCellEditor*       { $result = wxPyMake_wxGridCellEditor($1,   (bool)$owner); }
+%typemap(out) wxGridCellAttr*         { $result = wxPyMake_wxGridCellAttr($1,     (bool)$owner); }
+%typemap(out) wxGridCellAttrProvider* { $result = wxPyMake_wxGridCellAttrProvider($1, (bool)$owner); }
+%typemap(out) wxGridTableBase*        { $result = wxPyMake_wxGridTableBase($1,    (bool)$owner); }
 
 
 %{
@@ -796,6 +796,8 @@ public:
     virtual void StartingKey(wxKeyEvent& event);
     virtual void StartingClick();
     virtual void HandleReturn(wxKeyEvent& event);
+
+    %pythonAppend Destroy "args[0].thisown = 0"
     virtual void Destroy();
 
 };
@@ -1362,6 +1364,7 @@ public:
     wxPyGridTableBase();
     void _setCallbackInfo(PyObject* self, PyObject* _class);
 
+    %pythonAppend Destroy "args[0].thisown = 0"
     %extend { void Destroy() { delete self; } }
 
     wxString base_GetTypeName( int row, int col );
index 651cfe27677407afa8e8b8cbb0de27b648eb646a..e7656c3b649c016dac12edb6024fc53893f030d3 100644 (file)
@@ -1255,7 +1255,10 @@ public:
 
     wxHtmlHelpData* GetData();
     wxHtmlHelpController* GetController() const;
+
+    %disownarg( wxHtmlHelpController* controller );
     void SetController(wxHtmlHelpController* controller);
+    %cleardisown( wxHtmlHelpController* controller );
 
     // Displays page x. If not found it will offect the user a choice of
     // searching books.
@@ -1360,7 +1363,9 @@ public:
     wxHtmlHelpController* GetController() const;
 
     /// Sets the help controller associated with the window.
+    %disownarg( wxHtmlHelpController* controller );
     void SetController(wxHtmlHelpController* controller);
+    %cleardisown( wxHtmlHelpController* controller );
 
     /// Returns the help window.
     wxHtmlHelpWindow* GetHelpWindow() const;
@@ -1417,7 +1422,9 @@ public:
     wxHtmlHelpController* GetController() const;
 
     /// Sets the controller associated with this dialog.
+    %disownarg( wxHtmlHelpController* controller );
     void SetController(wxHtmlHelpController* controller);
+    %cleardisown( wxHtmlHelpController* controller );
 
     /// Returns the help window.
     wxHtmlHelpWindow* GetHelpWindow() const;
@@ -1533,8 +1540,6 @@ public:
 
     void MakeModalIfNeeded();
     wxWindow* FindTopLevelWindow();
-
-    %pythoncode { def Destroy(self): pass }
 };
 
 
index c22b3ae7ef05050294478c7a3bd17a80a4e7d492..f8b436a38b3797ac5c0885c3919e08d55b974fd2 100644 (file)
@@ -325,52 +325,52 @@ MAKE_INT_ARRAY_TYPEMAPS(styles, styles_field)
 // NOTE: For those classes that also call _setOORInfo these typemaps should be
 // disabled for the constructor.
 
-%typemap(out) wxEvtHandler*             { $result = wxPyMake_wxObject($1, $owner); }
-%typemap(out) wxMenu*                   { $result = wxPyMake_wxObject($1, $owner); }
-%typemap(out) wxValidator*              { $result = wxPyMake_wxObject($1, $owner); }
-
-%typemap(out) wxApp*                    { $result = wxPyMake_wxObject($1, $owner); }
-%typemap(out) wxPyApp*                  { $result = wxPyMake_wxObject($1, $owner); }
-%typemap(out) wxDC*                     { $result = wxPyMake_wxObject($1, $owner); }
-%typemap(out) wxFSFile*                 { $result = wxPyMake_wxObject($1, $owner); }
-%typemap(out) wxFileSystem*             { $result = wxPyMake_wxObject($1, $owner); }
-%typemap(out) wxImageList*              { $result = wxPyMake_wxObject($1, $owner); }
-%typemap(out) wxImage*                  { $result = wxPyMake_wxObject($1, $owner); }
-%typemap(out) wxListItem*               { $result = wxPyMake_wxObject($1, $owner); }
-%typemap(out) wxMenuItem*               { $result = wxPyMake_wxObject($1, $owner); }
-%typemap(out) wxMouseEvent*             { $result = wxPyMake_wxObject($1, $owner); }
-%typemap(out) wxObject*                 { $result = wxPyMake_wxObject($1, $owner); }
-%typemap(out) wxPyPrintout*             { $result = wxPyMake_wxObject($1, $owner); }
-%typemap(out) wxToolBarToolBase*        { $result = wxPyMake_wxObject($1, $owner); }
-%typemap(out) wxToolTip*                { $result = wxPyMake_wxObject($1, $owner); }
-
-
-%typemap(out) wxBitmapButton*           { $result = wxPyMake_wxObject($1, $owner); }
-%typemap(out) wxButton*                 { $result = wxPyMake_wxObject($1, $owner); }
-%typemap(out) wxControl*                { $result = wxPyMake_wxObject($1, $owner); }
-%typemap(out) wxFrame*                  { $result = wxPyMake_wxObject($1, $owner); }
-%typemap(out) wxGrid*                   { $result = wxPyMake_wxObject($1, $owner); }
-//%typemap(out) wxListCtrl*               { $result = wxPyMake_wxObject($1, $owner); }
-%typemap(out) wxMDIChildFrame*          { $result = wxPyMake_wxObject($1, $owner); }
-%typemap(out) wxMDIClientWindow*        { $result = wxPyMake_wxObject($1, $owner); }
-%typemap(out) wxMenuBar*                { $result = wxPyMake_wxObject($1, $owner); }
-%typemap(out) wxNotebook*               { $result = wxPyMake_wxObject($1, $owner); }
-%typemap(out) wxStaticBox*              { $result = wxPyMake_wxObject($1, $owner); }
-%typemap(out) wxStatusBar*              { $result = wxPyMake_wxObject($1, $owner); }
-%typemap(out) wxTextCtrl*               { $result = wxPyMake_wxObject($1, $owner); }
-%typemap(out) wxToolBar*                { $result = wxPyMake_wxObject($1, $owner); }
-%typemap(out) wxToolBarBase*            { $result = wxPyMake_wxObject($1, $owner); }
-//%typemap(out) wxTreeCtrl*               { $result = wxPyMake_wxObject($1, $owner); }
-%typemap(out) wxPyTreeCtrl*             { $result = wxPyMake_wxObject($1, $owner); }
-%typemap(out) wxWindow*                 { $result = wxPyMake_wxObject($1, $owner); }
-%typemap(out) wxPyHtmlWindow*           { $result = wxPyMake_wxObject($1, $owner); }
-%typemap(out) wxWizardPage*             { $result = wxPyMake_wxObject($1, $owner); }
-%typemap(out) wxPyWizardPage*           { $result = wxPyMake_wxObject($1, $owner); }
-%typemap(out) wxPanel*                  { $result = wxPyMake_wxObject($1, $owner); }
-%typemap(out) wxDialog*                 { $result = wxPyMake_wxObject($1, $owner); }
-%typemap(out) wxScrolledWindow*         { $result = wxPyMake_wxObject($1, $owner); }
-
-%typemap(out) wxSizer*                  { $result = wxPyMake_wxObject($1, $owner); }
+%typemap(out) wxEvtHandler*             { $result = wxPyMake_wxObject($1, (bool)$owner); }
+%typemap(out) wxMenu*                   { $result = wxPyMake_wxObject($1, (bool)$owner); }
+%typemap(out) wxValidator*              { $result = wxPyMake_wxObject($1, (bool)$owner); }
+
+%typemap(out) wxApp*                    { $result = wxPyMake_wxObject($1, (bool)$owner); }
+%typemap(out) wxPyApp*                  { $result = wxPyMake_wxObject($1, (bool)$owner); }
+%typemap(out) wxDC*                     { $result = wxPyMake_wxObject($1, (bool)$owner); }
+%typemap(out) wxFSFile*                 { $result = wxPyMake_wxObject($1, (bool)$owner); }
+%typemap(out) wxFileSystem*             { $result = wxPyMake_wxObject($1, (bool)$owner); }
+%typemap(out) wxImageList*              { $result = wxPyMake_wxObject($1, (bool)$owner); }
+%typemap(out) wxImage*                  { $result = wxPyMake_wxObject($1, (bool)$owner); }
+%typemap(out) wxListItem*               { $result = wxPyMake_wxObject($1, (bool)$owner); }
+%typemap(out) wxMenuItem*               { $result = wxPyMake_wxObject($1, (bool)$owner); }
+%typemap(out) wxMouseEvent*             { $result = wxPyMake_wxObject($1, (bool)$owner); }
+%typemap(out) wxObject*                 { $result = wxPyMake_wxObject($1, (bool)$owner); }
+%typemap(out) wxPyPrintout*             { $result = wxPyMake_wxObject($1, (bool)$owner); }
+%typemap(out) wxToolBarToolBase*        { $result = wxPyMake_wxObject($1, (bool)$owner); }
+%typemap(out) wxToolTip*                { $result = wxPyMake_wxObject($1, (bool)$owner); }
+
+
+%typemap(out) wxBitmapButton*           { $result = wxPyMake_wxObject($1, (bool)$owner); }
+%typemap(out) wxButton*                 { $result = wxPyMake_wxObject($1, (bool)$owner); }
+%typemap(out) wxControl*                { $result = wxPyMake_wxObject($1, (bool)$owner); }
+%typemap(out) wxFrame*                  { $result = wxPyMake_wxObject($1, (bool)$owner); }
+%typemap(out) wxGrid*                   { $result = wxPyMake_wxObject($1, (bool)$owner); }
+//%typemap(out) wxListCtrl*               { $result = wxPyMake_wxObject($1, (bool)$owner); }
+%typemap(out) wxMDIChildFrame*          { $result = wxPyMake_wxObject($1, (bool)$owner); }
+%typemap(out) wxMDIClientWindow*        { $result = wxPyMake_wxObject($1, (bool)$owner); }
+%typemap(out) wxMenuBar*                { $result = wxPyMake_wxObject($1, (bool)$owner); }
+%typemap(out) wxNotebook*               { $result = wxPyMake_wxObject($1, (bool)$owner); }
+%typemap(out) wxStaticBox*              { $result = wxPyMake_wxObject($1, (bool)$owner); }
+%typemap(out) wxStatusBar*              { $result = wxPyMake_wxObject($1, (bool)$owner); }
+%typemap(out) wxTextCtrl*               { $result = wxPyMake_wxObject($1, (bool)$owner); }
+%typemap(out) wxToolBar*                { $result = wxPyMake_wxObject($1, (bool)$owner); }
+%typemap(out) wxToolBarBase*            { $result = wxPyMake_wxObject($1, (bool)$owner); }
+//%typemap(out) wxTreeCtrl*               { $result = wxPyMake_wxObject($1, (bool)$owner); }
+%typemap(out) wxPyTreeCtrl*             { $result = wxPyMake_wxObject($1, (bool)$owner); }
+%typemap(out) wxWindow*                 { $result = wxPyMake_wxObject($1, (bool)$owner); }
+%typemap(out) wxPyHtmlWindow*           { $result = wxPyMake_wxObject($1, (bool)$owner); }
+%typemap(out) wxWizardPage*             { $result = wxPyMake_wxObject($1, (bool)$owner); }
+%typemap(out) wxPyWizardPage*           { $result = wxPyMake_wxObject($1, (bool)$owner); }
+%typemap(out) wxPanel*                  { $result = wxPyMake_wxObject($1, (bool)$owner); }
+%typemap(out) wxDialog*                 { $result = wxPyMake_wxObject($1, (bool)$owner); }
+%typemap(out) wxScrolledWindow*         { $result = wxPyMake_wxObject($1, (bool)$owner); }
+
+%typemap(out) wxSizer*                  { $result = wxPyMake_wxObject($1, (bool)$owner); }
 
 
 //---------------------------------------------------------------------------
index 84fc9a705a48de166aa9ebc94eb8cfd28b2a78ea..e3394d8c29e1107545ac9da10b726d08555745af 100644 (file)
@@ -1,45 +1,54 @@
 
 
-// There standard t_output_helper has been changed to return a list rather
-// than a tuple, we'll replace it with the old implementation here.
-
-
-%fragment("t_output_helper","header") %{
-  static PyObject* t_output_helper(PyObject* target, PyObject* o) {
-    PyObject*   o2;
-    PyObject*   o3;
-    
-    if (!target) {                   
-        target = o;
-    } else if (target == Py_None) {  
-        Py_DECREF(Py_None);
-        target = o;
-    } else {
-        if (!PyTuple_Check(target)) {
-            o2 = target;
-            target = PyTuple_New(1);
-            PyTuple_SetItem(target, 0, o2);
-        }            
-        o3 = PyTuple_New(1);            
-        PyTuple_SetItem(o3, 0, o);      
-
-        o2 = target;
-        target = PySequence_Concat(o2, o3); 
-        Py_DECREF(o2);                      
-        Py_DECREF(o3);
+//----------------------------------------------------------------------
+
+// The standard t_output_helper has been changed to return a list rather than
+// a tuple, we'll replace it with the old implementation here.  In SWIG 1.3.27
+// and earlier it is implemented as a $fragment, so it is only inserted in to
+// the modules that need it.  For SWIG 1.3.28 we just need to add a -D on the
+// compile command line to turn on this version of the AppendOuput function.
+#if SWIG_VERSION < 0x010328
+%fragment("t_output_helper","header")
+%{
+    static PyObject* t_output_helper(PyObject* result, PyObject* obj)
+    {
+        PyObject*   o2;
+        PyObject*   o3;
+        if (!result) {
+            result = obj;
+        } else if (result == Py_None) {
+            Py_DECREF(result);
+            result = obj;
+        } else {
+            if (!PyTuple_Check(result)) {
+                o2 = result;
+                result = PyTuple_New(1);
+                PyTuple_SET_ITEM(result, 0, o2);
+            }
+            o3 = PyTuple_New(1);            
+            PyTuple_SetItem(o3, 0, obj);      
+            o2 = result;
+            result = PySequence_Concat(o2, o3); 
+            Py_DECREF(o2);                      
+            Py_DECREF(o3);
+        }
+        return result;
     }
-    return target;
-  }
 %}
 
+#endif
+
+
 
 
+//----------------------------------------------------------------------
 // These fragments are inserted in modules that need to convert PyObjects to
 // integer values, my versions allow any numeric type to be used, as long as
 // it can be converted to a PyInt.  (Specifically, I allow floats where the
 // default SWIG_AsVal_long would just raise an exception.
 //
 
+#if SWIG_VERSION < 0x010328
 
 %fragment(SWIG_AsVal_frag(long), "header") {
 SWIGINTERN int
@@ -50,7 +59,7 @@ SWIG_AsVal(long)(PyObject* obj, long* val)
         return 1;
     }
     else {
-        SWIG_type_error("number", obj);
+        SWIG_Python_TypeError("number", obj);
     }
     return 0;
 }
@@ -64,7 +73,7 @@ SWIG_AsVal(unsigned long)(PyObject* obj, unsigned long* val)
 {
     long v = 0;
     if (SWIG_AsVal_long(obj, &v) && v < 0) {
-        SWIG_type_error("unsigned number", obj);
+        SWIG_Python_TypeError("unsigned number", obj);
     }
     else if (val)
         *val = (unsigned long)v;
@@ -82,8 +91,55 @@ SWIG_AsVal(double)(PyObject *obj, double* val)
         return 1;
     }
     else {
-        SWIG_type_error("number", obj);
+        SWIG_Python_TypeError("number", obj);
     }
     return 0;
 }
 }
+
+
+#else  // SWIG_VERSION >= 1.3.28
+
+%fragment(SWIG_AsVal_frag(long), "header") {
+SWIGINTERN int
+SWIG_AsVal(long)(PyObject* obj, long* val)
+{
+    if (PyNumber_Check(obj)) {
+        if (val) *val = PyInt_AsLong(obj);
+        return SWIG_OK;
+    }
+    return SWIG_TypeError;
+}
+}
+
+
+%fragment(SWIG_AsVal_frag(unsigned long), "header",
+          fragment=SWIG_AsVal_frag(long)) {
+SWIGINTERN int 
+SWIG_AsVal(unsigned long)(PyObject* obj, unsigned long* val)
+{
+    long v = 0;
+    if (SWIG_AsVal_long(obj, &v) && v < 0) {
+        return SWIG_TypeError;
+    }
+    else if (val)
+        *val = (unsigned long)v;
+    return SWIG_OK;
+}
+}
+
+
+%fragment(SWIG_AsVal_frag(double), "header") {
+SWIGINTERN int
+SWIG_AsVal(double)(PyObject *obj, double* val)
+{
+    if (PyNumber_Check(obj)) {
+        if (val) *val = PyFloat_AsDouble(obj);
+        return SWIG_OK;
+    }
+    return SWIG_TypeError;
+}
+}
+
+
+#endif // SWIG_VERSION