diff 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
line wrap: on
line diff
--- a/popupNav.ur	Tue Apr 26 20:27:04 2011 -0430
+++ b/popupNav.ur	Fri May 06 23:00:22 2011 -0430
@@ -1,10 +1,12 @@
 datatype menuState = Open | Closed
 
 type formatCtl = {FormatMenu : xbody -> xbody -> xbody,
+                  WrapMenu : xbody -> xbody,
                   OpenCtl : transaction unit -> xbody,
                   CloseCtl : transaction unit -> xbody}
 
-val defaultFormat = {FormatMenu = fn ctl menu => <xml>{ctl}<ul>{menu}</ul></xml>,
+val defaultFormat = {FormatMenu = fn ctl menu => <xml>{ctl}{menu}</xml>,
+                     WrapMenu = fn menu => <xml><ul>{menu}</ul></xml>,
                      OpenCtl = fn behaviour => <xml><button value="Open" onclick={behaviour}/></xml>,
                      CloseCtl = fn behaviour => <xml><button value="Close" onclick={behaviour}/></xml>}
 
@@ -36,7 +38,7 @@
           <dyn signal={c <- signal popup.MenuState;
                        return
                            (case c of
-                                Open => <xml>{navBarToXml popup.NavBar}</xml>
+                                Open => <xml>{popup.FormatCtl.WrapMenu (navBarToXml popup.NavBar)}</xml>
                               | Closed => <xml/>)
                       }/>
         </xml>