view 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
line wrap: on
line source
con t::{Unit}->Type

(* The type of dateboxes, which are input elements
 * allowing the user to select a date from a popup
 * calendar. *)

type date = {Year : int, Month : int, Day : int}
val date_eq : eq date
val date_ord : ord date
val time : date -> time
val date : time -> date
(* Type of dates and some useful utility functions. *)

val create : other_ctx:::{Unit} -> [other_ctx ~ body] => time -> transaction (t other_ctx)
(* Get a datebox initially set to the given time. *)

val onChange : other_ctx:::{Unit} -> [other_ctx ~ body] => t other_ctx -> (date -> transaction {}) -> transaction {}
(* Add an action to be run when the date changes. *)

val set : other_ctx:::{Unit} -> [other_ctx ~ body] => t other_ctx -> date -> transaction {}
(* Call this to change the selected date. *)

val value : other_ctx:::{Unit} -> [other_ctx ~ body] => t other_ctx -> signal date
(* Extract the current date value. *)

val render : other_ctx:::{Unit} -> [other_ctx ~ body] =>  t other_ctx -> xml ([Body] ++ other_ctx) [] []
(* Draws the datebox as a piece of xml. *)