changeset 1791:2f8b8952fe27

Add more global mouse event hooks
author Adam Chlipala <adam@chlipala.net>
date Mon, 23 Jul 2012 08:38:39 -0400
parents 56b8efff64e7
children 3d823d8424cc
files lib/js/urweb.js lib/ur/basis.urs src/settings.sml tests/globalHandlers.ur
diffstat 4 files changed, 30 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/lib/js/urweb.js	Sun Jul 22 09:42:17 2012 -0400
+++ b/lib/js/urweb.js	Mon Jul 23 08:38:39 2012 -0400
@@ -504,6 +504,18 @@
     uw_handler("onmousedown", f);
 }
 
+function uw_onMousemove(f) {
+    uw_handler("onmousemove", f);
+}
+
+function uw_onMouseout(f) {
+    uw_handler("onmouseout", f);
+}
+
+function uw_onMouseover(f) {
+    uw_handler("onmouseover", f);
+}
+
 function uw_onMouseup(f) {
     uw_handler("onmouseup", f);
 }
--- a/lib/ur/basis.urs	Sun Jul 22 09:42:17 2012 -0400
+++ b/lib/ur/basis.urs	Mon Jul 23 08:38:39 2012 -0400
@@ -981,6 +981,9 @@
 val onKeypress : (keyEvent -> transaction unit) -> transaction unit
 val onKeyup : (keyEvent -> transaction unit) -> transaction unit
 val onMousedown : (mouseEvent -> transaction unit) -> transaction unit
+val onMousemove : (mouseEvent -> transaction unit) -> transaction unit
+val onMouseout : (mouseEvent -> transaction unit) -> transaction unit
+val onMouseover : (mouseEvent -> transaction unit) -> transaction unit
 val onMouseup : (mouseEvent -> transaction unit) -> transaction unit
 
 (* Prevents default handling of current event *)
--- a/src/settings.sml	Sun Jul 22 09:42:17 2012 -0400
+++ b/src/settings.sml	Mon Jul 23 08:38:39 2012 -0400
@@ -174,6 +174,9 @@
                         "onKeypress",
                         "onKeyup",
                         "onMousedown",
+                        "onMousemove",
+                        "onMouseout",
+                        "onMouseover",
                         "onMouseup",
                         "preventDefault",
                         "stopPropagation",
@@ -204,6 +207,9 @@
                         "onKeypress",
                         "onKeyup",
                         "onMousedown",
+                        "onMousemove",
+                        "onMouseout",
+                        "onMouseover",
                         "onMouseup",
                         "preventDefault",
                         "stopPropagation",
@@ -320,6 +326,9 @@
                           ("onKeypress", "uw_onKeypress"),
                           ("onKeyup", "uw_onKeyup"),
                           ("onMousedown", "uw_onMousedown"),
+                          ("onMousemove", "uw_onMousemove"),
+                          ("onMouseout", "uw_onMouseout"),
+                          ("onMouseover", "uw_onMouseover"),
                           ("onMouseup", "uw_onMouseup"),
                           ("preventDefault", "uw_preventDefault"),
                           ("stopPropagation", "uw_stopPropagation"),
--- a/tests/globalHandlers.ur	Sun Jul 22 09:42:17 2012 -0400
+++ b/tests/globalHandlers.ur	Mon Jul 23 08:38:39 2012 -0400
@@ -2,3 +2,9 @@
   <body onload={onDblclick (fn ev => alert ("ScreenX = " ^ show ev.ScreenX ^ "\nShiftKey = " ^ show ev.ShiftKey));
                 onKeypress (fn ev => alert ("KeyCode = " ^ show ev.KeyCode ^ "\nShiftKey = " ^ show ev.ShiftKey))}/>
 </xml>
+
+fun busy () : transaction page = return <xml>
+  <body onload={onMouseout (fn _ => alert "OUT!");
+                onMouseover (fn _ => alert "OVER!");
+                onMousemove (fn _ => alert "MOVE!")}/>
+</xml>