Mercurial > gui
comparison examples/popup.ur @ 6:f17b869fbb71
Shifting some generic theme navigation menu code to the library.
author | Karn Kallio <kkallio@eka> |
---|---|
date | Tue, 26 Apr 2011 20:27:04 -0430 |
parents | |
children | 48a4180171b0 |
comparison
equal
deleted
inserted
replaced
5:4385bc6a0d2d | 6:f17b869fbb71 |
---|---|
1 open Navbar | |
2 open PopupNav | |
3 | |
4 val testNav = navAdd (mkNavItem "item 2" (bless "http://item2.org")) | |
5 (navAdd (mkNavItem "item 1" (bless "http://item1.org")) | |
6 emptyNavBar) | |
7 | |
8 val testNav' = navAdd (mkNavItem "item 3" (bless "http://item3.org")) | |
9 testNav | |
10 | |
11 val otherFormat = {FormatMenu = fn ctl menu => <xml><h3>A Custom {ctl} Format</h3><ul>{menu}</ul></xml>, | |
12 OpenCtl = fn behaviour => <xml><a href={bless "http://#"} onclick={behaviour}>View</a></xml>, | |
13 CloseCtl = fn behaviour => <xml><a href={bless "http://#"} onclick={behaviour}>Hide</a></xml>} | |
14 | |
15 | |
16 fun main () = | |
17 | |
18 defaultFormatPopUp <- create defaultFormat testNav'; | |
19 otherFormatPopUp <- create otherFormat testNav'; | |
20 | |
21 return <xml> | |
22 <head> | |
23 <title>Navbar Based Popup Navigation.</title> | |
24 </head> | |
25 <body> | |
26 <h1>Example of using Navbar to build a widget.</h1> | |
27 <p> | |
28 This is a widget which generates a popup list | |
29 of links. | |
30 </p> | |
31 <h2>Example of the default format.</h2> | |
32 <p> | |
33 {render defaultFormatPopUp} | |
34 </p> | |
35 <h2>Example of another format.</h2> | |
36 <p> | |
37 {render otherFormatPopUp} | |
38 </p> | |
39 </body> | |
40 </xml> |