comparison 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
comparison
equal deleted inserted replaced
5:4385bc6a0d2d 6:f17b869fbb71
1 (* POPUPNAV provides a simple navigation menu which opens and
2 * closes when the user clicks on an associated control. *)
3
4 con popupNav :: Type -> Type
5 (* The type of popping open navigation menus. *)
6
7 type formatCtl = {FormatMenu : xbody -> xbody -> xbody,
8 (* Allows for formatting the menu. The first two parameters
9 * represent "holes" for the control and menu items and
10 * the result should be the desired menu xml. The controls
11 * can be formatted with the options below, and the menu items
12 * will be placed as a chain of <li><a> ....</a></li>. *)
13
14 OpenCtl : transaction unit -> xbody,
15 (* This should accept the transaction representing the opening of
16 * the menu and produce an xml control having this as action. *)
17
18 CloseCtl : transaction unit -> xbody}
19 (* This should accept the transaction representing the closing of
20 * the menu and produce an xml control having this as action. *)
21
22 val defaultFormat : formatCtl
23 (* Some reasonable default formats for the menu layout and controls. *)
24
25 val create : t ::: Type -> formatCtl -> Navbar.mode t -> Navbar.navBar t -> transaction (popupNav t)
26 (* Given instructions for formatting the display and a navbar, get a popup navigation. *)
27
28 val render : t ::: Type -> Navbar.mode t -> popupNav t -> xbody
29 (* Pretty prints a popup navigation as a piece of xml. *)