X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/d5a7caf6b618bd32f308251943035d05932c603a..716a5baa6ecd0d5d0c31914567e4da3165ca6ff0:/wxPython/src/_sizers.i diff --git a/wxPython/src/_sizers.i b/wxPython/src/_sizers.i index 9dc3a93a03..f3482de61e 100644 --- a/wxPython/src/_sizers.i +++ b/wxPython/src/_sizers.i @@ -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 ); } @@ -121,7 +125,7 @@ of item.", ""); needed by borders.", ""); DocDeclStr( - void , SetDimension( wxPoint pos, wxSize size ), + void , SetDimension( const wxPoint& pos, const wxSize& size ), "Set the position and size of the space allocated for this item by the sizer, and adjust the position and size of the item (window or subsizer) to be within that space taking alignment and borders into @@ -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( @@ -261,6 +267,18 @@ isn't any.", ""); return Py_None; } } + + DocStr(SetUserData, + "Associate a Python object with this sizer item.", ""); + void SetUserData(PyObject* userData) { + wxPyUserData* data = NULL; + if ( userData ) { + wxPyBlock_t blocked = wxPyBeginBlockThreads(); + data = new wxPyUserData(userData); + wxPyEndBlockThreads(blocked); + } + self->SetUserData(data); + } } }; @@ -318,14 +336,14 @@ static wxPySizerItemInfo wxPySizerItemTypeHelper(PyObject* item, bool checkSize, if ( !(info.window || info.sizer || (checkSize && info.gotSize) || (checkIdx && info.gotPos)) ) { // no expected type, figure out what kind of error message to generate if ( !checkSize && !checkIdx ) - PyErr_SetString(PyExc_TypeError, "wxWindow or wxSizer expected for item"); + PyErr_SetString(PyExc_TypeError, "wx.Window or wx.Sizer expected for item"); else if ( checkSize && !checkIdx ) - PyErr_SetString(PyExc_TypeError, "wxWindow, wxSizer, wxSize, or (w,h) expected for item"); + PyErr_SetString(PyExc_TypeError, "wx.Window, wx.Sizer, wx.Size, or (w,h) expected for item"); else if ( !checkSize && checkIdx) - PyErr_SetString(PyExc_TypeError, "wxWindow, wxSizer or int (position) expected for item"); + PyErr_SetString(PyExc_TypeError, "wx.Window, wx.Sizer or int (position) expected for item"); else // can this one happen? - PyErr_SetString(PyExc_TypeError, "wxWindow, wxSizer, wxSize, or (w,h) or int (position) expected for item"); + PyErr_SetString(PyExc_TypeError, "wx.Window, wx.Sizer, wx.Size, or (w,h) or int (position) expected for item"); } return info; @@ -383,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) { @@ -500,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 @@ -531,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 @@ -563,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 @@ -635,7 +660,7 @@ was found and detached.", ""); "GetItem(self, item) -> wx.SizerItem", "Returns the `wx.SizerItem` which holds the *item* given. The *item* parameter can be either a window, a sizer, or the zero-based index of -the item to be detached.", ""); +the item to be found.", ""); wxSizerItem* GetItem(PyObject* item) { wxPyBlock_t blocked = wxPyBeginBlockThreads(); wxPySizerItemInfo info = wxPySizerItemTypeHelper(item, false, true); @@ -681,6 +706,9 @@ the item to be detached.", ""); return self._SetItemMinSize(item, args[0]) } + + %disownarg( wxSizerItem *item ); + DocDeclAStrName( wxSizerItem* , Add( wxSizerItem *item ), "AddItem(self, SizerItem item)", @@ -699,6 +727,7 @@ the item to be detached.", ""); "Prepends a `wx.SizerItem` to the sizer.", "", PrependItem); + %cleardisown( wxSizerItem *item ); %pythoncode { @@ -910,7 +939,7 @@ subsizer. Returns True if the item was found.", ""); DocAStr(IsShown, "IsShown(self, item)", - "Determines if the item is currently shown. sizer. To make a sizer + "Determines if the item is currently shown. To make a sizer item disappear or reappear, use Show followed by `Layout`. The *item* parameter can be either a window, a sizer, or the zero-based index of the item.", ""); @@ -942,10 +971,6 @@ the item.", ""); void , ShowItems(bool show), "Recursively call `wx.SizerItem.Show` on all sizer items.", ""); - // TODO: - // void Show(bool show); - // bool IsShown(); - };