tuikit/events.py
changeset 71 cfd3445107b4
parent 65 5f0697950f15
child 74 23767a33a781
--- a/tuikit/events.py	Sun Jan 27 23:51:59 2013 +0100
+++ b/tuikit/events.py	Wed Jan 30 00:38:48 2013 +0100
@@ -65,19 +65,25 @@
 
 
 class MouseEvent(Event):
-    def __init__(self, x=0, y=0, button=0):
+    def __init__(self, button=0, x=0, y=0, relx=0, rely=0):
         Event.__init__(self)
-        self.x = x   # global coordinates
+        # global coordinates
+        self.x = x
         self.y = y
-        self.wx = x  # local widget coordinates
+        # local widget coordinates
+        self.wx = x
         self.wy = y
-        self.px = 0  # parent coordinates
+        # parent coordinates
+        self.px = 0
         self.py = 0
+        # relative change of coordinates (mousemove)
+        self.relx = relx
+        self.rely = rely
         #: Mouse button: left=1, middle=2, right=3, wheelup=4, wheeldown=5
         self.button = button
 
     def make_child_event(self, container, child):
-        ev = MouseEvent(self.x, self.y, self.button)
+        ev = MouseEvent(self.button, self.x, self.y, self.relx, self.rely)
         ev.originator = self.originator
         ev.event_name = self.event_name
         # original local coordinates are new parent coordinates
@@ -89,7 +95,7 @@
         return ev
 
     def __repr__(self):
-        return 'MouseEvent(x={0.x},y={0.y},button={0.button})'.format(self)
+        return 'MouseEvent(button={0.button},x={0.x},y={0.y},relx={0.relx},rely={0.rely})'.format(self)
 
 
 class GenericEvent(Event):