annotate datebox.urs @ 19:3a303df9ae92

Partial generalize togglePanel solution (breaks build)
author Ron de Bruijn <rmbruijn@gmail.com>
date Fri, 23 Sep 2011 13:30:01 +0200
parents 8300d5f0dc19
children 554e342665fe
rev   line source
rmbruijn@19 1 con t::{Unit}->Type
rmbruijn@19 2
kkallio@14 3 (* The type of dateboxes, which are input elements
kkallio@14 4 * allowing the user to select a date from a popup
kkallio@14 5 * calendar. *)
adam@2 6
adam@4 7 type date = {Year : int, Month : int, Day : int}
kkallio@14 8 val date_eq : eq date
adam@5 9 val date_ord : ord date
adam@5 10 val time : date -> time
kkallio@12 11 val date : time -> date
kkallio@14 12 (* Type of dates and some useful utility functions. *)
adam@4 13
rmbruijn@19 14 val create : other_ctx:::{Unit} -> [other_ctx ~ body] => time -> transaction (t other_ctx)
kkallio@14 15 (* Get a datebox initially set to the given time. *)
kkallio@14 16
rmbruijn@19 17 val onChange : other_ctx:::{Unit} -> [other_ctx ~ body] => t other_ctx -> (date -> transaction {}) -> transaction {}
kkallio@14 18 (* Add an action to be run when the date changes. *)
kkallio@14 19
rmbruijn@19 20 val set : other_ctx:::{Unit} -> [other_ctx ~ body] => t other_ctx -> date -> transaction {}
kkallio@14 21 (* Call this to change the selected date. *)
kkallio@14 22
rmbruijn@19 23 val value : other_ctx:::{Unit} -> [other_ctx ~ body] => t other_ctx -> signal date
kkallio@14 24 (* Extract the current date value. *)
kkallio@14 25
rmbruijn@19 26 val render : other_ctx:::{Unit} -> [other_ctx ~ body] => t other_ctx -> xml ([Body] ++ other_ctx) [] []
kkallio@14 27 (* Draws the datebox as a piece of xml. *)