comparison togglePanel.urs @ 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
comparison
equal deleted inserted replaced
26:86857ae0f386 27:5905b56e0cd9
4 4
5 con togglePanel :: Type -> {Unit} -> Type 5 con togglePanel :: Type -> {Unit} -> Type
6 (* The type of appearing and disappearing panels. The arguments 6 (* The type of appearing and disappearing panels. The arguments
7 * are as for [Gui.gui]. *) 7 * are as for [Gui.gui]. *)
8 8
9 con formatCtl = fn ctx :: {Unit} => [body ~ ctx] => 9 con formatCtl = fn ctx :: {Unit} => [[Dyn] ~ ctx] =>
10 {FormatPanel : xml (body ++ ctx) [] [] 10 {FormatPanel : xml ([Dyn] ++ ctx) [] []
11 -> xml (body ++ ctx) [] [] 11 -> xml ([Dyn] ++ ctx) [] []
12 -> xml (body ++ ctx) [] [], 12 -> xml ([Dyn] ++ ctx) [] [],
13 (* Allows for formatting the panel. The first two parameters 13 (* Allows for formatting the panel. The first two parameters
14 * represent "holes" for the control and panel respectively while 14 * represent "holes" for the control and panel respectively while
15 * the result should be the desired XML laying out the whole structure. 15 * the result should be the desired XML laying out the whole structure.
16 * The controls can be formatted with the options below. 16 * The controls can be formatted with the options below.
17 * The panel part appears and disappears according to the use 17 * The panel part appears and disappears according to the use
18 * of the controls. *) 18 * of the controls. *)
19 19
20 OpenCtl : transaction unit -> xml (body ++ ctx) [] [], 20 OpenCtl : transaction unit -> xml ([Dyn] ++ ctx) [] [],
21 (* This should accept the transaction representing the opening of 21 (* This should accept the transaction representing the opening of
22 * the panel and produce an XML control having this as action. *) 22 * the panel and produce an XML control having this as action. *)
23 23
24 CloseCtl : transaction unit -> xml (body ++ ctx) [] []} 24 CloseCtl : transaction unit -> xml ([Dyn] ++ ctx) [] []}
25 (* This should accept the transaction representing the closing of 25 (* This should accept the transaction representing the closing of
26 * the panel and produce an xml control having this as action. *) 26 * the panel and produce an xml control having this as action. *)
27 27
28 (* Some reasonable default formats for the layout and controls. *) 28 (* Some reasonable default formats for the layout and controls. *)
29 val defaultFormat : formatCtl [] 29 val defaultFormat : formatCtl body'
30 30
31 val create : t ::: Type -> ctx ::: {Unit} -> 31 val create : t ::: Type -> ctx ::: {Unit} ->
32 formatCtl ctx (* Formatting instructions *) 32 formatCtl ctx (* Formatting instructions *)
33 -> t (* Enclosed widget *) 33 -> t (* Enclosed widget *)
34 -> bool (* Start in open state? *) 34 -> bool (* Start in open state? *)
35 -> transaction (togglePanel t ctx) 35 -> transaction (togglePanel t ctx)
36 36
37 val gui_togglePanel : t ::: Type -> ctx ::: {Unit} 37 val gui_togglePanel : t ::: Type -> ctx ::: {Unit}