diff 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
line wrap: on
line diff
--- a/togglePanel.urs	Mon Aug 22 05:06:15 2011 -0430
+++ b/togglePanel.urs	Sat Sep 24 18:55:27 2011 -0430
@@ -2,33 +2,40 @@
  * 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. *)
+con togglePanel :: Type -> {Unit} -> Type
+(* The type of appearing and disappearing panels.  The arguments
+ * are as for [Gui.gui]. *)
 
-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. *)
+con formatCtl = fn ctx :: {Unit} => [body ~ ctx] =>
+                   {FormatPanel : xml (body ++ ctx) [] []
+                                  -> xml (body ++ ctx) [] []
+                                  -> xml (body ++ ctx) [] [],
+                    (* 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. *)
+                    OpenCtl : transaction unit -> xml (body ++ ctx) [] [],
+                    (* 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. *)
+                    CloseCtl : transaction unit -> xml (body ++ ctx) [] []}
+                    (* 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 defaultFormat : formatCtl []
 
-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 create : t ::: Type -> ctx ::: {Unit} ->
+    formatCtl ctx (* Formatting instructions *)
+    -> t             (* Enclosed widget *)
+    -> bool          (* Start in open state? *)
+    -> transaction (togglePanel t ctx)
 
-val gui_togglePanel : t ::: Type -> Gui.gui t -> Gui.gui (togglePanel t)
+val gui_togglePanel : t ::: Type -> ctx ::: {Unit}
+                      -> Gui.gui t ctx
+                      -> Gui.gui (togglePanel t ctx) ctx
 (* The togglePanel is itself a widget.  It can be pretty printed to a piece
- * of xml with a use of toXml. *)
+ * of XML with a use of [toXml]. *)