comparison togglePanel.urs @ 8:90be8b8917d5

Add a widget that opens and closes a panel.
author Karn Kallio <kkallio@eka>
date Fri, 17 Jun 2011 10:12:05 -0430
parents
children 16447dc6a68c
comparison
equal deleted inserted replaced
7:48a4180171b0 8:90be8b8917d5
1 (* TogglePanel provides a panel or section of xml which appears and
2 * disappears when the user activates an associated control. The
3 * panel may contain another gui widget as content. *)
4
5 con togglePanel :: Type -> Type
6 (* The type of appearing and disappearing panels. The argument
7 * is the type of the content. *)
8
9 type formatCtl = {FormatPanel : xbody -> xbody -> xbody,
10 (* Allows for formatting the panel. The first two parameters
11 * represent "holes" for the control and panel respectively while
12 * the result should be the desired xml laying out the whole structure.
13 * The controls can be formatted with the options below.
14 * The panel part appears and disappears according to the use
15 * of the controls. *)
16
17 OpenCtl : transaction unit -> xbody,
18 (* This should accept the transaction representing the opening of
19 * the panel and produce an xml control having this as action. *)
20
21 CloseCtl : transaction unit -> xbody}
22 (* This should accept the transaction representing the closing of
23 * the panel and produce an xml control having this as action. *)
24
25 val defaultFormat : formatCtl
26 (* Some reasonable default formats for the layout and controls. *)
27
28 val create : t ::: Type -> Gui.gui t -> formatCtl -> t -> bool -> transaction (togglePanel t)
29 (* Given instructions for formatting the display, some content and whether to start in
30 * the open state get such a togglePanel. *)
31
32 val gui_togglePanel : t ::: Type -> Gui.gui t -> Gui.gui (togglePanel t)
33 (* The togglePanel is itself a widget. It can be pretty printed to a piece
34 * of xml with a use of toXml. *)