sequences ;
: action ( gadget gesture -- quot )
- swap gadget-gestures hash ;
+ swap gadget-gestures ?hash ;
: set-action ( gadget quot gesture -- )
- rot gadget-gestures set-hash ;
+ pick gadget-gestures ?set-hash swap set-gadget-gestures ;
: add-actions ( alist gadget -- )
swap [ unswons set-action ] each-with ;
: handle-gesture* ( gesture gadget -- ? )
- tuck gadget-gestures hash* dup
- [ cdr call f ] [ 2drop t ] ifte ;
+ tuck gadget-gestures ?hash dup [ call f ] [ 2drop t ] ifte ;
: handle-gesture ( gesture gadget -- ? )
#! If a gadget's handle-gesture* generic returns t, the
M: gadget draw-gadget* ( gadget -- ) drop ;
+: paint-prop* ( gadget key -- value )
+ swap gadget-paint ?hash ;
+
: paint-prop ( gadget key -- value )
over [
- dup pick gadget-paint hash* dup [
- 2nip cdr
+ 2dup paint-prop* dup [
+ 2nip
] [
drop >r gadget-parent r> paint-prop
- ] ?ifte
+ ] ifte
] [
2drop f
] ifte ;
: set-paint-prop ( gadget value key -- )
- rot gadget-paint set-hash ;
+ pick gadget-paint ?set-hash swap set-gadget-paint ;
: fg ( gadget -- color )
dup reverse-video paint-prop