annotate datebox.ur @ 23:7c734edc6301

Merge from Adam.
author Karn Kallio <kkallio@eka>
date Sat, 24 Sep 2011 18:55:27 -0430
parents 554e342665fe
children 5905b56e0cd9
rev   line source
adam@20 1 type t = {Cal : Calendar.t,
adam@20 2 Panel : TogglePanel.togglePanel Calendar.t []}
adam@2 3
kkallio@14 4 type date = Calendar.date
kkallio@14 5 val date_eq = Calendar.date_eq
kkallio@14 6 val date_ord = Calendar.date_ord
kkallio@14 7 val time = Calendar.time
kkallio@14 8 val date = Calendar.date
adam@2 9
adam@20 10 val format : TogglePanel.formatCtl [] = fn [body ~ []] =>
adam@20 11 TogglePanel.defaultFormat
adam@20 12 -- #OpenCtl -- #CloseCtl
adam@20 13 ++ {OpenCtl = fn behaviour => <xml><button value="Choose" onclick={behaviour}/></xml>,
adam@20 14 CloseCtl = fn behaviour => <xml><button value="Hide" onclick={behaviour}/></xml>}
adam@3 15
adam@4 16 fun create tm =
kkallio@14 17 cal <- Calendar.create tm;
adam@20 18 panel <- TogglePanel.create @format cal False;
adam@2 19
kkallio@14 20 return {Cal = cal,
kkallio@14 21 Panel = panel}
adam@2 22
adam@15 23 fun onChange db f =
adam@15 24 Calendar.onChange db.Cal f
adam@4 25
kkallio@14 26 fun set db day =
kkallio@14 27 Calendar.set db.Cal day
kkallio@12 28
kkallio@14 29 fun value db = Calendar.value db.Cal
kkallio@12 30
adam@20 31 val gui_t = Gui.mkGui (fn [body ~ []] db =>
kkallio@12 32 <xml>
kkallio@14 33 <dyn signal={date <- Calendar.value db.Cal;
kkallio@14 34 return <xml>{[date.Year]}-{[date.Month]}-{[date.Day]}</xml>}/>
kkallio@14 35 {Gui.toXml db.Panel}
adam@20 36 </xml>)