annotate popupNav.urs @ 6:f17b869fbb71

Shifting some generic theme navigation menu code to the library.
author Karn Kallio <kkallio@eka>
date Tue, 26 Apr 2011 20:27:04 -0430
parents
children 48a4180171b0
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@6 12 * will be placed as a chain of <li><a> ....</a></li>. *)
kkallio@6 13
kkallio@6 14 OpenCtl : transaction unit -> xbody,
kkallio@6 15 (* This should accept the transaction representing the opening of
kkallio@6 16 * the menu and produce an xml control having this as action. *)
kkallio@6 17
kkallio@6 18 CloseCtl : transaction unit -> xbody}
kkallio@6 19 (* This should accept the transaction representing the closing of
kkallio@6 20 * the menu and produce an xml control having this as action. *)
kkallio@6 21
kkallio@6 22 val defaultFormat : formatCtl
kkallio@6 23 (* Some reasonable default formats for the menu layout and controls. *)
kkallio@6 24
kkallio@6 25 val create : t ::: Type -> formatCtl -> Navbar.mode t -> Navbar.navBar t -> transaction (popupNav t)
kkallio@6 26 (* Given instructions for formatting the display and a navbar, get a popup navigation. *)
kkallio@6 27
kkallio@6 28 val render : t ::: Type -> Navbar.mode t -> popupNav t -> xbody
kkallio@6 29 (* Pretty prints a popup navigation as a piece of xml. *)