annotate demo/more/dragList.ur @ 1716:05ae68e019b6

Tweak printing of constructor record literals to allow re-parsing by compiler
author Adam Chlipala <adam@chlipala.net>
date Mon, 16 Apr 2012 10:12:04 -0400
parents 6a77c3e33908
children e6bc6bbd7a32
rev   line source
adamc@916 1 fun draggableList title items =
adamc@916 2 itemSources <- List.mapM source items;
adamc@916 3 draggingItem <- source None;
adamc@916 4 return <xml>
adamc@916 5 <h2>Great {[title]}</h2>
adamc@916 6 <ul>
adamc@916 7 {List.mapX (fn itemSource => <xml>
adamc@916 8 <li onmousedown={set draggingItem (Some itemSource)}
adamc@916 9 onmouseup={set draggingItem None}
adamc@916 10 onmouseover={di <- get draggingItem;
adamc@916 11 case di of
adamc@916 12 None => return ()
adamc@917 13 | Some di => original <- get di;
adamc@917 14 movedOver <- get itemSource;
adamc@917 15 set di movedOver;
adamc@917 16 set itemSource original;
adamc@917 17 set draggingItem (Some itemSource)}>
adamc@918 18 <dyn signal={Monad.mp cdata (signal itemSource)}/>
adamc@916 19 </li></xml>) itemSources}
adamc@916 20 </ul>
adamc@916 21 </xml>
adamc@916 22
adamc@916 23 fun main () =
adamc@916 24 bears <- draggableList "Bears" ("Pooh" :: "Paddington" :: "Rupert" :: "Edward" :: []);
adamc@916 25 beers <- draggableList "Beers" ("Budvar" :: "Delirium Tremens" :: "Deuchars" :: []);
adamc@916 26 boars <- draggableList "Boars" ("Sus scrofa scrofa"
adamc@916 27 :: "Sus scrofa ussuricus"
adamc@916 28 :: "Sus scrofa cristatus"
adamc@916 29 :: "Sus scrofa taiwanus" :: []);
adamc@917 30 return <xml>
adamc@917 31 <head>
adamc@917 32 <link rel="stylesheet" type="text/css" href="../../dragList.css"/>
adamc@917 33 </head>
adamc@917 34 <body>
adamc@917 35 {bears}
adamc@917 36 {beers}
adamc@917 37 {boars}
adamc@917 38 </body>
adamc@917 39 </xml>