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