view togglePanel.urs @ 17:2947170fcfd6

Fix sign error in clock skew correction
author Adam Chlipala <adam@chlipala.net>
date Sun, 21 Aug 2011 11:27:41 -0400
parents 90be8b8917d5
children 16447dc6a68c
line wrap: on
line source
(* TogglePanel provides a panel or section of xml which appears and
 * disappears when the user activates an associated control.  The
 * panel may contain another gui widget as content. *)

con togglePanel :: Type -> Type
(* The type of appearing and disappearing panels.  The argument
 * is the type of the content. *)

type formatCtl = {FormatPanel : xbody -> xbody -> xbody,
                  (* Allows for formatting the panel.  The first two parameters
                   * represent "holes" for the control and panel respectively while
                   * the result should be the desired xml laying out the whole structure.
                   * The controls can be formatted with the options below.
                   * The panel part appears and disappears according to the use 
                   * of the controls. *)
                  
                  OpenCtl : transaction unit -> xbody,
                  (* This should accept the transaction representing the opening of
                   * the panel and produce an xml control having this as action. *)

                  CloseCtl : transaction unit -> xbody}
                  (* This should accept the transaction representing the closing of
                   * the panel and produce an xml control having this as action. *)

val defaultFormat : formatCtl
(* Some reasonable default formats for the layout and controls. *)

val create : t ::: Type -> Gui.gui t -> formatCtl -> t -> bool -> transaction (togglePanel t)
(* Given instructions for formatting the display, some content and whether to start in
 * the open state get such a togglePanel. *)

val gui_togglePanel : t ::: Type -> Gui.gui t -> Gui.gui (togglePanel t)
(* The togglePanel is itself a widget.  It can be pretty printed to a piece
 * of xml with a use of toXml. *)