kkallio@6: (* POPUPNAV provides a simple navigation menu which opens and
kkallio@6: * closes when the user clicks on an associated control. *)
kkallio@6:
kkallio@6: con popupNav :: Type -> Type
kkallio@6: (* The type of popping open navigation menus. *)
kkallio@6:
kkallio@6: type formatCtl = {FormatMenu : xbody -> xbody -> xbody,
kkallio@6: (* Allows for formatting the menu. The first two parameters
kkallio@6: * represent "holes" for the control and menu items and
kkallio@6: * the result should be the desired menu xml. The controls
kkallio@6: * can be formatted with the options below, and the menu items
kkallio@7: * will be placed as a chain of
.... wrapped
kkallio@7: * as given below. The menu part appears and disappears according
kkallio@7: * to the use of the controls. *)
kkallio@7:
kkallio@7: WrapMenu : xbody -> xbody,
kkallio@7: (* This allows for the wrapping of menu ... with some
kkallio@7: * chrome that will appear and disappear. *)
kkallio@6:
kkallio@6: OpenCtl : transaction unit -> xbody,
kkallio@6: (* This should accept the transaction representing the opening of
kkallio@6: * the menu and produce an xml control having this as action. *)
kkallio@6:
kkallio@6: CloseCtl : transaction unit -> xbody}
kkallio@6: (* This should accept the transaction representing the closing of
kkallio@6: * the menu and produce an xml control having this as action. *)
kkallio@6:
kkallio@6: val defaultFormat : formatCtl
kkallio@6: (* Some reasonable default formats for the menu layout and controls. *)
kkallio@6:
kkallio@6: val create : t ::: Type -> formatCtl -> Navbar.mode t -> Navbar.navBar t -> transaction (popupNav t)
kkallio@6: (* Given instructions for formatting the display and a navbar, get a popup navigation. *)
kkallio@6:
kkallio@6: val render : t ::: Type -> Navbar.mode t -> popupNav t -> xbody
kkallio@6: (* Pretty prints a popup navigation as a piece of xml. *)