]> git.saurik.com Git - wxWidgets.git/blobdiff - wxPython/src/msw/wx.py
wxDbGrid additions
[wxWidgets.git] / wxPython / src / msw / wx.py
index b651c3792af4397edf019ff05c4e3ee94f0219b2..0847fbd21e016bc21dfa62d975da5a2a03a99371 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)
@@ -819,6 +818,8 @@ wxEVT_DRAW_ITEM = wxc.wxEVT_DRAW_ITEM
 wxEVT_MEASURE_ITEM = wxc.wxEVT_MEASURE_ITEM
 wxEVT_COMPARE_ITEM = wxc.wxEVT_COMPARE_ITEM
 wxEVT_INIT_DIALOG = wxc.wxEVT_INIT_DIALOG
+wxEVT_HELP = wxc.wxEVT_HELP
+wxEVT_DETAILED_HELP = wxc.wxEVT_DETAILED_HELP
 wxEVT_IDLE = wxc.wxEVT_IDLE
 wxEVT_UPDATE_UI = wxc.wxEVT_UPDATE_UI
 wxEVT_COMMAND_LEFT_CLICK = wxc.wxEVT_COMMAND_LEFT_CLICK
@@ -1461,10 +1462,10 @@ def EVT_END_PROCESS(eh, id, func):
 
 # wxJoyStick
 def EVT_JOY_DOWN(win, func):
-    win.Connect(-1, -1, wxEVT_JOY_DOWN, func)
+    win.Connect(-1, -1, wxEVT_JOY_BUTTON_DOWN, func)
 
 def EVT_JOY_UP(win, func):
-    win.Connect(-1, -1, wxEVT_JOY_UP, func)
+    win.Connect(-1, -1, wxEVT_JOY_BUTTON_UP, func)
 
 def EVT_JOY_MOVE(win, func):
     win.Connect(-1, -1, wxEVT_JOY_MOVE, func)
@@ -1473,8 +1474,8 @@ def EVT_JOY_ZMOVE(win, func):
     win.Connect(-1, -1, wxEVT_JOY_ZMOVE, func)
 
 def EVT_JOYSTICK_EVENTS(win, func):
-    win.Connect(-1, -1, wxEVT_JOY_DOWN, func)
-    win.Connect(-1, -1, wxEVT_JOY_UP, func)
+    win.Connect(-1, -1, wxEVT_JOY_BUTTON_DOWN, func)
+    win.Connect(-1, -1, wxEVT_JOY_BUTTON_UP, func)
     win.Connect(-1, -1, wxEVT_JOY_MOVE, func)
     win.Connect(-1, -1, wxEVT_JOY_ZMOVE, func)
 
@@ -1495,17 +1496,9 @@ class wxTimer(wxPyTimer):
             self.SetOwner(evtHandler, id)
 
 #----------------------------------------------------------------------
-# Some wxWin methods can take "NULL" as parameters, but the shadow classes
-# expect an object with the SWIG pointer as a 'this' member.  This class
-# and instance fools the shadow into passing the NULL pointer.
 
-## NOTE:  This is not needed anymore as None can be passed instead and
-#         will be interpreted as NULL.
-
-class _NullObj:
-    this = 'NULL'       # SWIG converts this to (void*)0
-
-NULL = _NullObj()
+NULL = None  # For backwards compatibility only.  You should really be
+             # using None now.
 
 
 #----------------------------------------------------------------------
@@ -1544,11 +1537,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 +1679,6 @@ class __wxPyCleanup:
         self.cleanup()
 
 __cleanMeUp = __wxPyCleanup()
+
+#----------------------------------------------------------------------------
 #----------------------------------------------------------------------------