comparison togglePanel.urs @ 23:7c734edc6301

Merge from Adam.
author Karn Kallio <kkallio@eka>
date Sat, 24 Sep 2011 18:55:27 -0430
parents 30f9a763f5fb
children 5905b56e0cd9
comparison
equal deleted inserted replaced
22:4362b15220e4 23:7c734edc6301
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 arguments
7 * is the type of the content. *) 7 * are as for [Gui.gui]. *)
8 8
9 type formatCtl = {FormatPanel : xbody -> xbody -> xbody, 9 con formatCtl = fn ctx :: {Unit} => [body ~ ctx] =>
10 (* Allows for formatting the panel. The first two parameters 10 {FormatPanel : xml (body ++ ctx) [] []
11 * represent "holes" for the control and panel respectively while 11 -> xml (body ++ ctx) [] []
12 * the result should be the desired xml laying out the whole structure. 12 -> xml (body ++ ctx) [] [],
13 * The controls can be formatted with the options below. 13 (* Allows for formatting the panel. The first two parameters
14 * The panel part appears and disappears according to the use 14 * represent "holes" for the control and panel respectively while
15 * of the controls. *) 15 * the result should be the desired XML laying out the whole structure.
16 * The controls can be formatted with the options below.
17 * The panel part appears and disappears according to the use
18 * of the controls. *)
16 19
17 OpenCtl : transaction unit -> xbody, 20 OpenCtl : transaction unit -> xml (body ++ ctx) [] [],
18 (* This should accept the transaction representing the opening of 21 (* This should accept the transaction representing the opening of
19 * the panel and produce an xml control having this as action. *) 22 * the panel and produce an XML control having this as action. *)
20 23
21 CloseCtl : transaction unit -> xbody} 24 CloseCtl : transaction unit -> xml (body ++ ctx) [] []}
22 (* This should accept the transaction representing the closing of 25 (* This should accept the transaction representing the closing of
23 * the panel and produce an xml control having this as action. *) 26 * the panel and produce an xml control having this as action. *)
24 27
25 val defaultFormat : formatCtl
26 (* Some reasonable default formats for the layout and controls. *) 28 (* Some reasonable default formats for the layout and controls. *)
29 val defaultFormat : formatCtl []
27 30
28 val create : t ::: Type -> Gui.gui t -> formatCtl -> t -> bool -> transaction (togglePanel t) 31 val create : t ::: Type -> ctx ::: {Unit} ->
29 (* Given instructions for formatting the display, some content and whether to start in 32 formatCtl ctx (* Formatting instructions *)
30 * the open state get such a togglePanel. *) 33 -> t (* Enclosed widget *)
34 -> bool (* Start in open state? *)
35 -> transaction (togglePanel t ctx)
31 36
32 val gui_togglePanel : t ::: Type -> Gui.gui t -> Gui.gui (togglePanel t) 37 val gui_togglePanel : t ::: Type -> ctx ::: {Unit}
38 -> Gui.gui t ctx
39 -> Gui.gui (togglePanel t ctx) ctx
33 (* The togglePanel is itself a widget. It can be pretty printed to a piece 40 (* The togglePanel is itself a widget. It can be pretty printed to a piece
34 * of xml with a use of toXml. *) 41 * of XML with a use of [toXml]. *)