annotate examples/popup.ur @ 8:90be8b8917d5

Add a widget that opens and closes a panel.
author Karn Kallio <kkallio@eka>
date Fri, 17 Jun 2011 10:12:05 -0430
parents 48a4180171b0
children
rev   line source
kkallio@6 1 open Navbar
kkallio@6 2 open PopupNav
kkallio@6 3
kkallio@6 4 val testNav = navAdd (mkNavItem "item 2" (bless "http://item2.org"))
kkallio@6 5 (navAdd (mkNavItem "item 1" (bless "http://item1.org"))
kkallio@6 6 emptyNavBar)
kkallio@6 7
kkallio@6 8 val testNav' = navAdd (mkNavItem "item 3" (bless "http://item3.org"))
kkallio@6 9 testNav
kkallio@6 10
kkallio@7 11 val otherFormat = {FormatMenu = fn ctl menu => <xml><h3>A Custom {ctl} Format</h3>{menu}</xml>,
kkallio@7 12 WrapMenu = fn menu => <xml><div><ul>{menu}</ul></div></xml>,
kkallio@6 13 OpenCtl = fn behaviour => <xml><a href={bless "http://#"} onclick={behaviour}>View</a></xml>,
kkallio@6 14 CloseCtl = fn behaviour => <xml><a href={bless "http://#"} onclick={behaviour}>Hide</a></xml>}
kkallio@6 15
kkallio@6 16
kkallio@6 17 fun main () =
kkallio@6 18
kkallio@6 19 defaultFormatPopUp <- create defaultFormat testNav';
kkallio@6 20 otherFormatPopUp <- create otherFormat testNav';
kkallio@6 21
kkallio@6 22 return <xml>
kkallio@6 23 <head>
kkallio@6 24 <title>Navbar Based Popup Navigation.</title>
kkallio@6 25 </head>
kkallio@6 26 <body>
kkallio@6 27 <h1>Example of using Navbar to build a widget.</h1>
kkallio@6 28 <p>
kkallio@6 29 This is a widget which generates a popup list
kkallio@6 30 of links.
kkallio@6 31 </p>
kkallio@6 32 <h2>Example of the default format.</h2>
kkallio@6 33 <p>
kkallio@6 34 {render defaultFormatPopUp}
kkallio@6 35 </p>
kkallio@6 36 <h2>Example of another format.</h2>
kkallio@6 37 <p>
kkallio@6 38 {render otherFormatPopUp}
kkallio@6 39 </p>
kkallio@6 40 </body>
kkallio@6 41 </xml>