]> git.saurik.com Git - wxWidgets.git/commitdiff
Add Unbind methods that can Disconnect event handlers
authorRobin Dunn <robin@alldunn.com>
Tue, 27 Apr 2004 19:35:49 +0000 (19:35 +0000)
committerRobin Dunn <robin@alldunn.com>
Tue, 27 Apr 2004 19:35:49 +0000 (19:35 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@26988 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

wxPython/src/_event_ex.py
wxPython/src/_evthandler.i

index 70c658a93974973921c87997117b2e3a7e972bb5..03663716d2d2a68a342510f4de97a8a9a5cc1cc9 100644 (file)
@@ -23,6 +23,12 @@ class PyEventBinder(object):
         for et in self.evtType:
             target.Connect(id1, id2, et, function)
 
+    def Unbind(self, target, id1, id2):
+        """Remove an event binding."""
+        success = 0
+        for et in self.evtType:
+            success += target.Disconnect(id1, id2, et)
+        return success != 0
     
     def __call__(self, *args):
         """
index f4baaacfdbfe0c45450d34d79b7f8b26ba2950e8..5a12a452d844fc069ea4e07122eb7d14b683cc8d 100644 (file)
@@ -106,6 +106,14 @@ public:
                 id  = source.GetId()
             event.Bind(self, id, id2, handler)              
 
+        def Unbind(self, event, source=None, id=wx.ID_ANY, id2=wx.ID_ANY):
+            """
+            Disconencts the event handler binding for event from self.
+            Returns True if successful.
+            """
+            if source is not None:
+                id  = source.GetId()
+            event.Unbind(self, id, id2)              
     }