Mercurial > gui
annotate examples/navtest.ur @ 28:7d0014542199
TogglePanel.isOpen
author | Adam Chlipala <adam@chlipala.net> |
---|---|
date | Sun, 12 Feb 2012 10:27:02 -0500 |
parents | 48a4180171b0 |
children |
rev | line source |
---|---|
kkallio@7 | 1 open Navbar |
kkallio@7 | 2 open Navigation |
kkallio@7 | 3 |
kkallio@7 | 4 val bar = navAdd (mkNavItem "Item 2" (bless "http://item2.com")) (navAdd (mkNavItem "Item 1" (bless "http://item1.org")) emptyNavBar) |
kkallio@7 | 5 |
kkallio@7 | 6 val link = mkNavItem "Special link" (bless "http://special.net") |
kkallio@7 | 7 |
kkallio@7 | 8 structure N = Make(struct |
kkallio@7 | 9 con navbarPos = [Main] |
kkallio@7 | 10 con msgPos = [Top] |
kkallio@7 | 11 |
kkallio@7 | 12 con themePos = [Main] |
kkallio@7 | 13 |
kkallio@7 | 14 val linkStyles = {Special = None} |
kkallio@7 | 15 |
kkallio@7 | 16 fun formatNav barPieces lnkPieces msgPieces = |
kkallio@7 | 17 {Main = <xml>{msgPieces.Top}<h3>Here is a menu.</h3><ul>{barPieces.Main}<li>{lnkPieces.Special}</li></ul></xml>} |
kkallio@7 | 18 end) |
kkallio@7 | 19 |
kkallio@7 | 20 open N |
kkallio@7 | 21 |
kkallio@7 | 22 val topMsg : xbody = <xml><div>A banner message</div></xml> |
kkallio@7 | 23 |
kkallio@7 | 24 val nav = mkNav {Main = bar} {Special = Some link} {Top = Some topMsg} |
kkallio@7 | 25 |
kkallio@7 | 26 val xml = toXml nav |
kkallio@7 | 27 |
kkallio@7 | 28 |
kkallio@7 | 29 fun main () = |
kkallio@7 | 30 return <xml> |
kkallio@7 | 31 <head> |
kkallio@7 | 32 <title>Navbar Based Navigation.</title> |
kkallio@7 | 33 </head> |
kkallio@7 | 34 <body> |
kkallio@7 | 35 <h1>Example of using a Navigation.</h1> |
kkallio@7 | 36 <p> |
kkallio@7 | 37 This is a theme widget which manages a set |
kkallio@7 | 38 of links, messages and menus for site navigation. |
kkallio@7 | 39 </p> |
kkallio@7 | 40 <h2>Example of a navigation turned into a piece of xml.</h2> |
kkallio@7 | 41 <div> |
kkallio@7 | 42 {xml.Main} |
kkallio@7 | 43 </div> |
kkallio@7 | 44 </body> |
kkallio@7 | 45 </xml> |