comparison togglePanel.urs @ 19:3a303df9ae92

Partial generalize togglePanel solution (breaks build)
author Ron de Bruijn <rmbruijn@gmail.com>
date Fri, 23 Sep 2011 13:30:01 +0200
parents 16447dc6a68c
children 554e342665fe
comparison
equal deleted inserted replaced
18:16447dc6a68c 19:3a303df9ae92
1 (* TogglePanel provides a panel or section of xml which appears and 1 (* TogglePanel provides a panel or section of xml which appears and
2 * disappears when the user activates an associated control. The 2 * disappears when the user activates an associated control. The
3 * panel may contain another gui widget as content. *) 3 * panel may contain another gui widget as content. *)
4 4
5 con togglePanel :: Type -> Type 5 con togglePanel :: Type -> {Unit} -> Type
6 (* The type of appearing and disappearing panels. The argument 6 (* The type of appearing and disappearing panels. The argument
7 * is the type of the content. *) 7 * is the type of the content. *)
8 8
9 type formatCtl = {FormatPanel : xbody -> xbody -> xbody, 9 con formatCtl :: {Unit} -> Type
10 (* Allows for formatting the panel. The first two parameters 10
11 * represent "holes" for the control and panel respectively while 11 (* type formatCtl = {FormatPanel : xbody -> xbody -> xbody, *)
12 * the result should be the desired xml laying out the whole structure. 12 (* (\* Allows for formatting the panel. The first two parameters *)
13 * The controls can be formatted with the options below. 13 (* * represent "holes" for the control and panel respectively while *)
14 * The panel part appears and disappears according to the use 14 (* * the result should be the desired xml laying out the whole structure. *)
15 * of the controls. *) 15 (* * The controls can be formatted with the options below. *)
16 (* * The panel part appears and disappears according to the use *)
17 (* * of the controls. *\) *)
16 18
17 OpenCtl : transaction unit -> xbody, 19 (* OpenCtl : transaction unit -> xbody, *)
18 (* This should accept the transaction representing the opening of 20 (* (\* This should accept the transaction representing the opening of *)
19 * the panel and produce an xml control having this as action. *) 21 (* * the panel and produce an xml control having this as action. *\) *)
20 22
21 CloseCtl : transaction unit -> xbody} 23 (* CloseCtl : transaction unit -> xbody} *)
22 (* This should accept the transaction representing the closing of 24 (* (\* This should accept the transaction representing the closing of *)
23 * the panel and produce an xml control having this as action. *) 25 (* * the panel and produce an xml control having this as action. *\) *)
24 26
25 val defaultFormat : formatCtl
26 (* Some reasonable default formats for the layout and controls. *) 27 (* Some reasonable default formats for the layout and controls. *)
28 val defaultFormat : other_ctx:::{Unit} -> [other_ctx ~ body] => formatCtl other_ctx
27 29
28 val create : t ::: Type -> Gui.gui t xbody -> formatCtl -> t -> bool -> transaction (togglePanel t) 30 val create : t ::: Type -> other_ctx:::{Unit} -> [other_ctx ~ body] =>
31 Gui.gui t (xml ([Body] ++ other_ctx) [] []) -> formatCtl other_ctx -> t -> bool -> transaction (togglePanel t other_ctx)
29 (* Given instructions for formatting the display, some content and whether to start in 32 (* Given instructions for formatting the display, some content and whether to start in
30 * the open state get such a togglePanel. *) 33 * the open state get such a togglePanel. *)
31 34
32 val gui_togglePanel : t ::: Type -> Gui.gui t xbody -> Gui.gui (togglePanel t) xbody 35 val gui_togglePanel : t ::: Type -> other_ctx:::{Unit} -> [other_ctx ~ body] =>
36 Gui.gui t (xml ([Body] ++ other_ctx) [] []) -> Gui.gui (togglePanel t other_ctx) (xml ([Body] ++ other_ctx) [] [])
33 (* The togglePanel is itself a widget. It can be pretty printed to a piece 37 (* The togglePanel is itself a widget. It can be pretty printed to a piece
34 * of xml with a use of toXml. *) 38 * of xml with a use of toXml. *)