Mercurial > gui
view examples/navtest.ur @ 24:d314d2ec3300
Be able to obtain the name from a navItem
author | Ron de Bruijn <rmbruijn@gmail.com> |
---|---|
date | Sun, 04 Dec 2011 16:45:31 +0100 |
parents | 48a4180171b0 |
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>