Mercurial > gui
diff togglePanel.ur @ 27:5905b56e0cd9
Adapt to new HTML contexts
author | Adam Chlipala <adam@chlipala.net> |
---|---|
date | Tue, 20 Dec 2011 21:04:21 -0500 |
parents | 30f9a763f5fb |
children | 7d0014542199 |
line wrap: on
line diff
--- a/togglePanel.ur Fri Dec 09 17:38:20 2011 -0500 +++ b/togglePanel.ur Tue Dec 20 21:04:21 2011 -0500 @@ -1,13 +1,13 @@ datatype panelState = Open | Closed -con formatCtl = fn ctx :: {Unit} => [body ~ ctx] => - {FormatPanel : xml (body ++ ctx) [] [] - -> xml (body ++ ctx) [] [] - -> xml (body ++ ctx) [] [], - OpenCtl : transaction unit -> xml (body ++ ctx) [] [], - CloseCtl : transaction unit -> xml (body ++ ctx) [] []} +con formatCtl = fn ctx :: {Unit} => [[Dyn] ~ ctx] => + {FormatPanel : xml ([Dyn] ++ ctx) [] [] + -> xml ([Dyn] ++ ctx) [] [] + -> xml ([Dyn] ++ ctx) [] [], + OpenCtl : transaction unit -> xml ([Dyn] ++ ctx) [] [], + CloseCtl : transaction unit -> xml ([Dyn] ++ ctx) [] []} -val defaultFormat [body ~ []] = +val defaultFormat [[Dyn] ~ body'] = {FormatPanel = fn ctl panel => <xml>{ctl}{panel}</xml>, OpenCtl = fn behaviour => <xml><button value="Open" onclick={behaviour}/></xml>, CloseCtl = fn behaviour => <xml><button value="Close" onclick={behaviour}/></xml>} @@ -25,7 +25,7 @@ FormatCtl = @f, Content = content} -fun render [t ::: Type] [ctx ::: {Unit}] (_ : gui t ctx) [body ~ ctx] (panel : togglePanel t ctx) = +fun render [t ::: Type] [ctx ::: {Unit}] (_ : gui t ctx) [[Dyn] ~ ctx] (panel : togglePanel t ctx) = let val format = panel.FormatCtl ! val openCtl = format.CloseCtl (set panel.PanelState Closed)