Handbook
Glossary
interactor
Vocabulary
ui
.
tools
.
listener
Class description
An interactor is an
editor
intended to be used as the input component of a
UI listener
. It has the following slots:
waiting
If waiting is
t
, the interactor is waiting for user input, and invoking
evaluate-input
resumes the thread.
Interactors are created by calling
<interactor>
.
Interactors implement the
stream-readln
,
stream-read
and
stream-read-quot
generic words.
Definition
USING:
ui.gadgets.editors
;
IN:
ui.tools.listener
TUPLE:
interactor
<
source-editor
output history flag mailbox thread waiting token-model
word-model popup
;
Methods
USING:
destructors
kernel
ui.tools.listener
;
M:
interactor
dispose
drop
;
USING:
accessors
generic
kernel
models
ui.gadgets
ui.tools.listener
;
M:
interactor
graft*
[
M\
interactor
graft*
(call-next-method)
]
[
dup
word-model>>
add-connection
]
bi
;
USING:
accessors
combinators
combinators.short-circuit
generic
kernel
ui.gadgets.glass
ui.gestures
ui.tools.listener
ui.tools.listener.completion
;
M:
interactor
handle-gesture
{
{
[
over
key-gesture?
not
]
[
M\
interactor
handle-gesture
(call-next-method)
]
}
{
[
dup
popup>>
]
[
?check-popup
{
[
pass-to-popup
]
[
M\
interactor
handle-gesture
(call-next-method)
]
}
2&&
]
}
{
[
dup
token-model>>
value>>
]
[
{
[
interactor-operation
]
[
M\
interactor
handle-gesture
(call-next-method)
]
}
2&&
]
}
[
M\
interactor
handle-gesture
(call-next-method)
]
}
cond
;
USING:
accessors
generic
kernel
models
ui.gadgets.status-bar
ui.tools.listener
;
M:
interactor
model-changed
2dup
word-model>>
eq?
[
dup
popup>>
[
2drop
]
[
[
value>>
]
dip
show-summary
]
if
]
[
M\
interactor
model-changed
(call-next-method)
]
if
;
USING:
io
kernel
ui.tools.listener
;
M:
interactor
stream-element-type
drop
+character+
;
USING:
arrays
kernel
listener
ui.tools.listener
;
M:
interactor
stream-read-quot
dup
interactor-yield
dup
array?
[
over
interactor-finish
try-parse
or?
[
stream-read-quot
]
unless
]
[
nip
]
if
;
USING:
io
kernel
math
sequences
splitting
ui.tools.listener
;
M::
interactor
stream-read-unsafe
( n buf interactor -- count )
n
[
0
]
[
drop
interactor
interactor-read
dup
[
join-lines
]
when
n
index-or-length
[
head-slice
0 buf
copy
]
keep
]
if-zero
;
USING:
io
kernel
sequences
splitting
ui.tools.listener
;
M:
interactor
stream-read-until
swap
[
member?
]
curry
[
[
join-lines
10
suffix
]
]
dip
[
dupd
find
[
[
head
]
when*
]
dip
dup
not
]
curry
compose
[
[
interactor-read
]
curry
]
dip
[
[
f
f
f
]
if*
]
curry
compose
[
drop
]
produce
swap
[
concat
""
prepend-as
]
dip
;
USING:
combinators
io
kernel
sequences
ui.tools.listener
;
M:
interactor
stream-read1
dup
interactor-read
{
{
[
dup
not
]
[
2drop
f
]
}
{
[
dup
empty?
]
[
drop
stream-read1
]
}
{
[
dup
first
empty?
]
[
2drop
10
]
}
[
nip
first
first
]
}
cond
;
USING:
io
sequences
ui.tools.listener
;
M:
interactor
stream-readln
interactor-read
?first
;
USING:
accessors
generic
kernel
models
ui.gadgets
ui.tools.listener
;
M:
interactor
ungraft*
[
dup
word-model>>
remove-connection
]
[
M\
interactor
ungraft*
(call-next-method)
]
bi
;