Implemented the first phase of OOR (Original Object Return). See the
text in the demo for more details of what this means, but in a nutshell methods such as wxWindow.GetParent or FindWindowById will now return a shadow object of the proper type if it can. By "proper type" I mean that if the wxWindow pointer returned from FindWindowById really points to a wxButton then the Python object constructed will be of a wxButtonPtr class instead of wxWindowPtr as before. This should reduce or eliminiate the need for wxPyTypeCast. (Woo Hoo!) The objects returned are still not the original Python object, but that is the next step. (Although it will probably only work on Python 2.1 and beyond because it will use weak references.) A few other minor tweaks and fixes and additions for things found while doing the OOR stuff. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@10202 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -57,7 +57,7 @@ class wxListItemAttr(wxListItemAttrPtr):
|
||||
|
||||
|
||||
|
||||
class wxListItemPtr :
|
||||
class wxListItemPtr(wxObjectPtr):
|
||||
def __init__(self,this):
|
||||
self.this = this
|
||||
self.thisown = 0
|
||||
@@ -262,7 +262,6 @@ class wxListEventPtr(wxNotifyEventPtr):
|
||||
return val
|
||||
def GetItem(self, *_args, **_kwargs):
|
||||
val = apply(controls2c.wxListEvent_GetItem,(self,) + _args, _kwargs)
|
||||
if val: val = wxListItemPtr(val)
|
||||
return val
|
||||
def __setattr__(self,name,value):
|
||||
if name == "m_code" :
|
||||
@@ -321,6 +320,7 @@ class wxListCtrlPtr(wxControlPtr):
|
||||
return val
|
||||
def AssignImageList(self, *_args, **_kwargs):
|
||||
val = apply(controls2c.wxListCtrl_AssignImageList,(self,) + _args, _kwargs)
|
||||
_args[0].thisown = 0
|
||||
return val
|
||||
def DeleteItem(self, *_args, **_kwargs):
|
||||
val = apply(controls2c.wxListCtrl_DeleteItem,(self,) + _args, _kwargs)
|
||||
@@ -363,14 +363,12 @@ class wxListCtrlPtr(wxControlPtr):
|
||||
return val
|
||||
def GetImageList(self, *_args, **_kwargs):
|
||||
val = apply(controls2c.wxListCtrl_GetImageList,(self,) + _args, _kwargs)
|
||||
if val: val = wxImageListPtr(val)
|
||||
return val
|
||||
def GetItemData(self, *_args, **_kwargs):
|
||||
val = apply(controls2c.wxListCtrl_GetItemData,(self,) + _args, _kwargs)
|
||||
return val
|
||||
def GetItem(self, *_args, **_kwargs):
|
||||
val = apply(controls2c.wxListCtrl_GetItem,(self,) + _args, _kwargs)
|
||||
if val: val = wxListItemPtr(val) ; val.thisown = 1
|
||||
return val
|
||||
def GetItemPosition(self, *_args, **_kwargs):
|
||||
val = apply(controls2c.wxListCtrl_GetItemPosition,(self,) + _args, _kwargs)
|
||||
@@ -501,7 +499,7 @@ class wxTreeItemId(wxTreeItemIdPtr):
|
||||
|
||||
|
||||
|
||||
class wxTreeItemDataPtr :
|
||||
class wxTreeItemDataPtr(wxObjectPtr):
|
||||
def __init__(self,this):
|
||||
self.this = this
|
||||
self.thisown = 0
|
||||
@@ -568,6 +566,7 @@ class wxTreeCtrlPtr(wxControlPtr):
|
||||
return val
|
||||
def AssignImageList(self, *_args, **_kwargs):
|
||||
val = apply(controls2c.wxTreeCtrl_AssignImageList,(self,) + _args, _kwargs)
|
||||
_args[0].thisown = 0
|
||||
return val
|
||||
def GetCount(self, *_args, **_kwargs):
|
||||
val = apply(controls2c.wxTreeCtrl_GetCount,(self,) + _args, _kwargs)
|
||||
@@ -580,11 +579,9 @@ class wxTreeCtrlPtr(wxControlPtr):
|
||||
return val
|
||||
def GetImageList(self, *_args, **_kwargs):
|
||||
val = apply(controls2c.wxTreeCtrl_GetImageList,(self,) + _args, _kwargs)
|
||||
if val: val = wxImageListPtr(val)
|
||||
return val
|
||||
def GetStateImageList(self, *_args, **_kwargs):
|
||||
val = apply(controls2c.wxTreeCtrl_GetStateImageList,(self,) + _args, _kwargs)
|
||||
if val: val = wxImageListPtr(val)
|
||||
return val
|
||||
def SetImageList(self, *_args, **_kwargs):
|
||||
val = apply(controls2c.wxTreeCtrl_SetImageList,(self,) + _args, _kwargs)
|
||||
|
Reference in New Issue
Block a user