frp-editors use field-models

db4
Sam Anklesaria 2009-05-30 12:51:35 -05:00
parent 3adff7ebe9
commit b2770a31b5
2 changed files with 7 additions and 8 deletions

View File

@ -243,10 +243,6 @@ DEFER: __
\ if* 2 [ swap [ undo-if* ] 2curry ] define-pop-inverse
! misc
\ join 1 [ [ split ] curry ] define-pop-inverse
\ split 1 [ [ join ] curry ] define-pop-inverse
! Constructor inverse
: deconstruct-pred ( class -- quot )
"predicate" word-prop [ dupd call assure ] curry ;

View File

@ -1,7 +1,7 @@
USING: accessors arrays kernel models monads ui.frp.signals ui.gadgets
ui.gadgets.buttons ui.gadgets.buttons.private ui.gadgets.editors
ui.gadgets.tables sequences splitting models.illusion
ui.gadgets.scrollers documents ;
ui.gadgets.tables sequences splitting
ui.gadgets.scrollers ui.gadgets.borders ;
IN: ui.frp.gadgets
TUPLE: frp-button < button hook ;
@ -32,10 +32,13 @@ M: table output-model dup multiple-selection?>>
[ dup val-quot>> [ selected-value>> ] [ selected-index*>> ] if ] if ;
M: model-field output-model field-model>> ;
M: scroller output-model viewport>> children>> first output-model ;
M: multiline-editor output-model model>> [ "\n" join ] <illusion> ;
: <frp-field> ( -- field ) "" <model> <model-field> ;
: <frp-editor> ( model -- editor ) [ "\n" split document new-model ] bind <multiline-editor> swap >>model ;
: <frp-field*> ( model -- field ) "" <model> swap <switch> <model-field> ;
: <frp-editor> ( model -- gadget )
model-field [ <multiline-editor> ] dip new-border dup gadget-child >>editor
field-theme swap >>field-model { 1 0 } >>align ;
: <frp-editor*> ( model -- editor ) "" <model> swap <switch> <frp-editor> ;
IN: accessors
M: frp-button text>> children>> first text>> ;