Mercurial > gui
view examples/navtest.ur @ 7:48a4180171b0
Shifted some more generic theme navigation code to the library.
Also generalized formatting options a bit for popupNav.
author | Karn Kallio <kkallio@eka> |
---|---|
date | Fri, 06 May 2011 23:00:22 -0430 |
parents | |
children |
line wrap: on
line source
open Navbar open Navigation val bar = navAdd (mkNavItem "Item 2" (bless "http://item2.com")) (navAdd (mkNavItem "Item 1" (bless "http://item1.org")) emptyNavBar) val link = mkNavItem "Special link" (bless "http://special.net") structure N = Make(struct con navbarPos = [Main] con msgPos = [Top] con themePos = [Main] val linkStyles = {Special = None} fun formatNav barPieces lnkPieces msgPieces = {Main = <xml>{msgPieces.Top}<h3>Here is a menu.</h3><ul>{barPieces.Main}<li>{lnkPieces.Special}</li></ul></xml>} end) open N val topMsg : xbody = <xml><div>A banner message</div></xml> val nav = mkNav {Main = bar} {Special = Some link} {Top = Some topMsg} val xml = toXml nav fun main () = return <xml> <head> <title>Navbar Based Navigation.</title> </head> <body> <h1>Example of using a Navigation.</h1> <p> This is a theme widget which manages a set of links, messages and menus for site navigation. </p> <h2>Example of a navigation turned into a piece of xml.</h2> <div> {xml.Main} </div> </body> </xml>