]> git.saurik.com Git - wxWidgets.git/blobdiff - wxPython/src/msw/wx.py
Implemented the first phase of OOR (Original Object Return). See the
[wxWidgets.git] / wxPython / src / msw / wx.py
index b651c3792af4397edf019ff05c4e3ee94f0219b2..7a135d91c79ccc2d570398c8d03621f1854d8e45 100644 (file)
@@ -64,7 +64,6 @@ class wxPyAppPtr(wxEvtHandlerPtr):
         return val
     def GetTopWindow(self, *_args, **_kwargs):
         val = apply(wxc.wxPyApp_GetTopWindow,(self,) + _args, _kwargs)
-        if val: val = wxWindowPtr(val) 
         return val
     def GetVendorName(self, *_args, **_kwargs):
         val = apply(wxc.wxPyApp_GetVendorName,(self,) + _args, _kwargs)
@@ -1544,11 +1543,14 @@ wxPyDefaultSize     = wxDefaultSize
 def wxPyTypeCast(obj, typeStr):
     if obj is None:
         return None
+    theClass = globals()[typeStr+"Ptr"]
+    typeStr = __wxPyPtrTypeMap.get(typeStr, typeStr)
     if hasattr(obj, "this"):
+        if obj.__class__ is theClass:   # if already the right type then just return it
+            return obj
         newPtr = ptrcast(obj.this, typeStr+"_p")
     else:
         newPtr = ptrcast(obj, typeStr+"_p")
-    theClass = globals()[typeStr+"Ptr"]
     theObj = theClass(newPtr)
     if hasattr(obj, "this"):
         theObj.thisown = obj.thisown
@@ -1683,4 +1685,6 @@ class __wxPyCleanup:
         self.cleanup()
 
 __cleanMeUp = __wxPyCleanup()
+
+#----------------------------------------------------------------------------
 #----------------------------------------------------------------------------