]> git.saurik.com Git - wxWidgets.git/commitdiff
Give classes that need one a destructor wrapper, and set %disown when
authorRobin Dunn <robin@alldunn.com>
Fri, 10 Mar 2006 00:27:37 +0000 (00:27 +0000)
committerRobin Dunn <robin@alldunn.com>
Fri, 10 Mar 2006 00:27:37 +0000 (00:27 +0000)
another class takes ownership.

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

wxPython/src/_bitmap.i
wxPython/src/_constraints.i
wxPython/src/_menu.i
wxPython/src/_printfw.i
wxPython/src/_window.i

index 96a6329a78aad70db60ca99102bd7acb82d7a9b8..bd0600d824ed4b9e2ba683e7b831e6b7e9e9b669 100644 (file)
@@ -201,6 +201,7 @@ bitmap. This preserves mask information so that bitmaps and images can
 be converted back and forth without loss in that respect.", "");
     
 
+    
     DocDeclStr(
         virtual wxMask* , GetMask() const,
         "Gets the associated mask (if any) which may have been loaded from a
@@ -211,13 +212,14 @@ file or explpicitly set for the bitmap.
 
     // MSW only?    wxBitmap GetMaskBitmap() const;
 
+    %disownarg(wxMask*);
     DocDeclStr(
         virtual void , SetMask(wxMask* mask),
         "Sets the mask for this bitmap.
 
 :see: `GetMask`, `wx.Mask`
 ", "");
-    
+    %cleardisown(wxMask*);
     
     %extend {
         DocStr(SetMaskColour,
@@ -338,7 +340,7 @@ passed then BLACK is used.
         }
     }
     
-    //~wxMask();
+    ~wxMask();
 };
 
 %pythoncode { MaskColour = wx._deprecated(Mask, "wx.MaskColour is deprecated, use `wx.Mask` instead.") }
index 13ceba74f90c9cde78bac7c65daebe099ee0b220..1c0fd75f6d3aa682a9c51ad2c8ae2c81ccb8e2b8 100644 (file)
@@ -233,6 +233,7 @@ button label.", "");
         "is not determinable, -1.", "");
 };
 
+
 DocStr(wxLayoutConstraints,
 "**Note:** constraints are now deprecated and you should use sizers
 instead.
@@ -289,6 +290,8 @@ public:
     DocCtorStr(
         wxLayoutConstraints(),
         "", "");
+
+    ~wxLayoutConstraints();
     
     DocDeclA(
         bool, SatisfyConstraints(wxWindow *win, int *OUTPUT),
index b57f7bd6e72e08f2cf2c02ef117721f9b1c6d85c..2dbc925ea550902c1935effeed47098530e14a94 100644 (file)
@@ -55,16 +55,21 @@ public:
                                            wxMenu *submenu,
                                            const wxString& help = wxPyEmptyString));
 
+
+    %disownarg(wxMenuItem*);
     // the most generic form of Append() - append anything
     %Rename(AppendItem, wxMenuItem*, Append(wxMenuItem *item));
+    // insert an item before given position
+    %Rename(InsertItem, wxMenuItem*, Insert(size_t pos, wxMenuItem *item));
+    // prepend an item to the menu
+    %Rename(PrependItem,  wxMenuItem*, Prepend(wxMenuItem *item));
+    %cleardisown(wxMenuItem*);
+
 
     // insert a break in the menu (only works when appending the items, not
     // inserting them)
     virtual void Break();
 
-    // insert an item before given position
-    %Rename(InsertItem, wxMenuItem*, Insert(size_t pos, wxMenuItem *item));
-
     // insert an item before given position
     wxMenuItem* Insert(size_t pos,
                        int id,
@@ -94,9 +99,6 @@ public:
                                          wxMenu *submenu,
                                          const wxString& help = wxPyEmptyString));
 
-    // prepend an item to the menu
-    %Rename(PrependItem,  wxMenuItem*, Prepend(wxMenuItem *item));
-
     // prepend any item to the menu
     wxMenuItem* Prepend(int id,
                         const wxString& text,
@@ -122,9 +124,11 @@ public:
                                            wxMenu *submenu,
                                            const wxString& help = wxPyEmptyString));
 
+    
     // detach an item from the menu, but don't delete it so that it can be
     // added back later (but if it's not, the caller is responsible for
     // deleting it!)
+    %newobject Remove;
     wxMenuItem *Remove(int id);
     %Rename(RemoveItem,  wxMenuItem*, Remove(wxMenuItem *item));
 
@@ -323,6 +327,7 @@ public:
                const wxString& help = wxPyEmptyString,
                wxItemKind kind = wxITEM_NORMAL,
                wxMenu* subMenu = NULL);
+    ~wxMenuItem();
 
     // the menu we're in
     wxMenu *GetMenu() const;
index d6a702a12c4d8a4fdcad35f746e9335d0aaad3f3..cebbc4c996bc4467f4057ced09f8c52197d9ad53 100644 (file)
@@ -341,6 +341,7 @@ public:
 
     bool GetAbort();
     static wxPrinterError GetLastError();
+
 };
 
 
@@ -414,10 +415,14 @@ MustHaveApp(wxPyPrintout);
 class wxPyPrintout  : public wxObject {
 public:
     %pythonAppend wxPyPrintout   "self._setCallbackInfo(self, Printout)"
+    %typemap(out) wxPyPrintout*;    // turn off this typemap
 
     wxPyPrintout(const wxString& title = wxPyPrintoutTitleStr);
-    //~wxPyPrintout();      wxPrintPreview object takes ownership...
+    ~wxPyPrintout();      
     
+    // Turn it back on again
+    %typemap(out) wxPyPrintout* { $result = wxPyMake_wxObject($1, $owner); }
+
     void _setCallbackInfo(PyObject* self, PyObject* _class);
 
     
@@ -491,14 +496,17 @@ MustHaveApp(wxPreviewFrame);
 
 class wxPreviewFrame : public wxFrame {
 public:
+    %disownarg(wxPrintPreview*);
+    
     %pythonAppend wxPreviewFrame   "self._setOORInfo(self)"
-
     wxPreviewFrame(wxPrintPreview* preview, wxFrame* parent, const wxString& title,
                    const wxPoint& pos = wxDefaultPosition,
                    const wxSize&  size = wxDefaultSize,
                    long style = wxDEFAULT_FRAME_STYLE,
                    const wxString& name = wxPyFrameNameStr);
 
+    %cleardisown(wxPrintPreview*);
+
     void Initialize();
     void CreateControlBar();
     void CreateCanvas();
@@ -562,6 +570,8 @@ MustHaveApp(wxPrintPreview);
 
 class wxPrintPreview : public wxObject {
 public:
+    %disownarg(wxPyPrintout*);
+    
     %nokwargs wxPrintPreview;
     wxPrintPreview(wxPyPrintout* printout,
                    wxPyPrintout* printoutForPrinting,
@@ -570,6 +580,8 @@ public:
                   wxPyPrintout* printoutForPrinting,
                   wxPrintData* data);
 
+    ~wxPrintPreview();
+    
     virtual bool SetCurrentPage(int pageNum);
     int GetCurrentPage();
 
@@ -577,6 +589,8 @@ public:
     wxPyPrintout *GetPrintout();
     wxPyPrintout *GetPrintoutForPrinting();
 
+    %cleardisown(wxPyPrintout*);
+    
     void SetFrame(wxFrame *frame);
     void SetCanvas(wxPreviewCanvas *canvas);
 
@@ -695,6 +709,8 @@ MustHaveApp(wxPyPrintPreview);
 class wxPyPrintPreview : public wxPrintPreview
 {
 public:
+    %disownarg(wxPyPrintout*);
+
     %pythonAppend wxPyPrintPreview   "self._setCallbackInfo(self, PyPrintPreview)"
     %nokwargs wxPyPrintPreview;
     wxPyPrintPreview(wxPyPrintout* printout,
@@ -704,6 +720,8 @@ public:
                      wxPyPrintout* printoutForPrinting,
                      wxPrintData* data);
 
+    %cleardisown(wxPyPrintout*);
+    
     void _setCallbackInfo(PyObject* self, PyObject* _class);
     
     bool SetCurrentPage(int pageNum);
index 8bb7459a196f800daa40503a2d0168cdc3e85c49..6c9381ed1f9acf78eeb99d9fbe4f480f1ba6ff14 100644 (file)
@@ -1810,7 +1810,7 @@ Only functional on Windows.", "");
     // constraints and sizers
     // ----------------------
 
-    // set the constraints for this window or retrieve them (may be NULL)
+    %disownarg(wxLayoutConstraints*);
     DocDeclStr(
         void , SetConstraints( wxLayoutConstraints *constraints ),
         "Sets the window to have the given layout constraints. If an existing
@@ -1828,6 +1828,7 @@ effect.", "");
         wxLayoutConstraints *, GetConstraints() const,
         "Returns a pointer to the window's layout constraints, or None if there
 are none.", "");
+    %cleardisown(wxLayoutConstraints*);
     
 
     DocDeclStr(