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@10197 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -2,7 +2,33 @@
|
||||
import gdic
|
||||
|
||||
from misc import *
|
||||
class wxBitmapPtr :
|
||||
class wxGDIObjectPtr(wxObjectPtr):
|
||||
def __init__(self,this):
|
||||
self.this = this
|
||||
self.thisown = 0
|
||||
def __del__(self,gdic=gdic):
|
||||
if self.thisown == 1 :
|
||||
gdic.delete_wxGDIObject(self)
|
||||
def GetVisible(self, *_args, **_kwargs):
|
||||
val = apply(gdic.wxGDIObject_GetVisible,(self,) + _args, _kwargs)
|
||||
return val
|
||||
def SetVisible(self, *_args, **_kwargs):
|
||||
val = apply(gdic.wxGDIObject_SetVisible,(self,) + _args, _kwargs)
|
||||
return val
|
||||
def IsNull(self, *_args, **_kwargs):
|
||||
val = apply(gdic.wxGDIObject_IsNull,(self,) + _args, _kwargs)
|
||||
return val
|
||||
def __repr__(self):
|
||||
return "<C wxGDIObject instance at %s>" % (self.this,)
|
||||
class wxGDIObject(wxGDIObjectPtr):
|
||||
def __init__(self,*_args,**_kwargs):
|
||||
self.this = apply(gdic.new_wxGDIObject,_args,_kwargs)
|
||||
self.thisown = 1
|
||||
|
||||
|
||||
|
||||
|
||||
class wxBitmapPtr(wxGDIObjectPtr):
|
||||
def __init__(self,this):
|
||||
self.this = this
|
||||
self.thisown = 0
|
||||
@@ -93,7 +119,7 @@ class wxBitmap(wxBitmapPtr):
|
||||
|
||||
|
||||
|
||||
class wxMaskPtr :
|
||||
class wxMaskPtr(wxObjectPtr):
|
||||
def __init__(self,this):
|
||||
self.this = this
|
||||
self.thisown = 0
|
||||
@@ -110,7 +136,7 @@ class wxMask(wxMaskPtr):
|
||||
|
||||
|
||||
|
||||
class wxIconPtr :
|
||||
class wxIconPtr(wxGDIObjectPtr):
|
||||
def __init__(self,this):
|
||||
self.this = this
|
||||
self.thisown = 0
|
||||
@@ -171,7 +197,7 @@ class wxIcon(wxIconPtr):
|
||||
|
||||
|
||||
|
||||
class wxCursorPtr :
|
||||
class wxCursorPtr(wxGDIObjectPtr):
|
||||
def __init__(self,this):
|
||||
self.this = this
|
||||
self.thisown = 0
|
||||
@@ -218,7 +244,7 @@ class wxCursor(wxCursorPtr):
|
||||
|
||||
|
||||
|
||||
class wxFontPtr :
|
||||
class wxFontPtr(wxGDIObjectPtr):
|
||||
def __init__(self,this):
|
||||
self.this = this
|
||||
self.thisown = 0
|
||||
@@ -292,7 +318,7 @@ class wxFont(wxFontPtr):
|
||||
|
||||
|
||||
|
||||
class wxFontListPtr :
|
||||
class wxFontListPtr(wxObjectPtr):
|
||||
def __init__(self,this):
|
||||
self.this = this
|
||||
self.thisown = 0
|
||||
@@ -315,7 +341,7 @@ class wxFontList(wxFontListPtr):
|
||||
|
||||
|
||||
|
||||
class wxColourPtr :
|
||||
class wxColourPtr(wxObjectPtr):
|
||||
def __init__(self,this):
|
||||
self.this = this
|
||||
self.thisown = 0
|
||||
@@ -353,7 +379,7 @@ class wxColour(wxColourPtr):
|
||||
|
||||
|
||||
|
||||
class wxColourDatabasePtr :
|
||||
class wxColourDatabasePtr(wxObjectPtr):
|
||||
def __init__(self,this):
|
||||
self.this = this
|
||||
self.thisown = 0
|
||||
@@ -376,7 +402,7 @@ class wxColourDatabase(wxColourDatabasePtr):
|
||||
|
||||
|
||||
|
||||
class wxPenPtr :
|
||||
class wxPenPtr(wxGDIObjectPtr):
|
||||
def __init__(self,this):
|
||||
self.this = this
|
||||
self.thisown = 0
|
||||
@@ -440,7 +466,7 @@ class wxPen(wxPenPtr):
|
||||
|
||||
|
||||
|
||||
class wxPenListPtr :
|
||||
class wxPenListPtr(wxObjectPtr):
|
||||
def __init__(self,this):
|
||||
self.this = this
|
||||
self.thisown = 0
|
||||
@@ -463,7 +489,7 @@ class wxPenList(wxPenListPtr):
|
||||
|
||||
|
||||
|
||||
class wxBrushPtr :
|
||||
class wxBrushPtr(wxGDIObjectPtr):
|
||||
def __init__(self,this):
|
||||
self.this = this
|
||||
self.thisown = 0
|
||||
@@ -526,7 +552,7 @@ class wxBrushList(wxBrushListPtr):
|
||||
|
||||
|
||||
|
||||
class wxDCPtr :
|
||||
class wxDCPtr(wxObjectPtr):
|
||||
def __init__(self,this):
|
||||
self.this = this
|
||||
self.thisown = 0
|
||||
@@ -903,7 +929,7 @@ class wxMetaFileDC(wxMetaFileDCPtr):
|
||||
|
||||
|
||||
|
||||
class wxPalettePtr :
|
||||
class wxPalettePtr(wxGDIObjectPtr):
|
||||
def __init__(self,this):
|
||||
self.this = this
|
||||
self.thisown = 0
|
||||
@@ -929,7 +955,7 @@ class wxPalette(wxPalettePtr):
|
||||
|
||||
|
||||
|
||||
class wxImageListPtr :
|
||||
class wxImageListPtr(wxObjectPtr):
|
||||
def __init__(self,this):
|
||||
self.this = this
|
||||
self.thisown = 0
|
||||
@@ -973,6 +999,129 @@ class wxImageList(wxImageListPtr):
|
||||
|
||||
|
||||
|
||||
class wxRegionPtr(wxGDIObjectPtr):
|
||||
def __init__(self,this):
|
||||
self.this = this
|
||||
self.thisown = 0
|
||||
def __del__(self,gdic=gdic):
|
||||
if self.thisown == 1 :
|
||||
gdic.delete_wxRegion(self)
|
||||
def Clear(self, *_args, **_kwargs):
|
||||
val = apply(gdic.wxRegion_Clear,(self,) + _args, _kwargs)
|
||||
return val
|
||||
def Contains(self, *_args, **_kwargs):
|
||||
val = apply(gdic.wxRegion_Contains,(self,) + _args, _kwargs)
|
||||
return val
|
||||
def ContainsPoint(self, *_args, **_kwargs):
|
||||
val = apply(gdic.wxRegion_ContainsPoint,(self,) + _args, _kwargs)
|
||||
return val
|
||||
def ContainsRect(self, *_args, **_kwargs):
|
||||
val = apply(gdic.wxRegion_ContainsRect,(self,) + _args, _kwargs)
|
||||
return val
|
||||
def ContainsRectDim(self, *_args, **_kwargs):
|
||||
val = apply(gdic.wxRegion_ContainsRectDim,(self,) + _args, _kwargs)
|
||||
return val
|
||||
def GetBox(self, *_args, **_kwargs):
|
||||
val = apply(gdic.wxRegion_GetBox,(self,) + _args, _kwargs)
|
||||
if val: val = wxRectPtr(val) ; val.thisown = 1
|
||||
return val
|
||||
def Intersect(self, *_args, **_kwargs):
|
||||
val = apply(gdic.wxRegion_Intersect,(self,) + _args, _kwargs)
|
||||
return val
|
||||
def IntersectRect(self, *_args, **_kwargs):
|
||||
val = apply(gdic.wxRegion_IntersectRect,(self,) + _args, _kwargs)
|
||||
return val
|
||||
def IntersectRegion(self, *_args, **_kwargs):
|
||||
val = apply(gdic.wxRegion_IntersectRegion,(self,) + _args, _kwargs)
|
||||
return val
|
||||
def IsEmpty(self, *_args, **_kwargs):
|
||||
val = apply(gdic.wxRegion_IsEmpty,(self,) + _args, _kwargs)
|
||||
return val
|
||||
def Union(self, *_args, **_kwargs):
|
||||
val = apply(gdic.wxRegion_Union,(self,) + _args, _kwargs)
|
||||
return val
|
||||
def UnionRect(self, *_args, **_kwargs):
|
||||
val = apply(gdic.wxRegion_UnionRect,(self,) + _args, _kwargs)
|
||||
return val
|
||||
def UnionRegion(self, *_args, **_kwargs):
|
||||
val = apply(gdic.wxRegion_UnionRegion,(self,) + _args, _kwargs)
|
||||
return val
|
||||
def Subtract(self, *_args, **_kwargs):
|
||||
val = apply(gdic.wxRegion_Subtract,(self,) + _args, _kwargs)
|
||||
return val
|
||||
def SubtractRect(self, *_args, **_kwargs):
|
||||
val = apply(gdic.wxRegion_SubtractRect,(self,) + _args, _kwargs)
|
||||
return val
|
||||
def SubtractRegion(self, *_args, **_kwargs):
|
||||
val = apply(gdic.wxRegion_SubtractRegion,(self,) + _args, _kwargs)
|
||||
return val
|
||||
def Xor(self, *_args, **_kwargs):
|
||||
val = apply(gdic.wxRegion_Xor,(self,) + _args, _kwargs)
|
||||
return val
|
||||
def XorRect(self, *_args, **_kwargs):
|
||||
val = apply(gdic.wxRegion_XorRect,(self,) + _args, _kwargs)
|
||||
return val
|
||||
def XorRegion(self, *_args, **_kwargs):
|
||||
val = apply(gdic.wxRegion_XorRegion,(self,) + _args, _kwargs)
|
||||
return val
|
||||
def __repr__(self):
|
||||
return "<C wxRegion instance at %s>" % (self.this,)
|
||||
class wxRegion(wxRegionPtr):
|
||||
def __init__(self,*_args,**_kwargs):
|
||||
self.this = apply(gdic.new_wxRegion,_args,_kwargs)
|
||||
self.thisown = 1
|
||||
|
||||
|
||||
|
||||
|
||||
class wxRegionIteratorPtr(wxObjectPtr):
|
||||
def __init__(self,this):
|
||||
self.this = this
|
||||
self.thisown = 0
|
||||
def __del__(self,gdic=gdic):
|
||||
if self.thisown == 1 :
|
||||
gdic.delete_wxRegionIterator(self)
|
||||
def GetX(self, *_args, **_kwargs):
|
||||
val = apply(gdic.wxRegionIterator_GetX,(self,) + _args, _kwargs)
|
||||
return val
|
||||
def GetY(self, *_args, **_kwargs):
|
||||
val = apply(gdic.wxRegionIterator_GetY,(self,) + _args, _kwargs)
|
||||
return val
|
||||
def GetW(self, *_args, **_kwargs):
|
||||
val = apply(gdic.wxRegionIterator_GetW,(self,) + _args, _kwargs)
|
||||
return val
|
||||
def GetWidth(self, *_args, **_kwargs):
|
||||
val = apply(gdic.wxRegionIterator_GetWidth,(self,) + _args, _kwargs)
|
||||
return val
|
||||
def GetH(self, *_args, **_kwargs):
|
||||
val = apply(gdic.wxRegionIterator_GetH,(self,) + _args, _kwargs)
|
||||
return val
|
||||
def GetHeight(self, *_args, **_kwargs):
|
||||
val = apply(gdic.wxRegionIterator_GetHeight,(self,) + _args, _kwargs)
|
||||
return val
|
||||
def GetRect(self, *_args, **_kwargs):
|
||||
val = apply(gdic.wxRegionIterator_GetRect,(self,) + _args, _kwargs)
|
||||
if val: val = wxRectPtr(val) ; val.thisown = 1
|
||||
return val
|
||||
def HaveRects(self, *_args, **_kwargs):
|
||||
val = apply(gdic.wxRegionIterator_HaveRects,(self,) + _args, _kwargs)
|
||||
return val
|
||||
def Reset(self, *_args, **_kwargs):
|
||||
val = apply(gdic.wxRegionIterator_Reset,(self,) + _args, _kwargs)
|
||||
return val
|
||||
def Next(self, *_args, **_kwargs):
|
||||
val = apply(gdic.wxRegionIterator_Next,(self,) + _args, _kwargs)
|
||||
return val
|
||||
def __repr__(self):
|
||||
return "<C wxRegionIterator instance at %s>" % (self.this,)
|
||||
class wxRegionIterator(wxRegionIteratorPtr):
|
||||
def __init__(self,*_args,**_kwargs):
|
||||
self.this = apply(gdic.new_wxRegionIterator,_args,_kwargs)
|
||||
self.thisown = 1
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#-------------- FUNCTION WRAPPERS ------------------
|
||||
@@ -1117,3 +1266,6 @@ wxIMAGELIST_DRAW_FOCUSED = gdic.wxIMAGELIST_DRAW_FOCUSED
|
||||
wxIMAGE_LIST_NORMAL = gdic.wxIMAGE_LIST_NORMAL
|
||||
wxIMAGE_LIST_SMALL = gdic.wxIMAGE_LIST_SMALL
|
||||
wxIMAGE_LIST_STATE = gdic.wxIMAGE_LIST_STATE
|
||||
wxOutRegion = gdic.wxOutRegion
|
||||
wxPartRegion = gdic.wxPartRegion
|
||||
wxInRegion = gdic.wxInRegion
|
||||
|
Reference in New Issue
Block a user