diff datebox.urs @ 14:0827320b0f04

Write calendarCtl in terms of a source with a listener.
author Karn Kallio <kkallio@eka>
date Fri, 05 Aug 2011 18:55:24 -0430
parents bbdedfde154e
children 8300d5f0dc19
line wrap: on
line diff
--- a/datebox.urs	Thu Jul 28 11:51:10 2011 -0430
+++ b/datebox.urs	Fri Aug 05 18:55:24 2011 -0430
@@ -1,30 +1,26 @@
-class givesDates
-
 type t
-type calendarCtl
-
-val givesDates_t : givesDates t
-val givesDates_calendarCtl : givesDates calendarCtl
+(* 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 : time -> transaction t
+(* Get a datebox initially set to the given time. *)
+
+val addListener : (date -> transaction unit) -> t -> transaction unit
+(* Add an action to be run when the date changes. *)
+
+val set : t -> date -> transaction unit
+(* Call this to change the selected date. *)
+
+val value : t -> signal date
+(* Extract the current date value. *)
+
 val render : t -> xbody
-
-val createCalendarCtl : time -> transaction calendarCtl
-val renderCalendarCtl : (date -> transaction unit) -> calendarCtl -> xbody
-val setCalendarCtl : (date -> transaction unit) -> calendarCtl -> date -> transaction unit
-
-val value : t ::: Type -> givesDates t -> t -> signal date
-
-style calendar
-style prev
-style this
-style next
-style weekday
-style curday
-style otherday
-style selday
+(* Draws the datebox as a piece of xml. *)