annotate popupNav.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 48a4180171b0
children
rev   line source
kkallio@6 1 (* POPUPNAV provides a simple navigation menu which opens and
kkallio@6 2 * closes when the user clicks on an associated control. *)
kkallio@6 3
kkallio@6 4 con popupNav :: Type -> Type
kkallio@6 5 (* The type of popping open navigation menus. *)
kkallio@6 6
kkallio@6 7 type formatCtl = {FormatMenu : xbody -> xbody -> xbody,
kkallio@6 8 (* Allows for formatting the menu. The first two parameters
kkallio@6 9 * represent "holes" for the control and menu items and
kkallio@6 10 * the result should be the desired menu xml. The controls
kkallio@6 11 * can be formatted with the options below, and the menu items
kkallio@7 12 * will be placed as a chain of <li><a> ....</a></li> wrapped
kkallio@7 13 * as given below. The menu part appears and disappears according
kkallio@7 14 * to the use of the controls. *)
kkallio@7 15
kkallio@7 16 WrapMenu : xbody -> xbody,
kkallio@7 17 (* This allows for the wrapping of menu <li> ... </li> with some
kkallio@7 18 * chrome that will appear and disappear. *)
kkallio@6 19
kkallio@6 20 OpenCtl : transaction unit -> xbody,
kkallio@6 21 (* This should accept the transaction representing the opening of
kkallio@6 22 * the menu and produce an xml control having this as action. *)
kkallio@6 23
kkallio@6 24 CloseCtl : transaction unit -> xbody}
kkallio@6 25 (* This should accept the transaction representing the closing of
kkallio@6 26 * the menu and produce an xml control having this as action. *)
kkallio@6 27
kkallio@6 28 val defaultFormat : formatCtl
kkallio@6 29 (* Some reasonable default formats for the menu layout and controls. *)
kkallio@6 30
kkallio@6 31 val create : t ::: Type -> formatCtl -> Navbar.mode t -> Navbar.navBar t -> transaction (popupNav t)
kkallio@6 32 (* Given instructions for formatting the display and a navbar, get a popup navigation. *)
kkallio@6 33
kkallio@6 34 val render : t ::: Type -> Navbar.mode t -> popupNav t -> xbody
kkallio@6 35 (* Pretty prints a popup navigation as a piece of xml. *)