1 ! Copyright (C) 2008 Slava Pestov.
2 ! See http://factorcode.org/license.txt for BSD license.
3 USING: accessors calendar.format calendar.model fonts fry
4 grouping kernel math models.arrow namespaces sequences ui
8 : lcd-digit ( digit row -- str )
9 [ dup CHAR: : = [ drop 10 ] [ CHAR: 0 - ] if ] dip {
11 " | | | _| _| |_| |_ |_ | |_| |_| * "
12 " |_| | |_ _| | _| |_| | |_| | * "
14 } nth 4 <groups> nth ;
16 : lcd-row ( row digit -- string )
17 '[ _ lcd-digit ] { } map-as concat ;
19 : lcd ( digit-str -- string )
20 4 iota [ lcd-row ] with map "\n" join ;
22 : <time-display> ( model -- gadget )
23 [ timestamp>hms lcd ] <arrow> <label-control>
24 "99:99:99" lcd >>string
25 monospace-font >>font ;
27 MAIN-WINDOW: time-window { { title "Time" } }
28 time get <time-display> >>gadgets ;