comparison popupNav.ur @ 7:48a4180171b0

Shifted some more generic theme navigation code to the library. Also generalized formatting options a bit for popupNav.
author Karn Kallio <kkallio@eka>
date Fri, 06 May 2011 23:00:22 -0430
parents f17b869fbb71
children b5432d74841a
comparison
equal deleted inserted replaced
6:f17b869fbb71 7:48a4180171b0
1 datatype menuState = Open | Closed 1 datatype menuState = Open | Closed
2 2
3 type formatCtl = {FormatMenu : xbody -> xbody -> xbody, 3 type formatCtl = {FormatMenu : xbody -> xbody -> xbody,
4 WrapMenu : xbody -> xbody,
4 OpenCtl : transaction unit -> xbody, 5 OpenCtl : transaction unit -> xbody,
5 CloseCtl : transaction unit -> xbody} 6 CloseCtl : transaction unit -> xbody}
6 7
7 val defaultFormat = {FormatMenu = fn ctl menu => <xml>{ctl}<ul>{menu}</ul></xml>, 8 val defaultFormat = {FormatMenu = fn ctl menu => <xml>{ctl}{menu}</xml>,
9 WrapMenu = fn menu => <xml><ul>{menu}</ul></xml>,
8 OpenCtl = fn behaviour => <xml><button value="Open" onclick={behaviour}/></xml>, 10 OpenCtl = fn behaviour => <xml><button value="Open" onclick={behaviour}/></xml>,
9 CloseCtl = fn behaviour => <xml><button value="Close" onclick={behaviour}/></xml>} 11 CloseCtl = fn behaviour => <xml><button value="Close" onclick={behaviour}/></xml>}
10 12
11 open Navbar 13 open Navbar
12 14
34 36
35 <xml> 37 <xml>
36 <dyn signal={c <- signal popup.MenuState; 38 <dyn signal={c <- signal popup.MenuState;
37 return 39 return
38 (case c of 40 (case c of
39 Open => <xml>{navBarToXml popup.NavBar}</xml> 41 Open => <xml>{popup.FormatCtl.WrapMenu (navBarToXml popup.NavBar)}</xml>
40 | Closed => <xml/>) 42 | Closed => <xml/>)
41 }/> 43 }/>
42 </xml> 44 </xml>