2009-03-05 14:38:32 -05:00
|
|
|
! Copyright (C) 2007, 2009 Slava Pestov.
|
2007-09-20 18:09:08 -04:00
|
|
|
! See http://factorcode.org/license.txt for BSD license.
|
2009-03-05 14:38:32 -05:00
|
|
|
USING: accessors io kernel prettyprint colors.constants ui ui.gadgets
|
|
|
|
ui.gadgets.panes ui.gadgets.scrollers ui.gestures ui.pens.solid ;
|
2007-09-20 18:09:08 -04:00
|
|
|
IN: gesture-logger
|
|
|
|
|
2008-07-12 02:29:25 -04:00
|
|
|
TUPLE: gesture-logger < gadget stream ;
|
2007-09-20 18:09:08 -04:00
|
|
|
|
|
|
|
: <gesture-logger> ( stream -- gadget )
|
2009-03-05 14:38:32 -05:00
|
|
|
\ gesture-logger new
|
2008-06-18 23:30:54 -04:00
|
|
|
swap >>stream
|
|
|
|
{ 100 100 } >>dim
|
2009-03-05 14:38:32 -05:00
|
|
|
COLOR: black <solid> >>interior ;
|
2007-09-20 18:09:08 -04:00
|
|
|
|
2008-08-27 17:24:04 -04:00
|
|
|
M: gesture-logger handle-gesture
|
2008-08-23 00:27:25 -04:00
|
|
|
over T{ button-down } = [ dup request-focus ] when
|
|
|
|
stream>> [ . ] with-output-stream*
|
2007-09-20 18:09:08 -04:00
|
|
|
t ;
|
|
|
|
|
|
|
|
M: gesture-logger user-input*
|
2008-09-02 14:02:51 -04:00
|
|
|
stream>> [
|
2007-09-20 18:09:08 -04:00
|
|
|
"User input: " write print
|
2008-05-05 03:19:25 -04:00
|
|
|
] with-output-stream* t ;
|
2007-09-20 18:09:08 -04:00
|
|
|
|
|
|
|
: gesture-logger ( -- )
|
|
|
|
[
|
2009-02-09 23:40:11 -05:00
|
|
|
<pane> t >>scrolls? dup <scroller>
|
2007-09-20 18:09:08 -04:00
|
|
|
"Gesture log" open-window
|
|
|
|
<pane-stream> <gesture-logger>
|
|
|
|
"Gesture input" open-window
|
|
|
|
] with-ui ;
|
|
|
|
|
|
|
|
MAIN: gesture-logger
|