rmbruijn@19: con t::{Unit}->Type rmbruijn@19: kkallio@14: (* The type of dateboxes, which are input elements kkallio@14: * allowing the user to select a date from a popup kkallio@14: * calendar. *) adam@2: adam@4: type date = {Year : int, Month : int, Day : int} kkallio@14: val date_eq : eq date adam@5: val date_ord : ord date adam@5: val time : date -> time kkallio@12: val date : time -> date kkallio@14: (* Type of dates and some useful utility functions. *) adam@4: rmbruijn@19: val create : other_ctx:::{Unit} -> [other_ctx ~ body] => time -> transaction (t other_ctx) kkallio@14: (* Get a datebox initially set to the given time. *) kkallio@14: rmbruijn@19: val onChange : other_ctx:::{Unit} -> [other_ctx ~ body] => t other_ctx -> (date -> transaction {}) -> transaction {} kkallio@14: (* Add an action to be run when the date changes. *) kkallio@14: rmbruijn@19: val set : other_ctx:::{Unit} -> [other_ctx ~ body] => t other_ctx -> date -> transaction {} kkallio@14: (* Call this to change the selected date. *) kkallio@14: rmbruijn@19: val value : other_ctx:::{Unit} -> [other_ctx ~ body] => t other_ctx -> signal date kkallio@14: (* Extract the current date value. *) kkallio@14: rmbruijn@19: val render : other_ctx:::{Unit} -> [other_ctx ~ body] => t other_ctx -> xml ([Body] ++ other_ctx) [] [] kkallio@14: (* Draws the datebox as a piece of xml. *)